The road to learning tcl (3) (vivado design resource management)

Management resource elements

  When building a project in project mode, there are usually four file sets: sources_1 constrs_1 sim_1 utils_1. They contain Vivado's design resources, which include: HDL code, netlist files, IP files, BD files (based on IP integrator, which can be understood as the IP core of the CPU core), constraint files, auxiliary files, etc.

#该命令可以获取当前工程下的文件集
get_filesets

1Manage HDL code

#以获得.v文件为例 -of全称为-of_objects
set verilog_files [get_files -of [get_filesets sources_1] *.v]
#通常get_files还有两个选项-compile_order和-used_in,两者必须同时使用.
get_files -compile_order sources -used_in synthesis -of [get_filesets sources_1]
#该语句的意思为:获取文件集sources_1内在综合阶段(由-used_in限定)使用的文件,并将其用vivado编译顺序排列(由-compile_order限定)。 -compile_order有两个选择 sources和constraints(约束)
#查看文件属性
report_property -class file
#选中文件的所有属性
report_property -all [get_selected_objects]
#正则表达式匹配(匹配所有带TYPE的属性)
report_property [get_selected_objects] -regexp .*TYPE
#获取所有属性名
list_property [get_selected_objects]
#获取属性值以CLASS为例
get_property CLASS [get_selected_objects]
#如果想改变文件的语法类型,在project和Non-project模式下有以下方法
#project
set_property -file_type {
    
    VHDL 2008} [get_files C:/myuram.vhd]
set_property -file_type SystemVerilog [get_files C:/myuram.v]
#Non-project
read_verilog -sv ./my.v
read_vhdl -vhdl2008 ./my.vhd
#可以通过属性筛选出目标文件
get_files -of [get_filesets sources_1] -filter {
    
    FILE_TYPE=="Verilog Header"}

2 Management constraint files

  There are five types of constraint files, namely: timing constraint files, pin constraint files, debugging constraint files, position constraint files, and constraint files for a certain module. Among them, the first two are necessary constraint files.
  The method of obtaining attributes and attribute values ​​is similar to 1.1

#设置为目标约束文件
set_property target_constrs_file C:/Sources/xdc/wave_gen_pins.xdc [current_fileset -constrset]

3 Manage IP files

#在生成IP核时,可以使用如下语句来创建.xcix文件
set_property coreContainer.enable 1 [current_project]
#在生成.xci文件后,想要转化为.xcix文件
convert_ips [get_files C:/IP/char_fifo/char_fifo.xci]
#生成ip状态报告
report_ip_status -name ip_status
#更新ip
upgrade_ip [get_ips]
#使用如下语句可以生成一个可以重建IP的tcl脚本
write_ip_tcl [get_ips mmcm] -force ./mmcm.tcl
write_ip_tcl -ip_name mmcm1 [get_ips mmcm] -force ./mmcm1.tcl
write_ip_tcl [get_ips] -force
write_ip_tcl multiple_files [get_ips] -force
#复制ip
copy_ip name mmcm1 [get_ips mmcm]
#查看ip是否被锁
get_property IS_LOCKED [get_ips mmcm]
#ip被锁的一些原因
1.ip文件是只读的
2.ip版本发生变化
3.ip没有独立的文件目录
4.芯片型号已改
5.没有该ip许可证

Guess you like

Origin blog.csdn.net/weixin_44126785/article/details/131932640