Hi,
In my_test i am overriding base_seq with my_seq. my_seq has random variables.
If i randomize base_seq in base_test, random variables in my_seq gets randomized and everything works fine.
But now i want to do randomize() with and i can not do that on base_seq.
My solution for this was
class my_class extends base_test;
...
my_seq m_my_seq;
function void build_phase(uvm_phase phase);
super.build_phase(phase);
base_seq::type_id::set_type_override(my_seq::get_type());
m_my_seq =my_seq::type_id::create("m_my_seq", this);
endfunction : build_phase
task run_phase(uvm_phase phase);
factory.print();
phase.raise_objection(this);
if(!m_my_seq.randomize() with {a==5;})
`uvm_fatal(get_type_name(), "m_my_seq randomization failed!");
$cast(m_base_seq,m_my_seq);
super.run_phase(phase);
phase.drop_objection(this);
endtask : run_phase
endclass : my_test
class base_test;
...
base_seq m_base_seq;
...
m_base_seq =base_seq::type_id::create("m_base_seq", this);
...
m_base_seq.start(...);
...
endclass
class my_seq extends base_seq;
rand int a;
rand int b;
endclass
class base_seq;
endsclass
But in this case, it does not randomize.
Do you know how can i solve this?
Thanks in advance