Hardware Reference
In-Depth Information
The following observed deferred assertions are illegal , as their fail actions
contain either more than one statement, or are not a subroutine call:
da5: assert #0 (a == b) else begin
err_cnt++; $error("p1 failure: a = %b,b=%b",a,b); end
da6: assert #0 (a == b) else ctr++;
da7: assert #0 (a == b) else
begin
$error("da7 failure:a=%b,b=%b",a,b);
end
t
If the above observed deferred assertions are replaced by final ones, then
assertion da1 becomes also illegal because the action block modifies the global
variable err_cnt .
Delayed execution of deferred assertions puts forth a question about which
values of the subroutine arguments are used during action execution. The answer
is twofold:
￿ If a subroutine argument is passed by value, the argument value is used at the
instant when the deferred assertion expression is evaluated. 3
￿ If a subroutine argument is passed by reference, the argument value from the
reporting region is used. That is, in the Reactive region for observed assertions
and in the Postponed region for the final assertions.
Since system tasks $display , $error , etc. pass their arguments by reference,
it means that when these tasks are used with deferred assertions, the argument
values from the Reactive, respectively Postponed, region are printed. Although these
values in these region may differ from the values used during the deferred assertion
expression evaluation, in practice the values of variables representing actual design
signals remain the same, and thus the deferred assertion reporting provides accurate
reporting of signal values.
4.3.3
Standalone Deferred Assertions
Unlike immediate assertions, deferred assertions may also be placed outside
procedural code. In such cases, a deferred assertion is semantically treated as if
the assertion were enclosed within an always_comb procedure.
This was illustrated in Figs. 4.5 and 4.6 . Explicit always_comb statement used
with the immediate assertion in Fig. 4.4 is not necessary. This feature of deferred
assertions makes their usage more intuitive and convenient.
At this point is it useful to point out that immediate assertions of any kind may
behave differently in an always_comb procedure and in an always @ * procedure.
3 This means that the value of the variable must be stored in the deferred assertion report queue
with the assertion identification.
Search WWH ::




Custom Search