I have a class of sequence item with rand variables:
class my_seq_item extends uvm_sequence_item;
rand bit a, b, c, d;
I want to generate a random bit for 'd' only if 'b' and 'c' are 0. How do I write a constraint for this?
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI have a class of sequence item with rand variables:
class my_seq_item extends uvm_sequence_item;
rand bit a, b, c, d;
I want to generate a random bit for 'd' only if 'b' and 'c' are 0. How do I write a constraint for this?
constraint my_constraint { if (b==0 && c==0) d==1; else d==0;}