UVM Tutorial for Candy Lovers – 17. Register Read Demystified

Last Updated: December 28, 2013

In the last post, Register Access Methods, we looked at the primary methods of RAL and showed how they worked. This post will further focus on the read() method and show how the method actually reads and returns the value of a register. In particular, we will explain the steps #1 to #5 of the read() method we have seen in the last post in more detail.

The following sequence diagram shows the steps involved in the read() method. We assumed that the user called the method like this:

uvm_status_e status;
uvm_reg_data_t value;
jb_reg_block.jb_taste_reg.read( status, value );
ral
How the read() method reads and returns the value of a register
The number in the angle bracket below corresponds to the number in the figure.

  • [1] The user calls the read() method.
  • [3] The read() method calls the XreadX() method of the uvm_reg class. The XreadX() method creates a uvm_reg_item object corresponding to the read.
  • [4] The XreadX() method calls the do_read() method of the uvm_reg class.
  • [6] and [7] The do_read() method retrieves the “path” and the register map (local_map) of the register. We assume that we use the FRONTDOOR path.
  • [8] The do_read() method calls the do_read() method of the uvm_reg_map class, which creates a parent sequence. The parent sequence will be used to start a bus request in the later step.
  • [9] The do_read() method calls the do_bus_read() method of the uvm_reg_map class. The do_bus_read() method creates a uvm_reg_bus_op that corresponds to the read.
  • [10] and [11] The do_bus_read() method calls the reg2bus() method of the uvm_reg_adapter class that is associated with the register map to obtain the corresponding bus request.
  • [12] The do_bus_read() method assigns the sequencer that the bus request will be processed on to the bus request. We assume that the sequencer was associated with the register map.
  • [13] The do_bus_read() method starts the parent sequence using the above sequencer.
  • [14] The do_bus_read() method waits for the sequence to finish.
  • [15] to [18] If the provides_responses property of the register adapter was set to be true, a separate bus response is retrieved by calling the get_base_response(). The response is converted to a uvm_reg_bus_op (shown as rw_access).
  • [19] and [20] If the provides_responses property of the register adapter was set to be false, the bus request, which also contains the bus response, is converted to a uvm_reg_bus_op (shown as rw_access).
  • [21] to [24] The status and the value of the rw_access is returned to the caller.

I hope this post helped to understand how the read() method works under the hood.

Leave a Reply

Your email address will not be published. Required fields are marked *