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

help in reading a large text file using verilog....

Altera_Forum
Honored Contributor II
1,088 Views

I am having a large text file which contains only the pixel values of an image.....here i can able to read the pixels using $readmemh system task..... but the prolem is memory......am using only 1000 words of memory as below  

reg [31:0] Mem [0:999];  

initial $readmemh("pixels.txt",Mem);  

By this i can get only 1000 pixles from the text file and i will give these pixels to the next module for furthur processing....then i have to read the next 1000 pixels from the text file and put it in the Mem....similarly i want all the pixels to be readed from the txt file with the Mem size as 1000 and give those to the next module for furthur processing......so how i can do this plz i will be very thank full to u...plz help me.....
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
396 Views

Typically in image processing you use "stream oriented" processing and not "buffer oriented" processing. 

 

You seam to think in terms of buffers, one buffer is 100 pixels, you process it and then move on to the next buffer. It is a nice approach for typical processors, but not for FPGAs. 

 

In FPGAs you can do many operations in parallel, and therefore it is better to think in streams, one stream is a sequence of pixels. you fetch a pixel, process it, and store it back all at the same time in the FPGA (aka pipelining). 

 

So back to you question, how do you read large images ? Read it pixel by pixel. After all The simulation can be slow, the hardware will be fast anyways. 

 

Try reading on "Avalon streaming interfaces", you will get my point.
0 Kudos
Reply