Jump to content
Sign in to follow this  
kkarvas

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);

 

 

 

 

 

 

 

 

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×