R
Russell Fredrickson
Guest
Hi all,
A common syntax I use with $display is the following:
$display("%t INFO: ", $time,
"A write to address 0x%h ", address,
"of data 0x%h occurred." data);
However, if instead of sending it to the display, I want to write it to
a string reg variable, the following (very similar) construct does NOT work
(using NCVerilog 5.1):
reg [320*8:1] TmpStr;
...
$sformat(TmpStr, "%t INFO: ", $time,
"A write to address 0x%h ", address,
"of data 0x%h occurred." data);
I get a run-time error message saying too many arguments for the format
specifiers. Recoding it like this:
$sformat(TmpStr, "%t INFO: A write to address 0x%h of data 0x%h occurred."
$time, address, data);
works -- but I really don't like this style since many times I have long
and descriptive info, error or warning message and I like keeping my lines
to 80 characters or less (even if I didn't care about line width -- the
format specification supported by $display is much more user-friendly).
So is $sformat specified in the LRM like this -- or is this a restriction of
the Cadence simulator? If the behavior is correct according to the LRM --
what bozo didn't keep the same syntax rules for $sformat as $display? I
suppose I <could> write my own PLI routine that did the right thing -- but
never having done that -- it seems like it would be a lot more pain than I'm
willing to go through.
Thanks,
Russell
A common syntax I use with $display is the following:
$display("%t INFO: ", $time,
"A write to address 0x%h ", address,
"of data 0x%h occurred." data);
However, if instead of sending it to the display, I want to write it to
a string reg variable, the following (very similar) construct does NOT work
(using NCVerilog 5.1):
reg [320*8:1] TmpStr;
...
$sformat(TmpStr, "%t INFO: ", $time,
"A write to address 0x%h ", address,
"of data 0x%h occurred." data);
I get a run-time error message saying too many arguments for the format
specifiers. Recoding it like this:
$sformat(TmpStr, "%t INFO: A write to address 0x%h of data 0x%h occurred."
$time, address, data);
works -- but I really don't like this style since many times I have long
and descriptive info, error or warning message and I like keeping my lines
to 80 characters or less (even if I didn't care about line width -- the
format specification supported by $display is much more user-friendly).
So is $sformat specified in the LRM like this -- or is this a restriction of
the Cadence simulator? If the behavior is correct according to the LRM --
what bozo didn't keep the same syntax rules for $sformat as $display? I
suppose I <could> write my own PLI routine that did the right thing -- but
never having done that -- it seems like it would be a lot more pain than I'm
willing to go through.
Thanks,
Russell