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

How to use System-Verilog Assertions on modules within top level DUT

我正在尝试编写一个内存调度测试台,并验证我是否正在访问正确的地址并在正确的时间写入正确的值我想比较信号发生的情况我的顶级模块中,我制定了我的时间表。

我已经尝试查找 "dot notation" 并使用我的模拟器 (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

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