Hardware Reference
In-Depth Information
The default sampled value of any other variable or net is the default value of the
corresponding type.
Example A.3.
Given the declaration:
wire
w=a;
ǚ.
a
/
D
1'bz
, because the default sampled value of a net is the default value of
its type.
t
If
s
is a sequence then the default sampled values of
s.triggered
and
s.matched
are false (
1'b0
).
The default sampled value of an expression is defined recursively.
Example A.4.
Given the declarations:
bit
a;
logic
[3:0] b = 7,c=4;
ǚ.
a||b>c
/
D
ǚ.
a
/
||
ǚ.
b>c
/
D
1'b0 ||
ǚ.
b
/
>
ǚ.
c
/
D
7>4
D
1'b1
.
t
A default sampled value is used in the definition of sampled value functions
when there is need to reference a sampled value of an expression before time 0 (see
Sect.
7.2.1
).
A.2
Sampled Value of Variable
The general rule for variable sampling is as follows:
The sampled value of a variable in time slot 0 is its default sampled value defined
in Sect.
A.1
.
The sampled value of a variable in any other time slot is the value of the variable
in the Preponed region of this time slot.
This rule has the following exceptions:
The sampled value of an automatic variable is its current value. When a past or a
future value of an automatic variable is referenced by a sampled value function,
the current value of the automatic variable is taken instead. The indication of past
of future is thus disregarded.
Example A.5.
The sampled value of
i
in the following loop:
for
(
int
i=0;i<7;i++)
begin
...
end
is its current value. If
a
is a vector, then in both
$sampled(a[i])
and
$past(a[i])
the current value of
i
in the current time slot is assumed.
t
Search WWH ::
Custom Search