Hardware Reference
In-Depth Information
v <= ...;
...
v <= ...;
Since nonblocking assignments are executed in order, only the last assignment
counts and the preceding assignments to v are simply ignored.
23.2.2.2
Conditional Assignment to Free Variable
The formal semantics of a free variable assignment within a conditional or looping
statement is not elaborated in the LRM. The description here is according to
our understanding. We limit our consideration to the case when the always_ff
procedure in which the free variable is assigned is controlled by the global
clock. 5 The case of an arbitrary clocking event is obtained using the generalization
described in Sect. 23.2.2.1 and is left to the reader (see Exercise 23.2 ). We limit our
discussion to plain if and if ... else statements. Other conditional statements of
SystemVerilog can be rewritten using these forms. If a free variable assignment is
within the scope of a looping statement, directly or otherwise, we assume that the
looping statement is statically unrollable. We also assume that the loop management
does not cause side effects.
Formal Semantics. The formal semantics is obtained by the recursive application
of the following rewriting rules for free variable v .
1. Unroll all loops containing a free variable assignment (directly or otherwise).
As a result, the free variable is not within the scope of any looping statement,
directly or otherwise.
2. Here and in the remaining rules we consider direct scopes only. If v has multiple
assignments within the same clause of a conditional statement, eliminate all
the assignments except the last one (see Sect. 23.2.2.1 ). Recall that we consider
different bits of a free variable as different free variables.
For example,
if (cond) begin
... // sequence of statements 1
v <= expr1;
... // sequence of statements 2
v <= expr2;
end
is rewritten as
if (cond) begin
... // sequence of statements 1
5 Since free variables may be assigned only within always_ff procedures and since a variable
assigned in an always_ff procedure cannot be assigned in any other process (see Sect. 2.2.1.3 ),
we can focus on a single always_ff procedure.
Search WWH ::




Custom Search