I am having the hardest time figuring out how realtime boolean expression rounding occurs. Given the following code:
`timescale `1ns/1fs
`define CLK350_PERIOD_L 2.857000ns
`define CLK350_PERIOD_H 2.857286ns
property p350Mhz(clk);
realtime current_time;
@(posedge clk)
(1,current_time=$realtime) |=> (`CLK350_PERIOD_L <= $realtime-current_time && $realtime-current_time <= `CLK350_PERIOD_H);
endproperty
Into this property, I am passing in a clock whose period measures 2.857ns exactly (from sim waveform set at fs scale). However the assertion continues to fail despite the fact that 2.857ns should fall with the _L and _H macros that I have specified…
I have also tried dividing all $realtime calls by 1fs:
property p350Mhz(clk);
realtime current_time;
@(posedge clk)
(1,current_time=$realtime/1fs) |=> (`CLK350_PERIOD_L <= $realtime/1fs-current_time && $realtime/1fs-current_time <= `CLK350_PERIOD_H);
endproperty
Does the boolean expression $realtime-current_time get rounded somehow due to timeunit? How can I get the assertion to not fail?