Verilog Add 4 Bit Code
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
module Add4bit(
input [3:0] A,
input [3:0] B,
output Cout,
output [3:0] S
);
wire [2:0] tmp;
HA U0(.A(A[0]),.B(B[0]),.Cout(tmp[0]),.S(S[0]));
FA U1(.A(A[1]),.B(B[1]),.Cin(tmp[0]),.Cout(tmp[1]),.S(S[1]));
FA U2(.A(A[2]),.B(B[2]),.Cin(tmp[1]),.Cout(tmp[2]),.S(S[2]));
FA U3(.A(A[3]),.B(B[3]),.Cin(tmp[2]),.Cout(Cout),.S(S[3]));
endmodule
'Study' 카테고리의 다른 글
Verilog Full Adder Code (0) | 2019.05.26 |
---|---|
Verilog Half Adder Code (0) | 2019.05.26 |
Verilog Lab_4_Bit_Adder Code (0) | 2019.05.26 |
면접은 암기다? (0) | 2019.03.01 |
병자호란과 대한민국 (0) | 2018.07.23 |