Printing the name of a reg

Hello Everyone,

I am trying to get the access type of a reg and from the reference manual I can use get_access() to get the access type of field.
I was wondering how to get the name of the register from the field’s name.

I am currently something like.

fields[$] → will have list of fields

field.get_parent()–> this returns a uvm component but I am not sure how to print the name of the register.
Can someone please shed some light on this.

Thanks
Subramaniam

In reply to ssubramaniam:

Hello Everyone,
I am trying to get the access type of a reg and from the reference manual I can use get_access() to get the access type of field.
I was wondering how to get the name of the register from the field’s name.
I am currently something like.
fields[$] → will have list of fields
field.get_parent()–> this returns a uvm component but I am not sure how to print the name of the register.
Can someone please shed some light on this.
Thanks
Subramaniam

You have a wrong concept since get_parent() returns a uvm_reg handle, not a UVM component, you could do
string name;
name = field[i].get_parent().get_name();

Or

uvm_reg rg;
rg = field[i].get_parent();
name = rg.get_name();

HTH

-R