Jump to content

Backdoor read\write to a register


Recommended Posts

Hi,
Please help with an issue about backdoor read\write to a register. Is it going to be fixed?

 

When doing backdoor write\read to a register – the code (uvm_reg) uses the default map instead of the map the user gave in the write\read register operation:

A. do_write gets rw with the correct map that the user wanted – rw.map.

B. When doing backdoor write (1 below) , XpredictX (3 below) is called with rw.local_map (=null).
get_access with null map is actually default map.

C. Even If XpredictX was called with rw.map – it should make many warnings no matter what is the default map\which map we gave the write. This is because in the do_write, Xcheck_accessX (2 below) is changing rw.map to “Backdoor” – empty map which doesn’t contain any regs.


-------------------------------------------------------------------------------------------------------------------------
1.
task uvm_reg::do_write (uvm_reg_item rw); -> with the user specified map - rw.map
   …
   if (!Xcheck_accessX(rw,map_info,"write()")) (see Xcheck_accessX below )
     return;
    …
   // EXECUTE WRITE...
   case (rw.path)
      
      // ...VIA USER BACKDOOR
      UVM_BACKDOOR: begin
..
         begin
            foreach (m_fields) begin
               uvm_reg_data_t field_val;
               int lsb = m_fields.get_lsb_pos();
               int sz = m_fields.get_n_bits();
               field_val = m_fields.XpredictX((rw.value[0] >> lsb) & ((1<<sz)-1),
                                                 (value >> lsb) & ((1<<sz)-1),
                                                 rw.local_map); -> local map is null – see XpredictX below
 ….
endtask: do_write
------------------------------------------------------------------------------------------------------------------------------------
2.
function bit uvm_reg::Xcheck_accessX (input uvm_reg_item rw, ->with the user specified map
                                      output uvm_reg_map_info map_info,
                                      input string caller);
  …
   if (rw.path == UVM_BACKDOOR) begin
      if (get_backdoor() == null && !has_hdl_path()) begin
         `uvm_warning("RegModel",
            {"No backdoor access available for register '",get_full_name(),
            "' . Using frontdoor instead."})
         rw.path = UVM_FRONTDOOR;
      end
      else
        rw.map = uvm_reg_map::backdoor(); -> rw map is changed to “Backdoor”, local map is not calculated (for FRONTDOOR it is – below)
   end

  if (rw.path != UVM_BACKDOOR) begin
rw.local_map = get_local_map(rw.map,caller);
  …
   return 1;
endfunction
-------------------------------------------------------------------------------------------------------------
3.
function uvm_reg_data_t uvm_reg_field::XpredictX (uvm_reg_data_t cur_val,
                                                  uvm_reg_data_t wr_val,
                                                  uvm_reg_map map); -> map is null
   uvm_reg_data_t mask = ('b1 << m_size)-1;

   case (get_access(map)) -> get access is performed with null map = get access is performed without giving a map and it is using the default map instead of the map that the user specified in the write operation
     "RO": return cur_val;
     "RW": return wr_val;

-------------------------------------------------------------------------------------------------------------
 

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...