I have this assertion in order to check clk freq:
assert property clk_freq;
int cnt;
@(posedge fast_clk, clk_1MHz) disable_iff(!enable_check)
($rose(clk_1MHz), cnt=0) |=> (!$rose(clk_1MHz),cnt++) [*0:$] ##1 $rose(clk_1MHz), cnt==fast_clk_freq;
endproperty
fast_clk starts to toggle during (not from beginning) of the simulation after disable_check is asserted.
The problem is that it seems that the assertion ignores the disable_iff
Question: is a $rose(clk_1Mhz) event "registered" even though the assertion is disabled (or am I missing something else ?)
There is no
disable_iffkeywords, it isdisable iff(without the underscore). Properties can have local variables but the local variables cannot be defined inline withassert. Separate the property definition and the assertion instantiation.The clock sampling doesn't seem to be correct.
@(posedge fast_clk, clk_1MHz)mean on rising fast_clk or any change to clk_1MHz. clk_1MHz is the sampled data value, therefore it should not be a clock.$rose(clk_1MHz), cnt==fast_clk_freqis ilegal syntax, sugest:$rose(clk_1MHz) ##0 cnt==fast_clk_freqSuggested property definition and the assertion instantiation:
For more on assertions refer to section 16 of IEEE Std 1800-2012.