Quantcast
Channel: UVM Forums RSS Feed
Viewing all articles
Browse latest Browse all 756

`uvm_do_with is not working with variable constraint

$
0
0

Following is the sequence code

 

class basic_sequence extends from uvm_sequence(#sequence_item);

 

sequence_item item;

 

task body()

 

fp1 =fscanf("abc.txt", addr, data);

 

`uvm_do_with(item,{

                               item.addr = addr;

                               item.data = data;

                              });

 

endtask

 

endclass

 

I have constrained addr and data from file reading data. It is not happening with the above code. data_item is getting a random value.

 

 

I have written a user-defined task to solve this problem like below

 

task do_rw(int addr, int data);
  begin
   item = sequence_item::type_id::create("item",,get_full_name());
   item.wr_adr.rand_mode(0); 
   item.wr_dat.rand_mode(0); 
   item.wr_adr = addr;
   item.wr_dat = data;
   start_item(item);
   randomize(if_item);
   finish_item(item);
  end
endtask
 

inplace of uvm_do_with call uder defined do_rw task like below

fp1 = fscanf("abc.txt", addr, data);
while(!eof(fp1) {
do_rw(addr, data);
}

This will work. I used above solution to work. I really don't understand why uvm is not supporting it with uvm_do_with. any answers for fit??

 

Thanks,

Satya

 


Viewing all articles
Browse latest Browse all 756

Trending Articles