FPGA中几种初始化文件.docx_第1页
FPGA中几种初始化文件.docx_第2页
FPGA中几种初始化文件.docx_第3页
FPGA中几种初始化文件.docx_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

一、Altera ROM初始化文件mif文件格式 以下文字引自Altera公司的资料。Memory Initialization File (.mif) DefinitionAn 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 bitsWIDTH = 8; - The size of memory in wordsADDRESS_RADIX = HEX; - The radix for address valuesDATA_RADIX = BIN; - The radix for data valuesCONTENT - start of (address : data pairs)BEGIN00 : 00000000; - memory address : data01 : 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/2void main()FILE *fp;int j;unsigned char i=0;unsigned char x=0;if(fp=fopen(d:sin.mif,w)=NULL)printf(cant 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 beginn);for(j=0;jx=(int)(LENTH+LENTH*sin(2*Pi*i/DEPTH);fprintf(fp, %x: %x;n,i,x);i+;fprintf(fp,n);fprintf(fp,end;n);printf(success);getch(); 二、Xilinx ROM初始化文件coe文件格式在ISE初始化ROM的时候要用到一个扩展名为.coe的文件,一个标准的coe文件的格式如下:MEMORY_INITIALIZATION_RADIX=2; /数据格式,此为2进制,还可以为8,10,16进制MEMORY_INITIALIZATION_VECTOR=01110100,00100000,11110101,10000000,01111000,00100010,00000001,00010100,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,01110100,00000101,11110101,10000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000;三、Xilinx FIR滤波器系数文件格式 radix = 10; /系数的进制,此为10进制,也可以为2, 10,16进制coefdata =coef1,coef2,coef3,coefN;文件扩展名为.coe。FIR的datasheet里没有写进制位8的情况。在ise下,ROM初始化是靠加载coe文件完成的。其格式如下:MEMORY_INITIALIZATION_RADIX=2; /表示ROM内容的数据格式是2进制MEMORY_INITIALIZATION_VECTOR=00000000 0000000100000011;但是当数据量很大的时候,直接写很不方便。下面我将介绍,借助matlab工具来快速完成包含大量数据的coe文件的编写。1、在matlab中将数据录入,如果数据是在txt文件中,可以读文件录入(网上很容易找到相关命令)。2、将数据存成n行1列的数组。3、通常录入的数据都是10进制的。可以用命令A=dec2bin(I);转为2进制字符,再用M=str2num(A);转换为数字显示。 如15,经过两次转化即为11111111;4、将matlab数据窗口中的A双击出来,会显

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论