# Register callback to uvm\_reg\_block model

**URL:** <https://verificationacademy.com/forums/t/register-callback-to-uvm-reg-block-model/29251>\
**Category:** UVM\
**Tags:** UVM, uvm\_reg\_cbs, UVM-callback, uvm\_reg\_block\
**Created:** [March 13, 2014, 3:18pm UTC](https://verificationacademy.com/forums/t/register-callback-to-uvm-reg-block-model/29251 "2014-03-13T15:18:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JonMac](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@JonMac](https://verificationacademy.com/forums/u/JonMac)\
**Post date:** [March 13, 2014, 3:18pm UTC](https://verificationacademy.com/forums/t/register-callback-to-uvm-reg-block-model/29251/1 "2014-03-13T15:18:34Z")

</div>

Hello all,

I am trying to implement a register call back class to call the post\_write hook from the uvm\_reg\_cbs class.

Here is my call back class  
class aiop\_register\_call\_back extends uvm\_reg\_cbs;

`uvm\_object\_utils(aiop\_register\_call\_back);

// Set the Function Name  
function new(string name = “aiop\_register\_call\_back”);  
super.new(name);  
//this.set\_response\_queue\_error\_report\_disabled(1’b1);  
endfunction

uvm\_elem\_kind\_e element\_kind;  
uvm\_object element;  
uvm\_access\_e kind;  
uvm\_reg\_data\_t value;  
uvm\_reg\_addr\_t offset;  
uvm\_status\_e status;  
uvm\_path\_e path;  
uvm\_sequence\_base parent;

virtual task post\_write(uvm\_reg\_item rw);  
element\_kind = rw.element\_kind;  
element = rw.element;  
value = rw.value;  
offset = rw.offset;  
status = rw.status;  
path = rw.path;  
parent = rw.parent;  
`uvm\_info(“AIOP REGISTER CALL BACK”, $sformatf(“%0s,%0s,%0h,%0h,%0s,%0s,%0s”,element\_kind,element,value,offset,status,path,parent), UVM\_NONE);  
endtask

endclass : aiop\_register\_call\_back

My Question is how would you register this to the uvm\_reg\_block register model. It seems that you can only register individual registers because when I try using uvm\_callbacks::add(T obj, callback obj) where the type object for registering the call back is the reg\_map extension of the uvm\_reg\_block class, it says I cant add this type to this call back because it is not registered.

So do I have to register the register call back all the way through the higherarchy of the reg\_block register model.

so Something like.

`uvm_register_cb(uvm_reg_block,uvm_reg_cbs) `uvm\_register\_cb(reg\_model,callback)  
uvm\_callbacks::add(reg\_block obj,callback obj)

Any help is appreciated.

Best,  
Jon
