返回介绍

17.14 时钟解析

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

SystemVerilog具有多种方法为一个特性指定时钟。

— 具有一个时钟的序列实例,例如:

sequence s2;
    @(posedge clk)
        a ##2 b;
endsequence

property p2;
    not s2;
endproperty

assert property(p2);

— 特性,例如:

property p3; @(posedge clk) not (a ##2 b); endproperty
assert property (p3);

— contextually inferred clock from a procedural block, for example:

always @(posedge clk) assert property (not (a ##2 b));

— clocking block, for example:

clocking master_clk @(posedge clk);
    property p3; not (a ##2 b); endproperty
endclocking
assert property (master_clk.p3);

— default clock, for example:

default clocking master_clk ; // master clock as defined above
property p4; (a ##2 b); endproperty
assert property (p4);

For a multi-clocked assertion, the clocks are explicitly specified. No default clock or inferred clock is used. In addition, multi-clocked properties are not allowed to be defined within a clocking block.

A multi-clocked property assert statement must not be embedded in procedural code where a clock is inferred.For example, following forms are not allowed.

always @(clk) assert property (mult_clock_prop);// illegal
initial @(clk) assert property (mult_clock_prop);// illegal

The rules for an assertion with one clock are discussed in the following paragraphs.

The clock for an assertion statement is determined in the decreasing order of priority:

  1. Explicitly specified clock for the assertion.
  2. Inferred clock from the context of the code when embedded.
  3. Default clock, if specified.
A concurrent assertion statement must resolve to a clock. Otherwise, the statement is considered illegal.

Sequences and properties specified in clocking blocks resolve the clock by the following rules:

  1. Event control of the clocking block specifies the clock.
  2. No explicit event control is allowed in any property or sequence declaration.
  3. If a named sequence that is defined outside the clocking block is used , its clock, if specified, must be identical to the clocking block’s clock.
  4. Multi-clock properties are not allowed.
Resolution of clock for a sequence declaration assumes that only one explicit event control can be specified. Also, the named sequences used in the sequence declaration can, but do not need to, contain event control in their definitions.

sequence s;
    //sequence composed of two named subsequences
    @(posedge s_clk) e ##1 s1 ##1 s2 ##1 f;
endsequence

sequence s1;
    @(posedge clk1) a ##1 b; // single clock sequence
endsequence

sequence s2;
    @(posedge clk2) c ##1 d; // single clock sequence
endsequence

These example sequences are used in Table 17-3 to explain the clock resolution rules for a sequence declaration. The clock of any sequence when explicitly specified is indicated by X. Otherwise, it is indicated by a dash.

Table 17-3: Resolution of clock for a sequence declaration

s_clkclk1clk2Resolved clockSemantic restriction
---unclocked-
X--s_clk-
XX-s_clks_clk and clk1 must be identical
XXXs_clks_clk, clk1 and clk2 must be identical
X-Xs_clks_clk and clk2 must be identical
-X-unclocked-
-XXunclockedclk1 and clk2 must be identical
--Xunclocked-

Once the clock for a sequence declaration is determined, the clock of a property declaration is resolved similar to the resolution for a sequence declaration. A single clocked property assumes that only one explicit event control can be specified. Also, the named sequences used in the property declaration can contain event control in their declarations. Table 17-4 specifies the rules for property declaration clock resolution. The property has the form:

property p;
    @(posedge p_clk) not s1 |=> s2;
endproperty

p_clk is the property for the clock, clk1 is the clock for sequence s1 and clk2 is the clock for sequence s2. The same rules apply for operator |->.

Table 17-4: Resolution of clock for a declaration

p_clkclk1clk2Resolved clockSemantic restriction
---unclocked-
X--p_clk-
XX-p_clkp_clk and clk1 must be identical
XXXp_clkp_clk, clk1 and clk2 must be identical
X-Xp_clkp_clk and clk2 must be identical
-X-unlocked-
-XXunlocked or multi-clockclk1 and clk2 must be identical. If clk1 and clk2 are different for the case of operator |=>, then it is considered a multi-clock implication
--Xunlocked-

Resolution of clock for an assert statement is based on the following assumptions:

  • assert can appear in an always block, initial block or outside procedural context
  • clock is inferred from an always or initial block
  • default clock can be specified using default clocking block
Table 17-5 specifies the rules for clock resolution when assert appears in an always or initial block, where i_clk is the inferred clock from an always or initial block, d_clk is the default clock, and p_clk is the property clock.

Table 17-5: Resolution of clock in an always or initial block

i_clkd_clkp_clkResolved clockSemantic restriction
---unclockedError. An assertion must have a clock
X--i_clk-
-X-d_clk
--Xp_clk
X-Xi_clki_clk and p_clk must be identical
XX-i_clk-
-XXp_clk
--Xp_clk-

When the assert statement is outside any procedural block, there is no inferred clock. The rules for clock resolution are specified in Table 17-6.

Table 17-6: Resolution of clock outside a procedural block

d_clkp_clkResolved clockSemantic restriction
--unlockedError. An assertion must have a clock
X-d_clk
-Xp_clk
XXp_clk

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

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

发布评论

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