Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

MIF file

efe373
New Contributor I
470 Views

Hello,

 

I want to initialize my RAM using .mif file. I want to store 2 different width of data in the memory, one is 16-bit and the other is 18-bit. Therefore, I have decided to use 18-bit wide RAM. However, when I try to fill the .mif file I got confused. I want to write the initialization data in HEX format, addressing in DEC format. For example, if I want to have 0x0ABC as 16-bit data in the address 10d, what should I write?

10 : 00ABC; 

Is this right?

Also if I want to have 11_1010_1011_1100_1101b (18-bit) in the address 15d, what should I write?

15 : FABCD;

Is this also right? If not, can you guide me a little? 

 

Thanks.

0 Kudos
1 Solution
SyafieqS
Moderator
422 Views

Hi Yitim,


In a Memory Initialization File, you must specify the memory depth and width values. In addition, you can specify data radixes as binary (BIN), hexadecimal (HEX), octal (OCT), signed decimal (DEC), or unsigned decimal (UNS) to display and interpret addresses and data values. Data values must match the specified data radix.


The format is like this:


DEPTH = 32;          -- The size of memory in words

WIDTH = 8;          -- The size of data in bits

ADDRESS_RADIX = HEX;     -- The radix for address values

DATA_RADIX = BIN;       -- The radix for data values

CONTENT            -- start of (address : data pairs)

BEGIN


00 : 00000000;        -- memory address : data

01 : 00000001;

02 : 00000010;

03 : 00000011;

04 : 00000100;

05 : 00000101;


END;


You can easily use memory editor to create a mif file in file--> new --> memory file --> select your option.


View solution in original post

3 Replies
SyafieqS
Moderator
423 Views

Hi Yitim,


In a Memory Initialization File, you must specify the memory depth and width values. In addition, you can specify data radixes as binary (BIN), hexadecimal (HEX), octal (OCT), signed decimal (DEC), or unsigned decimal (UNS) to display and interpret addresses and data values. Data values must match the specified data radix.


The format is like this:


DEPTH = 32;          -- The size of memory in words

WIDTH = 8;          -- The size of data in bits

ADDRESS_RADIX = HEX;     -- The radix for address values

DATA_RADIX = BIN;       -- The radix for data values

CONTENT            -- start of (address : data pairs)

BEGIN


00 : 00000000;        -- memory address : data

01 : 00000001;

02 : 00000010;

03 : 00000011;

04 : 00000100;

05 : 00000101;


END;


You can easily use memory editor to create a mif file in file--> new --> memory file --> select your option.


SyafieqS
Moderator
370 Views

Yitim,


May I know if there is any update?



efe373
New Contributor I
366 Views

Hi,

 

Because you said 'Data values must match the specified data radix.', I wrote everything in binary, not hexadecimal. So, there is no problem. However, I wish Quartus do bit reduction when I specify 18-bit word length and write 0x3FFFF. Thanks.

Reply