While some Tcl commands expect a design object, other commands may 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 in order to pass it to the Tcl command.
For example in the following regexp
command, both IF statements are equivalent, since 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
will also run much faster than the second, since it does not have to access and return
the properties on the object. The get_property
command in the second
statement will cause 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 run time for your Tcl script.