I have a sequence simplified as :
class my_seq extends some_base_sequence;
bit[7:0] exp_val[5];
task body();
// loops through each exp_val item for some checks
endtask
endclass
It is randomized-constrained from another sequence which is simplified as :
class top_seq extends uvm_sequence;
bit[7:0] exp_val[5];
my_seq check_seq;
task body();
foreach (exp_val[idx])
exp_val[idx] = some_val; // basically some calculated value
check_seq = my_seq::type_id::create("check_seq");
if (!randomize(check_seq) with {
foreach (exp_val[idx])
exp_val[idx] == exp_val[idx];
})
`uvm_fatal("Randomization failed")
else
check_seq.start(p_sequencer.my_seqr, this);
endtask
endclass
Now when check_seq
is started, the exp_val
items are all just 0
. It means it didn’t get the values passed to it by the top_seq
. Even if I try adding this
to give the distinction between the 2 members, the issue is still there.
if (!randomize(check_seq) with {
foreach (exp_val[idx]) // also tried this.exp_val in this line
exp_val[idx] == this.exp_val[idx];
})
If I change the name of my_seq
’s exp_val
to something else and do the same in top_seq
, then the constraint takes effect. So I’m guessing it’s a ‘same member name’ issue ? In Specman e if I recall there’s a way to do it by adding .
to specify the object’s member, but I don’t know how to do it here.