I have more than 10 years of professional experience in VLSI industry. I can help you in any questions related to verilog and vhdl design, verification and FPGA implementation.
It is a simple problem so I am not so much worried about the payment. Required code is given below (for-loop and output). Let me know if it helps you and if you need any other guidance on this problem or any other problems:
module t_test_fulladder;
reg [3:0] A, B;
reg Cin;
reg [3:0] S;
reg Cout;
// Test bench task to verify Full Adder logic
task test_fulladder (input [3:0] A, input [3:0] B, input Cin);
reg Cin_tmp;
integer i;
begin
Cin_tmp = Cin;
for (i=0; i<4; i=i+1)
begin
Cout = (A[i] & B[i]) + (Cin_tmp & (A[i] ^ B[i]));
S[i] = A[i] ^ B[i] ^ Cin;
Cin_tmp = Cout;
end
$display ("Full Adder input A = %b, B = %b, Cin = %b. Full Adder output S = %b, Cout = %b", A, B, Cin, S, Cout);
end
endtask
// Drive input stimulus here
initial
begin
A = 4'b1000;
B = 4'b0101;
Cin = 1'b0;
// Call the test bench task to verify Full Adder logic.
test_fulladder (A, B, Cin);
#10;
A = 4'b0111;
B = 4'b1101;
Cin = 1'b1;
// Call the test bench task to verify Full Adder logic.
test_fulladder (A, B, Cin);
#10;
$finish;
end
endmodule
OUTPUT:
Full Adder input A = 1000, B = 0101, Cin = 0. Full Adder output S = 1101, Cout = 0
Full Adder input A = 0111, B = 1101, Cin = 1. Full Adder output S = 0101, Cout = 1