4 BIT ADDER
module adder4bit(carry,sum,a,b); output [3:0]sum; output carry ; input [3:0]a,b; reg [3:0]sum; reg carry; reg [4:0]tmp; always @(a,b) begin assign tmp=a+b; assign sum=tmp[3:0]; assign carry=tmp[4]; end endmodule
No comments:
Post a Comment