Cadence $display and $swrite

R

Robert Au

Guest
I am using Cadence LDV 5.1 and found out the following inconsistency
between $display and $swrite.

reg [159:0] mem_file;
reg [1023:0] full_name;

$value$plusargs("MEM_FILE=%s", mem_file);
$display("This is display: %0s.%0h\n", mem_file, 1);
$swrite(full_name, "%0s.%0h", mem_file, 1);
$display("This is swrite: %0s\n", full_name);

Output will show
This is display: mem_file.1
This is swrite: mem_file.00000001

How to fix it?
 
That would be a bug in $swrite. Apparently it was not handling the '0'
in the "%0h" format properly. It works fine in the versions I tried,
so it has presumably been fixed.
 
sharp@cadence.com 寫道:

That would be a bug in $swrite. Apparently it was not handling the '0'
in the "%0h" format properly. It works fine in the versions I tried,
so it has presumably been fixed.
Which version of LDV you are using?
Any workaround for my LDV 5.1

Robert
 
oo.. sorry,
After reconfirm with my version, it is LDV 5.0
 
It appears that this fix went in to LDV 5.3. If you need the fix, you
will need this version or later.

I don't see a workaround that will give you identical results, except
with extra coding. For example, you could write the number into a
separate string variable and process that to remove the leading zeroes
before writing it as a string into the filename. If you used a numeric
expression with just the necessary bit-width for the number, rather
than a 32-bit integer value, that would eliminate the leading zeroes.
For example, in this case a numeric value of 4'h1 would work. However,
you presumably want something that will work for numeric values that
may have arbitrary variable numbers of digits.

Or if you control the other tools that operate on that (e.g. the tool
that generates it, assuming that you are creating this name to read it
into Verilog), you could modify them to use filenames with leading
zeroes.
 

Welcome to EDABoard.com

Sponsor

Back
Top