使用windows命令行和tcl脚本创建Vivado工程

创建工程需要的文件:

1:工程所需要的源代码和自定义IP文件库;

2.bat文件,用于在windows下面直接调用vivado编译工程;

auto.bat文件的创建过程是,新建一个记事本,然后另存为.bat文件即可,下面为.bat文件的内容

path %psth%;D:\Xilinx_2019.2\Vivado\2019.2\bin
start "C:\Windows\System32\cmd.exe" 
@echo Produce the vivado project.

set cache_floder=.Xil
cd  %~dp0
if exist %~dp0%cache_floder% ( 
    echo The floder is exist.
    pause
) else (
    vivado -source create_design.tcl
)
exit

注:a.当电脑中安装了几个vivado的版本时,需要用path指令指定编译的vivado版本的路径。

b.if else 语句的意思是,如果当前目录中存在.Xil文件,就暂停编译,是为了防止工程已经建立了的情况下又去创建一次。

3.create_design.tcl文件,为创建工程需要的脚本。下面以创建一个小的子系统为例。

# Script Parameters
#
#
set prj_name      "prj_zc706_xrf2_eg_hw"
set board         "xilinx.com:zynq:zc706:1.1"
set top_bd_design zynq_1

# Main Script
#
#

# create project
create_project -force $prj_name "./$prj_name"
set_property board $board [current_project]

# set up IP Repositories
set repo_paths [list \
	       ../dfe_ip \
	      ]
set_property ip_repo_paths $repo_paths [current_fileset]
update_ip_catalog -rebuild


# source block design tcl script
#
# changes to the block design can be saved using write_bd_tcl command
source -notrace zynq_1_bd.tcl

# switch to global rather than out-of-context synthesis
# (this is quicker if starting a fresh design)
set_property synth_checkpoint_mode None [get_files zynq_1.bd]

# additional clock constraints
set_property CONFIG.FREQ_HZ 153600000 [get_bd_pins /RFISS0/RFIF_1/dfe_jesd_io_0/phy_fabric_refclk]

# add constraints
import_files [glob *.xdc]

# make hdl wrapper for block design
#
#
make_wrapper -files [get_files ${top_bd_design}.bd] -top
add_files -norecurse ${prj_name}/${prj_name}.srcs/sources_1/bd/${top_bd_design}/hdl/${top_bd_design}_wrapper.vhd

# stop here (if not implementing)
#error "stopping here pre-synthesis"

# run synthesis
reset_run impl_1
launch_runs synth_1
wait_on_run synth_1

# stop here
#error "stopping here: pre-implementation"

# generate bitstream
launch_runs impl_1 -to_step write_bitstream
wait_on_run impl_1



注:a.如果工程中创建了block_diagram,那需要准备bd.tcl的文件,如果bd模块较多较复杂,可以通到vivado工具倒推bd.tcl的文件。

上面的文件都准备齐全后,双击auto.bat文件,就可以创建vivado工程啦。

你可能感兴趣的:(vivado,fpga开发)