He escrito este código y no da un valor para la suma. ¿Por qué?
diseño:
module fourBitAdder (input [3:0] A, B, input cin, output [3:0] S, output cout);
wire [4:0] c;
wire [4:0] S0;
assign c[0] = cin;
assign cout = c[4];
assign S0 = A + B + cin;
assign {cout, S} = (S0>9)? S0+6 : S0;
endmodule
module fourBitAdder11 (input [15:0] A, B, input cin, output [15:0] S, output cout);
wire [16:0] c;
fourBitAdder FB0 [3:0] (A[3:0], B[3:0], c[3:0], c[4:1], S[3:0]);
fourBitAdder FB1 [7:4] (A[7:4], B[7:4], c[7:4], c[8:5], S[7:4]);
fourBitAdder FB2 [11:8] (A[11:8], B[11:8], c[11:8], c[12:9], S[11:8]);
fourBitAdder FB3 [15:12] (A[15:12], B[15:12], c[15:12], c[16:13], S[15:12]);
endmodule
banco de pruebas:
module Test_fourBitAdder;
reg [15:0] A, B;
reg cin;
wire [15:0] S;
wire cout;
wire [16:0] c;
fourBitAdder FB0 [3:0] (A[3:0], B[3:0], c[3:0], c[4:1], S[3:0]);
fourBitAdder FB1 [7:4] (A[7:4], B[7:4], c[7:4], c[8:5], S[7:4]);
fourBitAdder FB2 [11:8] (A[11:8], B[11:8], c[11:8], c[12:9], S[11:8]);
fourBitAdder FB3 [15:12] (A[15:12], B[15:12], c[15:12], c[16:13], S[15:12]);
initial begin
$dumpfile("dump.vcd");
$dumpvars;
A = 16'h1234; B = 16'h4567; cin = 0;
#20 $finish;
end
endmodule