Using vsequence to share data between sequences

I have a scenario where a control interface sequence_item and data_interface sequence_item need to share some data. I have a common variable idx available in the virtual sequence. The ctl sequence_item anda data sequence_item need to get a new value of idx i.e on ctl intf C0/C5/C3 and on data interface D0/D5/D3. I am not sure how to

  1. push the idx data into sequence_item from vsequence.
  2. updatw sequence_item with new idx for every packet once the sequence starts.
class block_vseqr extends uvm_sequencer;
  int idx[$];
endclass

class block_vseq extends uvm_sequence 
  ctl_sequence ctl_seq;
  data_sequence data_seq;
  int idx;  // Can be retrieved from p_sequencer

  //factory registry
  //constructor

  virtual task body();
    // create sequences 
    fork
      //Start sequences with new seq_item.idx each time
      //seq_item.idx == p_sequencer.idx_q.pop_front()
      ctl_seq.start(p_sequencer.ctL_seqr);
   join
  endtask

class ctl_sequence extends uvm_sequence#(ctl_seq_item);
  int idx;  
endclass

class data_sequence extends uvm_sequence#(data_seq_item);
  int idx;
endclass
  
endclass

In reply to deepthig92:

Your code does not show enough information. When are the data_seq_items sent? Is there a 1-to-1 relationship between each ctl_seq_item and data_seq_item being sent, and do they share idx values? Why do you think you need a virtual sequencer to put shared index value; why no just share it in the virtual sequence?

In reply to dave_59:

When are the data_seq_items sent?
The data_seq_item can be sent before or after its ctl_seq_item. But order needs to be maintained i.e order of packets on ctl_interface is C0/C1/C2/C3 and order on data_interface is D0/D1/D2/D3- timing between packets can be randomized.

Is there a 1-to-1 relationship between each ctl_seq_item and data_seq_item being sent, and do they share idx values?
Yes there is a 1-to-1 correlation between ctl and data packets. They share “idx” field. Ctl_packet0 will have idx=55, data_packet0 needs to have idx=55. Ctl_packet1 will have idx=132, Data_packet1 needs to have idx=132 and so on…

Why do you think you need a virtual sequencer to put shared index value; why no just share it in the virtual sequence?
Eventually once an pktid or “Idx” leaves the packet processor, that idx will need to be released back to the system. I plan to connect analysis port from output monitor to input virtual sequencer to release the idx back to the system. Since I need port connection , I thought virtual sequencer is a better place to keep the active_idx array.