'last_event VHDL等效于verilog

时间:2014-12-04 15:20:34

标签: vhdl verilog

我在Verilog中搜索VHDL属性my_signal'last_event的verilog等价物。我用google搜索没有成功。有人知道怎么做吗?

'last_event属性用于了解自信号上次事件以来的时间。 例如,如果在15us时,信号toto从0到1。 然后在20us时,toto'last_event返回5us。

2 个答案:

答案 0 :(得分:0)

您是否尝试过查看一些verilog系统任务?具体如下:

$time;                            // Return current simulation time in 64-bit integer 

$monitor("format", v1, v2, ...);  // Invoke only once, and execute (
                                  //   automatically when any of the
                                  //   variables change value. 

您可以查看“嵌套 - 如果 - 其他 - 如果'例如,http://www.asic-world.com/verilog/vbehave2.html示例了解使用这些的测试工作台。

答案 1 :(得分:0)

您可以创建时间变量,并在信号发生变化时更新

time my_signal_last_change;

always @(my_signal) begin
    my_signal_last_change = $time;
end

这适用于SystemVerilog;不确定它是否会在verilog中(你可以尝试将时间更改为reg [63:0]以防万一)