Jump to content
Sign in to follow this  

Using uvm callbacks

Recommended Posts

I am not sure if I understand the UVM callbacks correctly. What I intend to do is when Golden reference model FSM is finished, generate a callback by calling do_callback. So that my virtual sequencer can decide when to kill the sequences running on individual sequencers. Also if required same callback can be used to inform Scoreboard to do final comparison or generate reports.

I am not sure if we can register multiple component with same callback.

So far I have created

1. Created model_callback class extending from uvm_callback having pure virtual functions. Something like Class model_callback extends uvm_callback;

2. Register this in reference model and call function uvm_do_callback where necessary. `uvm_register_cb(model,model_callback); Also somewhere in the model I did `uvm_do_callbacks(model,model_callback, function_name());

3. Then I create a class that extends from model_callback.. class custom_callback extends model_callback

4. Wrote implementation of function call here in this class. Funtion that was defined as pure virtual function in model_callback class.

5. In the TOP I created the instance of custom_callback and did uvm_callback #(model,model_callback)::add(model,custom_callback_inst);

Now when I run the simulation; Model initiate the callback and I see the function is executed in custom_callback class, which is intended. How can I use the same callback inside other components like scoreboard or virtual sequencers. Or

How can i make my sequencer or scoreboard make use of this callback? Can i register or add my scoreboard function to be called automatically when model initiate the callback.

Thanks in advance!

Share this post

Link to post
Share on other sites

If you are just passing information one-way, from the model to the scoreboard, etc. An analysis port may be the more logical choice.

Callbacks are generally more useful if the registered listeners are needed to modify the data.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this