Constraint X/Z state value error

Hi all.
I’m trying to call the macro ovm_do_on_with upon some predefined sequence. The values in the constraint block are legitimate, but still, the simulator says that: "State variable 'jtag_seq.Packet.Expected_Data' contains an X/Z value" The call is: ovm_do_on_with(jtag_seq , p_sequencer.jtag_sqcr,
{ jtag_seq.Packet.Expected_Data == 0; })

(using just `ovm_do_on succeeding)
Thanks,
Assaf

I had got the error before. My issue was, i had not declared the variable which i was constraining in ovm_do as “rand” .
Ex:
logic [7:0] addr; i was getting error. i changed to ,
rand logic [7:0] addr;

Reason could be `ovm_do macros , creates and then ““randomizes”” the sequence items.
Just check . Hope this works for you if not someone else in the forum may help you :)

In reply to DiJo:

Your observation is on target - in SV, a variable in a class is called as “state variable” unless it is declared as “rand/randc”. Another quick note - for random gen, only 2-state variables are considered, so it is recommended to use bit/int than logic.

HTH
Ajeetha, CVC

In reply to ajeetha:

Hello Ajeetha,

  I am hitting the same issue. What if I want to deliberately drive x's on a signal as per the specification and I want the x's driven on input-2 only for certain values of input-1. How can I achieve this ?

Thanks,
Madhu