笔记同步在我的个人网站进行更新,欢迎来访查看。
这篇博客将以一个demo为例介绍如何使用OpenFPGA Shell。
首先进入OpenFPGA/openfpga
,输入 ./openfpga -i
启动交互模式:
(1)使用 vpr,生成对应FPGA架构的基准电路的网表文件:
# Run VPR for the 'and' design
vpr ../openfpga_flow/vpr_arch/k6_frac_N10_tileable_40nm.xml ../openfpga_flow/benchmarks/micro_benchmark/and2/and2.blif --clock_modeling route
这里生成的文件会直接保存在OpenFPGA/openfpga
目录下,目前我还不知道如何去设置输出目录的路径,等知道了再更新,这里我是手动整理的:
(2)读取适用于 openfpga的架构描述文件:
# Read OpenFPGA architecture definition
read_openfpga_arch -f ../openfpga_flow/openfpga_arch/k6_frac_N10_40nm_openfpga.xml
(3)继续读取 openfpga的仿真设置文件:
# Read OpenFPGA simulation settings
read_openfpga_simulation_setting -f ../openfpga_flow/openfpga_simulation_settings/auto_sim_openfpga.xml
(4)将openfpga架构文件链接到vpr架构文件上,并设置 activity_file,此文件在运行 yosys flow时会用到:
# Annotate the OpenFPGA architecture to VPR data base
# to debug use --verbose options
link_openfpga_arch --activity_file ../openfpga_flow/benchmarks/micro_benchmark/and2/and2.act --sort_gsb_chan_node_in_edges
(5)检查并修正基准电路网表中的命名冲突,结果保存到 netlist_renaming.xml
文件中
# Check and correct any naming conflicts in the BLIF netlist
check_netlist_naming_conflict --fix --report ./netlist_renaming.xml
(6)生成模块图,这里添加了参数--compress_routing
,作用是压缩路由模块,可以极大减小网表大小
# Build the module graph
# - Enabled compression on routing architecture modules
# - Enable pin duplication on grid modules
build_fabric --compress_routing
(7)将FPGA Fabric图写入到指定文件中
# Write the fabric hierarchy of module graph to a file
# This is used by hierarchical PnR flows
write_fabric_hierarchy --file ./fabric_hierarchy.txt
类似于将.v文件导入vivado,自动生成的模块层次
(8)生成该架构FPGA Fabric的Verilog网表(实际上就是所有模块的verilog代码)
# Write the Verilog netlist for FPGA fabric
# - Enable the use of explicit port mapping in Verilog netlist
write_fabric_verilog --file ./SRC --explicit_port_mapping --include_timing --print_user_defined_template --verbose
至此从输入VPR架构文件,基准电路文件,openfpga的架构文件和仿真设置文件,到最终FPGA Fabric Verilog网表文件的生成 整个流程都完成了。
输入exit 退出 openfpga_shell。