如何在顶级 DUT 中的模块上使用 System-Verilog 断言



我正在尝试编写一个内存调度测试平台,并验证我是否正在访问正确的地址并在正确的时间写入正确的值,我想将我的顶级模块中的信号与我开发的时间表进行比较。

我尝试查找"点符号"并使用我的模拟器(ModelSim(访问信号(我可以在波形上很好地做到这一点(,但我希望能够使用 SVA 来检查我的值是否正确。

module top(input d, output q)
    //wires
    wire sub1_output
    // Instantiate submodule
    sub_module1 sub1(.sub1_output(sub1_output));
    always begin
        // logic
    end
endmodule
module tb_top();
    reg d;
    wire q;
    DUT top(.*);
    initial begin
        // This is where I want to access something within my DUT
        assert(DUT.sub1_output == 1'b1)
    end
endmodule

当我尝试这样做时,我的代码会编译并运行,但是如果我编写断言使其失败并停止我的代码,则没有任何反应。

DUT.sub1_output

是对顶级实例化中的信号使用断言的正确格式。

最新更新