getvictor Posted January 2, 2014 Report Share Posted January 2, 2014 What is the recommended way to call UVM report functions and macros from a static method in a uvm_component? Having the following code: static function static_check(); `uvm_error("ID", "Something failed"); endfunction causes a compile error: ** Error: testbench.sv(15): (vlog-2888) Illegal to access non-static method 'uvm_report_enabled' from a static method. Full example can be edited and run here: http://www.edaplayground.com/s/4/762 Quote Link to comment Share on other sites More sharing options...
l00169990 Posted January 6, 2014 Report Share Posted January 6, 2014 uvm_report_enabled in the macro is not static! Quote Link to comment Share on other sites More sharing options...
uwes Posted January 7, 2014 Report Share Posted January 7, 2014 hi, in static contexts you have to use the macro set with the postfix "_context". while the normal macros will invoke <this>.uvm_report_xyz() and therefore require a non static context the _context macros will invoke <context>.uvm_report_xyz(). messages emitted with the _context version can be used in static contexts and provide the same functionality as-if the non-context version would have been invoked in context. (an alternate use model for the _context macro version is to emit a message from a different place than what appears as the messages context. eg. you can print from within the driver BUT the context is showing as if the message was emitted by the agent) /uwe getvictor 1 Quote Link to comment Share on other sites More sharing options...
getvictor Posted January 7, 2014 Author Report Share Posted January 7, 2014 uwe, I tried `uvm_error_context and it works: http://www.edaplayground.com/s/4/839 `uvm_error_context("ID", "Something failed", uvm_root::get()); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.