FPGA中ICAP原语的使用

您所在的位置:网站首页 icap仪器是测试什么的 FPGA中ICAP原语的使用

FPGA中ICAP原语的使用

2024-07-16 17:29| 来源: 网络整理| 查看: 265

ICAP原语的使用 一、杂谈ICAP原语的介绍ICAPE2原语的介绍ICAPE2原语的代码验证结束语

一、杂谈

有一段时间没写博客了,因为从学校回家了。现在正值肺炎流行,不给社会添麻烦,自己在家调调程序看看论文。可是今天写的icap原语在板子上的验证没通过,因为学的是icap原语是用在S6芯片上的,但是因为自己回家没带S6的开发板,这里用7系列的icape2原语进行做实验,虽然板上验证没通过,但是还是非常用实用意义。最后在这个不平稳的日子里,希望武汉加油、中国加油、一起共度难关!!!

ICAP原语的介绍

ICAP原语是S6芯片上的一个原语,这里有必要对原语的概念说明一下,我们可以把原语想象成一个IP核,只不过IP核是图形化界面,而原语就相当于生成IP核生成的.v文件,原语的使用不需要添加相应的文件。对于ISE软件,原语调用的位置如下:

在这里插入图片描述其中对应的ICAP原语的调用位置如下:

在这里插入图片描述 其中,icap原语的内容如下:

// ICAP_SPARTAN6 : In order to incorporate this function into the design, // Verilog : the following instance declaration needs to be placed // instance : in the body of the design code. The instance name // declaration : (ICAP_SPARTAN6_inst) and/or the port declarations within the // code : parenthesis may be changed to properly reference and // : connect this function to the design. All inputs // : and outputs must be connected. // // ICAP_SPARTAN6: Internal Configuration Access Port // Spartan-6 // Xilinx HDL Language Template, version 14.7 ICAP_SPARTAN6 #( .DEVICE_ID(0'h4000093), // Specifies the pre-programmed Device ID value .SIM_CFG_FILE_NAME("NONE") // Specifies the Raw Bitstream (RBT) file to be parsed by the simulation // model ) ICAP_SPARTAN6_inst ( .BUSY(BUSY), // 1-bit output: Busy/Ready output .O(O), // 16-bit output: Configuartion data output bus .CE(CE), // 1-bit input: Active-Low ICAP Enable input .CLK(CLK), // 1-bit input: Clock input .I(I), // 16-bit input: Configuration data input bus .WRITE(WRITE) // 1-bit input: Read/Write control input ); // End of ICAP_SPARTAN6_inst instantiation

这里对原语中得分几个信号的使用做出介绍: 1、DEVICE_ID:不同芯片的DEVICE_ID不相同,在使用该原语时,一定要查找对用芯片的ID,具体查找的数据手册UG380 ; 2、SIM_CFG_FILE_NAME:仿真使用,默认即可。 3、BUSY:原语对应的忙信号 4、O:配置数据的输出 5、CE:原语的使能信号,低电平有效 6、CLK:原语的时钟信号 7、I:原语配置数据的输入信号 8、WRITE:读写原语的使能信号,低电平有效 在这里插入图片描述 这里需要在DEVICE_ID中填入对应的ID号 然后按照上面的要求该原语得从I中输入相应的指令,FPGA才能从指定的存储地址启动。 在这里插入图片描述 按照上面的数据输入到ICAP原语中,FPGA便可以从制定的存储器件指定的存储地址中读取代码,这里需要注意的是I中的数据与上表中的数据要按照字节反转,这部分内容在手册中也能查找到,如下: 在这里插入图片描述

这里需要重点解释Opcode的含义,如下图: 在这里插入图片描述 该Opcode的物理意义是对用flash的读命令代码,对应镁光的一般是0x03。其余配置数据的含义从图中可以知道。有了以上信息,我们便可以操作S6系列的ICAP原语。

ICAPE2原语的介绍

由于在家没带S6的开发板,我们紧接着介绍A7开发板中ICAP原语的使用,通S6一样知道上述信息如下: 对于vivado软件,原语调用的位置如下: 在这里插入图片描述

其中对应的ICAP原语的调用位置如下:在这里插入图片描述 其中,icap原语的内容如下:

// ICAPE2 : In order to incorporate this function into the design, // Verilog : the following instance declaration needs to be placed // instance : in the body of the design code. The instance name // declaration : (ICAPE2_inst) and/or the port declarations within the // code : parenthesis may be changed to properly reference and // : connect this function to the design. All inputs // : and outputs must be connected. // // ICAPE2: Internal Configuration Access Port // Artix-7 // Xilinx HDL Language Template, version 2019.1 ICAPE2 #( .DEVICE_ID(0'h3651093), // Specifies the pre-programmed Device ID value to be used for simulation // purposes. .ICAP_WIDTH("X32"), // Specifies the input and output data width. .SIM_CFG_FILE_NAME("NONE") // Specifies the Raw Bitstream (RBT) file to be parsed by the simulation // model. ) ICAPE2_inst ( .O(O), // 32-bit output: Configuration data output bus .CLK(CLK), // 1-bit input: Clock Input .CSIB(CSIB), // 1-bit input: Active-Low ICAP Enable .I(I), // 32-bit input: Configuration data input bus .RDWRB(RDWRB) // 1-bit input: Read/Write Select input ); // End of ICAPE2_inst instantiation

在这里插入图片描述 在这里插入图片描述 在这里插入图片描述

ICAPE2原语的代码

工程1的代码: top模块的代码

`timescale 1ns / 1ps // ********************************************************************************* // Project Name : OSXXXX // Author : zhangningning // Email : [email protected] // Website : // Module Name : top.v // Create Time : 2020-01-29 13:45:19 // Editor : sublime text3, tab size (4) // CopyRight(c) : All Rights Reserved // // ********************************************************************************* // Modification History: // Date By Version Change Description // ----------------------------------------------------------------------- // XXXX zhangningning 1.0 Original // // ********************************************************************************* module top( input sclk , input rst_n , input key_i , output wire [ 3:0] led ); //========================================================================================\ //**************Define Parameter and Internal Signals********************************** //========================================================================================/ wire key_flag ; //========================================================================================\ //************** Main Code ********************************** //========================================================================================/ led led_inst( .sclk (sclk ), .rst_n (rst_n ), .led (led ) ); key key_inst( .sclk (sclk ), .rst_n (rst_n ), .key (~key_i ), .key_o (key_flag ) ); icap_start icap_start_inst( .sclk (sclk ), .rst_n (rst_n ), .icap_flag (key_flag ), .icap_done ( ) ); endmodule

icap_start模块的代码:

`timescale 1ns / 1ps // ********************************************************************************* // Project Name : OSXXXX // Author : zhangningning // Email : [email protected] // Website : // Module Name : icap_start.v // Create Time : 2020-01-29 13:02:26 // Editor : sublime text3, tab size (4) // CopyRight(c) : All Rights Reserved // // ********************************************************************************* // Modification History: // Date By Version Change Description // ----------------------------------------------------------------------- // XXXX zhangningning 1.0 Original // // ********************************************************************************* module icap_start( input sclk , input rst_n , input icap_flag , output reg icap_done ); //========================================================================================\ //**************Define Parameter and Internal Signals********************************** //========================================================================================/ wire csib ; reg [31:0] con_data [ 7:0] ; wire [31:0] con_data_r ; reg [ 2:0] cnt ; reg busy_flag ; reg rdwrb ; //========================================================================================\ //************** Main Code ********************************** //========================================================================================/ initial begin con_data[0] = 32'hFFFF_FFFF; con_data[1] = 32'hAA99_5566; con_data[2] = 32'h2000_0000; con_data[3] = 32'h3002_0001; con_data[4] = 32'h00a0_0000; con_data[5] = 32'h3000_8001; con_data[6] = 32'h0000_000F; con_data[7] = 32'h2000_0000; end assign csib = ~busy_flag; assign con_data_r = {con_data[cnt][24],con_data[cnt][25],con_data[cnt][26],con_data[cnt][27],con_data[cnt][28],con_data[cnt][29], con_data[cnt][30],con_data[cnt][31],con_data[cnt][16],con_data[cnt][17],con_data[cnt][18],con_data[cnt][19], con_data[cnt][20],con_data[cnt][21],con_data[cnt][22],con_data[cnt][23],con_data[cnt][08],con_data[cnt][09], con_data[cnt][10],con_data[cnt][11],con_data[cnt][12],con_data[cnt][13],con_data[cnt][14],con_data[cnt][15], con_data[cnt][00],con_data[cnt][01],con_data[cnt][02],con_data[cnt][03],con_data[cnt][04],con_data[cnt][05], con_data[cnt][06],con_data[cnt][07]}; always @(posedge sclk or negedge rst_n) if(rst_n == 1'b0) busy_flag


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3