Search form

Main menu

My Account Menu

randomization NOT happening for seq_item veriable if uvm_field_* is NOT enabled

anantv
anantv
Full Access
47 posts

HI
In my Testbench, I am NOT able to get random value for a seq_item variable which was NOT part of the uvm_object_utils - uvm_field_int() macros.

1. Integer Variable "temp" is defined as rand in the sequence item "bus_item" of sequencer A. But "temp" is NOT registered for UVM Field Automation using the uvm_field_int* macro
2.In the virtual sequencer, the bus_item is applied to the sequencer A using the following code:

bus_item bitem;
`uvm_do_on_with(bitem,p_sequencer.A_seqr,{temp=='d20};)

3.But in the simulation, the value of temp is always '0' even with different seeds.
4.After adding the "temp" in the uvm_object_utils - uvm_field_int() macro of the "but_item", the constrained value of 'd20 is applied to the "temp" variable in my simulations.

How does the UVM Field Automation affects the randomization of a rand variable in sequence item???

I am using the UVM-1.1b version with VCS

Please let me know the odd behavior of "temp" variable in my simulation?

Regards
AnantharajTV

Answers

ajeetha
ajeetha
Full Access
61 posts

AnantharajTV,
Can you add a display in the bus_item class as below:

  class bus_item extends uvm_sequence_item..
    rand int temp;
    // ..

   function void post_randomize;
     $display ("%p", this);
     // or just the temp variable as below
     $display ("Temp: %0d", this.temp);
   endfunction : post_randomize

The field_int macro enables printing, copying etc. It is possible that you are displaying the temp value at the destination after a copy/clone operation - that is certainly affected by the macro addition.

HTH,
Ajeetha, CVC
www.cvcblr.com/blog

anantv
anantv
Full Access
47 posts

Hi Ajeetha,

Thanks for the reply & clarification.

YES, I had used a clone method for the sequence item inside driver, which had caused this issue.

Now I had understood the reason for this issue.

Regards
AnantharajTV