Jump to content

Type-parameterized class and callback

Recommended Posts

Hi all,


There is problem with having callbacks with type parameterized classes:


1. Callback class:

typedef class driver;

virtual class driver_cb extends uvm_callback;

virtual task drive(
    driver driver, 
    ref transaction req, 
    ref transaction rsp

function new(string name="driver_cb");


2. Class with type parameter:

class driver #(
    type transaction_t = transaction_base
) extends uvm_driver #(transaction_t);


`uvm_register_cb(driver#(transaction_t), driver_cb)

function new(string name, uvm_component parent);
    super.new(name, parent);

virtual task drive(transaction_t req, transaction_t rsp); endtask

task main_phase(uvm_phase phase);
   `uvm_do_callbacks(driver#(transaction_t), driver_cb, drive(this, req, rsp));


typedef uvm_callbacks #(driver, driver_cb) driver_cb_pool;

Compiler claims about type incompatibility and expects that type parameter should be "transaction_base" only.


Any help is welcome.



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.

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