The use of these functions is not limited
to assertion features; they can be used as expressions in procedural code as
well. The clocking event, although optional as an explicit argument to the
functions $past, $rose, $stable and $fell, is
required for their semantics. The clocking event is used to sample the value of
the argument expression.
The function $sampled does not use a clocking event, although one
can be optionally provided. The optional clocking event is ignored, and its use
is deprecated. The value of $sampled is updated in the preponed scheduling
region.
Replace
Function $sampled returns the sampled value of the
expression with respect to the last occurrence of the clocking event. When $sampled is invoked prior to the occurrence of the
first clocking event, the value of X is returned. The use of $sampled in assertions, although allowed, is
redundant, as the result of the function is identical to the sampled value of
the expression itself used in the assertion.
With
The $sampled function returns the value of the expression sampled in the
preponed region of the simulation time step in which the function is called. No
clocking event is ever inferred. The value is stable throughout the simulation
step.
The value of an expression
sampled in the preponed region corresponding to time 0 is the result of
evaluating the expression using the initial values of the variables comprising
the expression. The initial value of a static variable is the value assigned in its declaration, or in the absence of such an
assignment it is the default (or uninitialized) value of the corresponding
type. The initial value of any other variable or signal is the default value of
the corresponding type. For example, if $sampled(y) is called at time 0, and y is of type logic, the value returned is X.
The use of $sampled in assertions, although allowed, is
redundant, as the result of the function is identical to the sampled value of
the expression itself used in the assertion.
Page 247
Replace
When
these functions are called at or before the first clock tick of the clocking
event, the results are computed by comparing the current sampled value of the
expression to X.
With
When these functions are called at or
before the first clock tick of the clocking event, the results are computed by
comparing the current sampled value of the expression to X the result of the
expression evaluated using the initial
values of the variables comprising the expression. The initial value of a
static variable is the value assigned in its
declaration, or in the absence of such an assignment it is the default (or
uninitialized) value of the corresponding type. The initial value of any other
variable or signal is the default value of the corresponding type.
Page 248
Replace
A
clock tick is based on clocking_event. If the specified clock tick in the past
is before the start of simulation, the returned value from the $past
function is a value of X.
With
A
clock tick is based on clocking_event. If the
specified clock tick in the past is before the start of simulation, the
returned value from the $past function is a value of X.
If the specified clock tick in
the past is before the start of simulation, the returned value from the $past
function is the result of evaluating the expression using the initial values of
the variables comprising the expression. The initial value of a static variable
is the value assigned in its declaration, or in the absence of such an
assignment it is the default (or uninitialized) value of the corresponding type.
The initial value of any other variable or signal is the default value of the
corresponding type.