1) Design Sources : 실제 하드웨어 동작을 정의하는 코드 2) Constraints : 설계가 실제 FPGA하드웨어에서 올바르게 동작하도록 하기 위해 설정된 제약 조건 파일 3) Simulation Sources : 설계된 회로의 동작을 시뮬레이션하고 검증하기 위한 테스트벤치와 입력 데이터
This Verilog code implements a 4-bit full adder using multiple 1-bit full adders. The full_adder module is instantiated four times, each handling one bit of the input operands (a and b), and the carry is passed through between stages. The half_adder module is used within the full_adder to compute the sum and carry for individual bits.
6. Testing and Debugging
* Testing Tools: VIVADO, Modelsim
module tb_adder(
);
reg [3:0]a, b;
reg cin;
wire [3:0]sum;
wire carry;
full_adder_4bit DUT(
.a(a), .b(b), .cin(cin),
.sum(sum), .carry(carry)
);
integer i, j, k; // Loop variables
initial begin
// Iterate through all combinations of a, b, and cin
for (i = 0; i < 16; i = i + 1) begin
for (j = 0; j < 16; j = j + 1) begin
for (k = 0; k < 2; k = k + 1) begin
#10 a = i; b = j; cin = k; // Assign test values
end
end
end
#10 $finish; // End simulation
end
endmodule