The OVM
SystemVerilog Class Library has built-in automation for many service routines
that classes need for printing, copying, comparing and so on. OVM allows you to
specify the automation needed for each field and to use a built-in, mature and
consistent implementation of these routines. For each field you must use OVM
field registration macros as in the example below:
...
rand bit [15:0] addr;
rand xbus_read_write_enum read_write;
rand int unsigned size;
rand bit [7:0]
data[];
rand bit [3:0]
wait_state[];
...
`ovm_object_utils_begin(xbus_transfer)
`ovm_field_int (addr, OVM_ALL_ON)
`ovm_field_enum
(xbus_read_write_enum, read_write, OVM_ALL_ON)
`ovm_field_int (size, OVM_ALL_ON)
`ovm_field_array_int(data, OVM_ALL_ON)
`ovm_field_array_int(wait_state, OVM_ALL_ON)
...
Inside a
single dedicated `ovm_*_utils_begin...end
block, you must use dedicated macros for each field type. For example `ovm_field_int for a
simple int or `ovm_field_aa_int_byte_unsigned
for an associative array of integral types indexed by the byte unsigned.
If you are
hesitant and your head aches when matching the right macro with the right type,
the OVM Field Editor of the already well known DVT (Design and
Verification Tools) Eclipse Plug-in IDE comes to rescue:
You can
quickly check whether you have unregistered fields or registration errors. The
DVT OVM Field Editor allows you to click on a field and register it with the
right macro or customize it's printing, copying, packing and other controls.
Based on the enclosing class type (object, component or sequence), the right `ovm_*_utils_begin...end<
enclosing block for the registration macros is also created.
From now
on, just declare your fields, then open the OVM Field Editor, select all fields
and click Register. That's it!
Just don't
forget to read more about the DVT Eclipse Plug-in and get your free trial
license from www.dvteclipse.com.
=genIES