问题
I have two events @A and @B. I want to check that at occurrence of @A, @B is either emitted at the same time or some cycles later.
expect my_check is ((@A and @B) or (@A => {[0..N]; @B}))@clk exec {
message(NONE, "my_check");
};
However, I can see (from the message) that the TE succeeds every clock cycle from the start of the simulation. This is puzzling, as neither A nor B occur in that timeframe. Any ideas what's wrong? Is it forbidden to mix boolean and temporal yield operator?
回答1:
What you see here is a vacuous pass. The first sub expression is FALSE, and evaluation advances to the next sub expression. That second sub expression evaluates to TRUE since the prerequisite @A does not occur (in which case the implication couldn't care less about the RHS expression). Hence, the OR is satisfied and the exec block is activated.
回答2:
After some experimenting I found:
expect my_check is @A => ({[..N-1];@B} or detach({@B; ~[..1]}))@clk
Note that this still requires a 2nd expect statement to check for spurious B events.
来源:https://stackoverflow.com/questions/32822270/te-to-check-two-events-coinciding-or-delayed