Why is the output different for both of these prints? I could roughly give a guess for what could be happening with the sformatf - (might be printing integer values of the string it generated) it would be better if someone could give a concrete explanation for me.
Also, simulator throws something like below. Am I missing some point for the sformatf ??
Warning-[STASKW_SFRTMATR] More arguments than required
testbench.sv, 12
Number of arguments (9) passed to place in the format string are more than
the number of format specifiers (1).
module tb;
initial begin
string sfrmt, psprnt;
psprnt = $psprintf("%0s\n", "",
"row : %08x\n", 5,
"col : %08x\n", 6,
"addr : %08x\n", 7,
"cmd : %0s\n", "cmd");
$display(psprnt);
//output
//row : 00000005
//col : 00000006
//addr : 00000007
//cmd : cmd
sfrmt = $sformatf("%0s\n", "",
"row : %08x\n", 5,
"col : %08x\n", 6,
"addr : %08x\n", 7,
"cmd : %0s\n", "cmd");
$display(sfrmt);
//output - random big numbers
//2321025888408877083000271174924298 52016786340018993991845306433042442
//61975347634275872380922925474674698 7 7877442999272995673474881057546 6516068
end
endmodule