Simplifying hierarchy in UVM

Hi,

We have following code. Multiple users.
We need to do the repetition for every user and it’s pretty big.
Is there any easier way to achieve this ? eval string or somehow write smaller code instead of such a big loop.
Any inputs are appreciated.

end else if (usr_itr==2) begin
m_reg_block_h.WFAX_ROBE_default.usr_tab_0_l_b2.write(.status(status),.value(usr_wdata[usr_itr][0]), .parent(this));
m_reg_block_h.WFAX_ROBE_default.usr_tab_0_u_b2.write(.status(status),.value(usr_wdata[usr_itr][1]), .parent(this));
);
end else if (usr_itr==3) begin
m_reg_block_h.WFAX_ROBE_default.usr_tab_0_l_b3.write(.status(status),.value(usr_wdata[usr_itr][0]), .parent(this));
m_reg_block_h.WFAX_ROBE_default.usr_tab_0_u_b3.write(.status(status),.value(usr_wdata[usr_itr][1]), .parent(this));

Thanks,
Bhavik

*In reply to bvyas:*Can you explain what usr_tab_0_l_b2 and usr_tab_0_l_b3 are? If these are class variables, why are they not an array?

In reply to dave_59:

Hi Dave,

They are the names of registers, each containing 32 bits.
I am not sure if there is anyway.

Thanks,
Bhavik

In reply to bvyas:

Are they class types, or modules?

In reply to bvyas:

Hi,

I think you are trying to write a regiter in a reg block. what you can do is you can form the register name using psprintf and write using “write_reg_by_name” task

string reg_name;

reg_name = $psprintf(“usr_tab_0_l_b%0d”,usr_itr).

In reply to saravanantvs:

Thanks Dave and saravanantvs.
Dave, they are class types.

Thanks.