Hardware Reference
In-Depth Information
property p_data_and_parity_v2;
1
dataType l_data;
2
parityType l_parity;
3
start ##1
4
(
5
(
6
dataValid,
7
l_data = data, l_parity = parity,
8
$display("time=%0d data=%h parity=%h",
9
$time,l_data,l_parity)
10
)
11
within complete[->1]
12
)
13
|-> parityOK(l_data, l_parity);
14
endproperty
15
Fig. 16.7
Property with subroutine call attached to a sequence
assertions: current values are used for local variables, whereas sampled values are
used otherwise. Actual arguments passed by reference are evaluated using Reactive
region values when the subroutine executes.
A common use of subroutine calls as sequence match items is to export infor-
mation from the assertion evaluation thread, especially values of local variables.
The export can be for debugging, to communicate with other parts of a testbench,
or to populate a coverage model. The capability to place the subroutine call
as a sequence match item is essential to get visibility to the local variables,
which cannot be referenced from an action block. Figure 16.7 shows a variant of
p_data_and_parity illustrating this usage. In each time step that dataValid is
matched in Line 7 , the local variable assignments are performed in Line 8 and
then the $display is called. The arguments to $display are inputs. Their values are
computed in the Observed region, using the values assigned to the local variables in
Line 8 and the current value of $time .
As another example, suppose that startCode is a signal of type startType that
is valid with start , while endCode is a signal of type endType that is valid with
complete . Suppose that we want to collect coverage on the pairs of startCode
and endCode values that occur for transactions of the sequential protocol (see
Sect. 15.2 ). This can be done using a covergroup and calling its sample method
as a sequence match item. Figure 16.8 shows an encoding. The signature of the
covergroup sample method is declared in Line 2 , and the covergroup is instantiated
in Line 7 . The sequence s_SEC has a local variable to capture the value of
startCode . Once complete is reached in Line 13 , the covergroup sample method is
called in Line 14 . The signal endCode is valid at this time, while the startCode has
been stored in l_startCode . See Sect. 18.2.3 for further discussion of covergroups
and Sect. 18.2.4 for more examples of this kind.
Search WWH ::




Custom Search