EmbDev.net

Forum: FPGA, VHDL & Verilog help in reading a large text file using verilog.

Author: Alangs Kannan (Company: Kenit) (alangs)
Posted on:

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.....
Author: Harald Flügel (hfl)
Posted on:

The Verilog system tasks $readmemb/h are prepared to fill only a part of
the memory but not to read only a part of the file. This is different
from C. So, I would suggest that you increase the size of the memory so
that the complete file is read with one single call of $readmemh.
Afterwards you may process the data in chunks of 1000 samples out of the
memory.
Author: Alangs Kannan (Company: Kenit) (alangs)
Posted on:

Is there any method where we can read chunks of datas from a file using
verilog....
Author: Harald Flügel (hfl)
Posted on:

No.

It's quite simple to read the complete file. Why don't you do this?
Author: Alangs Kannan (Company: Kenit) (alangs)
Posted on:

i have tried but in icarus simulator the its reading upto 1980
words....after that it is giving error as below
Error: Invalid input character
Author: Harald Flügel (hfl)
Posted on:

That's surprising! Are you sure that there is no invalid character in
the file. If you delete the first n items does the error number stay the
same?
Author: Alangs Kannan (Company: Kenit) (alangs)
Posted on:

thanks a lot for ur reply......s u r right sir....i found one invalid
charachter over there now it is reading properly...

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.


webmaster@embdev.netContactAdvertising on EmbDev.net