In reply to AL_verif:
If you don’t want to consider the control signal in the sequence item, you can do this way. In transaction class declare data as a dynamic array & constraint the size of the array from the sequence.
//sequence
task body()
req = item::type_id::create("req");
//for single transfer
begin
start_item(req);
assert(req.randomize() with{ data.size == 1;});
finish_item(req);
end
//for multiple transfersi.e.,full band width
start_item(req);
assert(req.randomize() with{data.size == 10/*or any other values per your requirement*/;});
finish_item(req);
endtask
// Now in driver you need not to do any changes
virtual task main_phase(uvm_phase phase);
super.main_phase(phase);
forever begin
seq_item_port.get_next_item(req);
drive_data(reg);
seq_item_port.item_done();
end
endtask : main_phase
// --------------------------------------
virtual protected task drive_data(item curr_item);
// start transaction
foreach(curr_item.data[i])
begin
@(posedge vif.clk);
vif.valid <= 1;
vif.data <= curr_item.data[i];
end
// release the bus
@ (posedge vif.clk);
vif.valid <= 0;
vif.data <= $random();
endtask:drive_data
Regards,
Shanthi
www.maven-silicon.com