Jump to content

sc_report_info


c4brian

Recommended Posts

I use SystemC models in a UVM environment, and am recently updating the reporting for the SysC model from cout -> SC_REPORT_INFO(MSGID,str);

 

Simple question: how do I use this to return a value along with a message?  Example, SC_REPORT_INFO(MSGID,fcn("The value is=%0d", myint));

 

 

Link to comment
Share on other sites

The SC_REPORT_* macros take a C string as argument. To format the message and include runtime values in it, you will have to prepare this C string before passing it to SC_REPORT_*. Relying only on Standard C++, the string stream is a convenient and flexible way to do so:

#include <sstream>
...
int myint = 10;
...
{
  std::ostringstream ostr;
  ostr << "The value is " << myint;
  SC_REPORT_INFO(MSGID, ostr.str().c_str());
}
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...