Jump to content

`uvm_info_context - why use it?

Recommended Posts

In addition to the `uvm_info / `uvm_fatal / uvm_error, etc. macros, there are "context" versions: `uvm_info_context / `uvm_fatal_context, etc. The documentation is not exceptionally useful for the latter.


Why would one use the "context" versions of the macros?


Regards - Cliff Cummings

Link to comment
Share on other sites



the *_context variant of the macros can be used when you want the message to appear as if emitted by another object. a common use model would be if all your components use a common helper class which emits a message then typically you want instead of your common helper class appearing in the message the parent component to be printed. 


the _context macros are just



`define uvm_*_context(ID, MSG, CNTXT) \
   begin \
     if (CNTXT.uvm_report_enabled(...)) \
       CNTXT.uvm_report_* (...); \



Link to comment
Share on other sites

Hi Cliff,

  one use is if you're trying to debug a sequence. If you use `uvm_info you'll get the complete path to the sequencer in the reports, which is pretty unwieldy. If you use `uvm_info_context and specify the context as uvm_top, you get nice short messages.


The __FILE__ and __LINE__ still works, as the information is supplied as part of the `uvm_info_context call to the report code. Here's the source



`define uvm_info_context(ID, MSG, VERBOSITY, CNTXT) \
   begin \
     if (CNTXT.uvm_report_enabled(VERBOSITY,UVM_INFO,ID)) \
       CNTXT.uvm_report_info (ID, MSG, VERBOSITY, `uvm_file, `uvm_line); \



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