我正在学习SystemVerilog event data types。但我无法理解 模拟结果。
事件如何在SystemVerilog中运行?
1 module events();
2 // Declare a new event called ack
3 event ack;
4 // Declare done as alias to ack
5 event done = ack;
6 // Event variable with no synchronization object
7 event empty = null;
9 initial begin
10 #1 -> ack;
11 #1 -> empty;
12 #1 -> done;
13 #1 $finish;
14 end
15
16 always @ (ack)
17 begin
18 $display("ack event emitted");
19 end
20
21 always @ (done)
22 begin
23 $display("done event emitted");
24 end
25
26 /*
27 always @ (empty)
28 begin
29 $display("empty event emitted");
30 end
31 */
32
33 endmodule
如何显示如下?
ack event emitted
done event emitted
ack event emitted <== I don't understand here Why does it happens?
done event emitted
我认为它应该是这样的。
ack event emitted
done event emitted
done event emitted
答案 0 :(得分:0)
我认为您可能会对为什么多次打印事件感到困惑?看看第5行:
event done = ack;
现在ack和done是彼此的同义词,每当一个事件被触发时另一个事件也是如此,因为每次事件都会在你获得4个打印输出时被触发。