Configuration Randomization

In reply to Vignesh_18:

A very simple approach looks like tis:

class my_seq_config extends uvm_object;  // don't register with the factory
  rand bit set_count;
  rand int count;

  function new (int count_arg = 0);
    count = count_arg;
  endfunction 
endclass
class my_test extends uvm_test;
  ...
  function void build_phase(uvm_phase phase);
    ...
    my_seq_config cfg = new;   // Constructing the config_object
    if (!cfg.randomize() with { count < 16;})
      uvm_config_db #(my_top_seq_config)::set(this, "*.*seq*", "config", cfg);

    env = top::type_id::create("env", this);
  endfunction
  ...

Then you can retrieve the randomized value in your sequence.