Jump to content

How to access fields within registers with the same name


Recommended Posts

The issue I have is the register model has multiple registers of different names but the fields within the registers are named the same.  The register model is generated by a tool so getting changes made will take some time and I need a work around.  I have a lot of registers so this is a big problem.

 

class reg_0 extends uvm_reg;

 

rand uvm_reg_field  x;

rand uvm_reg_field  y;

 

......

endclass

 

class reg_1 extends uvm_reg;

 

rand uvm_reg_field x;

rand uvm_reg_field y;

 

......

endclass

 

I need to be able to access the fields in my scoreboard.  The problem is the field is not associated to the register so I can't simply call peek on x without associating it with the correct register.  Is there a way to associate the register name with the field name and then call peek without hard coding the call to peek? 

 

I am using get_registers() and get_fields() to load my queues.  Is there a way to get the registers and the fields for that register instead of one or the other?  Perhaps I have missed something in the reference manual.

 

reg_fields.peek(status,reg_field_data);

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

This should work :-

 

register_model.get_registers(regs);
    foreach(regs)
      begin

        regs.get_fields(fields);
     
        foreach(fields)
        begin
            fields.peek();
            ...
        end
      end

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.

Guest
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...