In reply to om30:

Check whether this code helps you : other two are zero when insert_err is zero.

******************************************************************

class test;

rand bit[1:0] insert_err;

rand bit data_cbit;

rand bit error_in;

constraint c1 { if(insert_err == 1'b0) data_cbit ==0;}

constraint c2 { if(insert_err == 1'b0) error_in ==0;}

task displayIt();

$display(" values of insert_err = %0d", insert_err);

$display(" values of data_cbit = %0d", data_cbit);

$display(" values of error_in = %0d", error_in);

endtask : displayIt

endclass

module tbtop;

test test1;

initial

begin

test1 = new();

for (int i =1 ; i<6; i++)

begin

assert(test1.randomize());

test1.displayIt();

end

$display ("**********block2***********");

for (int i =1 ; i<6; i++)

begin

test1.randomize() with {data_cbit==1; error_in==1;};

test1.displayIt();

test1.randomize() with {(data_cbit==0) && ( error_in==0);};

test1.displayIt();

end

$finish();

end

endmodule

Results :

values of insert_err = 3

values of data_cbit = 0

values of error_in = 1

values of insert_err = 1

values of data_cbit = 0

values of error_in = 0

values of insert_err = 1

values of data_cbit = 0

values of error_in = 1

values of insert_err = 1

values of data_cbit = 1

values of error_in = 0

values of insert_err = 0

values of data_cbit = 0

values of error_in = 0

**********block2***********

values of insert_err = 1

values of data_cbit = 1

values of error_in = 1

values of insert_err = 1

values of data_cbit = 0

values of error_in = 0

values of insert_err = 3

values of data_cbit = 1

values of error_in = 1

values of insert_err = 0

values of data_cbit = 0

values of error_in = 0

values of insert_err = 1

values of data_cbit = 1

values of error_in = 1

values of insert_err = 2

values of data_cbit = 0

values of error_in = 0

values of insert_err = 2

values of data_cbit = 1

values of error_in = 1

values of insert_err = 0

values of data_cbit = 0

values of error_in = 0

values of insert_err = 3

values of data_cbit = 1

values of error_in = 1

values of insert_err = 0

values of data_cbit = 0

values of error_in = 0