Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17263 Discussions

Reading a text file in verilog

Altera_Forum
Honored Contributor II
3,801 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,734 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,734 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,734 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