我的 4 位全加器输出总是 z 并且不会改变

My outputs in 4bits fullAdder are always z and don't change

我正在用 Active-hdl 中的 verilog 编写 4 位全加器我认为我的代码和测试平台是正确的但是 sum 和 cout 的值在波形中总是 z 谁能帮我解决问题 is.this 我的代码和 test-bech

    module fullAdder(A, B, cin, sum, cout);
    input A,B,cin;
    output sum,cout;
    assign {cout , sum} = A + B + cin;
endmodule

module fullAdder4bits(A, B, cin, sum, cout);
    input [3:0] A,B;
    input cin;
    output [3:0] sum;
    output cout;
    wire w1,w2,w3;
    fullAdder I0(A[0],B[0],cin,sum[0],w1);  
    fullAdder I1(A[1],B[1],w1,sum[1],w2);
    fullAdder I2(A[2],B[2],w2,sum[2],w3);
    fullAdder I3(A[3],B[3],w3,sum[3],cout);
endmodule   
`timescale 1 ns/1 ps  
module testbench;
    reg tcin;
    reg [3:0] tA,tB;
    wire [3:0] tsum;
    wire tcout;
    fullAdder4bits dut(tA, tB, tcin, tsum, tcout);
    initial 
        begin
        tA = 0;
        tB = 0;
        tcin = 0;
        #10 tA = 5;
        #10 tB = 8;
        #10 tA = 7;
        #10 tcin = 1;
    end
    initial $monitor("A = %d , B = %d , cin = %b , sum = %d , cout = %b",tA,tB,tcin,tsum,tcout);  
    initial #60 $finish;
    endmodule

我没有发现任何错误,所以我决定将您的设计交给 Vivado。

您提供了包含测试平台的完整代码,这对您很有帮助!

您的代码看起来不错,在 Vivado 中我没有看到 'z' 状态: