I am trying to achieve the following and am not sure how to do it. Any suggestions would be helpful.
- I have a base sequence item as follows:
class base_seq_item extends uvm_sequence_item;
`uvm_object_utils(base_seq_item);
bit init_zero;
bit init_rand;
function new(string name="base_seq_item");
init_zero = 0;
init_rand = 0;
endfunction
endclass
- I have a bunch of other sequence items that extend from the above base_seq_item with each extended class having its own variables. Here’s an example extended sequence item class
class ext_seq_item extends base_seq_item;
`uvm_object_utils(ext_seq_item);
rand logic [5:0] data;
function new(string name="ext_seq_item");
super.new(name);
if(init_zero)
data = 0;
if(init_rand)
data = $urandom();
endfunction
endclass
-
The extended class constructor uses the variables init_zero and init_rand to set the initial value of the sequence item.
-
I would like to know what is a way to set these variables (init_zero/init_rand) in the testbench (may be in build_phase) so that I can every sequence item object created sees this change. Is there any way to set this before creating the objects (afaik this is impossible in OOPs, but just checking)