How to read all the register in RAL model using reg_map?

I have multiple register in my design for which i have created a RAL Model?

How to read all the registers in RAL model using reg_map and RAL read method ?

Please explain with example?

In reply to nayan2208:

Hi
Following code may helpful to you.

 // Declaration
 uvm_reg_map   maps[$];
 uvm_reg       regs[$];
 uvm_status_e  status;
 
 // Getting number of maps associated with block handle
 blk.get_maps(maps);
 foreach(maps[d])
 begin
     regs.delete();
     // Getting associated total registers with map
     maps[d].get_registers(regs);
     foreach(regs[k])
     begin
       regs[k].read(status, rd_val, maps[d]);
       // Do necessary operation based on read value
     end
 end

Regards,
Mitesh Patel

In reply to mitesh.patel:
Why do we use regs.delete(); ?

In reply to Bindusreddy:

We may have multiple maps and each may have multiple registers. Therefore we are starting each map iteration with an empty register queue. (to remove the register handles from previous iterations)

In reply to mitesh.patel:

Can’t use maps[j]?

regs[k].read(status, next_lsb, maps[j]);

formal and actual do not have assignment compatible data types (expecting datatype compatible with ‘enumeration uvm_pkg::uvm_path_e’ but found ‘class uvm_pkg::uvm_reg_map’ instead).