init of FPGA's Block-RAMs.

Mar 16, 2007 2 Replies

Bonjour,



My name is Julien Lochen, I work as FPGA Design Engineer in France.



My question is about the init of FPGA's RAMs.



In my design, some data are stored in a block-RAM.



I need to init each byte stored in the block-RAM, but THE INIT VALUE ARE NOT THE SAME.



To do this, I use the constraint file, in which I use the following keyword :



"INIT_00 = 256'h ... INIT_01 = 256'h ... ... INIT_3F = 256'h ..."



The block-RAM is mapped as follow : 256 lines of 1 byte.



The question is :



If I want to init only the five first addresses to "1", and the rest of the block-RAM to zero, am I correct if I write : "INIT_00 =



256'h0000000000000000000000000000000000000000000000000000FFFFFFFFFFFF; INIT_01 =
256'h0000000000000000000000000000000000000000000000000000000000000000; ... INIT_3F =
256'h0000000000000000000000000000000000000000000000000000000000000000;"

regards, Julien



It looks like you have what you need if you ignore the fact that there are

12 F digits in your string rather than five 1s or five FFs.

The question is where do you want to apply the INITs? The INITs work fine in the .ucf file. If you want them in your source code, you have to instantiate the BlockRAM primitive. Is that what you've done? In Verilog, I prefer to use the inline parameters rather than synthesis attributes or defparam values. One of these three methods will need to be used to attach the INITs properly to the instantiated BlockRAM. Which do you prefer?

If you're inferring your memory, look to your synthesizer's reference for initialization. An initial block will work for some synthesizers and Barry Brown pointed out how Synplify likes to handle file-based memory initialization for Verilog.

- John_H

The "first five addresses" are different for different BRAM data width setting, so it is hard to say whether your values in UCF is correct or not without knowing the bus width.

Cheers, Jim

formatting link

Join the Discussion

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

Didn't find your answer?

Ask the community — no account required