ModelSim SE 5.7:意外 'Z' 和 'X'

ModelSim SE 5.7: unexpected 'Z' and 'X'

在使用旧的 Spartan2-Board 弄湿我的脚时,我尝试使用 Verilog 代码和随附的测试平台设置一个 1 位全加器,如下所示:

module full_adder(s, cout, a, b, cin);
output s, cout;
input a, b, cin;

wire t1, t2, t3;

xor (t1, a, b);
xor (s, t1, cin);
and (t2, t1, cin);
and (t3, a, b);
or  (cout, t2, t3);
endmodule

测试平台:

module tb_full_adder;

// Inputs
reg a;
reg b;
reg cin;

// Outputs
wire s;
wire cout;

// Instantiate the Unit Under Test (UUT)
full_adder uut (
    .s(s), 
    .cout(cout), 
    .a(a), 
    .b(b), 
    .cin(cin)
);

initial begin
    // Initialize Inputs
    a = 0;
    b = 0;
    cin = 0;

    // Wait 100 ns for global reset to finish
    #100;

    //125 ns
    #25;    a = 1'b1;
    //150 ns
    #25;    a = 1'b0;   b = 1'b1;
    //175 ns
    #25;    b = 1'b0;   cin = 1'b1;

end      
endmodule

我不得不使用 ISE 10.1 和 ModelSim SE 5.7,因为 ISE 的最新版本不再支持任何 Spartan 设备,IIUC(更不用说 Vivado)了。 问题是 ModelSim 的 'Wave window' 将所有信号显示为 hi-Z 或无关 'X':

如果我在 ISE 14.7 中设置完全相同的项目,代码也会编译和模拟,在这种情况下它是更新的 ISim,显示预期的轨迹:

除了年龄之外,ModelSim 和 ISim 之间还有什么区别? 我错过了什么?

最好的, 克里斯

Modelsim和ISim在这方面没有什么不同。使用 Modelsim 你还没有模拟你的测试台。我可以这么说,因为波形查看器中的信号名称都以 /full_adder/ 开头,而不是 /tb_full_adder/uut/。我也通过模拟测试台在 Modelsim 中获得了与您的 ISim 波形相似的波形,即通过在文字记录 window.

中键入 vsim tb_full_adder