Forum Discussion
Altera_Forum
Honored Contributor
9 years agoConclusion:
initializing a 2 d array using a .mif file works for a 2d array:Example:
// char mem
/*(* ram_init_file = "DE0_CV_SCREENCHAR.mif" *)*/ reg charMem;
// color mem
(* ram_init_file = "DE0_CV_SCREENCOL.mif" *) reg colMem;
// color mem
(* ram_init_file = "DE0_CV_SCREENPAL.mif" *) reg palMem I added the .mif files for these initializations. initializing a 1 d array also works. // helper variabeles to read .txt file: reg [7:0] charMemTmp[2000]; reg [7:0] colMemTmp[2000]; reg [3:0] palMemTmp[48];
//--------------------------------------------------------
// initialize char memory (this statement will be synthetisised):
initial
begin
$readmemh("DE0_CV_SCREENCHAR.txt",charMemTmp);
$readmemh("DE0_CV_SCREENCOL.txt" ,colMemTmp);
$readmemh("DE0_CV_SCREENPAL.txt" ,palMemTmp);
end In the zip file, all .mif and .txt are included. And also a .XLS with macro's to generate these files. Best Regards, Johi.