Memory Initialization Files
By default, The BRAM Wrapper core initialized memory value are all zeros. You can initialize memory with your own values by enabling the Initialize BRAM Memory File setting and providing the memory initialization file (in .mem format).
The memory initialization file has the following requirements:
- Data created in the memory file must be equal or less than the configured data width. Extra bits are ignored.
- Data separated by Return/Enter key are treated as value for the subsequent address.
- Values after a double slash (
//) within the same line are ignored so that you can label each data according to respective address to avoid confusion.
| Data | Address |
|---|---|
| 859 | 0 |
| C7A | 1 |
| 3DD | 2 |
| B91 | 3 |
| FAB | 4 |
| 415 | 5 |
| 6E3 | 6 |
| B26 | 7 |
//data separated by <Return/Enter> key
//you can comment or label your data using double slash
//the next line is always next address unless the entire line is commented out
859 //address 0
C7A //address 1
3DD
B91
415
6E3
B26
The following figure illustrates how the block RAM are updated.
The BRAM 0 and BRAM 1 in the bram_ini.vh file are updated as below:
function [255:0] bram_ini_table;
input integer index;//Mode type
input integer val_; //Port A index, Port B Index, Number of Items in Loop, Port A Start, Port B Start, reserved
case (index)
0: bram_ini_table=
(val_== 0)?256'h00000000000000000000000000026000e300015000ab00091000dd0007a00059:
(val_== 1)?256'h0000000000000000000000000000000000000000000000000000000000000000:
(val_== 2)?256'h0000000000000000000000000000000000000000000000000000000000000000:
...
(val_== 39)?256'h0000000000000000000000000000000000000000000000000000000000000000:
0;
1: bram_ini_table=
(val_== 0)?256'h0000000000000000000000000000b00006000040000f0000b000030000c00008:
(val_== 1)?256'h0000000000000000000000000000000000000000000000000000000000000000:
(val_== 2)?256'h0000000000000000000000000000000000000000000000000000000000000000:
...
(val_== 39)?256'h0000000000000000000000000000000000000000000000000000000000000000:
0;
endcase
endfunction