Interface handle : IF
clocking block : cb
clock used in clocking block: clk
logically both appear to have same functionality. But there is a difference due to clocking block.
when interacting with clocking blocks, only use the clocking block event @IF.cb as the synchronizing event. That includes not using the wait() statement or any other @IF.cb.variable expressions.
There are two reasons fort this recommendation.
There is a race condition if you use the @(posedge clk) and try to read a sampled clocking block variable. The race is between reading the old sampled value and the new sampled value. This is describe in a note in section 14.4 Input and output skews of the 1800-2012 LRM.
Although not explicitly stated in the LRM, a consequence of eliminating the above race is that because clocking block event comes after all clocking block variables are updated, if you wait on a clock block variable followed by a wait on a clocking block event, both event may occur in the same time slot. so write your code as
clocking block : cb
clock used in clocking block: clk
logically both appear to have same functionality. But there is a difference due to clocking block.
when interacting with clocking blocks, only use the clocking block event @IF.cb as the synchronizing event. That includes not using the wait() statement or any other @IF.cb.variable expressions.
There are two reasons fort this recommendation.
There is a race condition if you use the @(posedge clk) and try to read a sampled clocking block variable. The race is between reading the old sampled value and the new sampled value. This is describe in a note in section 14.4 Input and output skews of the 1800-2012 LRM.
Although not explicitly stated in the LRM, a consequence of eliminating the above race is that because clocking block event comes after all clocking block variables are updated, if you wait on a clock block variable followed by a wait on a clocking block event, both event may occur in the same time slot. so write your code as
@(IF.cb iff !IF.CB.reset); // instead of wait (!IF.cb.reset) ... @(IF.cb) // guaranteed to be 1 cycle later.
No comments:
Post a Comment