Can one use values from a previously run sequence to constraint a future sequence?


My current situation is that I have an SPB UVC which implements RAL sequences. These sequences fine, having tested the SPB UVC extensively. The SPB sequences are used to drive DAI register values, such as format, word length and channel control. I want to run a register sequence which sets up these values, then use these values to drive data from my DAI UVC accordingly. I am using a virtual sequencer to coordinate between the 2 DAI sequencers (one for serial, and one for parallel) and my SPB sequencer. The code below shows the sequence I am running on the virtual sequencer:

task body();
    //Set up SPB register values
    `uvm_do_on (spb_reg_rd_wr_seq, spb_reg_sqr);
    //Run serial and parallel sequences using the register values set in the above seq
        `uvm_do_on_with (dai_serial_seq, dai_ser_sqr, {num_loops == 2;})     //Use Values from seq to constraint here
        `uvm_do_on_with (dai_parallel_seq, dai_par_sqr, {num_loops == 2;})   //Use Values from seq to constraint here
endtask : body

More code can be revealed if required. Any suggestions are much appreciated.


You can always use by doing spb_reg_rd_wr_seq.item.value in next sequences’ constraint. Ensure that your register sequence finishes first to avoid unwanted value. If directly it does not work then I would suggest storing to temporary variable n_loop = spb_reg_rd_wr_seq.item.value and use new variable in constraint.

Hope this helps.