Command Reference 2. Synopsys Commands current_instance
NAME
current_instance
Sets the working instance object in
dc_shell. current_instance enables
other commands to be used on a specific
cell in the design hierarchy.
SYNTAX
string current_instance [instance]
string instance
ARGUMENTS
instance Specifies the working cell in dc_shell.
If instance is not specified, the focus
returns to the top level of the
current_design hierarchy. If instance
is ".", dc_shell returns to the working
instance. If instance is "..", the
context is moved up one level in the
instance hierarchy. If instance begins
with "/", dc_shell returns to the
working instance of the design whose
name is after the "/". More complex
examples of instance arguments are
described below in EXAMPLES.
DESCRIPTION
Sets the working instance in dc_shell. An instance is
a cell embedded in the hierarchy of a design. Usually,
you define an instance to set or get attributes on a
cell.
To display the instances available at the current level
of design hierarchy, use list_instances.
current_design changes the working design, setting the
current instance to the top level of the new current
design.
current_instance traverses the design hierarchy similar
to the way the UNIX "cd" command traverses the file
hierarchy. current_instance operates with a variety of
instance arguments.
⊕ If no instance argument is specified, the focus of
dc_shell is returned to the top level of the hierarchy.
⊕ If instance is ".", the current instance is returned
and no change is made.
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-1
current_instance 2. Synopsys Commands Command Reference
⊕ If instance is "..", the current instance is moved up
one level in the design hierarchy.
⊕ If instance is a valid cell at the current level of
hierarchy, the current instance is moved down to that
level of the design hierarchy.
⊕ Multiple levels of hierarchy can be traversed in a
single call to current_instance by separating multiple
cell names with slashes.
For example, current_instance U1/U2 sets the current
instance down two levels of hierarchy if both cells
exist at the current levels in the design hierarchy.
⊕ The ".." directive can also be nested in complex
instance arguments.
For example, the command current_instance
"../../MY_INST" attempts to move the context up two
levels of hierarchy, then down one level to the
"MY_INST" cell.
By default, the dc_shell prompt is "dc_shell> ". The
prompt can be set to show the working instance. If you
embed the string "$CI" in the value of the variable
shell_prompt, the working instance is shown as part of
the dc_shell prompt. The command to set shell_prompt
in this case is:
shell_prompt = "dc_shell$CI> "
For the shell_prompt assignment to take effect from the
beginning of a dc_shell session, define this variable
in your .synopsys_dc.setup file.
EXAMPLES
The following example uses current_instance to move up
and down the design hierarchy and list_instances to
show the available instances at each point in the
hierarchy.
dc_shell> current_design .
Current design is 'TOP'.
dc_shell> list_instances
U1 (ADDER) U2 (SUBTRACTOR)
dc_shell> current_instance U1
2-2 Synopsys Inc. 1988-1994. All rights reserved. V3.1
Command Reference 2. Synopsys Commands current_instance
Current instance is 'TOP/U1'.
dc_shell> current_instance "."
Current instance is 'TOP/U1'.
dc_shell> list_instances
U1 (FULL_ADDER) U2 (FULL_ADDER) U3 (FULL_ADDER) U4 (FULL_ADDER)
dc_shell> current_instance U3
Current instance is 'TOP/U1/U3'.
dc_shell> current_instance "../U4"
Current instance is 'TOP/U1/U4'.
dc_shell> current_instance
Current instance is the top-level of design 'TOP'.
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-3
current_instance 2. Synopsys Commands Command Reference
In the following example, changing the current_design
resets the current_instance to the top level of the new
design hierarchy.
dc_shell> current_design
Current design is 'TOP'.
dc_shell> current_instance "U2/U1"
Current instance is 'TOP/U2/U1'.
dc_shell> current_design ADDER
Current design is 'ADDER'.
dc_shell> current_instance .
Current instance is the top-level of design 'ADDER'.
The next example shows how to modify the variable
shell_prompt to show the current context in the
dc_shell prompt. Set the shell_prompt in your
.synopsys_dc.setup file.
dc_shell> list shell_prompt
shell_prompt = "dc_shell> "
dc_shell> current_instance .
Current instance is 'EXAMPLE/U77/BLAT'.
dc_shell> shell_prompt = "dc_shell$CI> "
"dc_shell$CI> "
dc_shell EXAMPLE/U77/BLAT> current_design TOP
Current design is 'TOP'.
dc_shell TOP>
The following example uses current_instance to go to an
instance of another design. The current_design is set
by the new design whose name is the name after the
first slash of the given instance name.
dc_shell> current_design .
Current design is 'TOP'.
dc_shell> current_instance U1
Current instance is 'TOP/U1'.
dc_shell> current_instance "/TOP/U2"
2-4 Synopsys Inc. 1988-1994. All rights reserved. V3.1
Command Reference 2. Synopsys Commands current_instance
Current instance is 'TOP/U2'.
dc_shell> current_instance "/ALARM_BLOCK/U6"
Current instance is 'ALARM_BLOCK/U6'.
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-5
current_instance 2. Synopsys Commands Command Reference
SEE ALSO
current_design(2), list_designs(2), list_instances(2),
find(2); shell_prompt(3).
2-6 Synopsys Inc. 1988-1994. All rights reserved. V3.1