FPGA
设计
领导形象设计圆作业设计ao工艺污水处理厂设计附属工程施工组织设计清扫机器人结构设计
中几种初始化文件的格式比较
一、Altera ROM初始化文件——mif文件格式
以下文字引自 Altera公司的资料。
Memory Initialization File (.mif) Definition
An ASCII text file (with the extension .mif) that specifies the initial conte
nt of a memory block (CAM, RAM, or ROM), that is, the initial values for ea
ch 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 initializati
on in the Compiler and Simulator. You can also use a Hexadecimal (Intel-For
mat) File (.hex) to provide memory initialization data.
A Memory Initialization File contains the initial values for each address i
n the memory. A separate file is required for each memory block. In a Mem
ory Initialization File, you must specify the memory depth and width values. I
n addition, you can specify data radixes as binary (BIN), hexadecimal (HEX), o
ctal (OCT), signed decimal (DEC), or unsigned decimal (UNS) to display and in
terpret 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 ke
ywords. You can use Tab "\t" and Space " " characters as separators, and in
sert multiple lines of comments with the percent "%" character, or a single c
omment with double dash "--" characters. Address : data pairs represent data
contained inside certain memory addresses and you must place them betwe
en the CONTENT BEGIN and END keywords, as shown in the following examp
les.
% 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;
可以通过 c语言很简单地得到 mif文件,下面是求 sina()的 256点用于 DDS
#include
#include
#include
#define Pi 3.1416
#define DEPTH 256
#define LENTH DEPTH/2
void main()
{
FILE *fp;
int j;
unsigned char i="0";
unsigned char x="0";
if((fp=fopen("d:\\sin.mif","w"))==NULL)
{
printf("can't open this file..\n");
exit(0);
}
fprintf(fp,"width=8;\n");
fprintf(fp,"depth=%d;\n",DEPTH);
fprintf(fp,"address_radix=hex;\n");
fprintf(fp,"data_radix=hex;\n");
fprintf(fp,"content begin\n");
for(j=0;j
本文档为【MIF_COE文件格式】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。