|
OVM Data item transaction
|
|
Data items Represent the main transaction input to the DUT Adhering to a protocol, consistent values are generated and sent Examples include packets, transactions, instructions, and so on
Test environment randomizes data items (transactions) A default distribution should be generated Tests further steer generation by layering constraints or selecting from pre-defined scenarios This makes test short, readable, easier to write and maintain
typedef enum {
READ,
WRITE
} mem_read_write_enum;
class mem_transfer extends ovm_sequence_item;
rand mem_read_write_enum read_write;
rand bit [`ADDR_SIZE-1:0] addr;
rand bit [`DATA_SIZE-1:0] data;
rand bit [`DATA_SIZE-1:0] write_enable;
rand bit chip_enable;
constraint c_addr {
addr <; 2**`ADDR_WIDTH;
}
constraint c_chip_enable {
chip_enable == 0;
}
// Register fields with OVM
`ovm_object_utils_begin (mem_transfer)
`ovm_field_int (addr, OVM_ALL_ON)
`ovm_field_int (data, OVM_ALL_ON)
`ovm_field_enum (mem_read_write_enum, read_write, OVM_ALL_ON)
`ovm_object_utils_end
// Class Constructor
function new (string name="mem_transfer_inst") ;
super.new (name);
endfunction : new
endclass : mem_transfer
What kind of operations may be required for such a data item?
- Customized Randomization
- Customized Printing
- Customized Comparing
- Customized Copying
- Customized Packing
- Customized Waveform Dumping
Out of the above features the first feature randomization is provided by system verilog. Rest all the features ovm provides.
|
|
This Articles is written/submitted by puneet (Puneet Aggarwal). You can also contribute to Asicguru.com. Click here to start
|
Prev << UVC in OVM
|
Next >> Sequence Item Macros
|