Creating Binary Files In Simulator

Guest
Hello,
Is there a way in Verilog to create a real binary files (not ASCII
binary representation) while simulating?

Thank you
 
On Nov 20, 6:27 am, japon...@gmail.com wrote:
Hello,
Is there a way in Verilog to create a real binary files (not ASCII
binary representation) while simulating?

Thank you
A Google search turned up a wealth of data. You really should learn
how to use Google for more than free email.

Bottom line: if $fwrite(%u,xxx) doesn't work with your simulator,
write your own PLI.

G.
 
On Nov 20, 9:27 am, japon...@gmail.com wrote:
Hello,
Is there a way in Verilog to create a real binary files (not ASCII
binary representation) while simulating?
The %u format can be used to write raw values out. However, the
output will always be a multiple of 32 bits. Smaller values will be
padded up to 32 bits. If you need to write a byte at a time, you may
be able to use %c. However, some simulators will fail to write out
bytes with a value of 0, because they buffer the output in a C string,
and the 0 byte gets treated as a string terminator. You may also need
to open up the output file explicitly in binary mode if you are on a
PC, to prevent bytes that are newline characters from being converted
into a carriage-return/newline pair on output.
 
On 22 נובמבר, 00:56, sh...@cadence.com wrote:
On Nov 20, 9:27 am, japon...@gmail.com wrote:

Hello,
Is there a way in Verilog to create a real binary files (not ASCII
binary representation) while simulating?

The %u format can be used to write raw values out.  However, the
output will always be a multiple of 32 bits.  Smaller values will be
padded up to 32 bits.  If you need to write a byte at a time, you may
be able to use %c.  However, some simulators will fail to write out
bytes with a value of 0, because they buffer the output in a C string,
and the 0 byte gets treated as a string terminator.  You may also need
to open up the output file explicitly in binary mode if you are on a
PC, to prevent bytes that are newline characters from being converted
into a carriage-return/newline pair on output.
Thanks,
It helped.
 

Welcome to EDABoard.com

Sponsor

Back
Top