Set or get the current instance
Syntax
current_instance [‑quiet] [‑verbose] [<instance>]
Returns
instance name
Usage
Name | Description |
---|---|
[-quiet]
|
Ignore command errors |
[-verbose]
|
Suspend message limits during command execution |
[<instance>]
|
Name of instance |
Description
Set the current instance in the design hierarchy to the specified instance cell or to the top of the current design. By default, current_instance
points to the top module of the current_design
, which is not an instantiated cell object. You can also set current_instance
to reference an instantiated hierarchical cell in the design.
current_instance
returns an empty string rather than a design object, when set to the top-level of the current design.The current design and current instance are the target of most of the commands and design changes you will make. The current design can be defined using the current_design
command.
You must specify the <instance> name relative to the currently defined instance, and use the established hierarchy separator to define instance paths. You can determine the current hierarchy separator with the get_hierarchy_separator
command.
Use '..' to traverse up the hierarchical instance path when specifying the current instance.
This command returns the name of the design object of the current_instance, or returns nothing when set to the top of current design.
Arguments
-quiet
- (Optional) Execute the command quietly, returning no messages from the command. The command also returns TCL_OK regardless of any errors encountered during execution.
-verbose
- (Optional) Temporarily override any message limits and return all messages from this command.
set_msg_config
command.- The <instance> is specified relative to the presently defined current instance, using the defined hierarchy separator.
- Use '..' to move up one level of the hierarchy relative to the current instance.
- If the <instance> argument is omitted, the current instance is reset to the top module in the design hierarchy.
- If the <instance> is specified as '.' then the name of the current instance is returned, and the instance is not changed.
Examples
current_instance
INFO: [Vivado 12-618] Current instance is the top level of design 'netlist_1'.
current_instance [lindex [get_selected_objects] 0]
get_selected_objects
returns a list, even of one object, so you must use lindex
to specify an object from that list.set_hierarchy_separator |
current_instance ..|cpu_iwb_dat_o|buffer_fifo
current_instance .
cpuEngine|cpu_iwb_dat_o|buffer_fifo