返回介绍

17.12.5 在多时钟语境中检测和使用一个序列的结束点

发布于 2020-09-09 22:55:54 字数 2466 浏览 964 评论 0 收藏 0

To detect the end point of a sequence when the clock of the source sequence is different than the destination sequence, method matched on the source sequence is used. The end point of a sequence is reached whenever there is a match on its expression. The occurrence of the end point can be tested in any sequence expression by using the method ended when the clocks of the source and destination sequences are the same, while method matched is used when the clocks are different.

The syntax of the matched method is:

sequence_instance.matched

matched is a method on a sequence which return true or false. Unlike ended, matched uses synchronization between the two clocks, by storing the result of the source sequence match until the arrival of the first destination clock tick after the match. When method matched is applied, it tests whether the source sequence has reached the end point at that particular point in time. The result of matched does not depend upon the starting point of the source sequence.

Like ended, matched can be used on sequences that have formal arguments.

An example is shown below:

sequence e1(a,b,c);
    @(posedge clk) $rose(a) ##1 b ##1 c ;
endsequence

sequence e2;
    @(posedge sysclk) reset ##1 inst ##1 e1(ready,proc1,proc2).matched [->1]
    ##1 branch_back;
endsequence

In this example, source sequence e1 is evaluated at clock clk, while the destination sequence e2 is evaluated at clock sysclk. In e2, the end point of the instance e1(ready,proc1,proc2) is tested to occur sometime after the occurrence of inst. Notice that method matched only tests for the end point of e1(ready,proc1,proc2) and has no bearing on the starting point of e1(ready,proc1,proc2).

Local variables can be passed into an instance of a named sequence to which matched is applied. The same restrictions apply as in the case of ended. Values of local variables sampled in an instance of a named sequence to which matched is applied will flow out under the same conditions as for ended. See Section 17.8.

As with ended, a sequence instance to which matched is applied can have multiple matches in a single cycle of the destination sequence clock. The multiple matches are treated semantically the same way as matching both disjuncts of an or. In other words, the thread evaluating the destination sequence will fork to account for such distinct local variable valuations.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文