Randomizing a UVM_SEQUENCE using a config object from the sequencer upon which it will be run

What I use in this case is the config in the p_sequencer:


class some_sequence extends uvm_sequence;
  `uvm_declare_p_sequencer(some_sequencer)

  constraint some_constraint {
    if (p_sequencer != null)
      some_field == p_sequencer.cfg.some_field;
  }
endclass

When you start the sequence, just make sure that it gets created on your specific sequencer:


some_sequence seq;
`uvm_create_on(seq, some_seqr)

seq.randomize();
`uvm_send(seq)

Sequences don’t have to be started on the sequencer to be associated with it.