I have a UVM test that calls a test sequence and randomizes it as follows,
class rd_test extends base_test;
`uvm_component_utils(rd_test)
q_pkg::q_vseq rd_seq;
virtual task main_phase(uvm_phase phase);
q_pkg::q_vseq rd_seq;
phase.raise_objection(this, “RD_TEST”);
rd_seq = q_pkg::q_vseq::type_id::create(“rd_seq”);
assert(rd_seq.randomize());
rd_seq.start(env.vsqr);
#10us;
if(!rd_seq.randomize() with {
0 < q_id < 8;
})
`uvm_fatal(get_type_name(), “Randomization failed”)
else
rd_seq.start(env.vsqr);
phase.drop_objection(this, “RD_TEST”);
endtask : main_phase
endclass : rd_test
class q_vseq extends vseq;
rand int q_id;
uvm_object_utils_begin(q_pkg::q_vseq)
uvm_field_int(q_id, UVM_ALL_ON);
`uvm_object_utils_end
constraint q_id_c {0 < q_id < 8};
endclass : q_vseq
The problem is, I do not see q_id getting constraint between 0 to 8 using both constraints inside the sequence and inline sequence as in the test, unless I call the randomization call as follows
assert(rd_seq.randomize() with {q_id==7;});
Can someone help understand what’s missing?