step1:使用creat_project指令创建一个项目设计,产生这个项目的目录,以及有关的子目录。
具体使用的指令是create_project tcl_first //这里的tcl_first是你的项目名称。
在你建好的项目中,有.xpr,.data,.srcs和.runs的目录。其中.xpr和.data保存着全部项目管理的信息和状态。在.srcs目录下的就是源文件:rtl(verilog,vhdl,system verilog);ip核(利用import_file指令将文件放到source_1的目录下,或者add file);约束文件集在constrs_1:包含设计所需的全部约束文件(时序约束和物理约束);仿真文件:testbench和测试案例。使用get_filesets指令可以找到文件集,利用get_files指令可以找到文件。
step2:项目运行管理器:输出文件的位置:directory。
利用的工具:flow。
综合运行:xst可以作为综合工具。
运行之后可以在tcl看要求的特性:get_property。
以上是一些可能用到的指令。
利用creat_run指令产生运行,synth_1和impl_1的运行是自动产生的。
利用set_property设置运行对象的特性来配置运行。利用launch_runs指令启动运行,利用-next_step或-to_step选项可以控制哪个步骤运行。
利用-pre_launch_script指令和-post_launch_script选项可以在进程进行之前或之后运行tcl脚本。
利用reset_runs指令可以进行复位运行。
利用wait_on_run指令主要的vivado设计套件的进程可以等待一个运行完成。
使用open_design可以看你的设计!
step3:约束管理: 当使用launch_runs的时候启动一个进程,后台在开始之前读入约束。在交互模式下,约束存放在存储器中,可以利用report_time和report_summmary产生时序报告。
step4:进入实战,了解了这么多概念,接下来试试利用基于项目的设计流程通过产生设计项目,添加源文件,设置项目变量进行进程特性和实现设计项目四个步骤实现wavegen项目。
利用tcl
修改tcl文件
在指定位置添加tcl命令
产生设计项目
do_build.tcl
#source $script_dir / create_proj.tcl
create_proj.tcl
create_project wave_gen -part $device
set_property
target_language verilog [current_project]
添加源文件
do_build.tcl
#source_files $script_dir/load_files.tcl
load_files.tcl
import_files [glob $src_dir / *]
import_files -fileset [get_fileset constrs_1] $xdc_dir / wave_gen_timing.xdc
get_timing.xdc
设置项目变量
do_build.tcl
#source $ script_dir/set_props.tcl
进行进程特征
set_props.tcl
set_property steps.synth_design. args. flatten_hierarchy full [get_runs synth_1]
实现设计项目
do_build.tcl
#source $ script_dir/implement.tcl
implement.tcl
wait_on_run synth_1
do_build.tcl文件:
# this script will form the basis of a repeatable, scripted build process
# that can be used to generate complete projects.
#
# while completely scripted, the end result is an vivado project that can be
# viewed and even manipulated by the vivado ide.
#
# this script will
# - create a new directory for the build
# - the name will be build_yymmdd_hhmmss where yymmdd_hhmmss is the
#
current time
# - change directory into that directory
# - create a new vivado project
# - set the main project properties for the target device
# - load all the # source files
# - set appropriate process properties
# - implement the design
#
# get the current date/time. the result is a machine readable version of the
# the date/time (number of seconds since the epoch started)
set time_raw [clock seconds];
# format the raw time to a date string
set date_string [clock format $time_raw -format %y%m%d_%h%m%s]
# set the directory name to be build_yymmdd_hhmmss
set proj_dir build_$date_string
# create the new build directory
puts creating build directory $proj_dir
file mkdir $proj_dir
# the remaining tcl scripts live in this directory. remember
# the path before we change directories
set script_dir [pwd]
set src_dir [pwd]/wave_gen/src
set core_dir [pwd]/wave_gen/cores
set xdc_dir [pwd]/wave_gen/constraints
# change directories to the new build directory
puts changing directory to $proj_dir
cd $proj_dir
# source the script that will create the new project
source $script_dir/create_proj.tcl
# source the script that will imports all the files required for the build
source $script_dir/load_files.tcl
# source the script that will set all the process properties necessary
source $script_dir/set_props.tcl
# source the script that will regenerate the cores and run the implementation
# process
source $script_dir/implement.tcl
以上是tcl的模板,根据上面step4的要求对这个进行修改。
》在命令行中找到你装的vivado的当前目录:比如-> cd d:xilinxvivado2014.2
》接着输入64位的 os用户,输入.settings64.bat
》接着到你的tcl的目录下,在命令行输入:vivado - mode tcl -source do_build.tcl(若发现错误,那就再运行一次)
》如果成功,你就可以看到:
我这里看到有以下的warning:
好像说的是有新版本。
》在vivado后面输入start_gui。
》看看project setting那里选的板子有没有错误。然后在tcl console那里输入stop_gui。在命令行那里输入exit。
对于create_proj.tcl的修改:以下tcl是用来选板子型号和源文件的语言。我的板子是zynq-7000,所以就把下面的device那里修改了一下!这个tcl完成的是项目的创建工作!
# this script sets the project variables for the kintex7 device
# assign part to device variable
set device xc7k70tfbg484-2
# create the project
puts creating new project: wave_gen
# insert the command to create the project here
create_project wave_gen -part $device
# insert the command to set the target language for the project here
set_property target_language verilog [current_project]
修改完保存退出,然后在命令行执行do_build.tcl,接着打开vivado的gui看到板子的型号已经改了。
对于load_files.tcl,这个是用来添加源文件的tcl。
import_files [glob $src_dir/*]
这个把rtl加了进去。
import_files -fileset [get_filesets constrs_1] $xdc_dir/wave_gen_timing.xdc
这个把约束加了进去。
import_ip -files $core_dir/char_fifo.xci -name char_fifo
加入了ip核,这里会有warning的话就根据给的提示,去vivado那里看看版本问题。
create_ip -name clk_wiz -version 5.1 -vendor xilinx.com -library ip -module_name clk_core
这个是增加了时钟。
具体代码如下:
# this script loads all the files required by the project
puts adding rtl files to the project
# insert the command to import the rtl files form $src_dir here
import_files [glob $src_dir/*]
puts importing xdc file to the project
# insert the command to import the xdc file form $xdc_dir here
import_files -fileset [get_filesets constrs_1] $xdc_dir/wave_gen_timing.xdc
puts importing char_fifo ip to the project
import_ip -files $core_dir/char_fifo.xci -name char_fifo
puts adding clk_core ip to the project
create_ip -name clk_wiz -version 5.1 -vendor xilinx.com -library ip -module_name clk_core
set_property -dict [list config.component_name {clk_core} config.prim_source {differential_clock_capable_pin} config.prim_in_freq {200.000} config.clkout2_used {true} config.clkout1_requested_out_freq {200.000} config.clkout2_requested_out_freq {193.750}] [get_ips clk_core]
对于配置文件,set_props修改如下:
# this script overrides some process properties. only those that need to be set
# differently from the defaults will be set here
puts setting synthesis and implementation properties
puts setting flatten hierarchy property for synth_1 run
# insert a command to change flatten_hierarchy property to full
set_property steps.synth_design.args.flatten_hierarchy full [get_runs synth_1]
puts enable power optimization for impl_1 run
set_property steps.power_opt_design.is_enabled true [get_runs impl_1]
最后是实现设计项目:
implement.tcl:
# synthesize and implement the design
puts synthesizing the design
# insert the command to launch synthesis run here
launch_runs synth_1
puts wait until synthesis done
# insert the command to wait on synth_1 run here
wait_on_run synth_1
puts implementing the design
launch_runs impl_1
puts wait until implementation done
wait_on_run impl_1
科创赋能!海南无人机科技企业新春表演荣登央视新闻报道
生而独立 贯穿未来 紫光展锐2022智能穿戴沙龙成功举办
诺基亚X6怎么样 值不值得买
【大大芯方案】戴口罩也能智能识别,大联大推出基于耐能产品的3D AI脸部辨识门禁系统方案
实现故障自愈要攻克的3个问题以及开箱即用的方案
FPGA开发之Tcl的基于项目设计
人造购物节的狂欢下,电商收入或将继续保持高位
智慧消防管理云平台在社会消防单位管理中的应用分析
计算机CPU散热的重要性与初略了解
央行预测:领跑数字货币的五大国家
ARM处理器体系结构概述
浪潮云将以“云底座”搭建教育信息化快车道
一文解析AUTOSAR CAN网络管理
电磁流量计的组成及基本原理
普通电阻触摸屏多点触摸低成本解决方案
工信部发布2020年7月通信业运行情况
物联网落实到现实世界:智能交通成长动能最强
斯普奥汀隔空无线充电解决方案正式亮相MWC
TI推出SWIFT同步降压稳压器TPS54061
国家发改委对电网企业实施留抵退税政策,5月1日开始执行