How to use a variable in uvm test and same variable in the sequence

HI ,

I want a scenario where UVM tests has an int variable declared. (Variable increments in the test.)

The same variable/datatype is used as a checker in the sequence once the body completes.

please let me know how to use it.

-Regards,
-RAJA.

Pass it as inline constraint in the sequence or assign it the same using the sequence object as follows.

class test extends uvm_test;
int v;

virtual task run_phase(uvm_phase phase);
  super.run_phase(phase);
  seq = sequence1::type_id::create("sequence1");
  seq.v = this.v;
  seq.randomize();
  seq.start( < **sequencer**>);
endtask

endclass

The solution provided by @Sabarish works if the value of the variable does not change in the test once the sequence gets started.

You can create a shared object containing the variable and share a handle to the object using the uvm_config_db.

1 Like