hvgbl Posted August 13, 2014 Report Share Posted August 13, 2014 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 ?? Quote Link to comment Share on other sites More sharing options...
tudor.timi Posted August 13, 2014 Report Share Posted August 13, 2014 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) my_regs.write(....); Quote Link to comment Share on other sites More sharing options...
hvgbl Posted August 13, 2014 Author Report Share Posted August 13, 2014 When i used following logic. uvm_reg my_reg[$]; block_obj.get_registers(my_reg); foreach(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'. Quote Link to comment Share on other sites More sharing options...
hvgbl Posted August 13, 2014 Author Report Share Posted August 13, 2014 Done . In my write method i havnt declared him the parent. my_reg.write (status, des_data, UVM_FRONTDOOR, .parent(this)); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.