Hi All,
I have the following where I want to randomize “pkt_item” and send it on 4 different sequences from my virtual sequence. When I randomize, for the first sequence, both pkt_id and data are randomized. For the other 3 sequences, I need to randomize only data; in other words, all 4 sequences will send a pkt_item with the SAME pkt_id but random data. How can I do this?
class pkt_item extends uvm_sequence_item;
`uvm_object_utils(pkt_item)
rand bit[7:0] pkt_id;
rand bit[63:0] data;
endclass
class my_virt_seq extends uvm_sequence#(pkt_item);
`uvm_object_utils(my_virt_seq)
my_sequence_0 seqA;
my_sequence_1 seqB;
my_sequence_2 seqC;
my_sequence_3 seqD;
virtual task body();
//factory create the sequences here; code not shown
fork begin
seqA.start(SEQRA);
seqB.start(SEQRB);
seqC.start(SEQRC);
seqD.start(SEQRD);
end
join
endtask
endclass
I guess you want to use your own ID (pkt_id).In that case your seunce has to have a data mamber which corresponds to pkt_id.
After the creation of the seuences you can assign the pakt_id to the corresponding data member.
Where is the problem?
All 4 sequences create and randomize pkt_item. However, for the B, C, D sequence, after randomization, pkt_id should be the same as sequenceA pkt_id. How would I copy pkt_id info across sequences?
You can try this way,I assumed pkt_h as a handle to pkt_item type of object in your sequences my_sequence_0 , my_sequence_1 etc
virtual task body();
//factory create the sequences here; code not shown
seqA.randomize() with {pkt_h.pkdid == 20;};
seqB.randomize() with {pkt_h.pkdid == 20;};
seqC.randomize() with {pkt_h.pkdid == 20;};
seqD.randomize() with {pkt_h.pkdid == 20;};
fork begin
seqA.start(SEQRA);
seqB.start(SEQRB);
seqC.start(SEQRC);
seqD.start(SEQRD);
end
join
endtask