Sie sind auf Seite 1von 99

Encounter Tcl

Database Access Commands


Cadence ICD R&D
Patrick J. Eichenseer
June 14, 2005 Version 1.0
CADENCE CONFIDENTIAL

CADENCE CONFIDENTIAL

1.0 Overview
1.0 Overview
2.0 Introduction
3.0 Schema Diagrams
4.0 Testing Objects
5.0 Retrieving Object
6.0 Retrieving Object Properties
7.0 Setting Objects
8.0 Adding/Creating/Manipulating Objects
9.0 Deleting Objects
10.0 Examples
11.0 Labs

CADENCE CONFIDENTIAL

Encounter Tcl
Database Access Commands

2.0 Introduction
CADENCE CONFIDENTIAL
CADENCE CONFIDENTIAL

2.0 Introduction - Premise For This Material


Users should not need to be TCL experts to be effective with
EDA tools
TCL can serve as a short term solution until native functions can
be developed and delivered; TCL shouldnt serve to eliminate
the need to enhance and refine an EDA tool
Becoming familiar with the native database structure in a design
system can help users be more effective with the tool
EDA databases are (hopefully) organized in a more logical way
than a text output from the tool
Manipulating EDA databases should be faster than parsing and
manipulating text output from tools

CADENCE CONFIDENTIAL

2.0 Introduction
The following files are searched for and loaded if found:
$ENCOUNTER/etc/enc.tcl ->Project-wide TCL Commands
./enc.tcl -> Design-specific TCL commands
~/enc.tcl -> User-specific TCL commands
these initialization tcl files which run just after FE invocation
Very easy to customize and automate Encounter using Tcl database access commands
Support both hierarchical database access and flat database access
Tcl 8.x for Encounter Fast-Track database access and user programming.
Tk 8.x for Encounter GUI customization.
Loading Tcl source file
source <tcl_file>
$ENCOUNTER/gift/scripts/tcl & $ENCOUNTER/fe/etc/ has examples
updateStatus force <mode> is often used with db access tcl scripts to update the current design
status

CADENCE CONFIDENTIAL

2.1Capturing TCL Commands


encounter.cmd<#>: Contains TCL commands that were executed during a session
encounter.log<#>: Contains the log file that was streamed to the screen
Tip: TCL commands are also embedded within the .log file. Search for the string
<cmd>

To determine what the name of the current .log/.cmd files:


encounter> getLogFileName
encounter> getCmdLogFileName
To replay the commands executed within a session:
encounter
Design->Design Import->OK maps to "loadConfig bigchip.conf"
encounter>amoebaPlace;trialRoute;extractRC;buildTimingGraph;reportViolation -outfile bigchip.tarpt;exit

encounter -init encounter.cmd

encounter -help -> for more startup options


Puts vs puts

CADENCE CONFIDENTIAL

2.2 Command Line Help


"info command *pattern*" or "*pattern*"
info command *Place* -> returns a list of all defined TCL commands that
match *Place*
*Place* -> also returns a list of commands, as it is "ambiguous", however, if
the search string matches exactly 1 TCL command, the command is
executed:
remove*Tree -> executes "removeBufferTree" command

help amoebaPlace -> returns usage for command


Case Sensitivity:
Good: trialRoute trialroute TRIALROUTE
Bad: TrialRoute trial_route
Options ARE case senstive:
help trialRoute -> trialRoute [-guide <fileName>] [-noDetour] [-ignoreObstruct]
GOOD: trialRoute -noDetour BAD: trialRoute -nodetour
7

CADENCE CONFIDENTIAL

2.3 Documentation
Where to get Encounter Documentation?
Click "Help" on the Main Encounter GUI for html
cp $ENCOUNTER/doc/*/*.pdf ~/fedocs/.
soceUG.pdf (Encounter Users Guide)
encounter.pdf (Menu Command Reference)
fetxtcmdref.pdf (Text Command Reference)
soceDBAref.pdf (Database Access Command Reference)

CADENCE CONFIDENTIAL

2.4 My "encounter>" prompt is hung!


encounter> prompt locks up after typing:
removeBuffre<Delete-Key>
removeBuffre^[[3<CR>
FE thinks a TCL command has been started, and is waiting for you
to complete it

Solutions
On the next line "close" the square brackets: ]]<CR>
Try "editCmdLine"
stty erase <Control-v> <backspace> <CR>

CADENCE CONFIDENTIAL

2.5 Connectivity Model


cells have fterms

Block Level Perspective:


set cell [dbgTopCell]

insts have terms


terms connect to nets

instPtr

IO Pin: ftermPtr

netPtr

termPtr

nets connect to terms and fterms


termPtr

fterms are IO Pins as viewed by the top cell

instPtr

fterms can also be the pins on a library cell, as in BUFX2


Library Cell Perspective:
set instName dtmf_inst/i635
set cell [dbInstCell [dbGetInstByName $instName]]
set cellName [dbCellName $cell]
BUFX2
A fterm

10

CADENCE CONFIDENTIAL

Z fterm

instPtr

2.6 Simple Example

termPtr

1.

instPtr

# select all instances connected to a specified net name

netPtr

termPtr
2.

proc selectInstByNet { netName } {

# proc and argument definition

3.

set netPtr [dbGetNetByName $netName]

# get the net pointer

4.

dbForEachNetTerm $netPtr termPtr {

# loop for all terminals

5.

if { [dbIsObjTerm $termPtr] == 1 } {

# if the object is instance terminal

6.

set instPtr [dbTermInst $termPtr]

# get a instance pointer of the terminal

7.

set instName [dbInstName $instPtr]

# get the instance name

8.

set cellName [dbInstCellName $instPtr]

# get the cell master name

9.

puts "Instance $instName ($cellName)

# print names

10.

selectInst $instName

# select the instance

11.

12.

13.

14.

encounter> source sample.tcl

# source the tcl file

15.

encounter> selectInstByNet <net_name>

# run the proc defined in your tcl file

11

CADENCE CONFIDENTIAL

termPtr
instPtr

Encounter Tcl
Database Access Commands

3.0 Schema Diagrams


CADENCE CONFIDENTIAL
CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
13 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell 38)Hinst->Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

3.2 Multiple Object Pointers: dbForEach


dbForEach<Object><Object>
Usage: dbForEachHeadSelPtr <cellPtr> <ptrVar> <body>
Example: Finding all of the clock nets by a search string
set count 0
dbForEachCellNet [dbgTopCell] netPtr {
set netName [dbNetName $netPtr]
if {[string match *CLK* $netName} {

puts "Net $netName matches search string \*CLK\*."

incr count

}
}
puts "Done. Found $count net(s) that match search criteria."
14

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access


Single Objects
07/01/05 P. Eichenseer
dbgHead

Head

Design Info

Numbers

Database Units

dbHeadTopCell/dbHeadChipTopCell

dbHeadNrSel

dbHeadPicoFPerDBU

dbHeadName
dbHeadAspectRatio
dbHeadBox

dbHeadNrHilite
dbHeadNrLayer
dbHeadNrLefLayer

dbHeadDBUPerIGU
dbHeadOhmPerDBU
dbHeadDBUPerIoGU

dbHeadCoreBox
dbHeadIoBox
dbHeadIoHgt
dbHeadStdCellHgt

dbHeadNrExtRule
dbHeadNrWireLayer
dbHeadNrExtRulePlus1

dbHeadNPicoSecPerDBU
dbHeadMicroPerDBU
dbHeadDBUPerMGrid

dbHeadBlockMargin
dbHeadBlockAsStdCell
dbHeadSpGlobalLen
dbHeadSpDetailLen

15

CADENCE CONFIDENTIAL

Cadence Company Confidential

3.5 Querying Single Object Pointers


db<Object><Attribute> $netPtr

Example: Querying a net to find out how many recievers it has


encounter> dbNetNrFanOut $netPtr
782

Capturing the result for later use


set fanout [dbNetNrFanOut $netPtr]
encounter> puts "Net $fanout"
782

16

CADENCE CONFIDENTIAL

3.4 Getting Single Object Pointers


By Selection
set netPtr [dbHeadFirstSelPtr]

By Name
dbGet<object>ByName <object_name>
Where <object> is one of:
Net, Inst, Term,

set <object>Ptr [dbGet<object>ByName <object_name>]


Examples:
encounter> set netPtr [dbGetNetByName SH17/net18028]
Returns: 0xc4d5c0c is GOOD Returns: 0x0 means not foundBy

By Reference
dbNetTerm

17

CADENCE CONFIDENTIAL

3.7 Modifying Single Objects

dbSet<Object><Attribute>
Example: Setting a net's weight for Amoeba Placement
dbSetNetUserWt <net_pointer> <weight>
dbSetNetUserWt [dbGetNetByName " SH17/net18028"] 10
dbSetIs<Object><Attribute>
Example: Instructing Trial Route to not route a certain net
dbSetNetIsIgnoreInRoute <net_pointer> <0 | 1>
dbSetNetIsIgnoreInRoute $netPtr 1

18

CADENCE CONFIDENTIAL

3.6 Looping Through Objects: dbForEach


dbForEach<Object><Object>
Example: dbForEachHeadSelPtr <headPtr> <ptrVar> <body>
Example: Finding nets that match a search string
set count 0
dbForEachCellNet [dbgTopCell] netPtr {
set netName [dbNetName $netPtr]
if {[string match *CLK* $netName} {

puts "Net $netName matches search string \*CLK\*."

incr count

}
}
puts "Done. Found $count net(s) that match search criteria."
19

CADENCE CONFIDENTIAL

3.7 The Selected Set

Usage: dbForEachHeadSelPtr <headPtr> <ptrVar> <body>


Example: Finding all currently selected Hierarchical Instances
set names {}
dbForEachHeadSelPtr [dbgHead] object {
if {[dbObjType $object] == "dbcObjHInst"} {

lappend names [dbHInstName $object]

}
}
Note: Objects can be hilited without being selected
dbIsInstHilite is not the same as dbIsInstSel
Refer to the number of selected objects in the lower right part of the GUI
20

CADENCE CONFIDENTIAL

3.7 The Selected Set


# userCheckArea checks a certain area(Box) on a specific
# layer and returns the object(s) type and name as well
# as the total number of objects
# eg. encounter> userCheckArea { 1000 1000 4000 4000 } 2
#

Info: editSelect -layer 2 -area 1000 1000 4000 4000

Info: found object SH25 of type dbcObjHInst

encounter

#
proc userCheckArea { Box layerList } {
set NrObj ""
foreach this_layer $layerList {
editSelect -layer $this_layer -area [lindex $Box 0] [lindex $Box 1] [lindex $Box 2] [lindex $Box 3]
if { [dbHeadNrSel] > 0} {
set NrObj "$NrObj $this_layer"
puts "Info: editSelect -layer $this_layer -area [lindex $Box 0] [lindex $Box 1] [lindex $Box 2] [lindex $Box 3]"
}
dbForEachHeadSelPtr [dbgHead] SelPtr {
Puts "Info: found object [dbObjName $SelPtr] of type [dbObjType $SelPtr]"
}
deselectAll
}
return $NrObj
}
21

CADENCE CONFIDENTIAL

Encounter Tcl
Database Access Commands

4.0 Testing Objects


CADENCE CONFIDENTIAL
CADENCE CONFIDENTIAL

4.0 Testing Objects - What is this Thing?

dbObjType [dbHeadFirstSelPtr]
Returns something like "dbcObjGuide"
Use this to guide your scripting
set count 0
dbForEachFPlanConstraint $floorplanPointer constraint {
if {[string match [dbObjType $constraint] "dbcObjGuide"]} {
puts "Found a guide!"
incr count

}
puts "Done. Found a total of $count floorplan guide(s)."

23

CADENCE CONFIDENTIAL

4. Testing Objects
4-1 general return the constant value of object type
ObjType

dbObjType $objPtr

dbcObjNet dbcObjTerm dbcObjFTerm dbcObjInst, dbcObjWire dbcObjHead dbcObjCell


dcbObjHInst dbcObjPath dbcObjIo dbcObjLayer dbcObjTimeArc dbcObjFPlan dbcObjStdRow
dbcObjConstraint dbcObjScreen dbcObjProp dbcObjDPath dbcObjDPInst dbcObjDPHInst
dbcObjObstruct dbcObjectWireX dbcObjPerim dbcObjGroup dbcObjBus dbcObjSec
dbcObjPtn dbcObjVio dbcObjSNet dbcObjRouteBox dbcObjRouteGuide dbcObjNetGroup
dbcObjDLine dbcObjTimeLib dbcObjOpCond dbcObjLayerBlk dncObjRuler dbcObjPtnCut
dbcObjPtnPinBlk dbcObjPtnFeed dbcObjPinGroup dbcObjCellPad dbcObjNetRect
dbcObjXPin dbcObjRPin dbcObjBumpCell dbcObjBump dbcObjIoSlot dbcObjFPin dbcObjAPin
dbcObjNetRectIntf dbcObjPowerSink dbcObjClock dbcObjPinWire dbcObjCloneList
dbcObjRectList dbcObjVia dbcObjViaRuleLayer dbcObjViaRuleCut dbcObjViaRule dbcObjSpacing
dbcObjLayerRule dbcObjExtRule dbcObjForeign dbcObjAntennaAttr dbcObjTable
dbcObjLinearTable dbcObjViaCell dbcObjVNet dbcObjVTerm dbcObjVInst dbcObjVCell
dbcObjVFterm dbcObjAntModel dbcObjPowerDomain dbcObjIter dbcObjLefFPin dbcObjLayerBox
Test the object type using constant, for example if { $obj_type == "dbcObjInst" } {}
Testing can also be done with the db access commands of the form dbIs* and dbSetIs*.

24

CADENCE CONFIDENTIAL

4.2 Testing Objects


Example:
proc userQuery {} {
set s [dbHeadSelList]
if { $s } {
set objPtr [dbSelPtr $s]
set obj_type [dbObjType $objPtr]
if { $obj_type == "dbcObjInst" } {
set objName [dbObjName $objPtr]
set leafCell [dbInstCellName $objPtr]
set cellPtr [dbInstCell $objPtr]
set orient [dbInstOrient $objPtr]
if { [dbIsInstPlaced $objPtr] == 1 } {
set placeStatus "Placed"
} else { set placeStatus "Not Placed" }
if { [dbIsCellBlock $cellPtr] == 1 } {
set cellType "Hard Block"
} elseif { [dbIsCellStdCell $cellPtr] == 1 } {
set cellType "Std Cell"
} elseif { [dbIsCellIo $cellPtr] == 1 } {
set cellType "I/O Cell"
} else { set cellType [dbCellType $cellPtr] }

} elseif { $obj_type == "dbcObjWire" } {


set wirePtr [dbWireNet $objPtr]
set wireName [dbNetName $wirePtr]
set netPtr [dbWireNet $objPtr]

25

CADENCE CONFIDENTIAL

Encounter Tcl
Database Access Commands

5.0 Retrieving Database Objects


CADENCE CONFIDENTIAL
CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-1 Head -- Pointer to the Fast-Track database currently opened
Head itself

dbgHead

HiLite

dbForEachHeadHilite [dbgHead] hilitePtr {}

Selected

dbForEachHeadSel [dbgHead] selPtr {}

Numbers of things

dbHeadNrSel (number of selected objects)

Example:

proc rptSelectedObjs {} {
dbForEachHeadSel [dbgHead] selPtr {
set objPtr [dbSelPtr $selPtr]
set obj_type [dbObjType $objPtr]
set obj_name [dbObjName $objPtr]
puts $obj_name of type $obj_type is selected
}
}

27

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-2 Fplan -- Floorplan Information
Cell Floor Plan

dbCellFPlan [dbgTopCell]

Standard Row

dbForEachFPlanDefRow $fplanPtr stdRowPtr {}

Obstruct

dbForEachFPlanObstruct [dbCellFPlan [dbgTopCell]] obsPtr { }

Layer Blockages

dbForEachFPlanLayerBlk $fplanPtr layerBlkPt {}

Groups

dbForEachFPlanCellGroup $fplanPtr cellGroupPtr {}

Partitions

dbForEachCellPtn $fplanPtr ptnPtr {}

Feeds/Pin Blockages/Cuts

dbForEachFPlanPtnFeed/PtnPinBlk/PtnCut

Constraint(Region/Fence/Guide)

dbForEachFPlanConstraint [dbCellFPlan [dbgTopCell]] constPtr {}

Density Screens

dbForEachFPlanScreen $fplanPtr screenPtr {}

Global Net Connections

dbForEachFPlanGlobalNetConnection

Example 1:
proc rptPtnNames {} {
puts The following are partitions in this design:
dbForEachCellPtn [dbHeadFPlan] ptnPtr{
set name [dbPtnName $ptnPtr]
puts $name
}
}

28

CADENCE CONFIDENTIAL

Retrieving Database Objects

5-2 Fplan Old Floorplan Information (pre 4.1)

Routing Blockage (LayerBlk)


Multiple layer in a layer blockage
One box

Placement Blockage (Obstruct)


One box

Area Density (Screen)


Capacity (0 to 16)
One box

GUI and FloorPlan file merge Obstruct and Screen into


placement blockage

29

CADENCE CONFIDENTIAL

5. Retrieving Database Objects

5-2 Fplan -- Floorplan Information (starting in 4.1)

Floor Plan Objects


BLOCKAGE
LAYER
PLACEMENT
 Hard (Obstruct)
 Soft (Screen with capacity 0)
 Partial (Screen with capacity > 0)

No more FE rows only DEF rows


Only one set of track data.

30

CADENCE CONFIDENTIAL

5. Retrieving Database Objects

5-2 FPlan
Example 2:

proc userGroupGateCount {grpName} {


set grpPntr [ dbGetGroupByName $grpName ]
set grpHierInstPntr [ dbGroupHInstList [ dbGetGroupByName
group1 ] ]
set cc 0
dbForEachGroupHInst $grpPntr instPntr {
set cc [ expr $cc+1 ]
}
puts " number of gates in $grpName is : $cc "
}
31

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-2 FPlan
Example 3:

proc userCheckForFenceOverlap { } {
dbForEachFPlanConstraint [dbHeadFPlan] constraintPtr {
set constraintType [dbConstraintType $constraintPtr]
if { $constraintType == "dbcFence" } {
set hinstName1 [dbHInstName [dbConstraintHInst $constraintPtr]]
set box1 [dbConstraintBox $constraintPtr]
dbForEachFPlanConstraint [dbHeadFPlan] constraintPtr2 {
set hinstName2 [dbHInstName [dbConstraintHInst $constraintPtr2]]
if { $constraintType == "dbcFence" } {
set box2 [dbConstraintBox $constraintPtr2]
set yes [dbIsBoxOverlappingOrTouchingBox $box1 $box2]
if { $yes == 1 } {
if { $hinstName1 != $hinstName2 } {
puts "The fences overlap for modules $hinstName1 $hinstName2"
}}}}}}}

32

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-2 FPlan

Example 4:
###################################################################
# userRptPinGuides reports the name and pins of pin guides
#####################################################################
proc userRptPinGuides { } {
# Usage: dbForEachNetGroupNet <netGroupPtr> <netPtrVar> <body>
# Usage: dbRouteGuideNetGroup <routeGuidePtr>
# Usage: dbRouteGuideBoxList <routeGuidePtr>
# Usage: dbFPlanRouteGuideList <fplanPtr>
set routeGuidePtr [dbFPlanRouteGuideList [dbCellFPlan [dbgTopCell] ] ]
while {"$routeGuidePtr" != "0x0"} {
Puts "RoutingGroup: [dbObjName $routeGuidePtr ]"
set netGroupPtr

[dbRouteGuideNetGroup $routeGuidePtr]

dbForEachNetGroupNet $netGroupPtr netPtr {


Puts " [dbObjName $netPtr]"
}
Puts " "
set routeGuidePtr [dbRouteGuideNext $routeGuidePtr]
}

33

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
34 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

5. Retrieving Database Objects


5-3 Cell Cell master in current database
Top Level Cell

dbgTopCell

HeadCell

dbForEachHeadCell [dbgHead] cell {}

Cell

dbGetCellByName

Example 1:
proc doesCellExist { cell } {
dbForEachHeadCell [dbgHead] cellPtr {
if { $cell == [dbCellName $cellPtr] } {
puts The cell $cell does exist.
}
}
Example 2:
proc userFindCellByCellName {cellNamePattern} {
set cellNameList {}
dbForEachHeadCell [dbgHead] cellPtr {
if [string match $cellNamePattern [dbCellName $cellPtr]] {
lappend cellNameList [dbCellName $cellPtr]
}
}
return $cellNameList
}

35

CADENCE CONFIDENTIAL

Retrieving Database Objects

5-3 Cell - Old FE Cell Geomtry

Cell
FTerm
FPin
Via

Via (via obs)


Blk (metal layer obs)
Bits used to block whole layer
LayerBlk

Blk (cut layer obs array)

Cut layer pins are treated as cut layer obs

36

CADENCE CONFIDENTIAL

Retrieving Database Objects

5-3 Cell - LEF (starting in 4.1)

Cell Geometry LEF file structure


MACRO (Cell)
PIN (FTerm)
PORT (LefPort)
Layer Geometry (LayerShape)
RECT/POLYGON/PATH (Shape)
VIA (LayerShape)

OBS (dbsLefOBS)

LayerId Index of layers defined in LEF file


No more contact layer use dbsViaCell
37

CADENCE CONFIDENTIAL

Retrieving Database Objects


5-3 Cell Obstructions (starting in 4.1)

dbForEachCellLefOBS
if (dbLefObsType == dbLefObsTypeVia) { /* viaobs */
dbViaCell = dbGetLefObsViaCell(obs);
dbsLoc loc = dbmGetObsViaLoc(obs);
} else { /* obs on one layer, maybe metal, cut, or overlap layer */
dbLayer = dbLefObsLayer(obs);
dbForEachLefOBSShape(obs, shape)
/* shape access routines */
}
}
}

38

CADENCE CONFIDENTIAL

5. Retrieving Database Objects

5-3 Cell Cell master in current database


Example 3:
Description: userGenJtagRegion generates "mini-regions" for JTAG cells
Usage: userGenJtagRegion padInstRootName jtagHInstRootName regWidth regDept

dbForEachCellIo [dbgTopCell] ioPtr {


set ioName [dbIoName $ioPtr]
if { [string match $padInstRootNamePattern $ioName] && [dbIsIoDummyPad $ioPtr] == 0 } {
set ioNameLength [string length $ioName]
set ioSuffix [string range $ioName $padInstRootNameLength $ioNameLength]
set jtagHInstNameList [concat $jtagHInstRootName $ioSuffix]
set jtagHInstName [join $jtagHInstNameList ""]
dbForEachHInstTreeHInst [dbGetHInstByName $hierInst] hinstPtr {
set hinstName [dbHInstName $hinstPtr]
if { [string match $jtagHInstName $hinstName] } {
createRegion $hinstName $region_llx $region_lly $region_urx $region_ury"
specifyJtag -inst $hinstName

39

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

Inst

dbForEachHInstTreeInst
dbInstHierHinst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
40 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

5. Retrieving Database Objects


5-4 Inst Cell instance
CellInst

dbForEachCellInst [dbgTopCell] inst {}

InstByName

dbGetInstByName $instName

Eample:
proc userSelectInsts { matchName } {
Puts "\n\n\nInfo: Checking for instance names pattern matching $matchName...\n"
set cnt_inst 0
dbForEachCellInst [dbgTopCell] instPtr {
set instName [dbInstName $instPtr]
if [string match $matchName $instName] {
incr cnt_inst
Puts "\tInstance: $instName"
selectInst $instName
}
}
Puts "\nInfo: Selected $cnt_inst instance(s)\n"
.s redraw
}

41

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
42 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

5. Retrieving Database Objects


5-5 Hinst Hierarchical instance = Verilog module
HInstByName

dbGetHInstByName $hinstPtr

HInstTreeHInst

dbForEachHInstTreeHInst $hinstPtr instPtr {}

InstHInst

dbInstHInst $hinstPtr

Parent

dbHInstParent $hinstPtr

Cell

dbCellHInst $cellPtr

Example:
proc rptNamesOfSelectedModules { } {
dbForEachHeadSelPtr [dbgHead] objPtr {
set objName [dbObjName $objPtr]
set obj_type [dbObjType $objPtr]
if { $obj_type == "dbcObjHInst" } {
set hierCell [dbHInstCellName $objPtr]
puts Module $hierCell is selected
}
}
}

43

CADENCE CONFIDENTIAL

5. Retrieving Database Objects

5-5 Hinst Hierarchical instance = Verilog module

Example 2:
dbForEachCellPtn [dbgTopCell] ptnPtr {
set ptnName [dbPtnName $ptnPtr]
set ptnCellPtr [dbPtnCell $ptnPtr]
set name [dbCellName $ptnCellPtr]
dbForEachHInstTreeHInst [dbCellHInst [dbgTopCell]] hinstPtr {
if [dbIsHInstHInst $hinstPtr] {
set hinstName [dbHInstName $hinstPtr]
set cellName [dbHInstCellName $hinstPtr]
if { $name == $cellName } {

44

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
45 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell 38)Hinst->Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

1. Get database object(s)


1-6 Hterm Hierarchical instance terminal on Verilog module
HInstHTerm

dbForEachHInstHTerm $hinstPtr htermPtr {}

Example:
proc userRptHInst { hinstPtr } {

Behavior of dbForEachHInstHTerm
had been changed from v3.2 to 3.3.

dbForEachHInstHTerm $hinstPtr htermPtr {


set hinstName [dbHInstName $hinstId]
set netId [dbHTermNet $htermPtr]

For 3.2, dbForEachHInstHTerm


returned only HTerm with net
connected.

set netName [dbNetName $netId]


set netNrTerm [dbNetNrTerm $netId]
puts $fp "HPIN : $hinstName/$ftermName"
puts $fp "NET : $netName"
puts $fp "TERMS : $netNrTerm"
}
}

46

CADENCE CONFIDENTIAL

On 3.3, dbForEachHInstHTerm
ruturns all HTerm and [dbHTermNet
$HTerm] returns "0x0" as net
pointer for HTerm which doesn't
have any net connection. Thus, one
should test whether the net is not
0x0 before using the pointer.

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
47 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

5. Retrieving Database Objects

5-7 HTerm
Example 2:
proc userRptFloatingPortsOnModules {} {
set delimiter [dbgHierChar]
set list_hinsts {}
dbForEachCellNet [dbgTopCelll] netPtr {

# get all nets in top cell

set netName [dbNetName $netPtr]


dbForEachNetTerm $netPtr termPtr {
if { ![dbIsTermFTerm $termPtr]} {

# get all terminals on net


# don't care about IO, just connections to instances

set termInstName [dbTermInstName $termPtr]


set inst_hier1 [lindex [split $termInstName $delimiter] 0]

# get module instance is in

set length [llength $list_hinsts]

set flag 0
for { set i 0 } { $i < $length } {incr i } {
if { $inst_hier1 == [lindex $list_hinsts $i] } {
set flag 1
}}
if { $flag == 0 } {
set hinstName [dbHInstCellName [dbGetHInstByName $inst_hier1]]
lappend list_hinsts $hinstName
}
}
}

48

CADENCE CONFIDENTIAL

add module to the list if it's not already in the list

5. Retrieving Database Objects

5-7 HTerm
Example 2 (Continued):
# now go through all verilog connections and see
dbForEachHInstHInst [dbCellHInst [dbgTopCell]] hinstPtr {
set hinstName [dbHInstCellName $hinstPtr]
if [dbIsHInstHInst $hinstPtr] {
dbForEachHInstHTerm $hinstPtr HTermPtr {
set ftermPtr [dbHTermFTerm $HTermPtr $hinstPtr]
set ftermName [dbFTermName $ftermPtr]
set netPtr [dbHTermNet $HTermPtr]
set netName2 [dbNetName $netPtr]
if { $netName == $netName2 } {
#

see if hinst is list; if not, it's not connected inside hinst


if { [lsearch -exact $list_hinsts $hinstName] } {
puts "The term $ftermName is not connected to any instances is the module $hinstName"
}
}
}
}
}
set list_hinsts {}

}
}

49

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

Inst

dbForEachHInstTreeInst
dbInstHierHinst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell
dbForEachFTermLefPort

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
50 CADENCE CONFIDENTIAL
GeomList

OpCond

dbSNetNet

Standard Row
dbForEachFPlanScreen

dbTermNet

ptnFeed
dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

5. Retrieving Database Objects


5-7 Term Instance terminal
InstTerm

dbForEachInstTerm $instPtr termPtr {}

InstInputTerm

dbForEachInstInputTerm $instPtr termPtr {}

InstOutputTerm

dbForEachInstOutputTerm $instPtr termPtr {}

TermByName

dbGetTermByName $startInst $startTerm

Example:
proc scanTracePath { startTermPoint } {
"\n\n\nInfo: Tracing scan chain starting at $startTermPoint...\n"
set delimiter [dbgHierChar]
set hier_list [split $startTermPoint $delimiter]
set cnt 0
foreach i $hier_list {
incr cnt

Note: Partial code listing

}
set startTermIndex [expr $cnt - 1]
set startTerm [lindex $hier_list $startTermIndex]
set inst_list ""
set cnt 0
foreach i $hier_list {
incr cnt
if { $cnt <= $startTermIndex } {
set inst_list [concat $inst_list $i]
}
}
set startInst [join $inst_list $delimiter]
set startTermPtr [dbGetTermByName $startInst $startTerm]

51

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
52 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

5. Retrieving Database Objects


5-8 FTerm Formal Terminal on master cell
CellFTerm

dbForEachCellFTerm $cellPtr ftermPtr <body>

InputFterm

dbForEachCellInputFTerm [dbgTopCell] {}

OutputFTerm

dbForEachCellOutputFTerm [dbgTopCell] {}

FTermByName

dbGetFTermByName $startCellPtr $startTerm

FTermNet

dbFTermNet $startFTermPtr

HTermFTerm

dbHTermFTerm $ftermPtr

Example 1:
proc userFixPins {} {
dbForEachCellInputFTerm [dbgTopCell] ftermpointer {
dbSetIsFTermPreassigned $ftermpointer 1
}
dbForEachCellOutputFTerm [dbgTopCell] ftermpointer {
dbSetIsFTermPreassigned $ftermpointer 1
}
}

53

CADENCE CONFIDENTIAL

5. Retrieving Database Objects

5-8 FTerm Cell Pin Geometry Traverse (starting in 4.1)


dbForEachFTermLefPort
dbForEachLefPortLayerShape
dbForEachShapeListShape
/* shape access routines */
}
}
}

54

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-12 FTerm
Example 2:

proc userRptTermDirs { netName } {


dbForEachNetTerm [dbGetNetByName $netName] termPtr {
if { [dbIsObjTerm $termPtr] == 1 } {
set instName [dbTermInstName $termPtr]
puts "Instance $instName has a port as follows"
set termName [dbTermName $termPtr]
if {[dbIsTermInput $termPtr]} {
puts " $termName with a direction of input"
} elseif { [dbIsTermOutput $termPtr] } {
puts " $termName with a direction of output"
} elseif { [dbIsTermBidi $termPtr] } {
puts " $termName with a direciton of bidir"
} else {
puts " $termName has an unknown direction"
}
} elseif { [dbIsFTermFTerm $termPtr] == 1 } {
puts "The top cell has a port as follows:"
set ftermPtr $termPtr
set termName [dbFTermName $ftermPtr]
if {[dbIsFTermInput $termPtr]} {
puts " $termName with a direction of input"
} elseif { [dbIsFTermOutput $termPtr] } {
puts " $termName with a direction of output"
} elseif { [dbIsFTermBidi $termPtr] } {
puts " $termName with a direciton of bidir"
} else {
puts " $termName has an unknown direction"
}

55

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-12 FTerm
Example 3:

proc userRptAllPGPins { pat output {output1 "userRptPin.rpt"}} {


dbForEachCellInst [dbgTopCell] instPtr {
set cellPtr [dbInstCell $instPtr]
set instName [dbInstName $instPtr]
set name [dbCellName $cellPtr]
if {[string match $pat $name]} {
puts "Processing cell $name..."
dbForAllCellPGFTerm $cellPtr ftermPtr {
set ftname [dbFTermName $ftermPtr]
set side [dbFTermSide $ftermPtr]
set width [dbFTermWidth $ftermPtr]
set depth [dbFTermDepth $ftermPtr]
dbForEachFTermLefPort $ftermPtr portPtr {
dbForEachLefPortLayerShape $portPtr lsPtr {
set testlen [string length [dbLayerShapeLayer $lsPtr]]
if {$testlen == 9} {
set trunkLayerName [dbLayerName [dbLayerShapeLayer $lsPtr]]
set layer [dbLayerWireId $trunkLayerName]
if { [dbIsLayerShapeShapeList $lsPtr] == 1 } {
dbForEachLayerShapeShape $lsPtr shapePtr {
set box [dbShapeRect $shapePtr]
set bllx [dbBoxLLX $box]
set blly [dbBoxLLY $box]
set burx [dbBoxURX $box]
set bury [dbBoxURY $box]

56

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
57 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

5. Retrieving Database Objects


5-8 FTerm Formal Terminal on master cell
Example 4:

proc userSetIONetWeight { } {
dbForEachCellInputFTerm [dbgTopCell] ioPtr {
set ioNetPtr [dbTermNet $ioPtr]
set ioNetName [dbNetName $ioNetPtr]
puts "Setting weight on INPUT net: $ioNetName"
specifyNetWeight $ioNetName 10
}
dbForEachCellOutputFTerm [dbgTopCell] ioPtr {
set ioNetPtr [dbTermNet $ioPtr]
set ioNetName [dbNetName $ioNetPtr]
puts "Setting weight on OUTPUT net: $ioNetName"
specifyNetWeight $ioNetName 5
}
}

58

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-8 FTerm Formal Terminal on master cell
Example 5:

proc userFindInstsByFterm { fterm fileName } {


set f [open $fileName w]
set cellPtr [dbgTopCell]
dbForEachCellInst $cellPtr instPtr {
set instName [dbInstName $instPtr]
#puts $instName
dbForEachInstTerm $instPtr termPtr {
set xxxnetPtr [dbTermNet $termPtr]
if { $xxxnetPtr != 0x0 } {
set ftermName [dbTermName $termPtr]
if { $ftermName == $fterm } {
puts $f "$instName"
}
}
}
close $f
}

59

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
60 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

5. Retrieving Database Objects


5-9 Net

61

CellNet

dbForEachCellNet [dbgTopCell] netPtr {} / dbForAllCellNet $cellPtr $netPtr {}

P/G Nets

dbGetSNetByName $name

TermNetFTermNet/HTermNet

dbTermNet $termPtr

NetTerm

dbForEachNetTerm $netPtr termPtr {}

NetOutputTerm

dbForEachNetOutputTerm $netPtr termPtr {}

NetInputTerm

dbForEachNetInputTerm $netPtr termPtr {}

NetByName

dbGetNetByName $netName

WireNet

dbWireNet $objPtr

HInstTreeNet

dbForEachHInstTreeNet

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-9 Net
Example 1:
proc userRptMultiDriverNets { {maxDriver {}} } {
if { $maxDriver == "" } {
set maxDriver 2
}
set designName [dbgDesignName]
dbForEachCellNet [dbgTopCell] netPtr {
set net [dbNetName $netPtr]
set cnt 0
dbForEachNetOutputTerm $netPtr outputTermPtr {
incr cnt
}
if {$cnt >= $maxDriver } {
puts "Net: $net Drivers: $cnt
}}}

62

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)Head->TileCell 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin

dbForEachFTermLefPort

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
63 CADENCE CONFIDENTIAL
GeomList

OpCond

dbSNetNet

Standard Row
dbForEachFPlanScreen

dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm
q

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

5. Retrieving Database Objects


5-9 Net
Find and report all nets connecting to specified instance
Example 2:
proc userFindNetsByInst { instName } {
set instPtr [dbGetInstByName $instName]
set cellName [dbInstCellName $instPtr]
Puts "Instance: $instName ($cellName)"
dbForEachInstTerm $instPtr termPtr {
set termName [dbTermName $termPtr]
set netPtr [dbTermNet $termPtr]
if { $netPtr != 0x0 } {
set netName [dbNetName $netPtr]
Puts "Term: $termName ($netName)"
}
}
}

64

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)Head->TileCell 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin

dbForEachFTermLefPort

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
65 CADENCE CONFIDENTIAL
GeomList

OpCond

dbSNetNet

Standard Row
dbForEachFPlanScreen

dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm
q

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

5. Retrieving Database Objects


5-9 Net
Issue: We are meeting timing except for these mutli-fanin nets connected to output pins coming from the IO pad cells to core
flip flop registers. Is there a way to force optDesign to buffer these and fix the max tran violations automagically.
Example 3:
set bidirNets [userGetAllBidirNets]
foreach netName $bidirNets {
specifyNetWeight $netName 10
}
<place, route etc>
set netNameList [userGetViolMultiFaninNets]
if { $netNameList != {} } {
foreach net $netNameList {
bufferMultiDriverNet -cell bfx6 -net $net
}
refinePlace
trialroute -highEffort -maxRouteLayer 6
extractrc
buildTimingGraph
reportTranViolation -outfile vmips_display_tran2b.rpt
optDesign

66

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-9 Net
Issue: From a slack file I can extract a list of timing critical std-cells and nets. How can I feed this list into amoebaPlace (or
placeDesign) ??
Example 4:
markCriticalNets -slackLessThan -0.3
dbForEachCellNet [dbHeadTopCell] net {
if {[dbIsNetCritical $net]} {
specifyNetWeight [dbNetName $net] 10
}
}
You could later check which nets are marked other than default (2 is
default) with something like this:
dbForEachCellNet [dbHeadTopCell] net {
if {[dbNetUserWt $net] > 2} {
puts "[dbNetName $net] [dbNetUserWt $net]"
}
}

67

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-9 Net
Issue: Tracing logic connectivity
Example 5:
set TermInstPtr [dbTermInst $termPtr]
set termInst [dbTermInstName $termPtr]
dbForEachInstOutputTerm $termInst termPtr {
set FTermPtr [dbTermFTerm $termPtr]
set nextNetPtr [dbTermNet $termPtr]
set nextNetName [dbNetName $nextNetPtr]
set TermInstPtr [dbTermInst $termPtr]
set termInst [dbTermInstName $termPtr]
set termName [dbTermName $termPtr]
dbForEachNetTerm $nextNetPtr termPtr {
set FTermPtr [dbTermFTerm $termPtr]
set flag_input [dbIsTermInput $termPtr]

68

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-9 Net - Reporting a net delay
# Usage: userRptNetDelay <netName>
proc userRptNetDelay { netName } {
set netPtr [dbGetNetByName $netName]
if { $netPtr != 0x0 } {
dbForEachNetOutputTerm $netPtr otermPtr {
if { [dbIsObjTerm $otermPtr] == 1 } {
set source_inst [dbTermInstName $otermPtr]
set sport [dbTermName $otermPtr]
dbForEachNetInputTerm $netPtr itermPtr {
if { [dbIsObjTerm $itermPtr] == 1 } {
set dest_inst [dbTermInstName $itermPtr]
set dport [dbTermName $itermPtr]
reportP2PCritPath -fromPin $source_inst/$sport -toPin $dest_inst/$dport
} elseif { [dbIsFTermFTerm $itermPtr] == 1 } {
set iftermPtr $itermPtr
set oPort [dbFTermName $iftermPtr]
reportP2PCritPath -fromPin $source_inst/$sport -toPort $oPort
}}
} elseif { [dbIsFTermFTerm $otermPtr] == 1 } {
set ftermPtr $otermPtr
set iPort [dbFTermName $oftermPtr]
dbForEachNetInputTerm $netPtr itermPtr {
if { [dbIsObjTerm $itermPtr] == 1 } {
set dest_inst [dbTermInstName $itermPtr]
set dport [dbTermName $itermPtr]
reportP2PCritPath -fromPort $iPort -toPin $dest_inst/$dport
} elseif { [dbIsFTermFTerm $itermPtr] == 1 } {
set iftermPtr $itermPtr
set oPort [dbFTermName $iftermPtr]
reportP2PCritPath -fromPort $iPort -toPort $oPort
}}}}}}
}}}}}}

69

CADENCE CONFIDENTIAL

Retrieving Database Objects

5-9 Net - Special

Special Net (SNet or Strip)


Always has a net
Space holder

Special Wire (dbStripBox)


dbsStripBox* dbSprNewPolygon(dbsNet*, dbsPoly*, Int z);
dbsStripBox* dbSprNewRect(dbsNet*, dbsBox*, Int z);
dbsStripBox* dbSprNewWireWithShapeAndStyle(dbsNet*, dbsLoc
*pt1, dbsLoc *pt2, Int z, dbsSprShape shape, Int style);
Int dbSprQueryWireWithStyle(dbsStripBox*, dbsLoc *pt1, dbsLoc
*pt2, Int *style, dbsCoord *width);

70

CADENCE CONFIDENTIAL

5. Retrieving Database Objects

5-9 Net - Special Net Traverse

- To traverse special net wires


dbForEachSNetBox
/* wire access routines */
- To traverse special net vias
dbForEachSNetBoxV
/* via access routines */

71

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-10 Wire wire geometry
NetWire

dbForEachNetWire $netPtr segmentPtr {}

WireNet

dbWireNet $wirePtr

WireInfo

dbWireInfo $wirePtr

Example 1:

proc rptSelectedTotalWireLength {} {
set s [dbHeadSelList]
set objPtr [dbSelPtr $s]
set netPtr [dbWireNet $objPtr]
set netName [dbNetName $netPtr]
dbForEachNetWire $netPtr segmentPtr {
set segLength [dbWireLen $segmentPtr]
set wireLength [expr $wireLength+$segLength]
}
puts Wire $netName has a length of: [expr $wireLength*[dbHeadMicronPerDBU]] um"
}

72

CADENCE CONFIDENTIAL

5. Retrieving Database Objects

5-10 Wire wire geometry

Example 2 (wire boxes):


dbForEachCellNet [dbgTopCell] netPtr {
set net [dbNetName $netPtr]
puts $fid "NET - $net"
dbForEachNetWire [dbGetNetByName $net] wirePtr {
set wireBox [dbWireBox $wirePtr]
set wireInfo [dbWireLocWithZ $wirePtr]
puts $fid "$wireInfo $wireBox"

73

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-11 Vias
ViaName
ViaInfo

dbGetViaCellByName $viaCellPtr
dbInfoVia $viaCellPtr

Examples:
proc printOneVia {viaName} {
set viaCellPtr [dbGetViaCellByName $viaName]
set loc [dbViaLoc $viaPtr]
set name [dbViaCellName $viaCellPtr]
puts "

via: $name $loc"

}
set cutbox [dbViaCellCutBox [dbGetViaCellByName VIA23]]
set x1 [lindex $cutbox 0]
set y1 [lindex $cutbox 1]
set x2 [lindex $cutbox 2]
set y2 [lindex $cutbox 3]
set width [expr [$x2 - $x1]
set height [expr [$y2 - $y1]]
74

CADENCE CONFIDENTIAL

5. Retrieving Database Objects

5-12 Technology
Timing Lib

dbForEachHeadTimeLib [dbgHead] tlibPtr {}

Timing Library Name

dbTimeLibName timeLibPtr

Timing Library OpCond

dbForEachTimeLibOpCond $tlib opcond

Layer

dbForEachHeadLayer [dbgHead] layer {}/dbGetLayerByName

Rule

dbHeadRule [dbgHead]

ExtendedRule

dbHeadExtRuleList [dbgHead]

Clocks

dbForEachHeadClock [dbgHead]

TechSite

dbTechSiteName

The dbLayer* commands access layer rules. The dbLayerRule* and dbLayerExtededRule* are for
non-default rules

75

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-12 Technology

Example 1:
proc rptTimeLibs {} {
dbForEachHeadTimeLib [dbgHead] tlibPtr {
set name [ dbTimeLibName tlibPtr]
puts Timing library name = $name
}
Output:
Timing library name = t25lib_tt

Example 3:
#####################################
#
# userGetClockRoot gets the clock roots of all clocks
#
####################################
proc userGetClockRoot {} {
getClock
dbForEachHeadClock [dbgHead] clockptr {
set clockName [dbClockName $clockptr]
}
}

Example 2:
getClock
proc
dbForEachHeadClock [dbgHead] clockPtr {
if {[string match [dbClockName $clockPtr] "my_clock_name"]} {
puts "[dbClockName $clockPtr] [dbClockRate $clockPtr]"
}
}

76

CADENCE CONFIDENTIAL

5. Retrieving Database Objects

5-12 Technology
Example 4:
set layer_list [list M1 M2 M3 M4 M5 M6 M7]

foreach layerName $layer_list {


Puts "Layer \"$layerName\":"
set layerPtr [dbGetLayerByName $layerName]
Puts " isHorizontal : [dbIsLayerH $layerPtr]"
Puts " isVertical : [dbIsLayerV $layerPtr]"
Puts " minWidth

: [expr [dbLayerMinWidth $layerPtr] * [dbgMicronPerDBU]]"

Puts " maxWidth

: [expr [dbLayerMaxWidth $layerPtr] * [dbgMicronPerDBU]]"

Puts " minSpace

: [expr [dbLayerMinSpace $layerPtr] * [dbgMicronPerDBU]]"

Puts " pitch

: [expr [dbLayerWirePitch $layerPtr] * [dbgMicronPerDBU]]"

Puts " offset

: [expr [dbLayerOffset $layerPtr] * [dbgMicronPerDBU]]"

77

CADENCE CONFIDENTIAL

5. Retrieving Database Objects

5-12 Technology
Example 5:
encounter 5> dbHeadNrExtRule [dbgHead]
10
encounter 6> dbExtRuleName [dbHeadExtRuleList [dbgHead]]
WMRULE1P5_1
encounter 7> dbForEachExtRuleLayerRuleList [dbHeadExtRuleList [dbgHead]] layerRulePtr
{ puts "[dbLayerRuleMinSpacing $layerRulePtr]"}
460
560
920

There are 10 extended rules. The first non-default rule is named WMRULE1P5_1. The
minimum spacings for WMRULE1P5_1 are .46, .56 and .92.

78

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-13 PowerDomains
Power Domains

dbForEachPowerDomain [dbgHead] powerDomainPtr {}

Pads

dbForEachPowerDomainPad $powerDomainPtr instPtr {}

Groups

dbGroupPowerDomain $groupPtr

Ground Nets

dbPowerDomainGNet powerDomainPtr

Power Nets

dbPowerDomainPNet powerDomainPtr

Example1:
dbForEachPowerDomain [dbgHead] powerDomainPtr {
set powerNetName [dbPowerDomainPNet $powerDomain]
puts Power net = $powerNetName
}
Output:
VDD1
Example2:
proc userRptPowerDomainBoxes { } {
dbForEachFPlanGroup [dbHeadFPlan] group {
if {[dbIsGroupPowerDomain $group]} {
puts "[dbGroupBox $group]"
}
}
}

79

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-14 Properties
Name

dbGetOrCreatePropByName $obj name

Properties

dbForEachObjProp / dbGetOrCreatePropByName

Register type

dbRegisterProptType $propName $propDescription $propDataType

Example:
proc user_inst_props {} {
dbRegisterPropType CORE_ROW Core Route TOP, BOTTOM, etc" str
dbRegisterPropType CORE_SOURCE Core Route CORE or PERIPHERY" str
dbForEachCellInst [dbgTopCell] instPtr {
if { [dbIsInstPlaced $instPtr] == 1 } {
set rowPtr [ dbGetOrCreatePropByName $inst CORE_ROW ]
set srcPtr [ dbGetOrCreatePropByName $inst CORE_SOURCE ]
dbSetPropValue $rowPtr "TOP"
dbSetPropValue $srcPtr "CORE"
set iName [dbInstName $inst]
set cName [dbInstCellName $inst]
puts [format " instPtr = %-s instName = %-s cellName = %-s" $inst $iName $cName ]
}}}

80

CADENCE CONFIDENTIAL

5. Retrieving Database Objects


5-15 Misc
Blackboxes
Bumps
BumpCells
BusBits
Clone
DPaths
FootPrint
FPins
GDSCell/Inst/Layer/Lib/Path/Poly/Text
GeomBox/Line/Path/Poly/Text
NetGroups
Path
PinGroup
RouteGuides
RowCluster
Ruler
Strips
IOs
Halos

81

CADENCE CONFIDENTIAL

Encounter Tcl
Database Access Commands

6.0 Retrieving Object Properties


CADENCE CONFIDENTIAL
CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-2 FPlan

Aspect ratio

dbHeadAspectRatio [dbgHead]

Size of the design

dbHeadBox [dbgHead]

Size of the core area

dbHeadCoreBox [dbgHead]

FPlanBox

dbFPlanBox

CoreBox

dbFPlanCoreBox

Size of the IO area

dbHeadIoBox [dbgHead]

Standard Row

dbRowBox
dbFPlanNrRow
dbRowOrient
dbRowTechSite
dbStdCellHgt

Site

dbSiteName/dbForEachHeadSite
dbSiteSizeX
dbSiteSizeY
dbStdRowSite
dbRowSite

83

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-2

FPlan (continued)

ConstraintType

dbConstraintType(dbcGuide/dbcFence/dbcRegion)
dbConstraintBox

LayerBlockage

dbLayerBlkType(dbcPtnCutLayerBlock, dbcRouteGuideLayerBlk, dbcUserLayerBlock)


dbLayerBlkCutLayer
dbLayerBlkLayer

Obsructions

dbObstructType (dbcUserObstruct, dbcBlockObstruct, dbcDynamicObstruct, dbcPtnCutObstruct)


dbObstructBox

Partition:
Partitions

dbPtnBox
dbPtnCoreToLeft/Right/Bottom/Top
dbPtnCut
dbPtnFeedBox
dbPtnFeedLayer
dbPtnLayerBlocked
dbPtnMinPinSpace
dbPtnPinSpaceOnSide

Screen

dbScreenBox
dbScreenCapacity

84

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-2 FPlan (continued)

Example:
proc prePlaceCloneInsts {} {
dbForEachCellPtn [dbgTopCell] ptnPtr {
dbForEachPtnCloneList $ptnPtr clonePtr {
set obj [dbCloneListInst $clonePtr]
set cloneName [dbObjName $obj]
puts "Processing clone = $cloneName"
# Get fence box of corresponding clone
set constraintPtr [dbHInstConstraint $obj]
set constraintBox [dbConstraintBox $constraintPtr]
set x1 [expr [lindex $constraintBox 0]*[dbHeadMicronPerDBU]]
set y1 [expr [lindex $constraintBox 1]*[dbHeadMicronPerDBU]]
set x2 [expr [lindex $constraintBox 2]*[dbHeadMicronPerDBU]]
set y2 [expr [lindex $constraintBox 3]*[dbHeadMicronPerDBU]]
set x [expr $x1 + [expr [expr $x2 - $x1] / 2 ]]
set y [expr $y1 + [expr [expr $y2 - $y1] / 2 ]]
# Place all clone cells in the middle of the fence
# and mark as preplaced
dbForEachCellInst [dbgTopCell] instPtr {
set instName [dbInstName $instPtr]
if [string match $cloneName* $instName] {
placeInstance $instName $x $y
dbSetIsInstPreplaced $instPtr 1
}}}}}

85

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-3 Cell
CellName

dbCellName $cell

NrInst

dbCellNrInst

NrBlock

dbCellNrBlock

NrRef

dbCellNrRef

NrRow

dbCellNrRow

NrFTerm

dbCellNrFTerm

NrBidi

dbCellNrNrBidi

NrInput

dbCellNrInput

NrOutput

dbCellNrOutput

NrInst

dbCellNrInst

CellType

dbCellType $cell

Origin

dbCellOrigin

Dimensions

dbCellDim

Example:
proc userFindInstsByCellName { cellName } {
set designName [dbgDesignName]
Puts "\nInfo: Searching for number of instances with $cellName cell master in $designName...\n"
set cnt 0
set cellPtr [dbgTopCell]
dbForEachCellInst $cellPtr instPtr {
set instName [dbInstName $instPtr]
set leafCell [dbInstCellName $instPtr]
if { $leafCell == $cellName } {
incr cnt
}}
Puts "\nInfo: Found $cnt instances with $cellName cell master\n"
}
86

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-4 Inst

87

InstName

dbInstName $cell

InstCellName

dbInstCellName $instPtr

InstBox

dbInstBox $instPtr

InstBoxDimX

dbBoxDimX [dbInstBox $inst]]

InstBoxDimY

dbBoxDimY [dbInstBox $inst]]

InstOrient

dbInstOrient $objPtr

InstLoc

dbInstLoc $objName

NrBidi Pins

dbInstNrBidi

NrOutput Pins

dbNrOutput

NrInput Pins

dbInstNrInput

HasObstruct

dbInstHasObstruct

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-4 Inst Example 1
###########################################################################
# userRptSelectInstancesInBox reports all selected instances in a given box
################################################################################
proc userRptSelectInstancesInBox {llx lly urx ury} {
set outfileName [dbgDesignName].out
puts "Searching in box $llx $lly $urx $ury expected input units are microns"
set outfile [open $outfileName "w"]
set count 0
set dbllx [dbMicronsToDBU $llx]
set dblly [dbMicronsToDBU $lly]
set dburx [dbMicronsToDBU $urx]
set dbury [dbMicronsToDBU $ury]
set dbsearchbox [list $dbllx $dblly $dburx $dbury]
dbForEachCellInst [dbHeadTopCell] inst {
set instBox [dbInstBox $inst]
if {[dbIsBoxOverlappingOrTouchingBox $instBox $dbsearchbox]} {
if {[dbIsInstSel $inst]} {
puts $outfile "[dbInstName $inst]"
puts "[dbInstName $inst]"
incr count
}}}
close $outfile
puts "Done. Selected instances found in box $llx $llx $urx $ury: $count"
puts "Wrote instance names to $outfileName"
}
88

CADENCE CONFIDENTIAL

dbIsBoxOverlappingOrTouchingBox
is a very useful function

6. Retrieving Object Properties


6-4 Inst Example 2
proc userSplitLoad_2PinInst { minFanOut minLoadInPf } {
set designName [dbgDesignName]
set f [open $designName.sel_net w]
set cntNets 0
dbForEachCellNet [dbgTopCell] netPtr {
set nrTerms [dbNetNrTerm $netPtr]
set nrFanOut [dbNetNrFanOut $netPtr]
set nrFanIn [dbNetNrFanIn $netPtr]
set netLoad [expr [dbNetCap $netPtr] * [dbgPicoFPerDBU]]
dbForEachNetOutputTerm $netPtr termPtr {
set srcInst [dbTermInstName $termPtr]
set leafCell [dbInstCellName $srcInst]
set nrSrcInstTerms [dbTermInstName $termPtr]
set srcPort [dbTermName $termPtr]
}
if { $nrFanIn == 1 && $nrFanOut >= $minFanOut && $netLoad >= $minLoadInPf } {
dbForEachNetOutputTerm $netPtr termPtr {
set srcInst [dbTermInstName $termPtr]
set srcPort [dbTermName $termPtr]
set nrSrcInstTerms [dbInstNrTerm $srcInst]
if { $nrSrcInstTerms == 2 } {
puts $f "[dbNetName $netPtr]"
incr cntNets
}}}}
close $f
Puts "splitLoad -selNetFile $designName.sel_net\n"
splitLoad -selNetFile $designName.sel_net
}

89

CADENCE CONFIDENTIAL

6. Retrieving Object Properties

6-5 HInst (Module)

90

HInstBaseName

dbHInstBaseName

Area

dbHInstArea

Constraint(Guide/Fence/Region)

dbHInstConstraint $hinstPtr

Floorplan Box

dbHInstFPlanBox $hinstPtr

Density

dbHInstDensity $hinstPtr

Congestion

dbHInstCongest $hinstPtr

Groups

dbHInstGroup $hinstPtr

Partition

dbHInstPtn $hinstPtr

Std. Cell Area

dbHInstStdCellArea $hinstPtr

Number of insts

dbHInstNrInst $hinstPtr

Number of pins on east side

dbHInstNrEPin $hinstPtr

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-5 HInst Example
proc userGenPinBlkForEachPtn { width height} {
set design [dbgDesignName]
Puts "\n\n\nInfo: Checking for Partitions specified in $design..."
set cnt_inst 0
dbForEachCellPtn [dbgTopCell] ptnPtr {
incr cnt_inst
set hinstPtr [dbPtnHInst $ptnPtr]
set hinstName [dbHInstName $hinstPtr]
if { $hinstName != "0x0" } {
set hinstBox [dbHInstFPlanBox $hinstName]
### Find instance bounding box ###
set hinstBox [dbHInstFPlanBox $hinstName]
set x1 [expr [lindex $hinstBox 0]*[dbHeadMicronPerDBU]]
set y1 [expr [lindex $hinstBox 1]*[dbHeadMicronPerDBU]]
set x2 [expr [lindex $hinstBox 2]*[dbHeadMicronPerDBU]]
set y2 [expr [lindex $hinstBox 3]*[dbHeadMicronPerDBU]]
set xExtend 2
set yExtend 2
### Blockage #1 bounding box (lower left) ###
set x1PinBlk1 [expr $x1 - $xExtend]
set y1PinBlk1 [expr $y1 - $yExtend]
set x2PinBlk1 [expr $x1 + $width]
set y2PinBlk1 [expr $y1 + $height]

91

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-5 HInst Example(Continued)
### Blockage #2 bounding box (lower right) ###
set x1PinBlk2 [expr $x2 - $width]
set y1PinBlk2 [expr $y1 - $yExtend]
set x2PinBlk2 [expr $x2 + $xExtend]
set y2PinBlk2 [expr $y1 + $height]
### Blockage #3 bounding box (upper right) ###
set x1PinBlk3 [expr $x2 - $width]
set y1PinBlk3 [expr $y2 - $height]
set x2PinBlk3 [expr $x2 + $xExtend]
set y2PinBlk3 [expr $y2 + $yExtend]
### Blockage #4 bounding box (upper left) ###
set x1PinBlk4 [expr $x1 - $xExtend]
set y1PinBlk4 [expr $y2 - $height]
set x2PinBlk4 [expr $x1 + $width]
set y2PinBlk4 [expr $y2 + $yExtend]
### Place blockages under the 4 corners of the instance ###
puts "\nInfo: Generating pin blockages for partition $hinstName..."
createPtnPinBlk $x1PinBlk1 $y1PinBlk1 $x2PinBlk1 $y2PinBlk1
createPtnPinBlk $x1PinBlk2 $y1PinBlk2 $x2PinBlk2 $y2PinBlk2
createPtnPinBlk $x1PinBlk3 $y1PinBlk3 $x2PinBlk3 $y2PinBlk3
createPtnPinBlk $x1PinBlk4 $y1PinBlk4 $x2PinBlk4 $y2PinBlk4
}
}
.s redraw
Puts "\nInfo: Created Partition pin blockages for $cnt_inst instance(s)\n"
}
92

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-6 HTerm
HTermSide

dbHTermSide

Example 1:
proc userRptHTermTerms { hterm } {
set hTermId [dbGetHTermByInstTermName $hterm]
set netId [dbHTermNet $hTermId]
set netName [dbNetName $netId]
set netNrTerm [dbNetNrTerm $netId]
Puts ""
Puts "HTERM : $hterm"
Puts "NET : $netName"
Puts "TERMS : $netNrTerm"
dbForEachNetTerm $netId termId {
set termType [dbObjType $termId]
if { $termType != "dbcObjFTerm"} {
set termName [dbTermName $termId]
set instName [dbTermInstName $termId]
Puts " INSTTERM : $instName/$termName"
}
}
}

93

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


6-6 HTerm Example 2
# userFindConnectingTermsToHTerm finds connecting terms to specified HTerm (input/output of a module)
proc userFindConnectingTermsToHTerm { htermName } {
set hierChar [dbgHierChar]
set htermPtr [dbGetHTermByInstTermName $htermName]
set netPtr [dbHTermNet $htermPtr]
set netName [dbNetName $netPtr]
set netNrFanOut [dbNetNrFanOut $netPtr]
set netNrFanIn [dbNetNrFanIn $netPtr]
Puts "INFO: HTERM $htermName"
Puts " Net:

$netName (FanIn: $netNrFanIn, FanOut: $netNrFanOut)"

dbForEachNetOutputTerm $netPtr termPtr {


set termName [dbTermName $termPtr]
set instName [dbTermInstName $termPtr]
set termDriver [join [concat $instName $termName] $hierChar]
Puts " Driver: $termDriver"
}
dbForEachNetInputTerm $netPtr termPtr {
set termName [dbTermName $termPtr]
set instName [dbTermInstName $termPtr]
set termReceiver [join [concat $instName $termName] $hierChar]
Puts " Receiver: $termReceiver"
}
return 1
}
94

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
95 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

6. Retrieving Object Properties


6-7 Term
TermName

dbTermName $termPtr

TermInstName

dbTermInstName $outputTermPtr

TermLoc

dbTermLoc

Layer

dbTermLayer

TransitionTime

dbTermTranTime

Box

dbTermBox

Floorplan/Schematic:

Example:

proc userAddBuf2AllHInsts { net buf } {

FF

set delimiter [dbgHierChar]


set input_terms {}
dbForEachNetOutputTerm [dbGetNetByName $net] termPtr {
set dest_inst [dbTermInstName $termPtr]

set src_inst [lindex [split $dest_inst $delimiter] 0]


set port [dbTermName $termPtr]

set output_term $dest_inst$delimiter$port


}

PLL

dbForEachNetInputTerm [dbGetNetByName $net] termPtr {


set dest_inst [dbTermInstName $termPtr]
set hier_list [split $dest_inst $delimiter]

FF

set port [dbTermName $termPtr]


lappend input_terms $dest_inst$delimiter$port
}
lsort input_terms

96

CADENCE CONFIDENTIAL

FF

6. Retrieving Object Properties


5-7 Term
Example(Continued):
set fout [open "gen_bufs.tcl" w]
set hinstName ""
foreach iTerm $input_terms {
set new_hinstName [lindex [split $iTerm $delimiter] 0]
if {$hinstName != $new_hinstName} {
puts "Be sure and place added instance $src_inst$delimiter$net$new_hinstName"
puts $fout "addInst $buf $src_inst$delimiter$net$new_hinstName"
puts $fout "attachTerm $src_inst$delimiter$net$new_hinstName A $net"
puts $fout "addNet $net$new_hinstName"
puts $fout "attachTerm $src_inst$delimiter$net$new_hinstName Z $net$new_hinstName"
} else {
set index [lsearch $input_terms $iTerm]
set next_hinstName [lindex [split [lindex $input_terms [expr $index + 1]] $delimiter] 0]
puts $fout "attachTerm [dbTermInstName [dbGetTermByInstTermName $iTerm]] [dbTermName [dbGetTermByInstTermName $iTerm]] \
$net$new_hinstName"
}
set hinstName $new_hinstName
}
close $fout
}

97

CADENCE CONFIDENTIAL

6. Retrieving Object Properties


5-7 Term
Example 2:
# Description: Find all std cells in the design with a clock pin and set the instance to "preplaced" placement status
# Usage: userSetStdCellWithClkToPreplace
proc userSetStdCellWithClkToPreplace {} {
set cnt 0
puts "\n Info: Searching for std cell instances in DB with clock terminal..."
dbForEachCellInst [dbgTopCell] instPtr {
set instName [dbInstName $instPtr]
set cellName [dbInstCellName $instPtr]
set cellPtr [dbGetCellByName $cellName]
dbForEachInstTerm $instPtr termPtr {
set xxxnetPtr [dbTermNet $termPtr]
if { $xxxnetPtr != 0x0 } {
set termName [dbTermName $termPtr]
set matchName phi
if { [dbIsTermClk $termPtr] == 1 && [dbIsInstStdCell $instPtr] == 1} {
#puts "$instName $cellName $termName"
### set preplaced attribute on instance
dbSetIsInstPreplaced $instPtr 1
### select the instance on viewing purpose only
selectInst $instName
incr cnt
}}}}}

98

CADENCE CONFIDENTIAL

4.2 Encounter Tcl/Tk Database Access

dbgHead

Head

07/01/05 P. Eichenseer

HilitePtr
SelectPtr
dbHeadFPlan

FPlan

dbForEachHeadPtn

dbForEachHeadCell

dbForEachHeadDPath

Path

HeadTimeLib

DPath

Path

TimeLib

Layer

HeadRule

Clock

dbForEachHeadCell
dbCellFPlan

Cell

Partition

dbForEachGroupHInst

dbForEachHInstTreeInst
dbInstHierHinst

Inst

dbForEachInstTerm

Constraint
(Guide/Fence)

dbHInstConstraint
dbConstraintHInst

Placement Blkg.

dbForEachHInstTreeHInst
dbHInstParent
dbForEachHInstHTerm

dbHTermFTerm
dbFTermHTerm

Routing Blkg.
Fterm

HTerm

dbFtermTerm
dbTermFterm

Term

ptnFeed
ptnPinBlk

dbFTermNet
dbForEachCell

dbForEachCellNet

dbForEachFPlanPtnCut

ptnCut
dbForEachFPlanDefRow

BlackBox

Halo

densityScreen
dbForEachFPlanRouteGuide

Route Guides

Wire

LefPort

dbWireNet dbForEachNetWire

Bump

SNet

Net

TimeArc

LefObs

dbForEachSNetStripBox

StripBox

ConstraintBox

GeomList
dbForEachFPlanGeomList
99 CADENCE CONFIDENTIAL
GeomList

Notes: There are a few db objects (or object relationships


not depicted). Some of them are 1)Cell->StorInst
2)Cell->PhyFterm 3)Cell->VInst 4)Cell->VNet
5)VInst->VTerm 6)VNet->VTerm 7)FPlan->PowerDom
8)FPlan->AIORowCluster 9)FPlan->Strip 10)Strip->Box
11)PowerDomain->Pad 12)Nets->netGroup 13)FPlan->
netGroup 14)FPlan->PinGroup 15)Pin->GroupPin
16)Head->ObjProp 17)HTerm->Net 18)Head->TileInst
19)ExtRule->LayerRule 20)Cell->TimeArc
21)AreaECOScreen->Screen 22)Row->Cluster Row
23) TileCell->TilePin 24) Head->BumpCell 25)Head->
CustomLayer 26)Head->TechSite 27)Head->Site
28)GeomList->GeomBox 29)GeomList->Geom
30)GeomList->Path 31)GeomList->Poly 32)Head->
ExtRule 33)Head->FELayer 34)Head->LEFLayer
35)Head->PropType 36)TileCell->TilePin 37) Head->
Tile Cell

dbSNetNet

Standard Row
dbForEachFPlanScreen

OpCond

dbForEachFTermLefPort
dbTermNet

dbForEachFPlanPtnPinBlk

dbForEachNetTerm

dbForEachFPlanLayerBlk

Clocks

et
stTreeN
achHIn
dbForE

dbTermInst

HInst

dbForEachFPlanObstruct

dbForEachFPlanPtnFeed

DPHinst
dbForEachPathTerm

ll

e
IoC

db

dbForEachFPlanConstraint

IO

DPinst

dbCellPadCell

CellPad

tC
ell

dbForEachFPlanCellPad

bI
ns

Group

ac
hC
ell
Ins

Rule

dbForEachTimingLibOpCond

Clone
Fo
rE

Io
ell
hC
ac
rE
Fo

dbForEachFPlanGroup

db

db

GlobalNetConnection

dbCellFTerm

dbForEachFPlanGlobalNetConnection

dbForEachCellFTerm

dbForEachPtnCloneList

Layer

GeomList under FPlan is for user created, while


under cell is for GDS

layerShape
Shape

Most of the cell


relationships
shown in this
diagram are for
the top cell only;
std cells use Fterm
TimeLib, LefObs
Cadence Company Confidential

Das könnte Ihnen auch gefallen