Jump to content

Recommended Posts

Hello all,

Sorry for stupid question.


I have my registers defined as, reg1, reg2, reg3.....................reg64.

Now i want to drive a single value (ZERO) to all register using for loop.


so i implemented,


for (integer i = 0; i<65; i = i+1);

des_data[0:7] = 8'h00;

block_obj.$sformatf("reg%0d",i).write(status, des_data, UVM_FRONTDOOR,.parent(this));


But i am unable to achieve so.

Any one else can suggest alternate solution or logic for the above problem ??

Link to comment
Share on other sites

You can't do this. What you're trying to do is meta-programming. The "for" and $sformat won't expand at compile time. if you want to loop over all registers in a block, you need to use the get_registers(...) method. Pseudocode:


uvm_reg  my_regs[$];

my_block.get_registers(my_regs); // now 'my_regs' will contain all of the registers


// loop over all elements in queue

foreach (my_regs)


Link to comment
Share on other sites

When i used following logic.


uvm_reg my_reg[$];





my_reg.write (status, des_data, UVM_FRONTDOOR, this);



I get following warning and error.


Warning: Register block_obj.reg1 is not contained with in map 'my_r_seq' (called from write()).

Error: No transactor available to physically access registers on map 'my_r_seq'.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...