在我的工作台程序中,我有这样的东西(简化):
// bench.sv
program tb (input clk, ...);
initial begin
...
repeat (100) begin
main_module_interface.write_index <= bench.write_index;
// drive additional inputs
...
@(clk);
$display("%t : BENCH", $realtime);
在我的主模块中,我有一个生成循环来创建我的index_reg
模块
// main_module.sv
generate
for (genvar ix = 0; ix < 32; ix++) begin
index_reg #(.WIDTH(32), .INDEX(ix)) r (
.clk,
.ind(writeIFC.write_index),
...
);
end
endgenerate
然后在我的index_reg
模块中,我添加了以下调试代码:
// index_reg.sv
always @ (posedge clk) begin
if (INDEX == 10) begin
$display("I see the clock");
end
end
我希望看到这个输出:
I see the clock
10 : BENCH
I see the clock
20 : BENCH
I see the clock
30 : BENCH
I see the clock
40 : BENCH
I see the clock
50 : BENCH
etc.
但有时,“我看到时钟”每隔一段时间才会出现一次。所以我看到
10 : BENCH
I see the clock
20 : BENCH
30 : BENCH
I see the clock
40 : BENCH
50 : BENCH
etc.
我不明白为什么会发生这种情况。有人可以指出我正确的方向吗?非常感谢。