I am writing a UVM sequence_item code with queue in it
For each test I am randomizing some variable in seq_item and passing it to driver through sequencer
Following is a dummy code
class seq_item extends uvm_sequence_item;
`uvm_object_utils(seq_item)
//Constructor
function new(string name="seq_item");
super.new(name);
endfunction : new
int a,b,c;
int q[$];
endclass : seq_item
class seq extends uvm_sequence#(seq_item);
`uvm_object_utils(seq)
//Constructor
function new(string name="seq");
super.new(name);
endfunction : new
seq_item req;
extern virtual task body();
endclass : seq
task seq :: body();
req = seq_item::type_id::create("req");
start_item(req);
if(!req.randomize() with { req.a == 8'h0;
req.b == 8'h5;})
`uvm_error("SEQ", $sformatf("Randomization Failed in %s", get_name()))
for(int i=0; req.start_elem_count_UVM+i<=req.final_elem_count_UVM;i++) begin
req.q[i] = i;
end
finish_item(req);
endtask : body
This is my first time using a queue in the Sequence_item and passing it to the driver seq_item_port
Will this work or cause error?