In reply to dave_59:
sorry!
the constraint C2 is on pB not the same as C1:
module top;
typedef enum {A,B,C,D} p_e;
class c;
rand p_e pA[2], pB[2];
constraint c1 { foreach(pA[i]) if(pA[i] == C) pB[i] dist{C:= 1, D:= 1}; }
constraint c2 { foreach(pB[i]) if(pB[i] == C) pA[i] dist{C:= 1, D:= 1}; }
endclass: c
c h=new;
initial repeat(50) begin
assert(h.randomize());
$display("%p %p", h.pA[0], h.pB[0]);
end
endmodule
this code generate the above too?
thanks!!