Jump to content

register a register call back to a reg_block model


Recommended Posts

Hello All,

 

I am trying to register my call back class to the register block model for the test bench.

 

Here is my register 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 I associate this call back to the reg_block model in the test bench. I have been searching for a while and have not been able to find a clear example or answer to this.
 
I have tried using:
uvm_callbacks::add(reg_block object handle, callback object)
`uvm_register_cb(reg_block,callback)
 
Any help appreciated.
 
 
 
Link to comment
Share on other sites

  • 2 weeks later...

Hi John,

 

The uvm_reg_cbs class can only be associated with uvm_reg, uvm_reg_field, uvm_mem, or uvm_reg_backdoor objects.

From your example, I suspect that you wish to associate your callback class with a given register in a reg block, such as: 

 

aiop_register_call_back cb = new();
uvm_reg_cb::add(reg_block.get_reg_by_name("my_reg_name"), cb);

 

Regards,

Steve

Link to comment
Share on other sites

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...