Object Names and the NAME Property - 2024.1 English

Vivado Design Suite User Guide: Using Tcl Scripting (UG894)

Document ID
Release Date
2024.1 English

While some Tcl commands expect a design object, other commands might expect a string input. The Vivado Design Suite has been implemented to allow design objects to be passed directly to Tcl commands, even those expecting a string argument. In this case, the hierarchical name of the design object is passed to the Tcl command as a string. There is no need to access the NAME property of the object to pass it to the Tcl command.

For example in the following regexp command, both IF statements are equivalent, because in both cases the Tcl interpreter is passed the name of the object:

if {[regexp {.*enable.*} $MyObject]} { ... }
if {[regexp {.*enable.*} [get_property NAME $MyObject]]} { ... }

In this example, the first expression is not only easier to read than the second expression, it also runs much faster than the second, because it does not have to access and return the properties on the object. The get_property command in the second statement causes the Vivado tools to iterate between the Tcl interpreter and the underlying C++ application code to access and return the object properties. If this is done in a looping construct, for multiple objects, it can significantly increase the runtime for your Tcl script.