I ran into an issue some time back and thought it would be good to put it here:
i have declared a randc variable inside a seq_item and used `uvm_do for sending the sequence item across but later i realized the randc wont work the way it should and the reason for the same is, `uvm_do calls for a `uvm_create every time, ans each time new item is getting created and that doesn't have any history of the previous values for the randc variable.
so solved the above issue with using another macro `uvm_rand_send which is same as uvm_do but without uvm_create (which basically wont create the seq_item every time and history of randc variable will be stored).
Found the following code snippet from synopsys UVM training material later:
i have declared a randc variable inside a seq_item and used `uvm_do for sending the sequence item across but later i realized the randc wont work the way it should and the reason for the same is, `uvm_do calls for a `uvm_create every time, ans each time new item is getting created and that doesn't have any history of the previous values for the randc variable.
so solved the above issue with using another macro `uvm_rand_send which is same as uvm_do but without uvm_create (which basically wont create the seq_item every time and history of randc variable will be stored).
Found the following code snippet from synopsys UVM training material later:
class trans extends
uvm_sequence_item;
randc
bit[3:0] value;
endclass
virtual task body()
`uvm_create_on(req, m_sequencer);
repeat
(n) begin
`uvm_rand_send(req); // Same as
uvm_do except no `uvm_create_on
//
randomizes the same object to enable randc
end
endtask
No comments:
Post a Comment