I cannot figure out why the following code works with rand
but not randc
.
I’d like to hit all posible states of a
before they start repeating in randomization, that is why i want randc
.
class myclass;
rand var byte a,b;
// randc var byte a,b; <- does not work
constraint spec0 {
a inside {[1:5]};
b inside {1,-1};
a == 3 -> b == -1;
solve a before b;
}
endclass
module tb;
initial begin
myclass abc = new();
repeat(10) begin
assert(abc.randomize());
$display("[i] rand abc.a = %0d, abc.b = %0d",abc.a,abc.b);
end
end
endmodule
Thank you for the help you can provide.