原创 mif文件的格式定义(From Altera)

2009-1-20 09:36 7502 1 1 分类: FPGA/CPLD

Memory Initialization File (.mif) Definition


An ASCII text file (with the extension .mif) that specifies the initial content of a memory block (CAM, RAM, or ROM), that is, the initial values for each address. This file is used during project compilation and/or simulation. You can create a Memory Initialization File in the Memory Editor, the In-System Memory Content Editor, or the Quartus II Text Editor.


A Memory Initialization File serves as an input file for memory initialization in the Compiler and Simulator. You can also use a Hexadecimal (Intel-Format) File (.hex) to provide memory initialization data.


A Memory Initialization File contains the initial values for each address in the memory. A separate file is required for each memory block. 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.


When creating a Memory Initialization File in the Quartus II Text Editor, you must start with the DEPTH, WIDTH, ADDRESS_RADIX and DATA_RADIX keywords. You can use Tab "\t" and Space " " characters as separators, and insert multiple lines of comments with the percent "%" character, or a single comment with double dash "--" characters. Address : data pairs represent data contained inside certain memory addresses and you must place them between the CONTENT BEGIN and END keywords, as shown in the following examples.


 


%  multiple-line comment  


multiple-line comment  %      


                                    


-- single-line comment


 


DEPTH = 32;                   -- The size of data in bits
WIDTH = 8;                    -- The size of memory in words
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;
06 : 00000110;
07 : 00000111;
08 : 00001000;
09 : 00001001;
0A : 00001010;
0B : 00001011;
0C : 00001100;


END;




%  multiple-line comment  


multiple-line comment  %      


                                    


-- single-line comment


 


DEPTH = 32;                   -- The size of data in bits
WIDTH = 8;                    -- The size of memory in words
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;
06 : 00000110;
07 : 00000111;
08 : 00001000;
09 : 00001001;
0A : 00001010;
0B : 00001011;
0C : 00001100;


END;


 




Address : Data Pairs Syntax Rules


Definition


Example


A : D


Addr[A] = D


2 : 4
Address: 01234567
Data:    00400000


[A0..A1] : D


Addr[A0] to [A1] contain data D


[0..7] : 6
Address: 01234567
Data:    66666666


[A0..A1] : D0 D1


Addr[A0] = D0,
Addr[A0+1] = D1,
Add [A0+2] = D0,


Addr[A0+3] = D1,


until A0+n = A1


[0..7] : 5 6
Address: 01234567
Data:    56565656


A : D0 D1 D2


Addr[A] = D0,
Addr[A+1] = D1,
Addr[A+2] = D2


2 : 4 5 6
Address: 01234567
Data:    00456000

广告

文章评论 0条评论)

登录后参与讨论
相关推荐阅读
hustzq_597478661 2009-08-28 22:02
关于quartus hdl综合的一个疑问
今天用quartus写了一个带clock enable的d触发器:library ieee;use ieee.std_logic_1164.all;entity test is    port(d, ...
hustzq_597478661 2009-02-23 14:24
[zz]关于TI DSP的EDMA
几天调下来,总感觉TI的文档语焉不详。不过想想也对,250页的文档是谁都要写到郁闷的。而且一个懂了的人给初学者讲东西总会自然的略过一些看似当然的关键。     这几天遇到的问题就是EDMA可以工作,却...
hustzq_597478661 2009-01-21 11:45
Synplify DSP安装、设置指南
Installing the Software on a Windows PlatformWindows平台安装指南(摘自Synplify? DSP Installation and License ...
hustzq_597478661 2009-01-19 17:38
用matlab生成mif文件
网上有一位网友提供了如何使用matlab生成mif文件的方法。但经过试验,在Quartus中无法打开生成的mif文件,提示有语法错误。以下是hustzq的一个小程序,生成了[0,pi/2]区间的正弦表...
hustzq_597478661 2009-01-19 14:27
【转帖】利用excel生成“.MIF”文件的办法
注:本文转帖自网友ql_smbj的博客:http://blog.ednchina.com/ql_smbj在FGPA的设计中,经常会对ROM进行初始化操作,如果内存数据不是很大(比如几十个),完全可以在...
我要评论
0
1
广告