ug909 - partial - config - christine

更新时间:2024-01-13 12:05:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

可重配置是通过下载可重配置比特文件,在不影响原有功能的情况下增加一些功能。可重配置特性让FPGA硬件资源像微处理器切换任务一样可以时分复用。因为FPGA是在硬件中切换资源,所以兼具了软件实现的灵活性以及硬件实现的高性能这两个优点。 优点:

减小资源利用率,降低功耗 提高算法或者协议选择的灵活性 提高FPGA容错率

适用于灵活改变功能的场合,比如logic equations,滤波器参数,I/O标准。如果改动大的话,不建议使用,比如说整个算法。因为改动不大,可重配置时间很短。

可重配置资源:

LUT 寄存器 BBRAM

DSP

不可重配置资源 BUFG BUFR MMCM PLL ISERDES、OSERDES BSCAN、STARTUP、ICAP、XADC IDELAYCTRL 串行收发器MGT 对于UltraScale器件,有更广泛的可重配置资源,BUFG、MMCM、PLL、SERDES、IDELAYCTRL等。

可重配置是一个属性。TCL命令如opt_design, place_design, route_design会检测到可重配置属性然后正确的去处理。

需要定义不同的可重配置区域,每个元素类型。

可重配置模块必须初始化为一个确定的状态。可以通过局部复位或者专用的GSR通过RESET_AFTER_CONFIG特性。对于ultrascale器件,该特性总是使能的。 举例:

1复用转发器

复用转发器的客户端可以支持多种接口协议,但是在配置FPGA之前不能预测使用哪个协议。为了避免FPGA重新配置时所有的端口都被禁用,为每个端口都实现了可能的接口协议。

这是一个低效的设计。高效的设计是使用可重配置模块。每个端口都是一个可重配置模块。同时也不再需要使用连接多个协议接口的开关MUX。此时,需要生成16个单独的局部比特文件。(为什么我觉得是3(3种协议)*4个port呢?)

通过PCIe接口配置程序

2数据包处理器可以利用可重配置根据接收的数据包类型更改其处理函数。 3非对称秘钥加密

在这种设计的真正的实现中,最初的比特文件是未加密的设计,不包含任何专有信息。最初的设计只包含生成公私密钥对和主机与FPGA和ICAP之间的连接接口的算法。初始的比特文件加载后,FPGA产生公私秘钥对。用于加密可重配置比特文件的公用秘钥会发送到主机。加密过的区域重配置文件通过ICAP接口重配置FPGA。 几个好处是:

1 公私秘钥对可以在任何时间产生。如果下载了新的配置,它也可以用一个不同的公用秘钥解密。如果FPGA使用同样的部分重配置比特文件,例如上电复位的时候,仍然可以使用一个不同的公用秘钥对。

2 私用秘钥存在SRAM中。如果FPGA掉电,私用秘钥不再存在。

VIVADO 软件流程

1 分别综合静态模块和可重配置模块

2 创建物理约束来定义可重配置区域

3 为每个可重配置分区设置RECONFIGURABLE属性

4 设计实现:实现一个完整的设计(静态和每一个可重新配置模块可重构分区)。 5 为完整布线的设计保存一个dcp。

6 从设计中移除可重配置模块,然后保存一个只有静态设计的检查点 7 锁定静态布线

8 给静态设计增加一个新的可重配置模块,然后实现这个新的配置,为整个设计保存一个检查点

9 重复第8步,直到所有的可重配置模块被实现 10 对所有的配置进行验证。pr_verify 11 为每个配置产生对应的比特文件

命令

综合

综合工具包括:XST,Synplify, Vivado Synthesis. 注意

1 UltraScale 器件在Vivado中不支持NGC。建议用户在vivado中重新生成IP或者使用NGC2EDIF命令将NGC改成EDIF格式。xilinx推荐使用本地Vivado IP而不是XST综合的NGC格式的文件.

2 自底向上的综合是指综合流程中每个模块都有自己的综合工程的流程。因此,需要为下级底层模块关掉自动插入I/O buffer.

–no_iobuf: Instructs the tool to not infer any input or output buffers. This is useful in a bottom-up flow where the output of the tool is used as a lower level later in the flow. This setting is a global setting that includes the whole design.

综合顶层模块

必须要有一个带有可重配置模块黑匣子的顶层网表。这就需要顶层综合为分区实例化的模块或实体声明,但是没有任何逻辑,模块(module)是空的。 可重配置模块不支持I/O逻辑。

综合可重配置模块

因为每个可重配模块都要能够实例化到同样的黑箱中,所以一定要有共同的接口。block的名字必须也相同,所有接口的属性(名字,宽度,方向)也必须相同。-mode out_of_context可以关掉自动插入BUFFER。

synth_design -mode out_of_context -flatten_hierarchy rebuilt -top -part

建议综合后关掉设计,然后独立运行实现。

读设计模块

有多种方法可以加载静态设计和RM。所有的配置都实现后,dcp可以仅仅用于获取布局布线数据。 有3种方法:

方法一:读取网表设计

用于模块不是通过Vivado综合的设计。

read_edif .edf/edn/ngc read_edif .edf/edn/ngc read_edif .edf/edn/ngc

link_design -top -part

方法二:Open/Read Checkpoint

如果综合或者实现的结果之前被保存成dcp的话。如果dcp是RM的,那么必须通过read_checkpoint -cell指定实例的名字(eg:inst_shift)。如果dcp是post-implementation的,必须加上-strict选项。如果要读取RM的dcp,顶层设计必须已经打开了,而且必须与指定的黑箱cell.

read_checkpoint -cell [-strict]

方法三:

用于综合结果是以网表的形式存在(edf/edn),但是静态设计已经实现过了。下面的例子演

示了第二个配置的命令。

open_checkpoint .dcp lock_design -level routing

update_design -cells -from_file .{edf/edn} update_design -cells -from_file .{edf/edn}

为RM模块添加多个网表

如果RM网表的子模块也是网表,有2种方法: Method1:

创建一个包含所有网表的dcp.在这种情况下,所有的edif/ngc都可以用add_files命令添加,link_design可以用于分解文件到各自相应的cells。(resolve)

add_files [list rm.edf ip_1.edf...ip_n.edf] # Run if RM XDC exists add_files rm.xdc

link_design -top -part write_checkpoint rm_v#.dcp close_project add_files static.dcp

link_design -top part lock_design -level routing read_checkpoint -cell rm_v#.dcp

Method2:

把子模块网表与RM顶层网表放在同样的路径下。

add_files static.dcp

link_design -top part lock_design -level routing

update_design -cells -from_file rm_v#.edf

确保把子模块网表跟RM的顶层网表放在同一目录下。执行update_design -cell命令时会自动加上。这个方法比方法一隐晦,但是步骤少。

实现

每个PR设计的实现叫做一个配置。每个设计模块都可以实现或者导入(如果以前实现过了直接导入即可)。

静态设计的实现结果必须是一致的,所以在一个配置中实现以后,将其导入接下来的配置。其余的配置可以导入静态和每个可重配置模块的实现结果。

# Run if all constraints are not already loaded read_xdc

# Optional command opt_design place_design # Optional command phys_opt_design route_design

保持实现数据

第一个配置的静态实现必须被保存成一个checkpoint。必须被锁定。 如果要锁定导入的checkpoint(静态或者可重配置),使用

lock_design -level routing [cell_name]其中cell_name可以忽略。 如果要锁定导入RM的结果,全部层次的名字必须被指定。例如: lock_design -level routing u0_RM_instance 对于部分重配置,唯一保存的水平是布线。

部分重配置的约束和性质

定义一个模块为可重配(必须)

为可重配区域创建一个floorplan(必须) 配置后使用复位(可选) 打开可视化脚本(可选)

1定义一个模块为可重配(必须)

set_property HD.RECONFIGURABLE TRUE [get_cells inst_count] HD.RECONFIGURABLE属性表明默认下列约束:

为指定cell和接口网络设置DONT_TOUCH,就可以避免模块边界优化

为Pblock设置EXCLUDE_PLACEMENT,可以避免静态逻辑布线到可重配置分区中 为Pblock设置CONTAIN_ROUTING,可以限制可重配置逻辑布线在指定的约束区域内 使能DRC,时钟路由的特殊代码

2为可重配区域创建一个floorplan(必须) Pblock不能重叠

多个PBLOCK区间的缝隙允许非可重构资源,但是为了布线成功,最好是连续的Pblock。 如果7系列的器件使用了RESET_AFTER_RECONFIG属性,Pblock的高度一定要和时钟区域对齐。

7系列的Pblock一定不能将interconnect columns分开。

例子

#define a new pblock create_pblock pblock_count

#add a hierarchical module to the pblock

add_cells_to_pblock [get_pblocks pblock_count] [get_cells [list inst_count]] #define the size and components within the pblock

resize_pblock [get_pblocks pblock_count] -add {SLICE_X136Y50:SLICE_X145Y99} resize_pblock [get_pblocks pblock_count] -add {RAMB18_X6Y20:RAMB18_X6Y39} resize_pblock [get_pblocks pblock_count] -add {RAMB36_X6Y10:RAMB36_X6Y19}

Floorplan in the Vivado IDE

尽管还不支持Project模式,但是IDE环境可以用于planning and visualization任务。最好的例子就是create and modify Pblock约束。

open_checkpoint synth/Static/top_synth.dcp

read_checkpoint -cell [get_cells inst_count] synth/count_up/count_synth.dcp read_checkpoint -cell [get_cells inst_shift] synth/shift_right/shift_synth.dcp set_property HD.RECONFIGURABLE true [get_cells inst_count] set_property HD.RECONFIGURABLE true [get_cells inst_shift]

圈之前需要打开综合后的结果。

在Vivado环境中可以圈出一个矩形来选择一个RM分区。如果是L形,可以在Device视图中右击Pblock然后选择增加Pblock矩形。(与Planahead中圈矩形相似)。 要进行DRC检查。

write_xdc top_fplan.xdc执行此条命令将floorplan约束保存起来。

注意:千万不要通过Vivado IDE File> Save Checkpoint保存整个设计。如果保存了,就会覆盖掉之前保存的dcp。

时序约束:分别做时序分析。

Partion pins

是在Pblock边界自动创建的接口点。是在interconnect tiles里的虚拟I/O。不需要任何物理资源,也不需要有任何附加的延迟。

布线器根据源、驱动和时序要求为其选择位置,但是它们的位置也可以通过用户约束确定。如:

set_property HD.PARTPIN_LOCS INT_R_X4Y153 [get_ports ] set_property HD.PARTPIN_RANGE SLICE_X4Y153:SLICE_X5Y157 [get_ports ]

interconnect tile的实例名可以在Device View视图中看到。 3配置后复位

使用这个特性,reconfig region可以在局部重构过程中保持稳定状态。静态逻辑不受影响,可以继续正常工作。带有这个特性的Partial Reconfig就像FPGA的初始化配置一样,同步元素处于一种已知的初始化状态。

注意:全局信号GSR和GWE的释放不一定保证是同步的。如果RM模块的功能依赖于同步的startup,那个模块的时钟驱动逻辑或者时钟使能信号可以在局部重构过程中禁用,然后局部重构完成后再启用。static logic不允许,但是static routing(在实际的布线中显示出来是虚线/实线?)是允许的。

set_property RESET_AFTER_RECONFIG true [get_pblocks ] 7系列的器件要应用此特性,Pblock约束一定要与可重配置帧对齐。因为GSR会影响区域内每个同步元素。

Pblock模块必须与时钟区域垂直。

Pblock_shift是帧对齐的,因为顶和底与时钟区域X1Y3对齐。Pblock_count是不能用RESET_AFTER_RECONFIG的,因为顶部不对齐。Ultrascale器件两个Pblock都可以使用RESET_AFTER_RECONFIG因为不再受GSR(全局复位)的影响。

使用SNAPPING_MODE约束可以自动创建合法的RP。

GSR功能嵌在partial bitstreams里,所以不用做什么包含。然而重配置过程利用了SHUTDOWN序列,外部DONE管脚会在重配置开始的时候拉低,配置完成后拉高。需要注意这个动作。使用STARTUP模块的DONEO不能阻止DONE脚改变状态,因为在shutdown过程中这个模块是禁用的。STARTUP同样不能用在其他地方,例如产生一个配置时钟。 另外一种方法就是使用局部复位local reset.

软件操作流程

综合

每个模块module(含静态)都需要自底向上的综合,以便每个模块都有各自的网表或者checkpoint。 1 综合顶层

cd d:/xilinx/vivado_prj/led_shift_count/Sources/hdl read_verilog top/top.v(及其他与静态设计、包括可重配置模块的黑箱模块定义相关的HDL文件)

cd d:/xilinx/vivado_prj/led_shift_count/Sources/xdc read_xdc top_io.xdc

synth_design -top top -part xc7z020clg484-1

write_checkpoint -force top_synth.dcp使用force选项能强制执行

2综合一个可重配置模块

cd d:/xilinx/vivado_prj/led_shift_count/Sources/hdl

read_verilog d:/xilinx/vivado_prj/led_shift_count/Sources/hdl/shift_right/shift_right.v synth_design -top shift -part xc7z020clg484-1 -mode out_of_context

write_checkpoint -force d:/xilinx/vivado_prj/led_shift_count/synth/shift_right/shift_right.dcp

read_verilog d:/xilinx/vivado_prj/led_shift_count/Sources/hdl/shift_left/shift_left.v synth_design -top shift -part xc7z020clg484-1 -mode out_of_context

write_checkpoint -force d:/xilinx/vivado_prj/led_shift_count/synth/shift_left/shift_left.dcp

3为其余的可重配置模块重复这个步骤

read_verilog d:/xilinx/vivado_prj/led_shift_count/sources/hdl/count_up/count_up.v synth_design -top count -part xc7z020clg484-1 -mode out_of_context

write_checkpoint -force d:/xilinx/vivado_prj/led_shift_count/synth/count_up/count_up.dcp 4

read_verilog d:/xilinx/vivado_prj/led_shift_count/Sources/hdl/count_down/count_down.v synth_design -top count -part xc7z020clg484-1 -mode out_of_context

write_checkpoint -force d:/xilinx/vivado_prj/led_shift_count/synth/count_down/count_down.dcp 5

建议综合完毕后关闭设计,重新运行实现。

建立Design Floorplan

open_checkpoint d:/xilinx/vivado_prj/led_shift_count/synth/Static/top_synth.dcp read_checkpoint -cell [get_cells inst_count] synth/count_up/count_synth.dcp // read_checkpoint -cell [get_cells inst_count] synth/count_up/count_up.dcp

read_checkpoint -cell [get_cells inst_shift] synth/shift_right/shift_synth.dcp // read_checkpoint -cell [get_cells inst_shift] synth/shift_right/shift_right.dcp

set_property HD.RECONFIGURABLE true [get_cells inst_count] set_property HD.RECONFIGURABLE true [get_cells inst_shift]

画矩形:draw Pblock

report drc write xdc

write_xdc d:/xilinx/vivado_prj/led_shift_count/sources/xdc/top_fplan.xdc

实现

(read_checkpoint -cell shift shift_right.dcp

Command: read_checkpoint -cell shift shift_right.dcp WARNING: [Vivado 12-156] No cells matched 'shift'

ERROR: [Common 17-162] Invalid option value specified for '-cell'.)即不承认cell。 为了至少将任一个可重配置模块实现一次需创建尽可能多的配置。第一个配置为顶层和第一个可重配置模块载入综合结果。你必须将模块标记为可重构的,然后运行实现。为完全布好线的配置write 一个checkpoint,也可以选择性的为可重配置模块wirte a checkpoint以便以后会用。最后,删除可重配置模块(update_design -cell -black_box),为静态设计单独write a checkpoint. Configuration 1:

cd d:/xilinx/vivado_prj/led_shift_count/Checkpoint open_checkpoint top_synth.dcp //read_xdc top_impl.xdc

read_checkpoint -cell inst_shift shift_right.dcp

set_property HD.RECONFIGURABLE true [get_cells inst_shift] opt_design place_design route_design

write_checkpoint config1_routed.dcp(为完整布线的生成checkpoint) write_checkpoint -cell shift shift_route_design.dcp update_design -cell shift -black_box lock_design -level routing

write_checkpoint static_routed.dcp Configuration 2:

open_checkpoint static_routed.dcp

read_checkpoint -cell rp1 rp1_b_synth.dcp opt_design place_design route_design

write_checkpoint config2_routed.dcp

write_checkpoint -cell rp1 rp1_b_route_design.dcp //**********************//

read_checkpoint -cell inst_shift d:/Xilinx/vivado_prj/led_shift_count/synth/shift_left/shift_left.dcp read_checkpoint -cell inst_count d:/Xilinx/vivado_prj/led_shift_count/synth/count_down/count_down.dcp

要为每个独立的配置建立一个不同的文件夹,这样所有中途过渡的checkpoint,日志,报告文件,比特文件和其他的一些输出才会不被覆盖。

生成比特文件

设计规则

设计层次

静态设计与重配置模块的接口一定是相同的,无论逻辑上还是物理上。分区边界和边界自身都不能优化。

Reconfigurable Partition Interfaces

综合后要尽可能的减少常量和未连接的端口。通过清除死逻辑,资源利用率会减少,布线冲突和时序紧张也可以避免。

1 静态和重构模块都有active逻辑(适用于输入和输出) 这是理想情况。会插入partition pin.

然而要是重构模块的输入是VCC或者GND,强烈建议在RM模块里面。这样会降低LUT利用率。

2 static有active driver,但是RM没有active loads(适用于partition inputs) 可以接受,会插入partition pin,不用的输入端口会不连。 例如一个模块需要CLKA,另一个需要CLKB。 3 static有active load,RM没有active driver 也是可以接受的。static的输入为GND。 4 RM需要输入,但是static没给 报错

5 RM有输出,但是Static不接受 不会错,但是不好

低电平有效的复位和时钟使能

对于PR模块,避免使用低电平有效的控制信号。在不可避免的情况下,产生一个新的等价信号,并且在所有地方都使用这个新信号。 reset_n <= !reset;

解耦功能

因为可重配逻辑是FPGA运行过程中修改的,所以在部分可重配过程中静态逻辑要忽略RM模块的输出。直到PR完成,R逻辑复位RM模块才会输出有效数据。最好是在静态逻辑一侧,将所有的RM模块的输出数据都寄存。一个使能信号可用于隔离未配置完成的逻辑,其他的方法也包括对于每个输出端口使用2选1的开关MUX。

静态逻辑应该包括数据和接口管理的逻辑。例如握手或者禁用逻辑。

黑匣子

RP在静态设计(从自底向上综合结果或者运行update_design -black_box指令)中必须是一个黑匣子。黑匣子通过update_design -buffer_ports可以在所有的输入输出上放置LUT1

buffer。

所有插入的LUT1 buffer都会连到地。如果必须连到逻辑1(Vcc),可以控制RP管脚的属性HD.PARTPIN_TIEOFF。默认是0,设置为1输出1.

set_property HD.PARTPIN_TIEOFF 1 [get_pins /]这个属性可以在任何时刻设置()。

黑匣子除了LUT1 buffer外没有任何用户逻辑。

使用黑匣子可以减少完整配置比特文件的大小,因此减少了初始配置时间。

在build可重配置设计时,最先build最难的那一个。确保选中的物理区域有足够多的资源(特别是BRAM和DSP48)。然后为每个RP选择最苛刻的RM。 如果不容易看出哪个配置是最难的,那就与静态逻辑一起实现,检查资源利用率和时序报告看哪个设计最容易满足设计标准且有最严格的允许范围或者差的最多。

建立实现需求

可重配分区的逻辑和物理接口保持一致性。 可重配部分的逻辑必须完全包含在物理区域内。

如果使用了专用的初始化特性,静态逻辑必须不能再可重配区域内。 推荐一次一个配置的实现。

1不带Pblock实现设计。采用自底向上的综合,遵循分层次设计原则,如寄存一次边界。 2添加Pblock。添加的过程中,HD.RECONFIGURABLE属性和RESET_AFTER_RECONFIG属性可以暂时加上好做DRC检查。这样会保证创建的floorplan满足PR大小和对齐的需求。 3建立好floorplan后,通过EXCLUSIVE_PLACEMENT属性分离静态设计资源。 4通过CONTAIN_ROUTING属性保持布线局限在Pblock中。

5最后,标记HD.RECONFIGURABLE属性。此时,EXCLUSIVE_PLACEMENT和CONTAIN_ROUTING已经冗余了,可以移除了。

定义边界

部分重配按帧配置。

每个物理可配置帧中只能有一个分区。一个配置帧是可重配置的最小的物理面积,它的高度与时钟区域和I/O边界相同。一个配置帧不能包含多于一个可重配置分区的逻辑。

设计版本检查

BITSTREAM.CONFIG.USR_ACCESS属性允许你向比特文件中直接输入一个修改版本号。ID放在USER_ACCESS寄存器中。通过一个同样名字的库原语可以通过FPGA逻辑访问。部分逻辑设计可以读取这个值然后与局部比特文件进行对比。

配置FPGA

部分配置大部分与标准的完全配置是相同的。 可以进行部分比特文件下载的配置端口为:SelectMAP,Serial, JTAG, or ICAP。Zynq 7000 AP SoC可以使用JTAG和PCAP。UltraScale器件可以使用MCAP。

要使用SelectMAP或者Serial下载比特文件,这些管脚必须要保留成初始化后使用。通过BITSTREAM.CONFIG.PERSIST保持双向I/O和设置配置宽度。语法是 set_property BITSTREAM.CONFIG.PERSIST [current_design]

value的值可以是No, Yes, CTLReg, X1, X8, X16, X32, SPI1, SPI2, SPI4,BPI8, BPI. 一个部分配置控制器从非易失性存储器中提取部分比特文件然后传递给配置端口。部分配置

控制逻辑或者在外部器件(如一个处理器)或者在FPGA逻辑中。用户自定义的内部PR通过ICAP接口加载比特文件。

内部配置由自定义的状态机或者一个类似于MicroBlaze的嵌入式处理器构成。

配置模式

ICAP - A good choice for user configuration solutions. Requires the creation of an ICAP controller as well as logic to drive the ICAP interface.

? MCAP - (UltraScale only) Provides a dedicated connection to the ICAP from one specific PCIE block per device.

? PCAP - The primary configuration mechanism for Zynq-7000 AP SoC designs. ? JTAG - A good interface for quick testing or debug. Can be driven using the Vivado Hardware Manager or ChipScope? Analyzer using a Xilinx configuration cable that supports JTAG.

? Slave SelectMAP or Slave Serial - A good choice to perform full configuration and Partial Reconfiguration over the same interface。主模式不支持。

partial bit file有一个简化的头,没有使FPGA进入用户模式的startup序列。比特文件只含有帧地址和配置数据,外加校验和。如果使用了Reset After Reconfiguration,DONE脚在配置开始时为低,完成后拉高。

如果没用Reset After Reconfiguration,必须监控发送的数据。比特文件尾有个去同步字0000000D。这个命令是在一系列填充空指令后面,确保去同步字监控到的时候所有的配置数据已经发送完成。一旦完整的比特文件发送到配置端口,释放可重配置端口为使能状态。

UltraScale器件的清除比特文件

举例:

一个设计有两个可重配置分区:RP1 RP2.每个分区各有两个可重配置模块。RP1含有A1和B1。RP2含有A2和B2,已经实现了。两个配置都经过布线了,pr_verify通过了。当比特文件产生时,每个配置都产生5个比特文件。对于configA:

configA.bit-完整的比特文件,用于上电配置。包含静态设计包含A1、A2功能。 configA_RP1_A1_partial.bit:功能A1的比特文件。当另一个RM从这个RP中清掉后要加载的。

configA_RP1_A1_partial_clear.bit:为A1功能的清除比特文件。在加载任何其他部分比特文件之前,必须加载这个文件 configA_RP2_A2_partial.bit

configA_RP2_A2_partial_clear.bit

如果清除比特文件不下载的话,去哪聚复位GSR不会起作用。如果下载了不正确的清除文件,甚至静态逻辑都可能崩溃。直到下一个部分比特文件加载。

配置FPGA的系统设计

在完全配置时需要在下载之前使INIT和PROG信号有效,但是对于部分比特文件配置时,千万不能有效。因为两个信号有效意味着full比特文件。

可以使用ICAP接口下载程序,它与Select MAP一样。ICAP库原语可以在HDL中实例化。

配置帧

配置帧是最小的可寻址的单元。

Base Regions in 7 series FPGAs are:

° CLB: 50 high by 1 wide ° DSP48: 10 high by 1 wide ° Block RAM: 10 high by 1 wide

? Base Regions in UltraScale? FPGAs are: ° CLB: 60 high by 1 wide ° DSP48: 24 high by 1 wide ° Block RAM: 12 high by 1 wide ° I/O and Clocking: 52 I/O (one bank), plus related XiPhy, MMCM, and PLL resources ° Gigabit Transceivers: 4 high (one quad, plus related clocking resources)

一个实际的例子(ug947)

第三步:综合

导航到解压到文件夹,运行脚本,5个都通过后,会产生三个日志文件。 第四步:

第五步:建立floorplan

第六步:实现第一个配置 1.加载顶层约束

read_xdc Sources/xdc/top_io.xdc

此约束设置器件的管脚分配和顶层时序约束。XDC不能通过IDE环境访问到,不会以设计源文件的方式出现。

顶层XDC文件应该只包含关于静态设计的object。 2. 优化,布局布线。 opt_design place_design route_design

3.保存完整设计的checkpoint

write_checkpoint -force Implement/Config_shift_right_count_up/top_route_design.dcp 4.保存每个RM的checkpoint

write_checkpoint -force -cell inst_shift Checkpoint/shift_right_route_design.dcp write_checkpoint -force -cell inst_count Checkpoint/count_up_route_design.dcp

此时,你已经创建了一个完整实现的partial reconfiguration design,可以生成full and partial bitstreams.静态部分可以用于下一步的配置,为了隔离静态设计,需要把RM模块移除。

5.确保资源布线使能,放大一个带有partition pins的interconnect tile. 6.清除RM逻辑

update_design -cell inst_shift -black_box

update_design -cell inst_count -black_box 执行前后的变化是: 完全布线(绿色)减少了;

在Netlist视图中inst_shift和inst_count空了;

7.锁定当前的布局布线

lock_design -level routing

变成虚线了。

8.执行下面的指令保存只有静态的checkpoint

write_checkpoint -force Checkpoint/static_route_design.dcp 第七步:实现第二个配置

1.使用锁定的结果,读取后综合checkpoint

2.优化,布局布线

read_checkpoint -cell inst_shift Synth/shift_left/shift_synth.dcp

read_checkpoint -cell inst_count Synth/count_down/count_synth.dcp opt_design place_design route_design

实现完第二个配置的设计是虚实线结合的设计。虚线表示锁定的布线,实线表示最新的布线。 3.保存full design checkpoint.

write_checkpoint -force Implement/Config_shift_left_count_down/top_route_design.dcp report_utilization -file Implement/Config_shift_left_count_down/top_utilization.rpt

report_timing_summary -file Implement/Config_shift_left_count_down/top_timing_summary.rpt 4. 可选的一步

write_checkpoint -force -cell inst_shift Checkpoint/shift_left_route_design.dcp

write_checkpoint -force -cell inst_count Checkpoint/count_down_route_design.dcp 第八步:检查结果

1.在TCL控制台,发起下列指令

source hd_visual/pblock_inst_shift_AllTiles.tcl

highlight_objects -color blue [get_selected_objects]

2.在Device视图中,点击某处取消选中frames,然后发起下列命令:

source hd_visual/pblock_inst_count_AllTiles.tcl

highlight_objects -color yellow [get_selected_objects] 高亮的tiles代表要去生成partial的配置帧。 3.关闭当前工程 第九步:生成比特文件

1.运行pr_verify命令

pr_verify

Implement/Config_shift_right_count_up/top_route_design.dcp

Implement/Config_shift_left_count_down/top_route_design.dcp

产生比特文件

1. 将第一个配置读进memory

open_checkpoint Implement/Config_shift_right_count_up/top_route_design.dcp 2.产生full和partial比特文件。要注意产生的路径要区分开来。

write_bitstream -file Bitstreams/Config_RightUp.bit

close_project

3.为第二个配置产生full 和partial文件

open_checkpoint Implement/Config_shift_left_count_down/top_route_design.dcp write_bitstream -file Bitstreams/Config_LeftDown.bit

close_project

4.产生带黑箱的full文件,和空的partial文件。空的partial文件可以擦除原有的配置来减少功耗。

open_checkpoint Checkpoint/static_route_design.dcp update_design -cell inst_count -buffer_ports update_design -cell inst_shift -buffer_ports place_design route_design

write_checkpoint Checkpoint/Config_black_box.dcp write_bitstream -file Bitstreams/config_black_box.bit

close_project

基础的配置文件没有任何reconfig分区。update_design命令插入0常量。place_design和route_design命令确保他们的完全实现。

第10步:部分配置 1. 连接好下载线。

2. Flow>Open Hardware Manager 3. Open a new hardware target. 4. Program device. 注意full的时间。

Partially reconfigure the device. 1. Program device. 2. Program device. Description

What configuration modes work with partial reconfiguration?

Solution

Partial reconfiguration is supported through the following configuration interfaces: JTAG

The JTAG interface is dedicated. SelectMAP

If PERSIST is set and the mode is set to slave, the interface remains active. Load the partial reconfiguration bitstream as a typical flow.

If PERSIST is set and the mode is set to master, CCLK runs continuously. This makes controlling the data flow more involved. It is recommended that you use the ICAP interface instead of PERSIST in the master SelectMAP mode.

If PERSIST is not set, you can forward the data to ICAP. You can also use the STARTUP block to drive the CCLK out. See the ICAP section below for more information. Note that you must account for the clock and the data alignment. BPI

BPI supports master mode only. This results in the CCLK being driven and continuous address incrementation. It is recommended that you avoid using PERSIST and that you use the ICAP interface instead to forward the data through the BPI data port. SPI

SPI supports master mode only. This results in the CCLK being driven and no further read commands are issued after configuration. It is recommended that you avoid using PERSIST and that you use ICAP interface instead to forward the data through the BPI data port. ICAP

ICAP is the internal configuration access port. It behaves identically to the slave SelectMAP interface with the exception that SelectMAP has a bi-directional data port while ICAP has dedicated data inputs and outputs. To use ICAP, do not set PERSIST during the bitstream generation process.

术语

configuration

A configuration是一个完整的设计,每个RP分区都有相应的RM模块。在一个Partial Reconfiguration FPGA Project中有很多配置。每个配置都会产生一个full文件加上为每个RM模块产生的partial比特文件。

Configuration Frame

FPGA配置存储器空间最小的可寻址的单元。可重构帧建立在这些底层的离散的单元上。

checkpoint

包含网表,约束和实现中的任何布局布线的数据信息。

eg: The synth_design command synthesizes the design and stores the results in memory. In order to write the results out to a file, use: write_checkpoint .dcp

cell partition

设计的一个逻辑分区。 partition pins

静态逻辑与可重配置逻辑之间的逻辑和物理连接。是自动为可重配置端口创建的。白色的矩形就是。可以是输入,也可以是输出,不可以是双向,除非连接到顶层。

Proxy Logic

RESET_AFTER_RECONFIG

design.tcl文件内容

set tclParams [list hd.visual 1]

#Define location for \set tclHome \if {[file exists $tclHome]} { set tclDir $tclHome

} elseif {[file exists \ set tclDir \} else {

error \valid location.\}

############################################################### ### Define Part, Package, Speedgrade

############################################################### set device \set package \set speed \

set part $device$package$speed

############################################################### ### Setup Variables

###############################################################

####flow control

set run.topSynth 1 set run.rmSynth 1 set run.prImpl 1 set run.prVerify 1 set run.writeBitstream 1

####Report and DCP controls - values: 0-required min; 1-few extra; 2-all set verbose 1 set dcpLevel 1

####Output Directories set synthDir \

set implDir \set dcpDir \set bitDir \

####Input Directories

set srcDir \set rtlDir \set prjDir \set xdcDir \set coreDir \set netlistDir \

####Source required Tcl Procs source $tclDir/design_utils.tcl source $tclDir/synth_utils.tcl source $tclDir/impl_utils.tcl

source $tclDir/hd_floorplan_utils.tcl

############################################################### ### Top Definition

############################################################### set top \set static \add_module $static

set_attribute module $static moduleName $top set_attribute module $static top_level 1

set_attribute module $static vlog [list [glob $rtlDir/$top/*.v]] set_attribute module $static synth ${run.topSynth}

#################################################################### ### RP Module Definitions

#################################################################### set module1 \

set module1_variant1 \set variant $module1_variant1 add_module $variant

set_attribute module $variant moduleName $module1

set_attribute module $variant vlog [list $rtlDir/$variant/$variant.v] set_attribute module $variant synth ${run.rmSynth}

set module1_variant2 \set variant $module1_variant2 add_module $variant

set_attribute module $variant moduleName $module1

set_attribute module $variant vlog [list $rtlDir/$variant/$variant.v] set_attribute module $variant synth ${run.rmSynth}

set module1_inst \

#################################################################### ### RP Module Definitions

#################################################################### set module2 \

set module2_variant1 \set variant $module2_variant1 add_module $variant

set_attribute module $variant moduleName $module2

set_attribute module $variant vlog [list $rtlDir/$variant/$variant.v] set_attribute module $variant synth ${run.rmSynth}

set module2_variant2 \set variant $module2_variant2 add_module $variant

set_attribute module $variant moduleName $module2

set_attribute module $variant vlog [list $rtlDir/$variant/$variant.v] set_attribute module $variant synth ${run.rmSynth}

set module2_inst \

######################################################################## ### Configuration (Implementation) Definition - Replicate for each Config

######################################################################## set config \

add_config $config

set_attribute config $config top $top

set_attribute config $config implXDC [list $xdcDir/${top}.xdc] set_attribute config $config impl ${run.prImpl}

set_attribute config $config settings [list [list $static $top implement] \\

[list $module1_variant1 $module1_inst implement] \\

[list $module2_variant1 $module2_inst implement] \\

] set_attribute config $config verify ${run.prVerify} set_attribute config $config bitstream ${run.writeBitstream}

######################################################################## ### Configuration (Implementation) Definition - Replicate for each Config

######################################################################## set config \

add_config $config

set_attribute config $config top $top

set_attribute config $config implXDC [list $xdcDir/${top}.xdc] set_attribute config $config impl ${run.prImpl}

set_attribute config $config settings [list [list $static $top import] \\

[list $module1_variant2 $module1_inst implement] \\

[list $module2_variant2 $module2_inst implement] \\

] set_attribute config $config verify ${run.prVerify} set_attribute config $config bitstream ${run.writeBitstream}

######################################################################## ### Task / flow portion

######################################################################## # Build the designs source $tclDir/run.tcl exit

效果是:

下载full文件后,LED灯执行两个任务。四盏灯在递增,另外四盏灯在向右移动闪烁。

1.

下载Config_LeftDown_pblock_inst_shift_partial.bit,

向右移动闪烁的四盏灯改变了方向,但是自增闪烁的四盏灯没有变,不受reconfig的影响。 2.

下载

Config_LeftDown_pblock_inst_count_partial.bit, then

此时递增计数闪烁的四盏灯变为递减计数闪烁了,但是移动闪烁的灯不受reconfig的影响。

另外一个例子:

synth_design -flatten_hierarchy rebuilt -top top -part xc7z020

synth_design -mode out_of_context -flatten_hierarchy rebuilt -top shift -part xc7z020

synth_design -mode out_of_context -flatten_hierarchy rebuilt -top count -part xc7z020

Xapp290:

使用FPGA_Editor做小小的改变 更改I/O标准

Block RAM内容(初始值) LUT programing

一些IOB的性质:转换极性的mux, flip-flop的初始化和复位值,上拉下拉,或者block RAM的写模式。

File->Main Progperties,然后选择 Edit Mode变为Read Write。 创建局部重构比特流

-g ActiveReconfig: Yes如果这个开关关闭的话,包含Shutdown和AGHIGH命令的partial 比特文件用于使DONE信号无效。

使用SelectMAP模式的partial Reconfig需要打开-g Persist: Yes开关。

这个开关允许配置完成后依然使用,因此可以继续用于partial Reconfig。-g Persist: Yes设置用于initial 比特流。对于initial bitstream , -g security:none设置必须用。

一个partial Reconfiguration bitstream可以使用其他的BitGen选项,包括-b选项或者-g选项。加密过的bitstream不能被Reconfig。可以用-r开关创建bitstream.

bitgen -g ActiveReconfig:Yes -g Persist:yes -r 例子:

bitgen -g ActiveReconfig:Yes -g Persist:Yes -r and_test.bit and_test2.ncd

and_test2_partial.bit

创建一个partial bitstream来恢复原有的设计

bitgen -g ActiveReconfig:Yes -g Persist:yes -r and_test2.bit and_test.ncd and_test_partial.bit

下载and_test2_partial.bit文件时,and_test配置文件必须已经下载进器件中。建议执行DRC检查除非-d option已经选上了。

UG702

设计需求

PR只支持Planahead或者命令行,不支持Project形式 Floorplanning

需要定义可重配置区域 ? 对齐到时钟区域边界

? bottom-up synthesis(创建多个网表文件),管理多个网表文件。(综合可以选择第三方工

具)

? 强烈建议解耦逻辑

? 如果RESET_AFTER_RECONFIG特性不使能,必须使用local reset ? 支持标准的时序约束

? 不是所有的实现选项都适用于PR。如优化要禁止边界优化。

? In the case of a black box RM (no logic) all partition pin outputs will be driven by a constant

Logic 1. In the case of a logic RM where there are unused partition pins, these outputs will be tied to constants, but the value may be a Logic 0 or a Logic 1. If your design requires a specific value, these ports should be tied off to the required values in the RM.

设计性能

设计性能因设计而异,一般 时钟频率降低10%;

slice利用率不超过80%;

如果可重构区域太小或者非矩形形状,有可能布线不成功

设计考虑

可重构资源 非可重构资源

Some component types can be reconfigured and some cannot. ? Clocks and Clock Modifying Logic must reside in the static region. - Includes BUFG, BUFR, MMCM, PLL, DCM, and similar ? The following components must reside in the static region: - I/O and I/O related components

- Serial transceivers (MGTs) and related components

- Individual architecture feature components (such as BSCAN, STARTUP, XADC, etc.) must remain in the static region of the design

? Global clocking resources to Reconfigurable Partitions are limited, depending on the device and on the clock regions occupied by these Reconfigurable Partitions. See Global Clocking Rules in Chapter 7 for more information.

? IP restrictions may occur due to components used to implement the IP. Examples include:

? ChipScope ICON (BUFG) ? EDK blocks with global buffers ? MIG controller (MMCM)

Reconfigurable Modules must be locally reset to ensure a predictable starting condition after reconfiguration. You can do this manually, or via dedicated GSR events by selecting the RESET_AFTER_RECONFIG feature. For more information, see Reset After Reconfiguration in Chapter 7.

Clock and other inputs to reconfigurable modules should be decoupled to prevent spurious writes to memories during reconfiguration. For more information, see Decoupling Functionality in Chapter 7.

? No bidirectional interfaces are permitted between static and reconfigurable regions, except in the case where there is a dedicated route. For example, a bidirectional I/O buffer (such as IOBUF) in the reconfigurable region routed to a top level I/O pad in the static logic can cross between the reconfigurable region and static logic via a bidirectional interface.

软件工具操作流程

综合 约束

面积约束从左下角到右上角:如

INST “reconfig_red” AREA_GROUP = “pblock_reconfig_red”;

AREA_GROUP “pblock_reconfig_red” RANGE = SLICE_X20Y76:SLICE_X25Y79; INST “reconfig_blue” AREA_GROUP = “pblock_reconfig_blue”;

AREA_GROUP “pblock_reconfig_blue” RANGE = SLICE_X28Y64:SLICE_X33Y67; INST “reconfig_green” AREA_GROUP = “pblock_reconfig_green”;

AREA_GROUP “pblock_reconfig_green” RANGE = SLICE_X20Y50:SLICE_X25Y53;

RP的边界落在CLB的边界上。对于V5器件,遵循这个原则要包含完整CLB。 minX是偶数,maxX是奇数。

分区的引脚

Path A) Static net input to a Partition Pin

Path B) Reconfigurable net output of a Partition Pin Path C) Reconfigurable net input to a Partition Pin Path D) Static net output of a Partition Pin

Paths X, Y and Z) Register-to-register paths that contain a Partition Pin in the path

在创建时序约束之前,需要使用PIN-TPSYNC约束来进行输入输出分组。 语法为:..

例子:

PIN “RP_A.1” TPSYNC = group_RP_A_input; PIN “RP_A.2” TPSYNC = group_RP_A_output;

TPSYNC 用于将那些不是管脚和同步元件的组件定义成同步元件,以便可以利用任意点来作为时序规范的终点和起点。其相应的语法为:

{NET|INST|PIN}“ ob_name” TPSYNC=“ New_part”;

将TPSYNC 约束附加在网线上,则该网线的驱动源为同步点;附加在同步元件的输出管脚上,则同步元件中驱动该管脚的源为同步点;附加在同步元件上,则输出管脚为同步点;附加在同步元件的输入管脚上,则该引脚被定义成同步点。

PIN-TPSYNC组约束支持标准的UCF通配符。例如,有一个输入数据线,可以加入到输入组中,可以通过以下约束:

PIN “RP_A.data*” TPSYNC = group_RP_A_input;

为了给RPA模块的1脚的静态输入网络和重构输出网络创建时序约束,使用: TIMESPEC TS_from_static_to_PP_input = TO “group_RP_A_input” 4.5 ns; TIMESPEC TS_from_PP_input_to_RM = FROM “group_RP_A_input” 4.5 ns;

(特定约束就是用FROM TO约束来定义两个TIMEGROUPs之间的延时,路径的起点和终点可以是PAD、寄存器、锁存器、LUT、RAM及乘法器等。在使用FROM TO约束分析时,工具会考虑Clock Skew因素。因此对于同步路径FROM TO约束就像是对特定路径的周期约束)

xilinx建议所有的往返RP的路径都是同步 的。如果FPGA管脚和RP中的同步元素直连的话,使用OFFSET约束路径。

如果是输入管脚驱动RP中的同步元素,使用OFFSET IN约束。 OFFSET = IN 3 ns VALID 8 ns BEFORE “clk”;

如果RP中的同步元素驱动输出管脚,使用OFFSET OUT约束。 OFFSET = OUT 5 ns AFTER “clk”;

将FPGA输入输出管脚与Partition pins直接相连,效果不是最佳,Partition Pins由组合逻辑组成,增加了路径延迟。Partition Pins禁止IOB packing。

虽然Partition Pins物理上在RR区域,逻辑是属于static逻辑,任何关于他们的约束都应该放在顶层UCF文件中。

实现

ngdbuild -sd ../red_fast -sd ../blue_fast –sd ../green_fast -uc ../UCF/design.ucf ../Static/top.edf FFF.ngd

map -w -o FFF_map.ncd FFF.ngd FFF.pcf par -w FFF_map.ncd FFF.ncd FFF.pcf 不能用的选项: -global_opt

-power high & xe BoundaryOpt属性 SmartGuide

RP面积组比平坦设计的面积组需要的面积大; RP布线有可能因为3个约束导致布线失败;

产生比特文件

报告

Build报告 布局报告

资源使用情况;各分区的资源利用率;

布线报告 TRACE报告 Bitgen报告

PlanAhead流程

Open the Netlist Design

Open Synthesized Design

定义可重构实例

1设置一个分区是可重构的 2 3 4 5

添加可重构模块到工程中

Add a Reconfigurable Module to a Reconfigurable Partition 也可以添加黑匣子

使用Add Reconfigurable Module命令,但是选择添加黑匣子选项。 定义PR区域

Set Pblock Size设置物理区域大小。 应用Reset After Reconfiguration属性

如果Static和RM是从其他配置导入的,那么就不能promoted。

创建比特文件

? fff.bit

? fff_reconfig_blue_blue_fast_partial.bit ? fff_reconfig_red_red_fast_partial.bit ? fff_reconfig_green_green_fast_partial.bit

命令行脚本 配置

? Base regions in 7 series FPGAs are 50 CLBs high by 1 CLB wide. ? Base regions in Virtex-6 FPGAs are 40 CLBs high by 1 CLB wide. ? Base regions in Virtex-5 FPGAs are 20 CLBs high by 1 CLB wide. ? Base regions in Virtex-4 FPGAs are 16 CLBs high by 1 CLB wide.

局限性

No Spartan ? device families are supported by Partial Reconfiguration software

本文来源:https://www.bwwdw.com/article/lueo.html

Top