I had written constraint for 6 varibles but its not working so can anyone please guide me where i am lacking?
Requirement is :
a,b,c between 0 to 7 but b != a and c != b or a
x,y,z between 0 to 63 but y != x and z != x or y
class error_constraint;
rand int a,b,c,x,y,z;
constraint a1 { a inside { [00:07] }; }
constraint a2 { (b != a) -> b inside { [00:07] }; }
constraint a3 { (c != a | c != b) -> c inside { [00:07] }; }
constraint x1 { x inside { [00:63] }; }
constraint x2 { (y != x) -> y inside { [00:63] }; }
constraint x3 { (z != x | z != y) -> z inside { [00:63] }; }
endclass
module a;
error_constraint err = new();
initial begin
repeat(10)
begin
void'(err.randomize());
$display("%0d %0d %0d %0d %0d %0d",err.a,err.b,err.c,err.x,err.y,err.z);
end
end
endmodule