Advertisement
Guest User

Untitled

a guest
Oct 8th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module ALU (Ain, Bin, ALUop, ALUout, ALUout_status);
  2.  
  3. input [15:0] Ain,Bin;
  4. input [1:0] ALUop;
  5. output ALUout;
  6. output reg [15:0] ALUout_status;
  7.  
  8. always @(*) begin
  9. case(ALUop)
  10. 2'b00: ALUout_status = Ain + Bin;
  11. 2'b01: ALUout_status = Ain - Bin;
  12. 2'b10: ALUout_status = Ain & Bin;
  13. 2'b11: ALUout_status = ~Bin;
  14. endcase
  15.   end
  16.  
  17. assign ALUout= |ALUout_status;
  18.  
  19.  
  20. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement