The LogiCore block ram core generator is a fast an easy way to instantiate block RAM. Using this method, one can also specify what values the RAM is initialized to.
On the fourth page of the core settings, there is a frame for Initial Contents. By inputting a hex value into the Global Init Value text box, one can set an initial value for all RAM addresses at once.
Setting Global Initial Contents:
On the same page, LogiCore also allows you to specify an initialization file for blockram created with the coregen. The required file format is .coe, which is a simple ASCII text description of the data you want in memory.
First, the radix of the data must be specified using the MEMORY_INITIALIZATION_RADIX directive. Supported values are 2, 10, and 16.
Next, a list of initialization values are provided. Each value must be unsigned, and fall in the range of 0 to 2^Data_Width-1. These values are specified in a comma seperated list terminated in a semicolon after the MEMORY_INITIALIZATION_VECTOR directive. All whitespace is ignored, so the file may be formatted for readability. Values begin filling memory at location zero, and each value after that represents the subsequent memory location. The entire available memory does not need to be specified.
After writing the COE file, return to the Initial Contents frame and check the Load Init File checkbox. Then click the Load File... button and locate the COE file. After loading the file, the Show Coefficients button may be used to ensure that the COE file was correctly read. Any erroneous values will be highlighted in red.
Loading the Initialization File:
Coefficient Preview:
The following file initializes the first 16 8-bit words in memory using hexidecimal. [ Download this file ]
MEMORY_INITIALIZATION_RADIX=16; MEMORY_INITIALIZATION_VECTOR= 0A, FF, 05, C0, 45, 35, 09, 80, A0, B7, E5, 44, E7, E8, 88, 80;