分享
分享赚钱 收藏 举报 版权申诉 / 4

类型FPGA中几种初始化文件.docx

  • 上传人:dcs1276
  • 文档编号:6278944
  • 上传时间:2019-04-04
  • 格式:DOCX
  • 页数:4
  • 大小:18.42KB
  • 配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    FPGA中几种初始化文件.docx
    资源描述:

    1、一、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 a

    2、nd/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-F

    3、ormat) 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 c

    4、an 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 m

    5、ust 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

    6、 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 commentDEPTH = 32; - The size of data in bitsWIDTH = 8; - The size of memory in wordsADDRESS_RADIX = H

    7、EX; - 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 : 000010

    8、10;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 filen“);exit(0);

    9、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 RO

    10、M 初始化文件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,0000000

    11、0,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 的情况。在 is

    12、e 下, ROM 初始化是靠加载 coe 文件完成的。其格式如下:MEMORY_INITIALIZATION_RADIX=2; /表示 ROM 内容的数据格式是 2 进制MEMORY_INITIALIZATION_VECTOR=00000000 0000000100000011;但是当数据量很大的时候,直接写很不方便。下面我将介绍,借助 matlab 工具来快速完成包含大量数据的 coe 文件的编写。1、在 matlab 中将数据录入,如果数据是在 txt 文件中,可以读文件录入(网上很容易找到相关命令) 。2、将数据存成 n 行 1 列的数组。3、通常录入的数据都是 10 进制的。可以用命令

    13、 A=dec2bin(I);转为 2 进制字符,再用M=str2num(A);转换为数字显示。如 15,经过两次转化即为 11111111;4、将 matlab 数据窗口中的 A 双击出来,会显示 n 行 1 列的 2 进制数(类似 excel) ,直接全选复制数据到 txt 文件中;在 txt 文件开头加入:MEMORY_INITIALIZATION_RADIX=2; /表示 ROM 内容的数据格式是 2 进制MEMORY_INITIALIZATION_VECTOR=在 txt 文件的最后一个数字后加入分号“;” 。5、将 txt 文件后缀直接改为 coe 文件类型。这时我们需要的 coe 文件就产生了。

    展开阅读全文
    提示  道客多多所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    关于本文
    本文标题:FPGA中几种初始化文件.docx
    链接地址:https://www.docduoduo.com/p-6278944.html
    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    道客多多用户QQ群:832276834  微博官方号:道客多多官方   知乎号:道客多多

    Copyright© 2025 道客多多 docduoduo.com 网站版权所有世界地图

    经营许可证编号:粤ICP备2021046453号    营业执照商标

    1.png 2.png 3.png 4.png 5.png 6.png 7.png 8.png 9.png 10.png



    收起
    展开