xilinx 配置flash中 使用用户段数据设置笔记

因为项目需要,需要在配置的flash芯片中,放入自己需要的数据,这个时候需要使用STARTUPE2原语。

对于此原语,具体参考UG470。

另外参考 

https://forums.xilinx.com/t5/Other-FPGA-Architecture/STARTUPE2-use-case-examples/td-p/770767

以及 https://blog.csdn.net/jiuzhangzi/article/details/79471365 

csdn上的原文如下:

  有的项目需要远程更新固件,更新完成后断电、重启即可。那远程更新是如何实现的呢?用的最多的应该是以太网或者自定义的局域网为主,当然还可以使用pcie、串口之类的,像xilinx还有golden image,以防止远程更新失败启动不起来,它主要是flash存有两个启动文件,正常情况下启动默认的,当默认的被损坏,就从备用的启动。本文章主要讲解的是STARTUPE2原语,这和远程更新有什么关系呢?请接着向下看。
我们知道,fpga掉电丢失,一般使用外部flash存储代码,flash有spi、bpi、qspi等接口,外部存储器的时钟管脚一般与fpga的CCLK_0连接,当使用远程更新时,首先fpga内部有控制flash的驱动(即逻辑控制flash时序),当然flash时钟也需要控制了,但这时时钟管脚已经连接到CCLK_0,那该如何操作啊,你直接约束分配管脚试试,是通不过的,这时STARTUPE2就派上用场了,那该如何使用啊,如下(verilog):
---------------------
 

STARTUPE2 #(
.PROG_USR("FALSE"), // Activate program event security feature. Requires encrypted bitstreams.
.SIM_CCLK_FREQ(0.0) // Set the Configuration Clock Frequency(ns) for simulation
)
STARTUPE2_inst
(
.CFGCLK(), // 1-bit output: Configuration main clock output
.CFGMCLK(), // 1-bit output: Configuration internal oscillator clock output
.EOS(), // 1-bit output: Active high output signal indicating the End Of Startup.
.PREQ(), // 1-bit output: PROGRAM request to fabric output
.CLK(0), // 1-bit input: User start-up clock input
.GSR(0), // 1-bit input: Global Set/Reset input (GSR cannot be used for the port name)
.GTS(0), // 1-bit input: Global 3-state input (GTS cannot be used for the port name)
.KEYCLEARB(1), // 1-bit input: Clear AES Decrypter Key input from Battery-Backed RAM (BBRAM)
.PACK(1), // 1-bit input: PROGRAM acknowledge input
.USRCCLKO(flash_clk), // 1-bit input: User CCLK input
.USRCCLKTS(0), // 1-bit input: User CCLK 3-state enable input
.USRDONEO(1), // 1-bit input: User DONE pin output control
.USRDONETS(1) // 1-bit input: User DONE 3-state enable outpu
);

其中flash_clk就是你时序控制的flash时钟信号,连接到这就行了,其它的不需要改动,也无需约束此管脚(因为此管脚不需要在顶层作为输出信号了)。当然你也可以例化qspi ip看里面是如何使用的。 顺便说一下,对于数据信号,一般是inout类型,对于单bit可以如下使用:

assign data = data_en ? data_reg : 1'bz;

多bit可以如下使用:

//data_en=1:data_in--valid;0:data_out--valid
generate
genvar j;
for (j = 0; j <= 3; j = j + 1)
begin : bidir_IO
IOBUF IOBUF_i (
.IO (flash_data[j]),
.I (data_out[j]),
.O (data_in[j]),
.T (data_en)
);
end
endgenerate
 

data_en、data_in、data_out是时序控制的信号,flash_data为顶层的inout类型信号(直接接芯片引脚)。

 

 

xilinx的论坛的一部分信息:

you may find detail information in configuration user guide UG470 for this primitive.

The general usage of this primitive is to use control configuratioin dedicated pin (like CCLK for 7 series ) post configuration.

Configuration dedicated pin cannot be directly controlled after configuration, but in some scenario, it needs to access the external SPI flash which is used to store FPGA configuration bit file.

 

Below is the example to instantiate the primitive in your design.


STARTUPE2_​INST: STARTUPE2
generic map(
PROG_​USR => "FALSE",​
SIM_​CCLK_​FREQ => 0.0)
port map (
CFGCLK => open,​
CFGMCLK => open,​
EOS => open,​
PREQ => open,​
CLK => '0',​
GSR => '0',​
GTS => '0',​
KEYCLEARB => '0',​
PACK => '0',​
USRCCLKO => spi_​clk,​ -- external (EMCCLK) spi_​clk signal from the design which is provide signal to output on CCLK pin USRCCLKTS => '0',​ -- Enable CCLK pin
USRDONEO => '1',​ -- Drive DONE pin High even though tri-state USRDONETS => '1' );​ -- Maintain tri-state of DONE pin

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值