Array of sequences

Hello,

https://verificationacademy.com/forums/systemverilog/creating-array-sequences

I referred to this post to understand how to create an array of sequences. I’d like some further clarifications.

I have a wreq seq, wdata seq and a top write seq (that forks of the 2 sequences in parallel, so they start at the same clk).

In my case, the wdata seq depends on some rand variables inside wreq_seq. I would like to simulate a case where multiple wreq sequences are issued before the 1st wdata seq.

Assuming I create an array of wreq sequences, how can I make a “wreq/wdata” pair before starting them ?

In words:

  1. make an array of wreq sequences
  2. make an array of wdata sequences, each wdata_seq should be formed by taking the random variables inside wreq seq into consideration.
  3. send multiple wreq sequences, followed by wdata sequences.

Please let me know your suggestions.

In reply to UVM_learner6:


class seq1 extends ..
rand int a,b;
endclass
 
class seq2 extends ..
rand int data;
rand int a,b;
constraint c1 { data == a*b; }
endclass
 
///test case
seq1 seq1_arr[10];
seq2 seq2_arr[10];

foreach(seq1_arr[i])begin
      seq1_arr[i] = seq1::type_id::create($sformatf("seq1_arr[%0d]",i));
      seq1_arr[i].randomize();
end

foreach(seq2_arr[i])begin
      seq2_arr[i] = seq2::type_id::create($sformatf("seq2_arr[%0d]",i));
      seq2_arr.randomize()with{ a==seq1_arr[i].a; b==seq1_arr[i].b; };
end

//start the sequence as per your requirement 
//send multiple wreq sequences, followed by wdata sequences.
foreach(seq1_arr[i])begin
     seq1_arr[i].start();
end
foreach(seq2_arr[i])begin
     seq2_arr[i].start();
end