# Backdoor acess through user defined maps

**URL:** <https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971>\
**Category:** UVM\
**Tags:** uvm\_reg\_map, UVM, DPI-backdoor-access\
**Created:** [January 24, 2018, 6:18am UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971 "2018-01-24T06:18:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![UnnikrishnanSNath](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/c68b51/32.png) [@UnnikrishnanSNath](https://verificationacademy.com/forums/u/UnnikrishnanSNath)\
**Post date:** [January 24, 2018, 6:18am UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/1 "2018-01-24T06:18:49Z")

</div>

Hi All,

Is there a way I can use register backdoor using user defined maps. Or is it like backdoor can only be done using default map. It would also be very helpful if you could comment on the uvm\_reg\_field::backdoor() static function and possible ways it can be a solution to my above problem. Thank You.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [January 24, 2018, 7:42am UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/2 "2018-01-24T07:42:20Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971):_

In the register model you are alwayys defining your individual reg\_map. Even if it is named default\_map it is the user-defined map.

---

<div class="post-metadata">

**Author:** ![cuonghle](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/cuonghle/32/3231_2.png) [@cuonghle](https://verificationacademy.com/forums/u/cuonghle)\
**Post date:** [January 24, 2018, 8:08am UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/3 "2018-01-24T08:08:13Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/2):_

> Hi All,  
> Is there a way I can use register backdoor using user defined maps. Or is it like backdoor can only be done using default map. It would also be very helpful if you could comment on the uvm\_reg\_field::backdoor() static function and possible ways it can be a solution to my above problem. Thank You.

Why do you think register backdoor access is related to register map?  
The flow that you need to do to access a register value using backdoor:

- Provide hdl\_path (size and offset as well) which is pointed to RTL register using add\_hdl\_path/add\_hdl\_path\_slice.
- Use provided functions to read/write backdoor such as peek, poke, mirror, etc.

---

<div class="post-metadata">

**Author:** ![UnnikrishnanSNath](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/c68b51/32.png) [@UnnikrishnanSNath](https://verificationacademy.com/forums/u/UnnikrishnanSNath)\
**Post date:** [January 24, 2018, 8:39am UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/4 "2018-01-24T08:39:19Z")

</div>

_In reply to [cuonghl](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/3):_

> _In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/3):_  
> Why do you think register backdoor access is related to register map?  
> The flow that you need to do to access a register value using backdoor:

- Provide hdl\_path (size and offset as well) which is pointed to RTL register using add\_hdl\_path/add\_hdl\_path\_slice.
- Use provided functions to read/write backdoor such as peek, poke, mirror, etc.

My register backdoor write test failed when I added another map in the child class of the reg\_top. The default map is added to the new map using add\_submap.

---

<div class="post-metadata">

**Author:** ![cuonghle](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/cuonghle/32/3231_2.png) [@cuonghle](https://verificationacademy.com/forums/u/cuonghle)\
**Post date:** [January 24, 2018, 8:54am UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/5 "2018-01-24T08:54:47Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/4):_

So, I think you use mirror to check, right? And you send here the detail flow and error log?

---

<div class="post-metadata">

**Author:** ![UnnikrishnanSNath](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/c68b51/32.png) [@UnnikrishnanSNath](https://verificationacademy.com/forums/u/UnnikrishnanSNath)\
**Post date:** [January 24, 2018, 8:55am UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/6 "2018-01-24T08:55:50Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/5):_

> _In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/5):_  
> In the register model you are alwayys defining your individual reg\_map. Even if it is named default\_map it is the user-defined map.

True. What I wanted was to differentiate map that is defined in the register definition and other maps to which this default map is added(in a wrapper outside the reg\_top).

---

<div class="post-metadata">

**Author:** ![UnnikrishnanSNath](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/c68b51/32.png) [@UnnikrishnanSNath](https://verificationacademy.com/forums/u/UnnikrishnanSNath)\
**Post date:** [January 24, 2018, 9:00am UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/7 "2018-01-24T09:00:44Z")

</div>

_In reply to [cuonghl](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/6):_

> _In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/6):_  
> So, I think you use mirror to check, right? And you send here the detail flow and error log?

I don’t get an error.It’s just that the value won’t be written to the hierarchy. The log “reporter [RegMem] backdoor\_write to ” is missing.

---

<div class="post-metadata">

**Author:** ![cuonghle](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/cuonghle/32/3231_2.png) [@cuonghle](https://verificationacademy.com/forums/u/cuonghle)\
**Post date:** [January 24, 2018, 9:08am UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/8 "2018-01-24T09:08:09Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/7):_

Did you add to reg correct hdl path using add\_hdl\_path\_slice/add\_hdl\_path function? Don’t add empty string to hdl\_path.

---

<div class="post-metadata">

**Author:** ![UnnikrishnanSNath](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/c68b51/32.png) [@UnnikrishnanSNath](https://verificationacademy.com/forums/u/UnnikrishnanSNath)\
**Post date:** [January 24, 2018, 9:16am UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/9 "2018-01-24T09:16:36Z")

</div>

_In reply to [cuonghl](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/8):_

> _In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/8):_  
> Did you add to reg correct hdl path using add\_hdl\_path\_slice/add\_hdl\_path function? Don’t add empty string to hdl\_path.

Yes I did…all registers have their corresponding hdl paths. I had the test passing before, only when the reg\_top was changed and maps added, this anomaly started arising.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [January 24, 2018, 12:53pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/10 "2018-01-24T12:53:56Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/9):_

> _In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/9):_  
> True. What I wanted was to differentiate map that is defined in the register definition and other maps to which this default map is added(in a wrapper outside the reg\_top).

The reg\_model defines the structure of your registers in the DUT. This register model might contain sub\_maps as required by the structure in the DUT.  
But you cannot have a reg\_map outside of your top reg\_block (register model).

---

<div class="post-metadata">

**Author:** ![UnnikrishnanSNath](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/c68b51/32.png) [@UnnikrishnanSNath](https://verificationacademy.com/forums/u/UnnikrishnanSNath)\
**Post date:** [January 24, 2018, 1:05pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/11 "2018-01-24T13:05:58Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/10):_

> _In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/10):_  
> The reg\_model defines the structure of your registers in the DUT. This register model might contain sub\_maps as required by the structure in the DUT.  
> But you cannot have a reg\_map outside of your top reg\_block (register model).

I created a class that extends from the real reg\_model and made it my new reg\_model. The other maps are defined inside the new reg\_model.

---

<div class="post-metadata">

**Author:** ![UnnikrishnanSNath](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/c68b51/32.png) [@UnnikrishnanSNath](https://verificationacademy.com/forums/u/UnnikrishnanSNath)\
**Post date:** [January 29, 2018, 2:12pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/12 "2018-01-29T14:12:17Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/11):_

Hi All,  
I found out that the failure was not due to maps, but reg.get\_full\_hdl\_path don’t return anything. While get\_hdl\_path is working fine.The definition shows a parent register file that is by default null. Is that the problem. Do share your ideas. Thanks.

---

<div class="post-metadata">

**Author:** ![cuonghle](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/cuonghle/32/3231_2.png) [@cuonghle](https://verificationacademy.com/forums/u/cuonghle)\
**Post date:** [January 29, 2018, 2:47pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/13 "2018-01-29T14:47:10Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/12):_

Could you share your source code (just simple)? I want to analyze this case.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [January 29, 2018, 3:00pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/14 "2018-01-29T15:00:59Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/13):_

get\_hdl\_path returns only the last hierarchy Level and get\_full\_hdl\_path returns the full hierarchy down to your registers. If this does not exist it doesn’t retrurn anything.  
You Can check the correct path to oyur registers with the function has\_hdl\_path.

---

<div class="post-metadata">

**Author:** ![UnnikrishnanSNath](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/c68b51/32.png) [@UnnikrishnanSNath](https://verificationacademy.com/forums/u/UnnikrishnanSNath)\
**Post date:** [January 29, 2018, 3:19pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/15 "2018-01-29T15:19:28Z")

</div>

In reply to [cuonghl](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/14):[/i]

```verilog

class reg1 extends uvm_reg;
  this.field1.configure.add_hdl_path_slice("abc");
  //...;
endclass

class reg_block extends uvm_reg_block;
  reg1.add_hdl_path("xyz");
  //...;
endclass

class top_regmodel extends reg_block;
  uvm_regmap spi_map;
  //.....;
ensclass

class env extends uvm_env;
  top_regmodel.set_hdl_path_root("pqr");
  //....;
endclass

class cb extends uvm_reg_cb;
  virtual task pre_write(uvm_reg_item rw);
    top_regmodel.reg_block.reg1.write(status,value,UVM_BACKDOOR); //write does not happen
  endtask
endclass

```

---

<div class="post-metadata">

**Author:** ![UnnikrishnanSNath](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/c68b51/32.png) [@UnnikrishnanSNath](https://verificationacademy.com/forums/u/UnnikrishnanSNath)\
**Post date:** [January 29, 2018, 3:44pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/16 "2018-01-29T15:44:46Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/15):_  
has\_hdl\_path is 1. But write is not happening.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [January 29, 2018, 3:53pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/17 "2018-01-29T15:53:52Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/16):_

Looks a Little bits complicated. The reg\_model needs the information about the hdl\_path\_slice this has to be defined for each register. And you have to define the the hdl\_path. This looks like this:

```verilog
class my_reg_block extends uvm_reg_block;
      `uvm_object_utils(my_reg_block)
.....
     rand my_reg0 reg0;
     rand my_reg1 reg1;
.....
     
     function new(string name = "my_reg_block");
         super.new(name, UVM_NO_COVERAGE);
     endfunction
 
     virtual function void build();
         reg0 = my_reg0::type_id::create("reg0");
         reg0.configure(this);
         reg0.build();
	 reg0.add_hdl_path_slice("mode_reg[0]", 0, 8);
..........
       // the same for all other registers
..........
         // Assign dut to the hdl path
         add_hdl_path(<name of the toplevel mod>.dut", "RTL"); // dut is the RTL. The regs are on the toplevel of the dut.
         lock_model();
      endfunction

```

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [January 29, 2018, 3:59pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/18 "2018-01-29T15:59:06Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/17):_

> _In reply to [chr\_sue](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/17):_  
> has\_hdl\_path is 1. But write is not happening.

This says you have defined a hdl\_path, but it doesn’t say it’s correct.  
backdoor access has specified commands for Read and write. I’d recommend to use this to be sure you are working backdoor.

The backdoor write is poke and the backdoor read is peek.

You can also use uvm\_hdl\_check\_path to check if the hdl\_path is existing.

---

<div class="post-metadata">

**Author:** ![UnnikrishnanSNath](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/c68b51/32.png) [@UnnikrishnanSNath](https://verificationacademy.com/forums/u/UnnikrishnanSNath)\
**Post date:** [January 29, 2018, 4:08pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/19 "2018-01-29T16:08:45Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/18):_  
Yeah I have implemented similarly. And about the hdl\_path being correct, shouldn’t the program give an error if it is not correct, like “hdl\_path not found”. And for the record the write to all registers works like a charm when the top\_regmodel is swapped with reg\_block in set\_hdl\_path\_root.i.e

```verilog

class reg1 extends uvm_reg;
  this.field1.configure.add_hdl_path_slice("abc");
  //...;
endclass
 
class reg_block extends uvm_reg_block;
  reg1.add_hdl_path("xyz");
  //...;
endclass
 
//class top_regmodel extends reg_block;
// uvm_regmap spi_map;
// //.....;
//ensclass
 
class env extends uvm_env;
  reg_block.set_hdl_path_root("pqr");
  //....;
endclass
 
class cb extends uvm_reg_cb;
  virtual task pre_write(uvm_reg_item rw);
    reg_block.reg1.write(status,value,UVM_BACKDOOR); //write does not happen
  endtask
endclass

```

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [January 29, 2018, 4:19pm UTC](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/20 "2018-01-29T16:19:12Z")

</div>

_In reply to [usnath](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971/19):_

If the hdl\_path is incorrect it does not return an error. Simply it does not work. In all my projetcs I had to spend certain effort on defining the correct hdl\_path.  
I found uvm\_hdl\_check\_path is a good means to double-check the correct hdl\_path.

[Next page](https://verificationacademy.com/forums/t/backdoor-acess-through-user-defined-maps/33971.md?page=2)
