TE to check two events coinciding or delayed

笑着哭i 提交于 2020-01-17 04:51:26

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!