You are on page 1of 59

Database Access with DBTCL

(dbGet, dbSet, dbSchema,


dbTransform, dbQuery)
Version 11
Lab Manual

April, 2012

ii1990-2010 Cadence Design Systems, Inc. All rights reserved.


Printed in the United States of America.
iiCadence Design Systems, Inc., 2655 Seely Avenue, San Jose, CA 95134, USA

iiCadence Trademarks
iiTrademarks and service marks of Cadence Design Systems, Inc. (Cadence) contained in this document are attributed to Cadence with the appropriate
symbol. For queries regarding Cadence trademarks, contact the corporate legal department at the address above or call 800.862.4522.
iiAllegro
iiAccelerating Mixed Signal Design
iiAssura

iiSKILL

iiInstallScape

iiSoC Encounter

iiIP Gallery

iiSourceLink online customer support

iiNanoRoute

iiBuildGates

iiCadence

iiSpecman

iiNC-Verilog

iiSpectre

iiNeoCell

iiSpeed Bridge

iiUltraSim

iiNeoCircuit

iiConformal

iiOpenBook online documentation library

iiConnections

iiVerifault-XL

iiOrCAD

iiDiva

iiDracula

iiCeltIC

iiSilicon Express

iiIncisive

iiVerification Advisor

iiPalladium

iiElectronStorm

iiVerilog

iiPearl

iiVirtuoso

iiPowerSuite

iiEncounter

iiVoltageStorm

iiPSpice

iiEU CAD

iiXtreme

iiSignalStorm

iiFire & Ice

iiFirst Encounter
iiHDL-ICE

iiSilicon Design Chain


iiSilicon Ensemble

Other Trademarks
Open SystemC, Open SystemC Initiative, OSCI, SystemC, and SystemC Initiative are trademarks or registered trademarks of Open SystemC Initiative,
Inc. in the United States and other countries and are used with permission.
All other trademarks are the property of their respective holders.

Confidentiality Notice
No part of this publication may be reproduced in whole or in part by any means (including photocopying or storage in an information storage/retrieval
system) or transmitted in any form or by any means without prior written permission from Cadence Design Systems, Inc. (Cadence).
Information in this document is subject to change without notice and does not represent a commitment on the part of Cadence. The information
contained herein is the proprietary and confidential information of Cadence or its licensors, and is supplied subject to, and may be used only by
Cadence customers in accordance with a written agreement between Cadence and its customers. Except as may be explicitly set forth in such
agreement, Cadence does not make, and expressly disclaims, any representations or warranties as to the completeness, accuracy or usefulness of the
information contained in this document. Cadence does not warrant that use of such information will not infringe any third party rights, nor does
Cadence assume any liability for damages or costs of any kind that may result from use of such information.
RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of
the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013.
UNPUBLISHED This document contains unpublished confidential information and is not to be disclosed or used except as authorized by written
contract with Cadence. Rights reserved under the copyright laws of the United States.

Cadence Design Systems, Inc

04/06/12

Table of Contents
Database Access with DBTCL
Module 1:
Lab 1-1

dbGet basics: interactive queries and introduction to database traversal


Using dbGet to query a selected object or objects .......................................... 1-2
Lab setup - starting the software and loading a design...................................................................1-2
Using dbGets .? to access attributes from a single object .............................................................1-4
Using dbGets .?? to access attributes and their values from a single object .................................1-4
Using dbGets .? and .?? with multiple objects selected ................................................................1-5
Using dbGets .? to access attributes from multiple objects...........................................................1-5
Using dbGets .?? to access attributes and values from multiple objects .......................................1-6

Lab 1-2

Using the . to traverse to child objects using dbGet .................................... 1-8


Introduction to the . operator to traverse to child objects or access specific attributes ...............1-8

Lab 1-3

Using the DB Browser to traverse to child objects (new in EDI 11) ........... 1-11
Introduction to the DB Browser to traverse to child objects or access specific attributes ............1-11

Module 2:
Lab 2-1

Advanced dbGet techniques for programming using pattern matching to


filter lists of pointers
Other starting objects for dbGet traversal .................................................... 2-16
Introduction to the dbGets additional starting points for traversals ............................................2-16

Lab 2-2

Using pattern matching to filter dbGet attribute searches .......................... 2-18


Using name based filtering with .? and .?? to limit attributes displayed ......................................2-18

Lab 2-3

Using <TAB> completion to find attribute names (new in EDI 10.1) ......... 2-19
Using <TAB> completion to match attribute names more quickly ..............................................2-19

Lab 2-4

Using pattern matching to filter dbGet return results ................................. 2-21


Introduction to filtering values returned .......................................................................................2-21
Using name based filtering and returning object pointers using dbGets p option .....................2-22
Examples of different styles of dbGet p usage with and without using Tcl foreach...................2-24
Handling name based filtering where nothing is found ................................................................2-25

Lab 2-5

Using expressions to filter dbGet return results............................................ 2-27


Using expression based filtering of objects..................................................................................2-27

Lab 2-6

Accessing geometric information using dbGet .............................................. 2-29


Working with geometric attributes like points (pt), rectangles (rect), etc ....................................2-29

Module 3:
Lab 3-1

Using dbGet .?h and dbSchema to learn more about the database
objects and their attributes
Finding out more descriptive information about an attribute ..................... 3-33
What to do what you know an attribute name, but do not know exactly what it is used for .........3-33
How do I use dbSchema instead of dbGets .?h operator to find out attribute details? ................3-35
How do I use dbSchema to find out what the possible parent objects are from an object type? ..3-37

Module 4:
Lab 4-1

Modifying object attributes using dbSet


Using dbSet to change attributes values ........................................................ 4-40
How can I change an attribute value on a selected object or set of selected objects?...................4-40
How can I change an attribute value on a multiple objects at the same time? ..............................4-41

04/06/12

Cadence Design Systems, Inc

iii

Module 5:
Lab 5-1

Using dbTransform to covert from local to global coordinates


Converting coordinates from local to global using dbTransform ............... 5-44
How can I convert coordinates from ones local to a cell to those in the design?..........................5-44

Module 6:
Lab 6-1

How to query objects within an area using dbQuery


Find objects in an area using dbQuery .......................................................... 6-47
How to find objects by area instead of by selection or by attribute based queries ...................... 6-47
How to find objects at a specific point or that cross a specified line ........................................... 6-48

Module 7:
Lab 7-1

Using dbShape to manipulate lists of shapes (new in 10.1)


dbShape basics ................................................................................................. 7-51
Using dbShape to find intersections and do sizing operations .................................................... 7-51

Module 8:
Lab 8-1

Extra Credit Working on your own


Extra Credit ...................................................................................................... 8-55
What are the names of the LEF VIAS with the DEFAULT keyword between layers Metal2 and
Metal3?........................................................................................................................................ 8-55
How many of each of those vias are used in the design?............................................................. 8-55
Create a routing blockage on Metal7 over Metal6 portion of the pin shape for the WE1 terminal of the
instance in the lower left of the core area .................................................................................... 8-55
Create a marker between the CLASS BLOCK instances if the instances are closer than 25u ..... 8-55

References .......................................................................................................... 8-55

Cadence Design Systems, Inc

04/06/12

Module 1:

dbGet basics:
interactive queries and
introduction to
database traversal

Lab 1-1

Using dbGet to query a selected object or objects

Objective:

To introduce dbGets features using the selected objects as a starting


point

In this section, well familiarize ourselves with the basics of dbGet for interactive queries of the
selected objects attributes.
Lab setup - starting the software and loading a design
1. Load the design (all labs have the same starting steps or you can just work from the in
design in the same session for each lab)
From a new xterm window:
UNIX> cd DBTCL/work
UNIX> encounter init ../scripts/testcase.tcl

2. Bring up the Encounter GUI


encounter> win

The design should look like this:

1-2

Database Access with DBTCL

04/06/12

Using dbGet to query a selected object or objects

Lab 1-1

3. Select the hard macro in the lower left corner of the design using the left mouse
button
4. With the cursor in the graphic window, use q to bring up the Attribute Editor form
and view the attributes for the selected object
The Attribute Editor form should look like this:

The dbGet command allows similar information to be accessed from the Tcl prompt.
This can be useful for both interactive queries and more complex programming in
Tcl.
5. Use dbGet to access the object pointer for the selected object
encounter> dbGet selected
0x1c3cff44

The 0x* value is the object pointer value and is valid for the current Encounter
session. Be careful when caching the value as the value may become invalid if the
object is deleted. The value 0x1c3cff44 will likely not be the value you see as each
session can be different.

If nothing is selected, then 0x0 is returned. This indicates a null pointer value.
04/06/12

Database Access with DBTCL

1-3

Lab 1-1

Using dbGet to query a selected object or objects

Using dbGets .? to access attributes from a single object


6. Use dbGet to find the list of attributes available from the selected object
Encounters dbGet command uses an access style that is similar to that in the Cadence
SKILL language. The use of .? lists the attributes similar to ~>? in SKILL.
encounter> dbGet selected.?
inst: box boxes cell instTerms isDontTouch isHaloBlock isJtagElem
isPhysOnly isSpareGate name objType orient pHaloBot pHaloBox pHaloLeft
pHaloRight pHaloTop pStatus pgCellTerms pgTermNets pt rHaloBotLayer
rHaloSideSize rHaloTopLayer

The format is object type: (inst: for this example) followed by the list of
attributes for that object and is useful for learning what is available from the current
object or as a reminder of the spelling of an attribute name.

If multiple different types of objects were selected, then one list would be
shown for each of the different types of object in the selected set.
Using dbGets .?? to access attributes and their values from a single object
7. Use dbGet to find the list of attributes available and their values from the selected
object
The use of .?? lists the attributes and their values similar to ~>?? in SKILL.
encounter> dbGet selected.??
box: {385 385.12 1146.745 907.87}
boxes: {{385 385.12 1146.745 907.87}}
cell: 0x18d238c0
instTerms: 0x1ca87950 0x1ca87984 0x1ca879b8 0x1ca879ec 0x1ca87a20
0x1ca87a54 0x1ca87a88 0x1ca87abc 0x1ca87af0 0x1ca87b24 ... (total
length 156)
isDontTouch: 0
isHaloBlock: 1
isJtagElem: 0
isPhysOnly: 0
isSpareGate: 0
name: coreinst/ks_core1/amba_dsp1/rom2p_2kx32/ram0
objType: inst
orient: R180
pHaloBot: 5
pHaloBox: {380 380.12 1151.745 912.87}
pHaloLeft: 5
pHaloRight: 5
pHaloTop: 5
pStatus: fixed
pgCellTerms: 0x18e1c0c0 0x18e1c104
pgTermNets: 0x28278518 0x2827857c
pt: {385 385.12}
1-4

Database Access with DBTCL

04/06/12

Using dbGet to query a selected object or objects

Lab 1-1

rHaloBotLayer: 0x0
rHaloSideSize: 0
rHaloTopLayer: 0x0

This is more like the Attribute Editor and useful for scanning for the values of
specific attributes. The Attribute Editor display attributes using labels that are
words, while the dbGet attributes are terser. Example: Location in the Attribute
Editor is equivalent to the inst objects .pt attribute. Using dbGets .?? makes it easy
to find equivalent attribute names by looking at the matching values to those in the
Attribute Editor form.

In the case of long lists of objects the display is limited to the first 10 objects
by default. Refer to the setDbGetMode options to increase the -displayLimit. You
can also change the formatting of the attr/value information into a tabular report
style using setDbGetMode displayFormat table.
Using dbGets .? and .?? with multiple objects selected
8. Use selectNet to select many net objects
encounter>
encounter>
0x272b5568
0x20aac1e0
0x20ab96f0

selectNet *clk
dbGet selected
0x248fab68 0x22f7c658 0x1f3ba4f4 0x1c0c06fc 0x1e149f54
0x20ab0004 0x20ab2920 0x20ab2664 0x20ab227c 0x20ab5f60
0x1c3cff44

There are 14 objects selected in this case.


Using dbGets .? to access attributes from multiple objects
9. Use dbGet to find the list of attributes available from set of selected object
encounter> dbGet selected.?
net: allTerms avoidDetour bottomPreferredLayer box hNets isAnalog
isCTSClock isClock isDontTouch isExternal isFixedBump isGnd
isPatternTrunk isPhysOnly isPwr isPwrOrGnd isScanNet name numInputTerms
numOutputTerms numTerms objType preferredExtraSpace props rule sVias
sWires shieldNets siPostRouteRepair skipAntennaRepair skipRouting
topPreferredLayer vias weight wires
inst: box boxes cell instTerms isDontTouch isHaloBlock isJtagElem
isPhysOnly isSpareGate name objType orient pHaloBot pHaloBox pHaloLeft
pHaloRight pHaloTop pStatus pgCellTerms pgTermNets pt rHaloBotLayer
rHaloSideSize rHaloTopLayer

Note that both net and inst attribute lists are displayed. This indicates that at least
one of each of those types of objects is included in the selected set. Even though there
were 14 objects selected, only 2 different types were selected (net, inst).

04/06/12

Database Access with DBTCL

1-5

Lab 1-1

Using dbGet to query a selected object or objects

Using dbGets .?? to access attributes and values from multiple objects
10. Use dbGet to find the list of attributes available from set of selected object
encounter> dbGet selected.??
allTerms: 0x282161e0 0x28215fa4 0x28215bc8
avoidDetour: 0
bottomPreferredLayer: 0x187c2190
box: {1073741.8235 1073741.8235 -1073741.824 -1073741.824}
hNets: 0x27fe28b4 0x27fe27b8 0x27fe2530 0x272ae6c0
isAnalog: 0
isCTSClock: 0
isClock: 0
isDontTouch: 0
isExternal: 0
isFixedBump: 0
isGnd: 0
isPatternTrunk: 0
isPhysOnly: 0
isPwr: 0
isPwrOrGnd: 0
isScanNet: 0
name: coreinst/ks_core1/periph1_PH/top_vga1/vga1/u1/luint_pclk
numInputTerms: 2
numOutputTerms: 1
numTerms: 3
objType: net
preferredExtraSpace: 0
props: 0x31352b80
rule: 0x0
sVias: 0x0
sWires: 0x0
shieldNets: 0x0
siPostRouteRepair: 0
skipAntennaRepair: 0
skipRouting: 0
topPreferredLayer: 0x187c2190
vias: 0x0
weight: 2
wires: 0x0
allTerms: 0x24a864e4 0x24a858d8 0x24a82fa0 0x24a7e9bc 0x24a7de28
avoidDetour: 0
bottomPreferredLayer: 0x187c2190
box: {1073741.8235 1073741.8235 -1073741.824 -1073741.824}
hNets: 0x24a80030 0x24a7c438 0x248f6220
isAnalog: 0
isCTSClock: 0

weight: 2
1-6

Database Access with DBTCL

04/06/12

Using dbGet to query a selected object or objects

Lab 1-1

wires: 0x0
allTerms: 0x22f67164 0x282aad40
avoidDetour: 0
bottomPreferredLayer: 0x187c2190
box: {2548.54 5024.45 2548.54 5024.45}
hNets: 0x282a2eec 0x20ac43b8
isAnalog: 0
isCTSClock: 0
isClock: 0
isDontTouch: 0
isExternal: 1
isFixedBump: 0
isGnd: 0
isPatternTrunk: 0
isPhysOnly: 0
isPwr: 0
isPwrOrGnd: 0
isScanNet: 0
name: mii2_rxclk
numInputTerms: 1
numOutputTerms: 1
numTerms: 2
objType: net
preferredExtraSpace: 0
props: 0x20b70630
rule: 0x0
sVias: 0x0
sWires: 0x0
shieldNets: 0x0
siPostRouteRepair: 0
skipAntennaRepair: 0
skipRouting: 0
topPreferredLayer: 0x187c2190
vias: 0x0
weight: 2
wires: 0x0
**Info: Number of objects exceeds limit.
Use setDbGetMode -displayLimit to control the number of objects
evaluated by 'dbGet <object>.??' query.

Note that display was limited to the first 10 objects and their values. Unlike .? where
the attribute names are only shown once for each different type of object, the .??
shows the attribute and value for each object (up to the maximum of objects defined
in the displayLimit).

04/06/12

Database Access with DBTCL

1-7

Lab 1-2

Using the . to traverse to child objects using dbGet

Objective:

To introduce dbGets feature to traverse from one object to another

In this section, well learn how to use dbGet to walk through the database.
Introduction to the . operator to traverse to child objects or access specific
attributes
For this section we are going to start with a single selected object again.
1. Select the hard macro in the lower left corner of the design using the left mouse
button (confirm that only one object is selected)
2. Use dbGet to find the list of attributes available and their values from the selected
object
encounter> dbGet selected.??
box: {385 385.12 1146.745 907.87}
boxes: {{385 385.12 1146.745 907.87}}
cell: 0x18d238c0
instTerms: 0x1ca87950 0x1ca87984 0x1ca879b8 0x1ca879ec 0x1ca87a20
0x1ca87a54 0x1ca87a88 0x1ca87abc 0x1ca87af0 0x1ca87b24 ... (total
length 156)
isDontTouch: 0
isHaloBlock: 1
isJtagElem: 0
isPhysOnly: 0
isSpareGate: 0
name: coreinst/ks_core1/amba_dsp1/rom2p_2kx32/ram0
objType: inst
orient: R180
pHaloBot: 5
pHaloBox: {380 380.12 1151.745 912.87}
pHaloLeft: 5
pHaloRight: 5
pHaloTop: 5
pStatus: fixed
pgCellTerms: 0x18e1c0c0 0x18e1c104
pgTermNets: 0x28278518 0x2827857c
pt: {385 385.12}
rHaloBotLayer: 0x0
rHaloSideSize: 0
rHaloTopLayer: 0x0

1-8

Database Access with DBTCL

04/06/12

Using the . To traverse to child objects using dbGet

Lab 1-2

Notice that the name of the instance is available as string attribute value
(coreinst/ks_core1/amba_dsp1/rom2p_2kx32/ram0) but the name of the cell master
is not directly exposed. Sometimes we need to walk from the current object to another
object where the information that we want is stored. In this case, we can walk from
the inst to the cell to find the name of the cell master for the inst. In this case the
. is used in a way that is similar to the ~> operator in the SKILL language.
3. Use dbGet to find the list of attributes available from the cell object by traversing to
the cell object using .
encounter> dbGet selected.cell.?
libCell: allObstructions baseClass cellDensities eeqCells foreigns
isDontTouch isSequential isTimeDefined name numBidirs numInputs
numOutputs numPGTerms numPhysTerms numRefs numTerms objType pgTerms
physTerms props site size subClass symmetryR90 symmetryX symmetryY
terms

We can see the list of attributes that area available from the cell pointers object (in
this case the .cell pointed to a libCell object, indicating leaf cell from a LEF MACRO
or an OpenAccess abstract view).
4. We could have also used .?? to query the attributes and their values at this point,
but we only want the name of cell master, so we will replace the .? with the specific
attribute we are interested in.
encounter> dbGet selected.cell.name
MEM2_2048X32

Using the .?, .??, and . you will learn which objects have the attributes that you
are looking for.
5. The traversal also works when you have multiple objects selected.
encounter> selectNet *clk
encounter> dbGet selected.name
coreinst/ks_core1/periph1_PH/top_vga1/vga1/u1/luint_pclk
coreinst/ks_core1/periph1_PH/amba_usb1/usb1/u1/hms_clk
coreinst/ks_core1/leon1/mcore0/uart2/r_extclk
coreinst/ks_core1/leon1/mcore0/uart1/r_extclk
coreinst/ks_core1/amba_dsp1/mcore0/uart2/r_extclk
coreinst/ks_core1/amba_dsp1/mcore0/uart1/r_extclk vid_pclk utmi_phy_clk
mii2_txclk mii2_rxclk mii1_txclk mii1_rxclk clk
coreinst/ks_core1/amba_dsp1/rom2p_2kx32/ram0

In this case it worked OK as both types of objects in the selected set (inst, net) had the
.name attribute. There would have been an error if you tried to access the .orient
object that existed on the inst object, but not on the net object. In the case of a
heterogeneous list the child attribute may not be available for all objects and for those
that do not have the attribute warnings will be displayed and 0x0 returned for each of
those.

04/06/12

Database Access with DBTCL

1-9

Lab 1-2

1-10

Using the . to traverse to child objects using dbGet

Database Access with DBTCL

04/06/12

Lab 1-3

Using the DB Browser to traverse to child objects (new in EDI


11)

Objective:

To introduce dbGet based DB Browser feature to traverse from one


object to another

In this section, well learn how to use dbGet to walk through the database via the DB browser.
Introduction to the DB Browser to traverse to child objects or access specific
attributes
For this section we are going to start with a single selected object again.
1. Select the hard macro in the lower left corner of the design using the left mouse
button (confirm that only one object is selected)
2. With the cursor in the graphic window, use q to bring up the Attribute Editor form
and view the attributes for the selected object
The Attribute Editor form should look like this:

04/06/12

Database Access with DBTCL

1-11

Lab 1-3

Using the DB Browser to traverse to child objects (new in EDI 11)

The dbGet command allows similar information to be accessed from the Tcl prompt.
This can be useful for both interactive queries and more complex programming in
Tcl.
3. With the cursor in the graphic window, use v to bring up the DB Browser form and
view the attributes for the selected object
The DB Browser form should look like this:

The DB Browser is built on top of dbGet functionality and command allows the same
information that can be obtained via dbGet to be traversed in a more graphical way.
information to be accessed from the Tcl prompt. This can be useful for both
interactive queries and more complex programming in Tcl.
4. Use dbGet to find the list of attributes available and their values from the selected
object
The use of .?? lists the attributes and their values similar to ~>?? in SKILL.
encounter> dbGet selected.??
box: {385 385.12 1146.745 907.87}
1-12

Database Access with DBTCL

04/06/12

Using the DB Browser to traverse to child objects (new in EDI 11)

Lab 1-3

boxes: {{385 385.12 1146.745 907.87}}


cell: 0x18d238c0
instTerms: 0x1ca87950 0x1ca87984 0x1ca879b8 0x1ca879ec 0x1ca87a20
0x1ca87a54 0x1ca87a88 0x1ca87abc 0x1ca87af0 0x1ca87b24 ... (total
length 156)
isDontTouch: 0
isHaloBlock: 1
isJtagElem: 0
isPhysOnly: 0
isSpareGate: 0
name: coreinst/ks_core1/amba_dsp1/rom2p_2kx32/ram0
objType: inst
orient: R180
pHaloBot: 5
pHaloBox: {380 380.12 1151.745 912.87}
pHaloLeft: 5
pHaloRight: 5
pHaloTop: 5
pStatus: fixed
pgCellTerms: 0x18e1c0c0 0x18e1c104
pgTermNets: 0x28278518 0x2827857c
pt: {385 385.12}
rHaloBotLayer: 0x0
rHaloSideSize: 0
rHaloTopLayer: 0x0

Compare the results for the .?? query to the contents of the DB Browser form. Object
attributes that have a .name attribute will be shown as their name. For example, the
cell indicates MEM2_2048X32 not the pointer value. All object and objectList type
attributes are shown as buttons for traversal purposes.
5. Use the DB Browser to push & pop through the objects starting with the selected
object.
Click on the button named MEM2_2048X32 (next to the cell attribute label). The
DB Browser form should now look like this:

04/06/12

Database Access with DBTCL

1-13

Lab 1-3

Using the DB Browser to traverse to child objects (new in EDI 11)

The information displayed is equivalent to "dbGet selected.cell.??" as we pushed into


the cell object from the selected inst object.
The buttons at the top of the form are for "Back" (to pop/return back the previous
level), "Previous" & "Next" for the case where there is more than one object. To see
an example, go "Back" to the selected instance and then click on the button next to
the instTerms label. In that case, the push would now be displaying the first of 156
objects.

1-14

Database Access with DBTCL

04/06/12

Module 2:

Advanced dbGet
techniques for
programming using
pattern matching to
filter lists of pointers

Lab 2-1

Other starting objects for dbGet traversal

Objective:

To introduce dbGets additional starting points

In this section, well learn how to start a dbGet traversal from other objects (top, head, and user
specified objects).
Introduction to the dbGets additional starting points for traversals
For this section we are going use the same database as in the earlier lab sections.
1. Use the help option to find the starting points for dbGet traversal
encounter> dbGet help
Usage: dbGet [-help] [-d] [-u] [-v] [-e] [-i <num>] [-regexp] [p[<num>]]{<obj>|<objList>|head|top|selected}[.<objType>]...[[.<attrName
>|.?|.??|.?h] [<pattern>] | [expression]]

{<obj>|<objList>|head|top|selected}[.<objType>]...[.<attrName>|.?|.??|.
?h]
# DB object-hierarchy-string.
{<obj>|<objList>|head|top|selected}:
# Specifies the starting point for the query; .<objType>:
Specifies
# the object type to query. You can specify more than one
object in
# the query; .<attrName>|.?|.??|.?h: Specifies the type of
# information to return. (string, required)

In the earlier labs we always use the selected set as a starting point by specifying the
keyword selected. In addition, the dbGet command can start from top (the top
cell object), head (root of the database, where technology info is stored), as well as
a user specified object (either a $variable or a specific 0x value) or object list
(either a homogeneous or heterogeneous list of objects). The use of the selected
keyword is commonly used for interactive queries, while the other starting points can
be equally useful in interactive and programmatic access.
2. Example of using the top as a starting point and finding the list of available
attributes
encounter> dbGet top.?
topCell: bumps fPlan hInst insts markers name nets numBidirs numInputs
numInsts numNets numPGTerms numPhysInsts numPhysNets numPhysTerms
numTerms objType pgTerms physInsts physNets physTerms pinToCornerDist
props statusClockSynthesized statusGRouted statusIoPlaced statusPlaced
statusPowerAnalyzed statusRCExtracted statusRouted statusScanOpted
symmetryR90 symmetryX symmetryY terms texts
2-16

Database Access with DBTCL

04/06/12

Other starting objects for dbGet traversal

Lab 2-1

3. Example of using the top as a starting point.


encounter> dbGet top.terms.name
{bist_fh[2]} {bist_fh[1]} {bist_fh[0]} {bist_mis[2]} {bist_mis[1]}
{bist_mis[0]} clk clk_cpu {em_a[27]} {em_a[26]} {em_a[25]} {em_a[24]}
{em_a[23]} {em_a[22]} {em_a[21]} {em_a[20]} {em_a[19]} {em_a[18]}
{em_a[17]} {em_a[16]} {em_a[15]} {em_a[14]} {em_a[13]} {em_a[12]}
{em_a[11]} {em_a[10]} {em_a[9]} {em_a[8]} {em_a[7]}

BG_scan_out_4 BG_scan_in_5 BG_scan_out_5 BG_scan_in_6 BG_scan_out_6


BG_scan_in_7 BG_scan_out_7 BG_scan_in_8 BG_scan_out_8 BG_scan_in_9
BG_scan_out_9 BG_scan_in_10 BG_scan_out_10 BG_scan_in_11 BG_scan_out_11

The list of names can be quite long, especially for child objects like insts and nets
where there might be millions, so interactive queries like dbGet top.nets.name are
not recommended without filtering the results (covered later).
Using head or user specified starting points would be similar (dbGet $myObject.?,
where $myObject is a pointer to a database object that you would like to find the
attributes for).

04/06/12

Database Access with DBTCL

2-17

Lab 2-2

Using pattern matching to filter dbGet attribute searches

Objective:

To introduce dbGets feature to filter results

In this section, well learn how the pattern matching can also be used to reduce the number of
attributes and values displayed by the .? and .?? operators.
Using name based filtering with .? and .?? to limit attributes displayed
For this section we are going use the same database as in the earlier lab sections.
For interactive queries, the .? and .?? will sometimes have long lists of attributes and the filtering can
be used to reduce the information displayed if you already know the exact attribute name or part of
the attribute name.
1. Display all attributes from the topCell object
encounter> dbGet top.?
topCell: bumps fPlan hInst insts markers name nets numBidirs numInputs
numInsts numNets numPGTerms numPhysInsts numPhysNets numPhysTerms
numTerms objType pgTerms physInsts physNets physTerms pinToCornerDist
props statusClockSynthesized statusGRouted statusIoPlaced statusPlaced
statusPowerAnalyzed statusRCExtracted statusRouted statusScanOpted
symmetryR90 symmetryX symmetryY terms texts

2.

Display only the attributes matching the *net* pattern


encounter> dbGet top.? *net*
topCell: nets numNets numPhysNets physNets

The displayed attributes are now limited to those that matched the *net* pattern..

Pattern matching is case insensitive for attribute names

2-18

Database Access with DBTCL

04/06/12

Lab 2-3

Using <TAB> completion to find attribute names (new in EDI


10.1)

Objective:

To introduce dbGets feature to filter results

In this section, well learn how to use <TAB> completion for finding available attributes to more
quickly identify available attributes. Functionality is the same as with the .?, but does not require
users to go back to a previous line and copy/paste the attribute names. The .? usage is more flexible
as complete patterns can be specified, while the <TAB> completion is only for finding attributes
starting with a fixed prefix (or no parttern).
Using <TAB> completion to match attribute names more quickly
For this section we are going use the same database as in the earlier lab sections.
For interactive queries, the <TAB> and .? return the list of available attributes from the current
object
1. Display all attributes from the topCell object
encounter> dbGet top.<TAB>
bumps
numPhysInsts
designLib
numPhysNets
designView
numPhysTerms
fPlan
numTerms
hInst
objType
insts
pgTerms
markers
physInsts
name
physNets
nets
physTerms
numBidirs
pinToCornerDist
numInputs
props
numInsts
ptns
numNets
statusClockSynthesized
numPGTerms
statusGRouted
encounter> dbGet top.

statusIoPlaced
statusPlaced
statusPowerAnalyzed
statusRCExtracted
statusRouted
statusScanOpted
symmetryR90
symmetryX
symmetryY
terms
texts

Notice that by using <TAB> the active line is maintained so the line is ready to have
more characters typed or copy/pasted without needing to use the up-arrow to move
back to the previous line as in the .? usage.
2. Display only the attributes start with t
encounter> dbGet top.t<TAB>
terms texts
encounter> dbGet top.te

04/06/12

Database Access with DBTCL

2-19

Lab 2-3

Using <TAB> completion to find attribute names (new in EDI 10.1)

Notice that in this case the .t<TAB> was matched to the next common partial match,
so the active line is updated to top.te.
3. Display only the attributes start with ter
encounter> dbGet top.ter<TAB>
encounter> dbGet top.terms.

Notice that when a single object attribute is matched using <TAB> the attribute name
is completely expanded and a "." is appended. The usage assumes that an additional
traversal is desired in the case of obj/objList type attributes.
4. Display only the attributes start with na from the top.terms starting point
encounter> dbGet top.terms.na<TAB>
encounter> dbGet top.terms.name

Notice that when a single non-object attribute is matched using <TAB> the attribute
name is completely expanded and a space is appended. Unlike the case when the
attribute is an obj or objList, simple attributes are always the last step of a traversal
and therefore do not have the "." appended.
Adding a <CR> at the end will now return all of the term (top level terminal) names
in the design.

Pattern matching is case insensitive for attribute name when using <TAB>
completion just like in the .? case.

2-20

Database Access with DBTCL

04/06/12

Lab 2-4

Using pattern matching to filter dbGet return results

Objective:

To introduce dbGets feature to filter results

In this section, well learn how to filter results from the dbGet queries.
Introduction to filtering values returned
For this section we are going use the same database as in the earlier lab sections.
1. Example of using dbGet without filtering the result
encounter> dbGet top.terms.name
{bist_fh[2]} {bist_fh[1]} {bist_fh[0]} {bist_mis[2]} {bist_mis[1]}
{bist_mis[0]} clk clk_cpu {em_a[27]} {em_a[26]} {em_a[25]} {em_a[24]}
{em_a[23]} {em_a[22]} {em_a[21]} {em_a[20]} {em_a[19]} {em_a[18]}
{em_a[17]} {em_a[16]} {em_a[15]} {em_a[14]} {em_a[13]} {em_a[12]}
{em_a[11]} {em_a[10]} {em_a[9]} {em_a[8]} {em_a[7]}

BG_scan_out_4 BG_scan_in_5 BG_scan_out_5 BG_scan_in_6 BG_scan_out_6


BG_scan_in_7 BG_scan_out_7 BG_scan_in_8 BG_scan_out_8 BG_scan_in_9
BG_scan_out_9 BG_scan_in_10 BG_scan_out_10 BG_scan_in_11 BG_scan_out_11

The return information shows all of the terminal names in the top cell.
2. Example of using dbGet with filtering to limit the information returned only what
matches a specified pattern.
encounter> dbGet top.terms.name BG*
BG_scan_in BG_scan_out BG_scan_in_2 BG_scan_out_2 BG_scan_in_3
BG_scan_out_3 BG_scan_in_4 BG_scan_out_4 BG_scan_in_5 BG_scan_out_5
BG_scan_in_6 BG_scan_out_6 BG_scan_in_7 BG_scan_out_7 BG_scan_in_8
BG_scan_out_8 BG_scan_in_9 BG_scan_out_9 BG_scan_in_10 BG_scan_out_10
BG_scan_in_11 BG_scan_out_11

The return information now only contains the terminal names that matched the BG*
pattern.

Pattern matching is case sensitive for string and enum type attributes

04/06/12

Database Access with DBTCL

2-21

Lab 2-4

Using pattern matching to filter dbGet return results

Using name based filtering and returning object pointers using dbGets p option
For interactive queries, filtering names is very useful to help find objects by name, but for
programming the goal is often to get the objects pointer instead of its name and then use that pointer
in another level of database access.
3. Example of using dbGet with filtering to limit the information returned only what
matches a specified pattern, but returning the parent object instead of the attribute
value
encounter>
0x22f6abdc
0x22f6ad74
0x22f6af0c
0x22f6b0a4

dbGet -p top.terms.name BG*


0x22f6ac20 0x22f6ac64 0x22f6aca8 0x22f6acec 0x22f6ad30
0x22f6adb8 0x22f6adfc 0x22f6ae40 0x22f6ae84 0x22f6aec8
0x22f6af50 0x22f6af94 0x22f6afd8 0x22f6b01c 0x22f6b060
0x22f6b0e8 0x22f6b12c 0x22f6b170

The p option returns the previous pointer after filtering based on the objects
attribute value. The effect is to backup one . and return the object pointer each time
the attribute value matches the specified pattern. The object pointer list return value
can be used to pass to another dbGet command as a starting point.
4. Example of using dbGet with filtering to instances that have a cell master called
MEM2_128X16
encounter> dbGet top.insts.cell.name MEM2_128X16
MEM2_128X16 MEM2_128X16

This indicates that the cell MEM2_128X16 is instantiated twice in the design.
5. Example of using dbGet with filtering to instances that have a cell master called
MEM2_128X16 and returning the cell pointers (-p)
encounter> dbGet p top.insts.cell.name MEM2_128X16
0x18d25728 0x18d25728

Note that the same object point is returned twice if the p option is used. The reason
is that the cell master pointer is being returned for each instance. To return the
instance pointers instead of the cell pointers we need to use p2 to backup two steps.
6. Example of using dbGet with filtering to instances that have a cell master called
MEM2_128X16 and returning the instance pointers (-p2)
encounter> dbGet p2 top.insts.cell.name MEM2_128X16
0x26a2fbfc 0x26f139bc

Notice that by using p2 the object pointers are different, that is because now the
return value is the list of instance object pointers instead of the cell pointers.
7. Example of using dbGet with filtering to instances that have a cell master called
MEM2_128X16 and returning the instance pointers (-p2), but using the result to
obtain the instance names
encounter> set instPtrs [dbGet p2 top.insts.cell.name MEM2_128X16]
0x26a2fbfc 0x26f139bc
2-22

Database Access with DBTCL

04/06/12

Using pattern matching to filter dbGet return results

Lab 2-4

Encounter> dbGet $instPtrs.name


coreinst/ks_core1/periph1_PH/dma_mac1/ethernet_mac_1/rx_fifo_module_to_
dma/pkt_cntr/dual_port_ram_4_tx_fifo/a/ram0
coreinst/ks_core1/periph1_PH/dma_mac1/ethernet_mac_2/rx_fifo_module_to_
dma/pkt_cntr/dual_port_ram_4_tx_fifo/a/ram0

Now we have a list of instance names.


8. Repeat example using nested return values in another dbGet call
encounter> dbGet [dbGet p2 top.insts.cell.name MEM2_128X16].name
coreinst/ks_core1/periph1_PH/dma_mac1/ethernet_mac_1/rx_fifo_module_to_
dma/pkt_cntr/dual_port_ram_4_tx_fifo/a/ram0
coreinst/ks_core1/periph1_PH/dma_mac1/ethernet_mac_2/rx_fifo_module_to_
dma/pkt_cntr/dual_port_ram_4_tx_fifo/a/ram0

We were able to achieve the same result without creating an intermediate variable to
hold the list of pointers. The nesting or chaining of the calls is done by using the
return values of the inner dbGet calls as the starting point for the next dbGet call. The
example shows two dbGet calls, but there is no theoretical limit to the depth that can
be done. While using deeper calls is legal, it may be easier to debug a script/proc that
uses the temporary Tcl variable method So, in some cases, the script writer will need
to choose between readability vs. compactness.
In this case the same query can be done using the dbFindInstsByCell Tcl command
or via Edit->Find/Select Object functionality:

04/06/12

Database Access with DBTCL

2-23

Lab 2-4

Using pattern matching to filter dbGet return results

These other mechanisms have a limited set of attributes that they expose. They are
only for the most common database objects. The dbGet method supports a broader set
of object types and attributes by using a generalized method of pattern matching and
object pointer retrieval instead of having different commands for each task.
Examples of different styles of dbGet p usage with and without using Tcl foreach
The following examples show how the same queries can be completed with varying levels of
readability and compactness.
For a challenge, before reviewing the examples, try and write a script to search the database for
instances that have fixed placement status whose cell master are MEM2_128X16.
9. Search the database for instances that have fixed placement status whose cell
master is MEM2_128X16 example 1
encounter> foreach inst [dbGet top.insts] {
encounter>
if {[dbGet $inst.cell.name] == "MEM2_128X16"} {
encounter>
if {[dbGet $inst.pStatus] == "fixed"} {
encounter>
puts "[dbGet $inst.name]"
encounter>
}
encounter>
}
encounter> }

The above is using the foreach to walk through all of the instances in the design and
then using a series of if statements to filter the results.
10. Search the database for instances that have fixed placement status whose cell
master is MEM2_128X16 example 2
encounter> foreach mem_inst [dbGet -p2 top.insts.cell.name MEM2_128X16]
{
encounter>
if {[dbGet $mem_inst.pStatus] == "fixed"} {
encounter>
puts "[dbGet $mem_inst.name]"
encounter>
}
encounter> }

The above is using the dbGet to pre-filter the list of instances passed to the foreach.
11. Search the database for instances that have fixed placement status whose cell
master is MEM2_128X16 example 3
encounter> set mem_inst_list [dbGet -p2 top.insts.cell.name
MEM2_128X16]
encounter> puts "[dbGet [dbGet -p $mem_inst_list.pStatus fixed].name]"

The above is not using the Tcl foreach at all, but instead just using the ability to pass
a list of pointers to another dbGet command via a Tcl variable.
12. Search the database for instances that have fixed placement status whose cell
master is MEM2_128X16 example 4
2-24

Database Access with DBTCL

04/06/12

Using pattern matching to filter dbGet return results

Lab 2-4

encounter> puts "[dbGet [dbGet -p $[dbGet -p2 top.insts.cell.name


MEM2_128X16].pStatus fixed].name]"

The above is a very compact method using a single nested set of dbGet calls, but do
you think that it is still readable?

The examples demonstrate some different styles of coding. The first method
returns a complete list of instances, so that is the least efficient even though it is the
most readable.

Handling name based filtering where nothing is found


For programmatic queries, sometimes looking at the length of the list that is returned can be useful.
The dbGet return value when nothing is found is 0x0, which allows the return value to be padded to
another dbGet call, but makes the length of the list returned 1 instead of 0.
13. Example of using what is returned when the with filtering fails to find a match (in this
case due to a typo in the cell name (MEM2_128X17 should have been
MEM2_128X16)
encounter> dbGet p2 top.insts.cell.name MEM2_128X17
0x0
encounter> dbGet [dbGet p2 top.insts.cell.name MEM2_128X17].name
0x0

The inner dbGet returns 0x0 and the outer returns 0x0 as well instead of an ERROR.
The goal was to make the scripts tolerant of the empty return case.
14. Use llength to observe the length of the returned list
encounter> llength [dbGet [dbGet p2 top.insts.cell.name
MEM2_128X17].name]
1

Rerturning the 0x0 causes the length of the list to be 1 even in the case where nothing
is being returned.
15. Use llength to observe the length of the returned list, but use dbGet with the -e option
(new in EDI 11) to return "" instead of 0x0 in the outer dbGet call
encounter> llength [dbGet -e [dbGet p2 top.insts.cell.name
MEM2_128X17].name]
0

Returning the "" (empty string/list) makes it a little easier to use the return value in a
program instead of needing to test for the 0x0 case, especially for the case where a
count is desired. Without the -e option, the count would appear as 1 when the user
would expect 0.
04/06/12

Database Access with DBTCL

2-25

Lab 2-4

2-26

Using pattern matching to filter dbGet return results

Database Access with DBTCL

04/06/12

Lab 2-5

Using expressions to filter dbGet return results

Objective:

To introduce dbGets feature to filter results using Tcl expressions

In this section, well learn how to use Tcl expressions to filter the objects returned by dbGet.
Using expression based filtering of objects
For this section we are going use the same database as in the earlier lab sections.
The dbGet functionality supports two types of filtering: pattern based (exact match, simple
wildcards) which is useful for string and enum attributes; Tcl expression style (allows use for all
attribute types) which is more powerful, but more complicated to use.
As the pattern matching style does not work well for numeric attributes or when dealing with lists,
the expression style is the method to use for filtering based on numeric attributes.
In the expression style, standard Tcl expressions are used (==, <, >, etc.) to test for true
evaluations and the objects the results in a true expression evaluation are kept. While the
expression is evaluated the .attribute is substituted with its value.
Example : An object with an attribute called .numInputs is replaced by the value of the .numInputs
attribute. Assume a .numInputs value of 5. The expression {.numInputs > 10} would become {5 >
10} and evaluate to false and the object would not be retained during filtering.
Compound expressions can be created with Logical AND (&&) and OR (||) operators.
Only attributes at the current object level may be used, additional levels of traversal are not allowed
(from an inst object, using {.cell.name .} is not allowed. Also, dbGet cannot use recursive calls, so
a dbGet cannot be used inside of the {} of the expression (using to enclose the expression is OK
as the dbGet call inside of the is evaluated before the attribute substitution is done).
1. Use Tcl expressions to find all library cells that have more than 10 inputs.
encounter> set lib_cell_list [dbGet -p head.allCells.objType libCell]
encounter> dbGet [dbGet $lib_cell_list {.numInputs > 10}].name
leon MEM1_256X32 MEM1_1024X32 MEM1_4096X32 MEM2_128X16 MEM2_128X32
MEM2_136X32 MEM2_512X32 MEM2_1024X32 MEM2_2048X32 MEM2_4096X32

2. Use homogeneous list method (head.libCells, new in EDI 11) to obtain list of library
cells instead of using "dbGet -p head.allCells.objType libCell"
encounter> set lib_cell_list [dbGet head.libCells]
encounter> dbGet [dbGet $lib_cell_list {.numInputs > 10}].name
leon MEM1_256X32 MEM1_1024X32 MEM1_4096X32 MEM2_128X16 MEM2_128X32
MEM2_136X32 MEM2_512X32 MEM2_1024X32 MEM2_2048X32 MEM2_4096X32

04/06/12

Database Access with DBTCL

2-27

Lab 2-5

Using expressions to filter dbGet return results

3. Use Tcl expressions to find all library cells that have more than 10 inputs and whose
name matches the MEM2* pattern (two step).
encounter> dbGet [dbGet [dbGet -p head.libCells.name MEM2*] {.numInputs
> 10}].name
MEM2_128X16 MEM2_128X32 MEM2_136X32 MEM2_512X32 MEM2_1024X32
MEM2_2048X32 MEM2_4096X32

Using the regular pattern matching is one way to filter the list of instance pointers
before using the expression style.
4. Use Tcl expressions to find all library cells that have more than 10 inputs and whose
name matches the MEM2* pattern (complex expression method)
encounter> dbGet [dbGet [dbGet head.libCells] {.numInputs > 10 &&
[string match MEM2* .name]}].name
MEM2_128X16 MEM2_128X32 MEM2_136X32 MEM2_512X32 MEM2_1024X32
MEM2_2048X32 MEM2_4096X32

Unlike the pattern matching method, the expression filtering method does not
require p to access the list of filtered objects. This is because the last element in the
traversal list is already an object, unlike the pattern matching method where the last
element in the traversal is an attribute.

2-28

Database Access with DBTCL

04/06/12

Lab 2-6

Accessing geometric information using dbGet

Objective:

To introduce dbGets feature access geometric information

In this section, well learn how to access geometric information (halos, pin location, etc.) using
dbGet.
Working with geometric attributes like points (pt), rectangles (rect), etc
For this section we are going use the same database as in the earlier lab sections.
The following is a list of the types of geometric attributes available
coord (coordinate) = Single value; either int (dbGet -d), or float (user units).
pt (point) = {coord coord}
ptList (list of points) = {pt pt ...} or {{coord coord} {coord coord} }
rect (rectangle) = {coord coord coord coord}
Select the block in the lower left corner of the core.
1. Access values for all of the attributes of the selected instance
encounter> dbGet selected.??
box: {385 385.12 1146.745 907.87}
boxes: {{385 385.12 1146.745 907.87}}
cell: 0x18cfeb98
instTerms: 0x1ca62bb8 0x1ca62bec 0x1ca62c20 0x1ca62c54 0x1ca62c88
0x1ca62cbc 0x1ca62cf0 0x1ca62d24 0x1ca62d58 0x1ca62d8c ... (total
length 156)
isDontTouch: 0
isHaloBlock: 1
isJtagElem: 0
isPhysOnly: 0
isSpareGate: 0
name: coreinst/ks_core1/amba_dsp1/rom2p_2kx32/ram0
objType: inst
orient: R180
pHaloBot: 5
pHaloBox: {380 380.12 1151.745 912.87}
pHaloLeft: 5
pHaloRight: 5
pHaloTop: 5
pStatus: fixed
pgCellTerms: 0x18df7398 0x18df73dc
pgTermNets: 0x28254320 0x28254384
pt: {385 385.12}
rHaloBotLayer: 0x0
04/06/12

Database Access with DBTCL

2-29

Lab 2-6

Accessing geometric information using dbGet

rHaloSideSize: 0
rHaloTopLayer: 0x0

In the attributes for the selected instance, there are many geometric pieces of
information, the box (bounding box of the instance), boxes (list of boxes for
instances that are rectilinear, pHalo* (placement halo distances), rHalo* (routing halo
information).
2. Access values for placement halo (pHaloBox) of the selected instance
encounter> dbGet selected.pHaloBox
{380 380.12 1151.745 912.87}

The bounding box of the placement halo for the selected instance is {380 380.12
1151.745 912.87}, notice that it is slightly larger than the .box information for the
instance which is {385 385.12 1146.745 907.87}.

Information returned for rectangles (rect), pts (pt), etc. is in a list-of-lists form,
so although the return value appears visually to be {380 380.12 1151.745 912.87}, it
is actually {380 380.12 1151.745 912.87}. So, be aware that you will need to use
"lindex" or "dbGet -i 0 ..." to access the box information for programming purposes.
For commands that do not accept a list of coordinates form and instead require llx,
lly, urx, and ury as separate values you will need to break the rectangle information
down into individual coordinates using lindex as well.
3. Use db_rect (new in EDI 11) to access individual point or coordinate values for
placement halo (pHaloBox) of the selected instance
encounter> db_rect -help
Usage: db_rect { -ll | -ur | -llx | -lly | -urx | -ury | -size | -sizex
| -sizey } rect
rect = {llx lly urx ury} or {{llx lly} {urx ury}}
-help
-ll

-ur

-llx

#
#
#
#
#
#
#
#
#
#

Prints out the command usage


returns {llx lly}.
Example : db_rect -ll {8.1 9.2 10.3 11.4}
returns {8.1 9.2}
returns {urx ury}.
Example : db_rect -ur {8.1 9.2 10.3 11.4}
returns {10.3 11.4}
returns {llx}.
Example : db_rect -llx {8.1 9.2 10.3 11.4}
returns {8.1}

...
encounter> db_rect -ll [dbGet selected.pHaloBox]
380
encounter> db_rect -size [dbGet selected.pHaloBox]
{771.745 532.75}
2-30

Database Access with DBTCL

04/06/12

Accessing geometric information using dbGet

04/06/12

Database Access with DBTCL

Lab 2-6

2-31

Module 3:

Using dbGet .?h and


dbSchema to learn
more about the
database objects and
their attributes

Lab 3-1

Finding out more descriptive information about an attribute

Objective:

To introduce dbGets .?h and dbSchema command to get more


information about attributes

In this section, well learn how use dbGets .?h operator and the dbSchema command to find out
more detailed information about an objects attributes.

What to do you know an attribute name, but do not know exactly what it is used
for
For this section we are going use the same database as in the earlier lab sections.
The names of attributes are fairly short and while in many cases the name is pretty clear on what it is
used for, there are some cases where the name alone just isnt enough. Along with dbGets .? and .??
operators for interactive query about what attributes are available there is also a .?h operator that
provides help on the attribute with information like attribute type (string, int, enum, etc.), legal
enum values for enum type attributes, whether the attribute is allowed to be modified or not, and a
short description about the purpose of the attribute. The dbSchema command provides the same
information without having to use database traversal methods in dbGet.
Select the block in the lower left corner of the core.
1. Access values for all of the attributes of the selected instance
encounter> dbGet selected.?
inst: box boxes cell instTerms isDontTouch isHaloBlock isJtagElem
isPhysOnly isSpareGate name objType orient pHaloBot pHaloBox pHaloLeft
pHaloRight pHaloTop pStatus pgCellTerms pgTermNets pt rHaloBotLayer
rHaloSideSize rHaloTopLayer

From the information displayed, we know that the object that is selected is an inst
and has many attributes. But, the information is just a simple list of names without
descriptions.
2. Which attribute is used for the instances placement status? The pStatus looks like the
correct one, lets find out more so we can be sure,
encounter> dbGet selected.?h pStatus
pStatus(settable): enum(cover fixed placed unplaced), Instance
placement status

Now we know that the pStatus attribute is indeed the Instance placement status, that
it can be modified (settable) and that it is an enum type of attribute with legal values
cover fixed placed unplaced. If we were scripting and needed to make decisions
based on the placement status, we now know what enum values to look for.
Had we not supplied the pStatus as a filter, all of the attributes and their descriptions
would have been returned as follows:
=======================================================================
========================
04/06/12

Database Access with DBTCL

3-33

Lab 3-1

Finding out more descriptive information about an attribute

inst: Instance - canonical (flat), equivalent to DEF COMPONENT. Points


to a libCell or ptnCell.
---------------------------------------------------------------------------------------------box: rect, Bounding box of the instance
boxes: list(rect), List of rectangles that define the shape of instance
cell: obj(libCell ptnCell), Pointer to child cell master or ptnCell
instTerms: objList(instTerm), List of pointers to instance terminals

orient(settable): enum(MX MX90 MY MY90 R0 R180 R270 R90), Instance


placement orientation

pStatus(settable): enum(cover fixed placed unplaced), Instance


placement status
pgCellTerms: objList(term), List of pointers to the instance's power
terminals
pgTermNets: objList(net), List of pointers to nets attached to P/G
terminals

3. Using database traversal and .?h work together as well. Id like to find out more info
about what nets are connected to the instance
encounter> dbGet selected.instTerms.net.?
net: allTerms avoidDetour bottomPreferredLayer box hNets isAnalog
isCTSClock isClock isDontTouch isExternal isFixedBump isGnd
isPatternTrunk isPhysOnly isPwr isPwrOrGnd isScanNet name numInputTerms
numOutputTerms numTerms objType preferredExtraSpace props rule sVias
sWires shieldNets siPostRouteRepair skipAntennaRepair skipRouting
topPreferredLayer vias weight wires

There are two different clock related clock attributes on the net object, which is the
one that corresponds to DEF + USE CLOCK?
4. Use the.?h and filter to find out more about the clock related attributes of the net
object.
encounter> dbGet selected.instTerms.net.?h *clock*
isCTSClock(settable): bool, Indicates that net is a cts clock net
(equivalent to 'USE CLOCK' property in DEF)
isClock: bool, Indicates that net is a clock according to timing
constraints and tracing

The isCTSClock attribute is the one that aligns to the DEF + USE CLOCK and that
attributes value can be modified (using dbSet). As a reminder the pattern matching
for attribute names is case-insensitive.

3-34

Database Access with DBTCL

04/06/12

Finding out more descriptive information about an attribute

Lab 3-1

How do I use dbSchema instead of dbGets .?h operator to find out attribute details?
As you get more familiar with object and attribute names, you might want to access the descriptive
information without needing to select an object or traverse from one object down to the one that you
are interested in. The dbSchema command provides more direct access to the descriptions than
dbGets .?h, but the information is displayed in the same format.
5. What are the different types of objects available in the Encounter database?
encounter> dbSchema -help
Usage: dbSchema [-help] [[<objNamePattern> [<objAttrNamePattern>]] | [parent <objNamePatternForParent> [-list ]]]
-help
<objNamePattern>

#
#
#
#

<objAttrNamePattern>
Pattern

Prints out the command usage


Object Name or Pattern
(string, optional)
Object Attribute Name or

# (string, optional)
# To print as a list of parent

-list
objects
-parent <objNamePatternForParent>
which

# (bool, optional)
# Type of Object/Attribute for
# parent needs to be found
# (string, optional)

encounter> dbSchema
antennaData antennaModel bndry bump bus busGuide cellDensity
densityShape fPlan foreign gCellGridDef group hInst hInstTerm hNet
hTerm head inst instTerm io layer layerRule layerShape libCell marker
net netGroup pBlkg pd pin pinGroup pinGuide prop ptn ptnCell rBlkg
resizeBlkg row rule sViaInst sWire sdp shape shapeVia site term text
topCell trackDef vCell via viaInst wire

We can use dbSchema to find out more about any of the objects whether the object is
currently used in the database or not. We can also use dbSchema if no database is
loaded in memory.
6. How would I use dbSchema to find out more about the net objects clock attributes
that I had used dbGet with the .?h earlier?
encounter> dbSchema net *clock*
=======================================================================
===========
net: Canonical (flat) net (equivalent to connectivity in DEF NETS and
SPECIALNETS)
--------------------------------------------------------------------------------isCTSClock(settable): bool, Indicates that net is a cts clock net
(equivalent to 'USE CLOCK' property in DEF)
isClock: bool, Indicates that net is a clock according to timing
constraints and tracing
04/06/12

Database Access with DBTCL

3-35

Lab 3-1

Finding out more descriptive information about an attribute

7. How can I use dbSchema to find out which objects have attributes with via in their
name?
encounter> dbSchema * *via*
===============================
head: Root/Head of the database
------------------------------vias: objList(via), List of pointers to via master
=======================================================================
===========
net: Canonical (flat) net (equivalent to connectivity in DEF NETS and
SPECIALNETS)
--------------------------------------------------------------------------------sVias: objList(sViaInst), List of pointers to sViasInsts (DEF
SPECIALNETS equivalent)
vias: objList(viaInst), List of pointers to viaInsts (DEF NETS
equivalent)
=============================================================
rule: Rule information (equivalent to LEF/DEF NONDEFAULTRULE)
------------------------------------------------------------vias: objList(via), List of pointers to via, default or USEVIA or
derived from mincut
===================================================================
sViaInst: Special Via (equivalent to DEF SPECIALNETS via instances)
------------------------------------------------------------------via: obj(via), Pointer to via master
=========================
shapeVia: layer Shape via
------------------------via: obj(via), Pointer to via master
=======================================================
viaInst: viaInst (equivalent to via in DEF NETS wiring)
------------------------------------------------------via: obj(via), Pointer to via cell

From the list above, the following objects have attributes that match the *via* pattern:
head, net, rule, sViaInst, via, viaInst.

The dbSchema pattern matching is name based, not object type based. If an
attribute is called list1 and its type of obj(via) it will not be found since the pattern
matching is only using the attributes name and not its type. Use the -parent option
(new in EDI 11) for type based matching of the child object.

3-36

Database Access with DBTCL

04/06/12

Finding out more descriptive information about an attribute

Lab 3-1

How do I use dbSchema to find out what the possible parent objects are from an
object type?
In many cases the object attributes are very similar to the child object type (example: inst.nets refers
to a list of net pointers from an instance object, but in some cases like group.members the attribute is
a objList that can contain a heterogeneous list of objects and the dbSchema * *<pattern>* doesn't
work as well. Using the dbSchema -parent feature is especially useful for finding the objects that
have inst object as one of their child attributes.
8. How can I use dbSchema -parent (new in EDI 11) to find out which objects have the
inst object as one of their child attributes?
encounter> dbSchema -parent inst
========================================
group: Group of hInsts, insts, or groups
---------------------------------------members: objList(group hInst inst), List of pointers to group's members
===================================================
hInst: Hierarchical instance (derived from netlist)
--------------------------------------------------allInsts: objList(hInst inst), List of pointers to all instances and
hierarchical instances in the level referred to by the hInst
allTreeInsts: objList(hInst inst), List of pointers to all instances
and hierarchical instances in the hInst
insts: objList(inst), List of pointers to all instances in the level
referred to by the hInst
treeInsts: objList(inst), List of pointers to all instances in the
hInst
============================================================
instTerm: Instance terminal (used in flattened connectivity)
-----------------------------------------------------------inst: obj(inst), Pointer to Instance containing the instTerm
================================================================
io: IO object for block (term) or chip design (inst) constraints
---------------------------------------------------------------inst: obj(inst), Pointer to IO instance (null/0x0 for block design
case)
===============================================
pBlkg: Placement blockage (hard, soft, partial)
----------------------------------------------inst: obj(inst), Pointer to the instance that the placement blockage is
associated with (equivalent to DEF BLOCKAGES + COMPONENT)
=====================
ptn: Partition Object
--------------------cloneInsts: objList(inst), List of pointers to the clone instances if
the partition is committed or a blackbox, otherwise 0x0 will be
returned.
clones: objList(hInst inst), List of pointers to the clone inst/hInsts.
The objTypes returned will be inst if the partition is committed or a
blackbox, otherwise the objType will be hInst.

04/06/12

Database Access with DBTCL

3-37

Lab 3-1

Finding out more descriptive information about an attribute

master: obj(hInst inst), Pointer to the master inst/hInst. The objType


returned will be inst if the partition is committed or a blackbox,
otherwise the objType will be hInst.
masterInst: obj(inst), Pointer to the master instance if the partition
is commited or a blackbox, otherwise 0x0 will be returned.
=======================
rBlkg: Routing blockage
----------------------inst: obj(inst), Pointer to the instance that the routing blockage is
associated with (equivalent to DEF BLOCKAGES + COMPONENT)
==============
sdp: Data Path
-------------inst: objList(inst), Pointer to instance (only for type = inst)
=======================================================
topCell: Top cell, container for flattened connectivity
------------------------------------------------------insts: objList(inst), List of pointers to instances in the cell
physInsts: objList(inst), List of pointers to physical instances in the
cell

9. How can I use dbSchema to find out which objects have the inst object as one of their
child attributes without the details?
encounter> dbSchema -parent inst -list
group hInst instTerm io pBlkg ptn rBlkg sdp topCell

3-38

Database Access with DBTCL

04/06/12

Module 4:

Modifying object
attributes using dbSet

Lab 4-1

Using dbSet to change attributes values

Objective:

To introduce the dbSet command and how to use it to change attribute


values

In this section, well learn how use dbSet to change an attribute value of an object or set of objects.
How can I change an attribute value on a selected object or set of selected objects?
For this section we are going use the same database as in the earlier lab sections.
Using dbGets .?h and dbSchema we are able to determine which attributes are allowed to be
modified. So, dbSet can be used to change the attributes values just like can be done using the
Attribute Editor GUI.
Select the block in the lower left corner of the core and zoom in around that instance.
1. Access values for the pHalo* attributes of the selected instance
encounter> dbGet selected.?? pHalo*
pHaloBot: 5
pHaloBox: {380 380.12 1151.745 912.87}
pHaloLeft: 5
pHaloRight: 5
pHaloTop: 5

From the information displayed, we can see that the halo bounding box is {380
380.12 1151.745 912.87} and that the halo offsets are 5u per side.
2. Confirm which of the attributes are allowed to be modified
encounter> dbGet selected.?h pHalo*
pHaloBot(settable): coord, Specifies extra spacing around the inst that
should not be used for placement
pHaloBox: rect, Bounding box of the inst placement halo
pHaloLeft(settable): coord, Specifies extra spacing around the inst
that should not be used for placement
pHaloRight(settable): coord, Specifies extra spacing around the inst
that should not be used for placement
pHaloTop(settable): coord, Specifies extra spacing around the inst that
should not be used for placement

We can see that all of the attributes can be modified, except that the pHaloBox is readonly (it is created from the instance size and other pHalo* attribute values). The
types of all of the attributes is coord (the coord attribute is accessed/set as a floating
point value in user-units, unless the d option is specified in which case it would be
accessed/set as an integer value in database units).
3. Use dbSet to change the value of the halo on the right side of the instance
(pHaloRight attribute) from 5 to 25
4-40

Database Access with DBTCL

04/06/12

Using dbSet to change attributes values

Lab 4-1

encounter> dbSet selected.pHaloRight 25

Use redraw to see the changes visually.


4. Access values for the pHalo* attributes of the selected instance again to see the
changes
encounter> dbGet selected.?? pHalo*
pHaloBot: 5
pHaloBox: {380 380.12 1171.745 912.87}
pHaloLeft: 5
pHaloRight: 25
pHaloTop: 5

Note the value of pHaloRight has been changed to 25. Additionally, the notice that
the halo bounding box (pHaloBox) has increased in size as well to {380 380.12
1171.745 912.87}.
How can I change an attribute value on a multiple objects at the same time?
The dbSet commands takes an object or list of objects as a starting point, so you can use the objects
returned from a dbGet query as that list of objects to start from.
5. Use dbGet to find all instances that have MEM2_4096X32 as their cell master name
encounter> dbGet [dbGet -p2 top.insts.cell.name MEM2_4096X32].name
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram0
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram1
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram10
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram11
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram12
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram13
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram14
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram15
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram16
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram17
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram18
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram2
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram3
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram4
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram5
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram6
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram7
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram8
coreinst/ks_core1/amba_dsp1/ram2p_78kx32/ram0/ram9

For dbSet we want to get the instance pointers instead of the instance names.
6. Use dbGet to find all instance pointers that have MEM2_4096X32 as their cell master
name
encounter> dbGet -p2 top.insts.cell.name MEM2_4096X32

04/06/12

Database Access with DBTCL

4-41

Lab 4-1

Using dbSet to change attributes values

0x1c178ce0 0x1c178d34 0x1c178d88 0x1c178ddc 0x1c178e30 0x1c178e84


0x1c178ed8 0x1c178f2c 0x1c178f80 0x1c178fd4 0x1c179028 0x1c1790d0
0x1c179124 0x1c179178 0x1c1791cc 0x1c179220 0x1c179274 0x1c1792c8
0x1c17931c

As a reminder, the p2 indicated to access the pointer two steps back from the .name
attribute, had we used p instead of p2 we would have a list of libCell pointers
instead of the desired instance pointers.
7. Use dbGet to query the placement status of those instances
encounter> dbGet [dbGet -p2 top.insts.cell.name MEM2_4096X32].pStatus
fixed fixed fixed fixed fixed fixed fixed fixed fixed fixed fixed fixed
fixed fixed fixed fixed fixed fixed fixed

All of the instances currently have fixed placement status.


8. Use dbSet to change the placement status of all of those instances to cover
encounter> dbSet [dbGet -p2 top.insts.cell.name MEM2_4096X32].pStatus
cover

The object list could have been passed to dbGet as a variable or as done in this case
using the dbGet return list directly.
9. Use dbGet to confirm that the placement status of those instances has been changed
encounter> dbGet [dbGet -p2 top.insts.cell.name MEM2_4096X32].pStatus
cover cover cover cover cover cover cover cover cover cover cover cover
cover cover cover cover cover cover cover

All of the instances now have cover placement status.

4-42

Database Access with DBTCL

04/06/12

Module 5:

Using dbTransform to
covert from local to
global coordinates

Lab 5-1

Converting coordinates from local to global using


dbTransform

Objective:

To introduce the dbSet command and how to use it to change attribute


values

In this section, well learn how use dbTransform to convert from coordinates inside of cells (local) to
those in the top level design (global).
How can I convert coordinates from ones local to a cell to those in the design?
For this section we are going use the same database as in the earlier lab sections.
Objects like libCell (created from LEF MACROs or OpenAccess abstract views) have a coordinate
system that is local to the cell. For example, coordinate transformation is required to take a set of pin
shapes for a cell master and convert the coordinates of those shapes into values that are in the design
context instead of the cell context.
Select the block in the lower left corner of the core and zoom in around that instance.
1. Use dbGet find the coordinates of the WE1 pin shapes for the selected instance (using
.? and ?h you could find the attribute names to use for the traversal).
encounter> dbGet [dbGet -p selected.cell.terms.name
WE1].pins.allShapes.shapes.rect
{376.01 12 376.67 12.66} {376.01 12 376.67 12.66} {376.01 12 376.67
12.66} {376.01 12 376.67 12.66}

Those coordinates are for the four rectangles that make up the WE1 pin, but they are
local to the cell master of the instance and not relative to the design.
2. Use the coordinates and selected instance pointer to convert that list of rectangles
into a list of rectangles in the design context
encounter> set local_pin_rects [dbGet [dbGet -p
selected.cell.terms.name WE1].pins.allShapes.shapes.rect]
{376.01 12 376.67 12.66} {376.01 12 376.67 12.66} {376.01 12 376.67
12.66} {376.01 12 376.67 12.66}
encounter> dbTransform -inst [dbGet selected] -localPt $local_pin_rects
{770.075 895.21 770.735 895.87} {770.075 895.21 770.735 895.87}
{770.075 895.21 770.735 895.87} {770.075 895.21 770.735 895.87}

Now the four rectangles are in design coordinates instead of the cell masters
coordinate system. The instances location, orientation, and size are taken into
account during the conversion. For instances with R0 orientation, the coordinate
transformation is pretty simple.

5-44

Database Access with DBTCL

04/06/12

Converting coordinates from local to global using dbTransform

Lab 4-1

For What If experiments, you can manually specify a cell, orientation, and
location using cell, -orient, and -pt instead of inst which uses an existing placed
instance in the design.
3. If you didnt need to real pin shapes, but just a derived pin location for the instance
terminals, you could access that directly without using dbTransform
encounter> dbGet [dbGet -p selected.instTerms.name *WE1].pt
{770.405 895.54}

The instTerm location is a derived single value for reference and may be all that you
need. If you need the real shapes of a LEF PIN or LEF OBS, then dbTransform is the
solution.

04/06/12

Database Access with DBTCL

5-45

Module 6:

How to query objects


within an area using
dbQuery

Lab 6-1

Find objects in an area using dbQuery

Objective:

To introduce the dbQuery command and how to use create a list of


objects in a specified area

In this section, well learn how use dbQuery to obtain a list of objects in a specified area.
How to find objects by area instead of by selection or by attribute based queries
For this section we are going use the same database as in the earlier lab sections.
As shown in earlier labs, dbGet can take an object or list of objects as the starting point for traversal
from several methods: keyword based starting points like top, head, and selected; single or
multiple objects returned from another dbGet call; and another other method. The dbQuery
command provides an area-lookup based method to get a list of object pointers.
The dbQuery command works similar to graphical selection without needing to maintain and
highlight the selected set of objects.
The dbQuery Tcl syntax is: dbQuery [-help] [-d] -area {llx lly urx ury} [-objType <objTypeList>],
with the possible object types being "bump", "inst", "pBlkg", "rBlkg", "regular" (DEF NETS
equivalent, union of viaInst & wire), resizeBlkg, special (DEF SPECIALNETS wiring
equivalent, union of sViaInst & sWire), "sViaInst", "sWire", "viaInst", and "wire".
1. Use dbQuery find the list of instances in the lower corner ({0 0 500 500}) of the
design (-objType is optional in this case as "inst" is the default objType)
encounter> dbQuery -area {0 0 500 500} -objType inst
0x282ad5d8 0x282b0b80 0x282ad4dc 0x282b0a84 0x282b0ad8 0x282ad530
0x282b0b2c 0x282ad584 0x1c3c7994

That list of pointers can be used with dbGet.


2. Use dbQuery with dbGet find cell names of the instance in the lower corner ({0 0 500
500}) of the design
encounter> dbGet [dbQuery -area {0 0 500 500} -objType inst].cell.name
PADO PADI PADO PADI PADO PADI PADI PADO MEM2_2048X32

So, in the lower left there are some instances of PADO, PADI, and MEM2_2048X32
3. How would we filter out the MACROs that are CLASS PAD in LEF, find which
attribute will help us filter out the pads
encounter> dbGet [dbQuery -area {0 0 500 500} -objType inst].cell.?h
*class*
baseClass: enum(block core corner cover none pad), Class type: derived
from LEF/OpenAccess (refer to documentation for complete mapping)

04/06/12

Database Access with DBTCL

6-47

Lab 6-1

Find objects in an area using dbQuery

subClass(settable): enum(block blockBlackBox blockRing blockSoft core


coreAntenna coreEndCapPost coreEndCapPre coreFeedthru coreSpacer
coreTieHigh coreTieLow coreWellTap cornerBottomLeft cornerBottomRight
cornerTopLeft cornerTopRight cover coverBump none pad padAreaIO
padInout padInput padOutput padPower padSpacer), Class sub type:
derived from LEF/OpenAccess (refer to documentation for complete
mapping)

It looks like the baseClass = pad is likely equivalent to CLASS PAD.


4. Lets try to access the baseClass
encounter> dbGet [dbQuery -area {0 0 500 500} -objType
inst].cell.baseClass pad
pad pad pad pad pad pad pad pad

In this case we wanted cells that are not CLASS PAD, so we need to use the dbGet v
option to the negative pattern matching (similar to UNIX grep v)
5. We found the right attribute to filter with, but we want to do a negative filter
encounter> dbGet v [dbQuery -area {0 0 500 500} -objType
inst].cell.baseClass pad
block

For this example there is only one non-pad instance in the specified area. Now all we
need is its instance name.
6. Now lets get the instance name
encounter> dbGet [dbGet p2 v [dbQuery -area {0 0 500 500} -objType
inst].cell.baseClass pad].name
coreinst/ks_core1/amba_dsp1/rom2p_2kx32/ram0

How to find objects at a specific point or that cross a specified line


7. Use dbQuery find the list of DEF SPECIALNETS shapes that intersect a line from
{400 250} to {400 375} in the design
encounter> dbQuery -area {400 250 400 375} -objType special
0x3191c914 0x3145ca08 0x3191c95c 0x3145cb04 0x3145cb28

The area option can be used to specify an area {llx lly urx ury}, a line {x1 y1 x1 y2}
or {x1 y1 x2 y1}, or a pt {x y x y}. Any object enclosed or intersecting an object will
be returned, so if a single point location is specified with objType inst, then it is
likely only one inst would be returned unless the pt is on the edge or corner where up
to four instances could be returned if they are not overlapping.
8. Use dbGet with dbQuery find which layers those shapes are on
encounter> dbGet [dbQuery -area {400 250 400 375} -objType
special].layer.extName
6-48

Database Access with DBTCL

04/06/12

Find objects in an area using dbQuery

Lab 6-1

Metal1 Metal1 Metal9 Metal1 Metal9

The layer.extName returns layer name information in the LEF/OA name space
instead of the Encounter internal name space.
9. Use dbGet with dbQuery find which + SHAPE attribute is on those shapes
encounter> dbGet [dbQuery -area {400 250 400 375} -objType
special].shape
followpin followpin ring followpin ring

There are two ring and three followpin shapes. You could use dbGet to isolate those
into separate lists if you needed to.
10. Use dbGet with dbQuery find the coordinates of those shapes
encounter> dbGet [dbQuery -area {400 250 400 375} -objType special].box
{370 371.77 5675.8 371.89} {370 373.48 5675.8 373.6} {315 315.06
5730.895 353.06} {370 370.12 5675.8 370.18} {267 267.06 5778.895
305.06}

Note that since we used dbQuery with a line as the method, there are no enclosed
objects only intersecting objects.

04/06/12

Database Access with DBTCL

6-49

Module 7:

Using dbShape to
manipulate lists of
shapes (new in 10.1)

Lab 7-1

dbShape basics

Objective:

To introduce the dbShape command and how to use do logical


operations on lists of shapes

In this section, well learn how use dbShape to basic operations like finding intersections between
sets of shapes and then oversizing the result.
Using dbShape to find intersections and do sizing operations
For this section we are going use the same database as in the earlier lab sections.
The dbShape command works on lists of shapes, not the database objects themselves. So, you can
use dbGet and other commands to produce lists of shapes and other commands like createRouteBlk
to create database objects from the dbShape results.
The dbShape Tcl syntax is: dbShape [-help] [-d] [-step <step>] [-output <polygon|rect|hrect>]
<shapeList> [AND <shapeList> | ANDNOT <shapeList> | OR <shapeList> | XOR <shapeList> |
BBOX | MOVE {<dx> <dy>} SIZE <value>| SIZEX <valuie> | SIZEY <value>] ...
1. Select the Metal9 VSS ring horizontal segment at the bottom left of the design and
store the .box attribute using dbGet
encounter> set set1 [dbGet selected.box]
{267 267.06 5778.895 305.06}

04/06/12

Database Access with DBTCL

7-51

Lab 7-1

dbShape basics

2. Select the first two Metal8 VSS segments connecting to the at the bottom left of the
design and store the .box attribute using dbGet
encounter> set set2 [dbGet selected.box]
{605 267.06 615 395.72} {485 267.06 495 395.72}

3. Use dbShape to find the intersections of the set1 and set2 lists of shapes
encounter> set intersection [dbShape $set1 AND $set2]
{605 267.06 615 305.06} {485 267.06 495 305.06}

4. Use dbShape to oversize each shape in the previous result by 2.5u


encounter> dbShape $intersection SIZE 2.5
{602.5 264.56 617.5 307.56} {482.5 264.56 497.5 307.56}

5. The same two could be done in a single dbShape call


encounter> dbShape $set1 AND $set2 SIZE 2.5
{602.5 264.56 617.5 307.56} {482.5 264.56 497.5 307.56}

dbShape operators (binary and unary) are processed in left to right order

7-52

Database Access with DBTCL

04/06/12

dbShape basics

Lab 7-1

Ooflab

04/06/12

Database Access with DBTCL

7-53

Module 8:

Extra Credit Working


on your own

Lab 8-1

Extra Credit

Objective:

To practice with the techniques that you have learned

In this section, well see if you are ready to go out on your own and search through the database
for information and use that to pass to other commands.
For this section we are going use the same database as in the earlier lab sections.
What are the names of the LEF VIAS with the DEFAULT keyword between layers
Metal2 and Metal3?
You can check your results by looking at the LEF files.
How many of each of those vias are used in the design?
Before the design is routed, you will have zero default vias. So, you will need to route the design for
this challenge (or load the provided routed.def.gz file). For an additional challenge you could use the
expression syntax to look for vias in a specific area (Note: dbQuery does not support DEF NETS
wiring at this time, so you would need to use dbGet for that).
Create a routing blockage on Metal7 over Metal6 portion of the pin shape for the WE1
terminal of the instance in the lower left of the core area
This is the first time you will need to break down the list-of-lists structure used by dbGet to return
geometric information in order to pass it to another command that expect individual coordinates to
be specified instead of accepting a list directly (refer to the createRouteBlk command Usage for the
syntax)
Create a marker between the CLASS BLOCK instances if the instances are closer
than 25u
Refer to the createMarker command for how to add a marker to the database. Hint: use dbShape with
the SIZE operator twice to oversize (10u) and undersize (-10u) to merge shapes that are closer than
20u.

References
Testcase database, Scripts and references can be found at Attachments and Related Solutions
sections below the PDF.
This pdf can be searched with the document 'Title' on https://support.cadence.com

04/06/12

Database Access with DBTCL

8-55

You might also like