we are going through a process of replacing each $display in the code base to `uvm_info for various reasons.
my problem is, that $display can format it’s arguments without using format specifiers like %s %d %f…
how can it be done to replace $display with `uvm_info without using format specifiers. example:
$display("some random string : ", some_array, some_string, some_complex_struct)
You can use $swrite to format your message into a string variable and the pass that variable to `uvm_info.
Note that the macro `uvm_info() macro is just a wrapper around uvm_report_info() that is supposed to prevent some overhead in formatting messages are not usually printed
`define uvm_info(ID, MSG, VERBOSITY) \
begin \
if (uvm_report_enabled(VERBOSITY,UVM_INFO,ID)) \
uvm_report_info (ID, MSG, VERBOSITY, `uvm_file, `uvm_line, "", 1); \
end
You can replace that macro with a version of your own.
`define display_info(ID, sMSG, VERBOSITY) \
begin \
if (uvm_report_enabled(VERBOSITY,UVM_INFO,ID)) begin \
string msg; \
MSG ; \
uvm_report_info (ID, sMSG, VERBOSITY, `uvm_file, `uvm_line, "", 1); \
end \
end
`display_info("MyID", $swrite(msg,"some random string : ", some_array, some_string, some_complex_struct), UVM_LOW)