Uvm_do constraint issue

In my transaction class, I have given some constraints.

  1. Constraints are working properly when I use :
    start_item(req);
    assert(req.randomize())
    finish_item(req);

    But, when I used `uvm_do(req) instead of above mentioned, constraints are not working properly.it is giving some random values.

  2. My transaction class variables are rand of dynamic array type. For the first method, I just need to pass size once.But while using uvm_do, I have to give seperate for each, like uvm_do_with(req,{…})

can someone suggest why is this happening…

Thanks in advance,
Roopa

In reply to roopatoms:

Could you please show the the constraints in your transaction class?

In reply to chr_sue:

That issue got solved. But, one of my transaction variable is dynamic.
so i am using constraint in `uvm_do:

`uvm_do_with(req,{req.data.size()==3;req.data={32’h3,32’h4,32’h5};});//data is dynamic

Here I am getting error as “can’t mix packed and unpacked”.So,please tell me how to assign value in constraint to a dynamic array.

Thanks,
Roopa

In reply to roopatoms:

You need to iterate over a dynamic array. So assign your literal to temp array and then do

`uvm_do_with(req,{data.size()==3;foreach(data[ii])data[ii]=temp[ii];});

In reply to dave_59:

Thanks Dave