Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17267 Discussions

Reading a text file in verilog

Altera_Forum
Honored Contributor II
3,810 Views

Hello friends... i am also having a problem in programming FPGA....i want to read the pixel values of an image and i created a file with "hex" values of pixel using MAT lab and now i want to read that file and use those values in my verilog program...please help me in solving this issue...i am using altera's quartus ii software and DE2 kit..... 

 

 

Regards, 

Gupta.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
2,743 Views

You can read some things about file IO in verilog here : http://larc.ee.nthu.edu.tw/~lmdenq/doc/fileio.htm 

 

You can only use for synthesis or for memory initialisation in testbenches, and maybe to initialise RAM-blocks during synthesis.  

 

Stefaan
0 Kudos
Altera_Forum
Honored Contributor II
2,743 Views

Hello...thanks for your reply...i had already seen the link that you had sent to me....but it was showing errors in quartus ii when i try to run the sample programs available in this link...is there any different syntax to run the program in quartus ii??? 

 

 

regards, 

 

Gupta.
0 Kudos
Altera_Forum
Honored Contributor II
2,743 Views

Unfortunately, you didn't tell what you exactly want to achieve. 

 

According to Quartus doc, only $readmemb and $readmemh are supported for memory initialisation. See specifying the initial contents of inferred memories in verilog hdl designs

 

Hex files can be most easily used as memory initialisation files with Ram MegaFunction.
0 Kudos
Reply