私のベンチプログラムでは、次のようなものがあります(簡略化):
// 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.
しかし、「時計が見える」が1回おきにしか表示されない場合もあります。だから私は見る
10 : BENCH
I see the clock
20 : BENCH
30 : BENCH
I see the clock
40 : BENCH
50 : BENCH
etc.
なぜそうなるのか理解できません。誰かが私を正しい方向に向けてくれませんか?どうもありがとう。