19 December 2007 - 20:59Verilog Fileio tutorial
I’ve always wondered why there wasn’t a simple verilog tutorial explaining how to use fileio for use in simulation. Well, now there is.
I have some code examples for a verilog module that opens, reads and writes binary or text files. Unfortunately, Modelsim doesn’t have the ability to write to a binary file (lame!) so I wrote a simple c program to help me do the conversions to/from binary and text files.
The verilog example shows the use of: $fopen, $fwrite, $fdisplay, $fread, $fclose, $readmemh.
Verilog_Fileio_tutorial.v (Server issue prevents me from called it a .v file. My apologies in advance for this lameness. Rename the .txt to a .v at will)
If you want, you can get the entire zip file that contains all the output products of these two files. The zip file also includes a project file for Xilinx ISE 7.1 as well as a project file for Visual Studio 2005. Verilog_fileio_tutorial.zip
Enjoy.
21 Jan 2008 - 10:31
Thnx man, nice tutorial, still it phails to start on some simulators cause they in fact have no such unctions as fread or fwrite….. I gonna cry out loud….