Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21335 Discussions

Initialization of multidimensional arrays

Altera_Forum
Honored Contributor II
2,071 Views

Hello, 

 

I am developing video processing cores to Cyclone III devices by using Quartus II 10.1sp1. I am writing the program codes in Verilog HDL. 

 

Now I need for a 2 dimensional array filled up with predefined values. The size of the array should be flexible. The next declaration was set up: 

 

parameter [4:0] NUMBER_OF_TAPS = 5'd6; 

parameter [6:0] NUMBER_OF_PHASES = 7'd16; 

 

reg [31:0] coefficients [log2(NUMBER_OF_PHASES)-1:0][log2(NUMBER_OF_TAPS)-1:0] 

 

The 'coefficients' array has a parameterized size and must be initialized not for simulation purposes but at power up in the Cyclone III device. I have tried to make a .mif file but it seems to be 1-dimensional only. 

The initial parameters are the subject of coninuous change for experiment purposes so it would be nice to have them in an external file or in a simple array declaration and not in value-by-value form. 

 

Can anybody help me? 

 

Regards, 

Istvan
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
1,102 Views

Hi,  

you can try to use a "initial" block to initialize the array. 

 

I'm not 100% sure about what Quartus supports in them. 

I've used "initial" blocks with "for" loops to initialize look up tables for fixed point dividers and it worked fine. 

I think you can also use the file reading functions.
0 Kudos
Altera_Forum
Honored Contributor II
1,102 Views

Hi, 

 

I have already tried the initial statement with individual initialization from element to element but the syntheser removed it. 

 

I am trying to set up a ROM modul which contains the information. Maybe this is a better solution than a 2D array. Unfortunately it is not so flexible:-( 

 

Regards, 

Istvan
0 Kudos
Altera_Forum
Honored Contributor II
1,102 Views

Hello, 

I am trying to initialize a series of multidimensional arrays with several .mif files. 

I get the impression that indeed, as stated above, .mif and multidimensional arrays are not very well supported by Quartus. 

The first array in the series is read in correctly, be it with an akward warning regarding the difference between the lenght of the array and the length of the file data (they both have 2000 bytes). In the support manual of quartus there is an elaborate section explaining the .mif editor, but i cannot find a reference to .mif and multidimensional arrays. 

Has anybody experience with this concept?  

(Reading a series of single byte arrays of 2000 bytes with .mif files works fine). 

Best Regards, 

Johi.
0 Kudos
Reply