intialize memory in fpga

Aug 29, 2007 3 Replies

I'd like to set up block rams(16k) to acts as a ROM lookup table after initialization. After establishing the Memory Area as an FPGA resource there's an option to initialize it by using memory eritor. However, this would be very time consuming, as my memory is 16Kwords deep. Is there some way to just reference an external text file, or excel sheet at least automatically read/paste an external file for this purpose?



and also How to combine both block memory and distributed memory (using lut) to use as one memrory of 16k?



Hi, Google 'data2mem' . Or, look up the BlockRAM in the libraries guide and learn how to initialise it in your HDL. HTH., Syms.

Taking a guess, sounds like you are programming for a Xilinx device. If so, you can use Xilinx's ISE's coregen (Core Generator) to create a

16KW Block Ram. Go under Memories -> RAM & ROM -> Block Memory Generator. Through the wizard there will be a option to initialize the memory using the values from a text file.

If you are using Verilog and XST for synthesis, you can use $readmemh or $readmemb to intialize the memory from a file at compile time.

HOWEVER... I currently have a WebCase pending with Xilinx. XST occassionally crashes when I do this with the dreaded Portability error message. Very helpful.

So - use this with caution, XST may cause you grief.

One workaround I've used (yuck) is to add a second port to the memory (write port) and tie its write enable and address to 0.

Good luck,

John Providenza

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required