在 vivado 中如何获取名为 bigfifo.sv 的文件的完整路径?
当我在 TCL 提示符下运行 get_files 时,它只会打印项目中所有文件的完整路径的长列表。
答案就在这里,在 get_files 的缺失和“逆向工程”命令参考中:
Vivado get_<object> -filter
-filter 选项在许多 Vivado
get_*
命令上可用,可根据对象的属性过滤返回的结果。
基本语法是:
get_<objects> [-filter <expression>]
其中
<expression>
是应用于返回对象的过滤表达式。
过滤表达式可用于匹配和比较对象的属性:
逻辑/数字/布尔运算符:
# Logical: ! == != && ||
# Numeric: == < <= > >=
# Boolean: true false
get_cells -filter {REF_NAME == FD}
get_nets -filter {FANOUT > 100 && IS_GLOBAL == false}
字符串匹配
# exact string match
get_files -filter {NAME =~ C:/myproj/abc.vhd}
#wildcard match
get_files -filter {NAME =~ */files.*}
#regexp match
get_files -filter -regexp {NAME =~ .*/abc/.*/}
#case insenstive match
get_files -filter -nocase {NAME =~ files/MyFileCrazyCase.VhDl}
不是字符串
# Files that do not contain abc
get_file -filter {NAME !~ *abc*}
# Example procedure to find an objects properties
tcl> set alist [get_files]
tcl> report_property [lindex $alist 0]
Property Type Read-only Value
CLASS string true file
CORE_CONTAINER string true
FILE_TYPE enum false VHDL 2008
IS_AVAILABLE bool true 1
IS_ENABLED bool false 1
IS_GENERATED bool true 0
IS_GLOBAL_INCLUDE bool false 0
IS_NGC_WRAPPER bool true 0
LIBRARY string false work
NAME string true C:/myproj/myfile.vhd
NEEDS_REFRESH bool true 0
PATH_MODE enum false RelativeFirst
USED_IN string* false synthesis simulation
USED_IN_SIMULATION bool false 1
USED_IN_SYNTHESIS bool false 1
例如:
NAME
属性始终与完整的层次结构名称匹配。
像
IS_PRIMITIVE
这样的布尔属性可以直接使用,无需显式比较:
get_cells -filter IS_PRIMITIVE
使用括号对表达式进行分组:
get_cells -filter {(REF_NAME =~ *FD*) && !(IS_PRIMITIVE)}
可以添加
-regexp
选项来启用过滤表达式中的正则表达式匹配:
get_cells -filter -regexp {REF_NAME =~ .*FD.*}
可以添加
-nocase
选项来执行不区分大小写的匹配:
get_cells -filter -regexp -nocase {NAME =~ .*validfor.*}
默认情况下
-filter
过滤当前层次结构级别的对象。
添加
-hierarchical
以跨所有级别分层过滤对象:
get_cells -hierarchical -filter {IS_PRIMITIVE}
filter
命令可以过滤任何Tcl集合,包括之前从get_*
返回的结果:
set allCells [get_cells]
set primCells [filter $allCells IS_PRIMITIVE]
总而言之,
-filter
是一种根据对象属性从 Vivado 数据库过滤结果的强大方法。过滤表达式语法提供了许多灵活的方法来选择对象。
get_files
检索当前项目中与指定搜索模式匹配的文件列表。默认行为是检索项目中的所有文件。使用命令参数根据需要过滤和自定义输出。
get_files
[-regexp]
[-nocase]
[-filter <arg>]
[-compile_order <arg>]
[-used_in <arg>]
[-references]
[-all]
[-of_objects <args>]
[-quiet]
[-verbose]
[<patterns>]
文件对象列表。
当然!下面是一个综合表,其中包含 Vivado 中
get_files
命令的所有参数及其描述:
论证 | 描述 |
---|---|
|
将模式解释为完整的正则表达式。 |
|
执行不区分大小写的匹配。 )仅对 -regexp 有效) |
|
使用表达式过滤列表。 |
|
按类型和编译顺序获取文件。 (必须与-used_in一起使用) |
|
获取特定步骤中使用的文件。 (必须与-compile_order一起使用) |
|
获取提供的对象中引用的文件。 (必须与 -of_objects 一起使用。) |
|
包括所有内部文件。 |
|
获取特定类型的“文件”对象。仅对文件类型有效:file、fileset、ip、reconfig_module |
|
抑制命令错误。 |
|
命令执行期间暂停消息限制。 |
|
将文件名与模式进行匹配。 (默认:*。) |
-
获取仿真中使用的VHDL文件:
get_files -filter {FILE_TYPE == VHDL && USED_IN =~ simulation*}
获取仿真中使用的源文件:
get_files -compile_order sources -used_in simulation
获取与综合中使用的特定IP核关联的文件:
get_files -compile_order sources -used_in synthesis -of [get_files ip.xci]
从特定文件集中获取文件:
get_files -of [get_filesets {sources_1 constrs_1}]
在不知道项目中的完整路径的情况下查找特定文件:
set file_obj [get_files -filter {NAME =~ */mycool.bd}
列出所有 vhdl 文件
set files_vhdl [get_files -filter {NAME =~ */*.vhd}]
foreach f $files_vhdl {puts $f}
CLASS string true file
CORE_CONTAINER string true
FILE_TYPE enum false VHDL 2008
IS_AVAILABLE bool true 1
IS_ENABLED bool false 1
IS_GENERATED bool true 0
IS_GLOBAL_INCLUDE bool false 0
IS_NGC_WRAPPER bool true 0
LIBRARY string false work
NAME string true C:/myproj/myfile.vhd
NEEDS_REFRESH bool true 0
PATH_MODE enum false RelativeFirst
USED_IN string* false synthesis simulation
USED_IN_SIMULATION bool false 1
USED_IN_SYNTHESIS bool false 1
report_compile_order
report_property