Your question starts off asking how suppress printing to the terminal. But your background to your question suggest you want the option to separately control the format to both.
Terminal/stdout suppression:
Your simulators might have a built in in command line option; ex -noprint
, -nostdout
, or -quiet
. Check the manual for your specific simulator.
For Linux based simulation you can always pipe the standard output to /dev/null
If using UVM:
Use the plusarg +uvm_set_action=*,_ALL_,UVM_INFO,UVM_LOG +uvm_set_action=*,_ALL_,UVM_WARNING,UVM_LOG
so info and warning messages will only go to a log file; error and fatal will still go to standard out and log.
To get all UVM messages to go only to the logs files you could add something like the following to the top of your base test's build_phase:
set_report_severity_action_hier(UVM_INFO, UVM_LOG);
set_report_severity_action_hier(UVM_WARNING, UVM_LOG);
set_report_severity_action_hier(UVM_ERROR, UVM_LOG | UVM_COUNT);
set_report_severity_action_hier(UVM_FATAL, UVM_LOG | UVM_EXIT);
Both allow ways to mix and match with controls on component, ID, and severity.
Reference guild for UVM messaging:
http://www.sunburst-design.com/papers/CummingsSNUG2014AUS_UVM_Messages.pdf
Fine tone control:
If you really need to terminal and log output to differ (ex color formatting, making log in XML format, etc.), then you will need to avoid using $display
and instead use your own VPI or DPI functions. To the best of my knowledge, you cannot override the $display
system function.
As stated in your background statement, you can write terminal using a regular printf
from C code. To write exclusivly to the log file, you can use $fdisplay
/$fwrite
or your own VPI/DPI code to target output file. Probably cannot be the default log file.
Your simulator might have a command to disable writing to the default log file if file management is an issue.
UVM Expert!!!
You need create your own report_server (extended form uvm_report_server
) and override the execute_report_message
and compose_report_message
. This might require you to write your own VPI or DPI functions.
uvm_report_server XML example: http://www.verilab.com/files/SNUG_Applications_of_custom_UVM_report_servers.pdf