Introduction
This Document describes the API for the database as an extension to the Tcl scripting language. This extension is a native (C-level) implementation to provide the user with the highest possible speed and minimum resource consumption to maintain huge net-list databases. All the API is based on one new Tcl command "zdb".
Extensions to this document are: Flat View, Spos, Cone Extraction, Operators (modify), and Prim Functions.
For further information please checkout the API Tutorial (that also includes calls to the GUI API).
The Index is an overview of all API documents.
Index
-
LOAD A DATABASE (load, delete, reloadModule, reloadParasitic, set hiersep)
-
ACCESS A DATABASE (UML diagram, Object IDs, create, access, print, convert, down/up, concat, exists, isnull, nulltype, parasitic), Foreach Loops, Search, Getting Bus Information, Getting Hierarchy Information, Getting Primitive Function, Report Module, Count Objects, Check Devices, Get Opposite Pin, Get Pin by Function, Get Bus Member by Index, Getting Pin Direction, Getting Connectivity Information, Get/Set Attributes, Get/Set Flags, Power/Ground Nets, Constant Nets)
Overview
A database — later referred to as $db — stores one structural circuit design. More than one database can exist simultaneously. The Tcl API introduces a new variable type called OID (for object identification) that is used as a "pointer" to database objects. This document uses $oid but also $mod, $inst, $pin etc. to name OID variables.
Here is a list of the most important commands:
Return Value | Command | Description |
---|---|---|
|
||
|
Load netlist objects into the database |
|
|
|
Search netlist object by name |
… |
|
Operators to modify the database |
|
|
Tools to query the database |
… |
|
Do Cone Extraction |
… |
|
user defined Cone Arcs |
… |
|
Get Data from SDF File |
Return Value | Command |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$inst |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return Value | Command | Description |
---|---|---|
… |
|
set, get or delete attributes |
… |
|
set, get, toggle or delete flags |
… |
|
set, get or delete highlight data |
… |
|
set, get or delete highlight data |
|
||
… |
|
get source file positions |
… |
|
flat view sub-commands |
|
||
… |
|
|
|
|
count the number of database objects of the given |
… |
|
|
|
read/update symlib file |
|
|
||
|
|
|
cur |
|
examine database root |
|
|
|
cur |
|
examine module/primitive interface |
|
|
cur |
|
examine module |
|
|
cur |
|
examine instance |
|
|
cur |
|
examine buses |
|
|
cur |
|
examine connectivity |
|
cur |
|
examine attributes |
Maintain a Database
To create a new database, use the zdb new
or zdb open
commands and
load netlist data with the $db load
command or with one of the
shipped parser executables
(e.g. verilog2zdb
).
The command
zdb new
creates a new and empty database and returns a "database handle" (later
referred to as $db
), usually something like zdb01
, zdb02
, etc.
zdb open ?-quick? $binfile
Returns a "database handle" for the created database (like the zdb new
command) but also loads the database from the specified binfile.
Opening the binfile in quick mode by specifying the -quick
option will load the cell definitions and hierarchy information only.
The contents for each module needs to be populated separately.
$db save $binfile
stores the contents of the database $db
into the specified $binfile
.
The command
zdb valid $db
can be used to check whether $db
is a valid database command returned from e.g.
zdb new
.
The command
zdb foreach db {
# do something with $db, e.g. '$db close'
}
can be used to loop over all active databases.
The command
$db write tcl ?-gzip? ?-compress t? ?-comments 0|1? ?-nospos? ?-noattr?
?-noflag? ?-noTsort? ?-flat? ?-sposidx? ?-mangle? $tclfile
writes the contents of the database $db
as Tcl $db load
commands into the specified $tclfile
.
-
If one of the options
-nospos
,-noflag
or-noattr
is given then no-spos
,-attr
/-pinattr
or-flag
options will be added to the$db load
commands. -
The option
-flat
adds flat infos. -
The option
-gzip
may be used to produce gzip compressed output. -
With
-comments 0
no comments are written to the output file; with-comments 1
only a file header is written. -
The option
-sposidx
generates more compact-spos
options using indices instead of filenames. -
With
-mangle
all names get mangled.
The command
$db write verilog ?-named? ?-gzip? ?-compress t?
?-comments 0|1|2? ?-objcomments?
?-preservenet?
?-implementFunction?
?-ignoreport $flag? ?-ignorecell $flag? ?ignorercell $flag?
?-ignoreinst $flag? ?-ignoreautogen? $verilogfile
?-noCelldefine?
writes the contents of the database $db
as Verilog into the specified Verilog
file using implicit connectivity.
-
With
-named
named connectivity is used. -
With
-ignoreport
flagged ports are not written to the output file. -
With
-ignorecell
flagged cells are not written to the output file. -
With
-ignorercell
flagged cells and referenced instances are not written to the output file. -
With
-ignoreinst
flagged instances are not written to the output file. -
With
-ignoreautogen
all cells auto generated by a parser are ignored. -
The option
-gzip
may be used to produce gzip compressed output. -
With
-comments 0
no comments are written to the output file. With-comments 1
only a file header, with-comments 2
info at each module are written. -
The option
-preservenet
may be used to give local net names priority over instance names if there are name clashes. -
With
-implementFunction
function implementations for selected primitives is added to run simulations. -
If
-objcomments
is specified then the module-based@comment
attribute is printed before a module, port or instance object. -
If
-noCelldefine
is specified then no`celldefine
and`endcelldefine
is written.
The command
$db write spice ?-gzip? ?-compress t?
?-comments 0|1? ?-subckt? ?-subcktx? ?-nomodel? ?-noEnd?
?-value0net $n? ?-value1net $n? ?-valuexnet $n? ?-valueznet $n?
$spicefile
writes the contents of the database $db
as Spice into the specified spicefile.
-
The option
-gzip
may be used to produce gzip compressed output. -
With
-comments 0
no comments are written to the output file. With-comments 1
only a file header is written. -
With
-subckt
devices are written as subckts instances and corresponding wrappers are created. -
With
-subcktx
devices are written as subckts instances. -
With
-nomodel
no.model
statements nor empty sub-circuits are created for models or macro models in the generated netlist. -
With
-noEnd
no.END
is added at the end of the file. -
The
-value0net
,-value1net
,-valuexnet
, and-valueznet
options can be used to specify names for constant nets which have a value.
The command
$db write dspf ?-gzip? ?-compress t?
?-comments 0|1? ?-ignoreempty?
?-top $top? ?-design $d? ?-version $v? ?-vendor $v?
?-date $dt? ?-program $p?
?-divider $div? ?-delimiter $del? ?-busdelimiter $bd?
?-gndnet $gnd?
?-only $netname?
?-noesc
$dspffile
writes the contents of the database $db
as DSPF into the specified dspffile.
-
The option
-gzip
may be used to produce gzip compressed output. -
With
-comments 0
no comments are written to the output file. With-comments 1
only a file header is written. -
The
-top
option defines the top module. -
The
-design
,-version
,-vendor
,-date
and-program
overwrite/set the corresponding header information. -
The
-divider
,-delimiter
,-busdelimiter
define the divider and delimiter used in the output file. -
The
-gndnet
defines a ground net used in the output file. -
With the
-ignoreempty
option empty parasitics are ignored. -
With the
-only
option only the given net is written. This option can exist multiple times. -
With the
-noesc
option strings are written as is. This may produce incorrect syntax.
The command
$db write spef ?-gzip? ?-compress t?
?-comments 0|1? ?-namemap? ?-ignoreempty?
?-top $top? ?-design $d? ?-version $v? ?-vendor $v?
?-date $dt? ?-program $p? ?-designflow $df?
?-divider $div? ?-delimiter $del? ?-busdelimiter $bd?
?-timescale $ts? ?-timeunit $tu?
?-capscale $cs? ?-capunit $cu?
?-resscale $rs? ?-resunit $ru?
?-indscale $is? ?-indunit $iu?
?-gndnet $gnd? ?-powernet $pwr?
?-only $netname?
?-noesc
$speffile
writes the contents of the database $db
as SPEF into the specified speffile.
-
The option
-gzip
may be used to produce gzip compressed output. -
With
-comments 0
no comments are written to the output file. With-comments 1
only a file header is written. -
The
-namemap
option creates a namemap in the outputfile. -
The
-top
option defines the top module. -
The
-design
,-version
,-vendor
,-date
,-program
,-designflow
-timescale
,-timeunit
,-capscale
,-capunit
,-resscale
,-resunit
-indscale
and-indunit
overwrite/set the corresponding header information. -
The
-divider
,-delimiter
,-busdelimiter
define the divider and delimiters used in the output file. -
The
-powernet
and-gndnet
define power and ground nets used in the output file. -
With the
-ignoreempty
option empty parasitics are ignored. -
With the
-only
option only the given net is written. This option can exist multiple times. -
With the
-noesc
option strings are written as is. This may produce incorrect syntax.
The command
$db write vhdl ?-gzip? ?-comments 0|1? ?-implementFunction? $vhdlfile
writes the contents of the database $db
as VHDL into the specified vhdlfile.
-
The option
-gzip
may be used to produce gzip compressed output. -
With
-comments 0
no comments are written to the output file. With-comments 1
a file header is written. -
With
-implementFunction
function implementations for selected primitives is added to run simulations.
The command
$db write liberty ?-gzip? ?-allCells? ?-library name? $libertyfile
writes the cells of the database $db
and the corresponding clock information as Liberty into the specified libertyfile.
-
The option
-gzip
may be used to produce gzip compressed output. -
With
-allCells
all cells are written to the file. -
The
-library
option defines the library’s name of the exported cells.
The command
$db close
closes the database and frees all associated resources including memory.
The command
$db info binfile
will print the binfile associated with the database or an empty string if no binfile was used.
The commands
zdb check $binfile
zdb validate $binfile
check if the $binfile
is valid for the current architecture and if the $binfile
is currently not in use by anyone else.
zdb check
returns an error code if the check is negative.
zdb validate
returns true if the $binfile
is ok, false otherwise.
zdb fileinfo $binfile
returns additional information about the given $binfile
.
zdb parserbits $binfile
returns a list of used licenses in the given $binfile
.
The command
zdb version
returns the internal version of the ZDB including the required license version, the binfile version and the stubs version as well as the build date.
zdb sizeof ?$type?
returns the amount of bytes that is needed by the in memory structures to store a
database object of the given $type
.
If no $type
is given then a list with the sizes of all types is returned.
Possible values for the $type
are: port
, portBus
, primitive
, module
, pin
, inst
, pinRef
, net
, netbus
, spos
, and sfile
.
Error Conditions
Some of the database commands above and below may return because of an error condition (e.g. file access problems, no disk space, out of memory, etc.). In those cases, an error message is returned that indicates the problem.
Quick Open Mode
A database can be opened in quick mode, then only the cell definitions and hierarchy information is loaded into memory. The contents for each module can be populated separately. The following chapter describes the database populate API.
$db populate
Database populate sub-command.
$db populate active
Returns true if populate is active (-quick mode).
Usage:
$db populate active
Parameters:
No parameters.
Example:
set active [$db populate active]
$db populate changed
Check if a database item was populated.
Usage:
$db populate changed ?-clear?
Parameters:
-clear (optional)
-
Clear current state.
Example:
set changed [$db populate changed]
$db populate changedFlat
Check if a flat item was populated.
Usage:
$db populate changedFlat ?-clear?
Parameters:
-clear (optional)
-
Clear current state.
Example:
set changed [$db populate changedFlat]
$db populate changedModule
Check if a module was populated.
Usage:
$db populate changedModule ?-clear?
Parameters:
-clear (optional)
-
Clear current state.
Example:
set changed [$db populate changedModule]
$db populate changedSfile
Check if a sfile item was populated.
Usage:
$db populate changedSfile ?-clear?
Parameters:
-clear (optional)
-
Clear current state.
Example:
set changed [$db populate changedSfile]
$db populate populatedCount
Get the number of populated items.
Usage:
$db populate populatedCount
Parameters:
No parameters.
Example:
set total [$db populate populatedCount]
$db populate populatedFlatCount
Get the number of populated flat trees.
Usage:
$db populate populatedFlatCount
Parameters:
No parameters.
Example:
set total [$db populate populatedFlatCount]
$db populate populatedModuleCount
Get the number of populated modules.
Usage:
$db populate populatedModuleCount
Parameters:
No parameters.
Example:
set total [$db populate populatedModuleCount]
$db populate populatedSfileCount
Get the number of populated sfiles.
Usage:
$db populate populatedSfileCount
Parameters:
No parameters.
Example:
set total [$db populate populatedSfileCount]
$db populate totalCount
Get the total number of populatable items.
Usage:
$db populate totalCount
Parameters:
No parameters.
Example:
set total [$db populate totalCount]
$db populate totalFlatCount
Get the total number of populatable flat trees.
Usage:
$db populate totalFlatCount
Parameters:
No parameters.
Example:
set total [$db populate totalFlatCount]
$db populate totalModuleCount
Get the total number of populatable modules.
Usage:
$db populate totalModuleCount
Parameters:
No parameters.
Example:
set total [$db populate totalModuleCount]
$db populate totalSfileCount
Get the total number of populatable sfiles.
Usage:
$db populate totalSfileCount
Parameters:
No parameters.
Example:
set total [$db populate totalSfileCount]
Load a Database
As an alternative to the parsers above, the database can also be
loaded through the API with $db load …
commands.
$db load primitive $name $function ?opt?
$db load module $name ?-top? ?opt? ?-primfunc $function? ?-parasitic?
$db load port $name $direction ?opt?
$db load portBus $name $direction $width $pname1 $pname2 ... ?-range $from $to? ?opt?
$db load inst $name $cellref ?opt? ?pinOpt?
$db load net $name ?-pin inst pin? ?-port port? ?-value $constantValue?
?-pinspos $iname $pname $fname $start $end? ?opt?
$db load netBus $name $width $net1 $net2 ... ?opt?
The Primitive’s $function
argument (and the Module’s -primfunc $function
option) is defined in the document
The Primitive Functions.
The option -parasitic
creates a parasitic module instead of a regular one
(it can only be instantiated in a special parasitic top module).
The ?opt?
is zero or one or more of:
-attr $name=$value -spos $fname $start $end -sposx $fidx $start $end -flag $flag
For loading instances the additional option -orient
can be used to specified
the orientation.
Possible orientation values are:
R0
, R90
, R180
, R270
, MY
, MYR90
, MX
, and MXR90
.
The ?pinOpt?
is zero or one or more of:
-pinattr $pin $name=$value -pinspos $pin $fname $start $end -pinsposx $pin $fidx $start $end -pinflag $pin $flag
Attributes can be defined for all objects with the -attr
option.
These options can be repeated to add multiple attributes (alternatively,
attributes can be set with the attr add command).
Source positions can be added with the -spos
option.
They can be repeated multiple times.
See the spos API for more information.
Flags can be set with the -flag
option.
See the $db flag set
for more information.
For pins attributes, flags and spos can be added with the
-pinattr
, -pinflag
, and -pinspos
options.
Instead of the -spos
and the -pinspos
options, -sposn
and
-pinsposn
may be used to store the filenames as is.
This may be useful, if the default conversion to absolute filenames is not
applicable.
As a more compact form to add source positions the -sposx
and the
-pinsposx
options use a numerical index for each referenced file.
The port $direction
argument is one of:
input
, output
, inout
, unknown
, and *
(the *
means that the port direction is derived from the Primitive’s or Module’s function).
The suffix .neg
is supported for some ports.
If a portBus range is specified using the -range
option then the portBus
member names need to conform to a supported bus member syntax (i.e. NAME[0]
, NAME(0)
, NAME<0>
, NAME{0}
, NAME_0_
, NAME_0
, and NAME0
, where NAME
is the bus' name and `0`is the member’s index).
The order of the load command is important.
A $db load primitive …
command must be followed by calls to $db load port …
and $db load portBus …
to define the primitive’s interface.
A $db load module …
command must be followed by calls to $db load port …
and $db load portBus …
to define the module’s interface and by calls to $db load inst …
, $db load net …
, and $db load netBus …
to define the module’s contents.
Further, declared before used is required, that means,
1. a primitive or module must be defined before an instance of it can be created;
2. ports and instances must be defined before a net can refer to them with -pin
or -port
.
The $db load netBus …
command finds existing sub-nets or creates new sub-nets.
That means, nets can be defined before or after they are "grouped" by a call to $db load netBus …
.
The same net can be loaded multiple times, if so, then the connections (defined
by -pin
and -port
) are accumulated.
However, other objects cannot be accumulated, each load must define a new object
with a unique name.
The $cellref
argument of the $db load inst
command must be either a module or
a primitive name.
Modules and primitives share the same name space.
To create an unique name, the command
$db uniqueName $module $type $name
can be used.
Delete Objects from a Database
$db deleteZombies
The $db deleteZombies
command deletes all objects with the zombie
flag
(must be set before calling $db deleteZombies
).
The table below displays the objects that accept the zombie
flag and the
detailed delete semantics (ports cannot be deleted, i.e. this command cannot
change the module/primitive interface).
Object Type | Effects of $db deleteZombies |
---|---|
|
automatically disconnect from nets. |
|
automatically disconnect from ports and instance pins. |
|
automatically expand the bus into single-bits (technically, the single-bit nets existed before and are not touched). |
|
automatically delete all module contents and all instances of that module. |
|
automatically delete all instances of that primitive. |
Reload Objects to a Database
$db reloadModule $name
$db load inst $name ...
$db load net $name ...
$db load netBus $name ...
The $db reloadModule …
command "goes to" the given module, so that further
$db load …
commands can add more objects to the specified module.
Only $db load inst …
, $db load net …
and $db load netBus …
are supported (this "reload" mode does not
support ports, i.e. it cannot change the module/primitive interface).
To reload parasitic modules please use $db reloadParasitic $name
.
Other commands that modify the database are described in the "Operator API" document.
Set Hierarchy Separator
$db hiersep $character
The $db hiersep …
command sets the hierarchy separator for the database
without any further checks if the specified $character
is an unused character.
There is a more user friendly (but slower) version of this function in the "Operator API".
Access a Database
The following UML diagram displays the major database objects and their static relations. The labels at the relations refer to the query API functions (basically to the foreach loops below).

The database can be traversed with foreach loops and implicitly
searched with the $db oid create …
command.
A new Tcl variable type called OID is defined by this Tcl API to
provide fast access to database objects.
Each OID variable (object identification) points to a database entry.
Object IDs
The Tcl interpreter is extended by a new Tcl variable type called OID (later
referred to as $oid
).
The string representation of these OIDs follow the Tcl-rules for a list,
however, internally they are stored as pointers to the database objects for
efficiency (Tcl variable’s native representation).
Here is a description of the OID string representation:
|
The object type; one of |
||
|
The name of the module containing the object (if no path is specified) — or the root of the instance path (if a path is specified) usually the design root. |
||
|
The instance names |
||
|
The name of the object that is one of instance name, net name, netBus name, etc. |
||
|
For objects of type |
|
For objects of type |
Basically, the database and API provides two ways (or styles) of addressing
objects, a module-based way with no instance path, and a tree-based way
with a valid instance path from the design root to the object.
The module-based OIDs can be sub-divided into those that refer to the design
root (alias top module)
and those that refer to an ordinary non-top module — the
$db oid isTopRoot …
command explains the difference.
The following table assumes GL85
is the design root (a top module), and
REG8
is an ordinary non-top module (the 2nd and 3rd columns refer to the same
database objects):
module-based OIDs rooted at top module | module-based OIDs rooted at non-top module | tree-based OIDs rooted at top module |
---|---|---|
|
|
|
|
|
|
Create Object IDs
Creating an OID from a string representation is a powerful command. It searches the database and figures out if the addressed object really exists. If not, an error is returned.
$db oid create $oid
$db oid createIcase $oid
This commands create and return an OID (internal representation) from a string
representation.
The given $oid
is expected to be a Tcl list like:
[list $otype $mname $path1 … $pathn $oname ?$pname?]
.
If, however, the given $oid
already is an OID, then the OID is simply returned.
The $db oid createIcase …
is equal to $db oid create …
, except that the internal database
searches are performed in "case-insensitive" mode (however, the returned OID is
always "case sensitive" — as the ZDB internally is).
$db oid createFromString $type $mod $str $hiersep
?-delim $d? ?-escape $e? ?-icase? ?-guess?
?-topInstName $t?
This command can be used if the instance path and name of the object is given
by one string $str
. The string is split by the given hierarchy separator
$hiersep
.
If no optional delimiter $d
is given, the hierarchy separator is
used to find the last part of the string, used as an object name.
Hierarchy separator and delimiter may be protected by preceding them with an
optional escape character $e
. Optional guessing by prepending an X
to the
instance name used during searching may be enabled by -guess
.
The option -topInstName
can be used to short the path until the first match.
Access Object IDs
Following the Tcl standard each OID is automatically converted back to its
string representation whenever needed.
That means lindex
and other Tcl commands can always operate on OIDs, but for
efficiency we recommend using these access methods:
$db oid type $oid
$db oid root $oid
$db oid path $oid
$db oid module $oid
$db oid oname $oid
$db oid pname $oid
$db oid cname $oid
$db oid tail $oid
$db oid iname0 $oid
$db oid pname0 $oid
$db oid iname1 $oid
$db oid pname1 $oid
The first three commands return object type, the root module name and the instance path starting at the root module.
The $db oid module $oid
command returns the name of the module
at the end of the path (is identical to the root if the path is empty;
for if $oid
is the port or portBus of a primitive, the primitive’s name is returned).
The $db oid oname $oid
returns the object’s name, e.g. instance name, net name,
etc.
However, for pins and pinBuses, the oname
is the instance name and
the $db oid pname $oid
command returns the pin name.
For all object types
except pins and pinBuses, the pname
command returns a empty string.
The $db oid cname $oid
returns the cell name.
This is the module or primitive name of the given inst (or pin or pinBus).
The $db oid tail $oid
command returns a two or three element list, consisting
of the object type plus oname
plus the optional pname
.
The $db oid iname0 $oid
and the $db oid iname1 $oid
commands return the instance names of pin1
and
pin2
of a netSeg OID. If the instance name is a empty string then the connected object is a
port, not a pin.
The $db oid pname0 $oid
and the $db oid pname1 $oid
commands return the pin names of the connected
pins/ports of a netSeg $oid
.
Some examples:
$oid |
type | root | path | module | oname | pname | cname | tail |
---|---|---|---|---|---|---|---|---|
|
inst |
gl85 |
IR B8 |
REG8BITT |
R3 |
DFF |
inst R3 |
|
|
inst |
REG8BITT |
REG8BITT |
R3 |
DFF |
inst R3 |
||
|
pin |
gl85 |
IR B8 |
REG8BITT |
R3 |
SET |
DFF |
pin R3 SET |
|
pin |
REG8BITT |
REG8BITT |
R3 |
SET |
DFF |
pin R3 SET |
|
|
pinBus |
gl85 |
IR B8 |
REG8BITT |
U9 |
I |
BUF8 |
pinBus U9 I |
|
net |
gl85 |
IR B8 |
REG8BITT |
Q0 |
net Q0 |
||
|
port |
gl85 |
IR B8 |
REG8BITT |
Q0 |
port Q0 |
||
|
port |
REG8BITT |
REG8BITT |
Q0 |
port Q0 |
|||
|
portBus |
gl85 |
IR B8 U9 |
BUF8 |
I |
portBus I |
||
|
netSeg |
gl85 |
IR |
INST_REG |
C |
netSeg C {} C B8 CK |
||
|
signal |
gl85 |
IR |
INST_REG |
C |
signal C |
||
|
module |
gl85 |
IR B8 U9 |
BUF8 |
BUF8 |
module BUF8 |
||
|
module |
BUF8 |
BUF8 |
BUF8 |
module BUF8 |
|||
|
primitive |
gl85 |
IR B8 R3 |
DFF |
DFF |
primitive DFF |
Additional examples for netSeg:
$oid |
iname0 | pname0 | iname1 | pname1 |
---|---|---|---|---|
|
{} |
C |
B8 |
CK |
|
and1 |
o |
m1 |
CLK |
The signal OID refers to a set of hierarchically interconnected nets and are only meaningful for flat traversals.
Print Object IDs
The command
$db oid print $oid
?-hiersep $sep? ?-delim $del? ?-joinchar $char?
?-notype? ?-noroot? ?-nopath? ?-noname?
?-addwidth? ?-addrange?
?-typeastitle? ?-tclname? ?-nameAttr?
prints the given $oid
(i.e. converts it to a string representation).
The actual content/layout of the string representation can be controlled by
the following options:
-
-hiersep $sep
: use the character$sep
to join the items of the OID’s hierarchical path (default: space character), -
-delim $del
: use the character$del
to join the pin name when printing a pin OID (default: the-hiersep
character), -
-joinchar $char
: use the character$char
to join all OID components, -
-notype
: omit the OID’s type, -
-noroot
: don’t print the root (top-level) module, -
-nopath
: omit the OID’s path, -
-noname
: omit the OID’s name, -
-addwidth
: add the width of bus objects to the type, -
-addrange
: add the range of bus objects to the type, -
-typeastitle
: print the type as a title, -
-tclname
: use Tcl conforming object name. -
--nameAttr
: use the @name attribute as the object name.
Convert Object IDs
The following commands handle the difference between module-based and tree-based OIDs:
$db oid isModBased $oid
$db oid createModBased $oid
$db oid searchTreeBased $oid ?$hint?
$db oid isTopRoot $oid
$db oid createNetSeg $pin1 $pin2
$db oid convertTo $type $oid ?$name?
the first three commands handle the difference between module-based and tree-based OIDs:
-
$db oid isModBased $oid
returns a boolean (true if the$oid
is a module-based OID, that means, it has no path). -
$db oid createModBased $oid
creates and returns a module-based OID from the given$oid
. If the given$oid
already is module-based, then that$oid
is just returned. -
$db oid searchTreeBased $oid
searches the design hierarchy for a tree-based OID that refers to the same module as the given module-based$oid
does (if$oid
already is tree-based, then that$oid
is just returned). The$hint
variable is optional — if specified, then it should be a tree-based OID that’s used as a starting point for the search algorithm. E.g.$db oid searchTreeBased {pin AUX U12 A}
might return{pin TOP B2 C2 U12 A}
(assumingTOP.B2.C2
is an instance of moduleAUX
) — and$db oid searchTreeBased {module AUX AUX}
would return{module TOP B2 C2 AUX}
.
As a special case, if a module or primitive is not instantiated, then$db oid searchTreeBased …
will return the given OID as is. Ditto for a port/portBus of a not instantiated module or primitive.$db oid searchTreeBased …
should never return an error.
$db oid isTopRoot $oid
returns a boolean; it is true if the $oid
's root
module is a top module, that means, the
foreach top iterator will return it and it
can be created with $db load module -top …
(a top module is not instantiated at all).
Most tree-based OIDs are rooted at a top module.
$db oid createNetSeg $pin1 $pin2
creates a netSeg
OID
(net segment) from two pins or ports ($pin1
and $pin2
can be pin or port OIDs).
They both must connect to the same net — if not, then an error is returned.
$db oid convertTo $type $oid ?$name?
converts the given OID into the given $type
if possible (these conversions run on the variable’s native representation
and are faster than using lreplace
on the OID’s Tcl-list representation).
Some conversions require an extra argument to define the port/pin $name
.
$oid |
$type |
?$name? |
Comments |
---|---|---|---|
|
|
||
|
|
||
|
|
||
|
|
||
|
|
identical to |
|
|
|
||
|
|
||
|
|
identical to |
|
|
|
||
|
|
||
|
|
identical to |
|
|
|
|
search for a port/pinBus named |
|
|
|
search for a port/portBus named |
Dive Up and Down with Object IDs
The following commands convert an OID in order to dive down and up the hierarchy:
$db oid down $oid
$db oid up $oid
The first command dives down the hierarchy tree and returns an OID with a
longer path;
the second command is the reverse function and returns an OID
with a shorter path (the second only works, if the given $oid
is a
tree-based OID).
$db oid down $oid
accepts an $oid
of type inst
, pin
, and pinBus
and returns
and OID of type module
/primitive
, port
, and portBus
, respectively.
$db oid up $oid
accepts an $oid
of type module
, primitive
, port
, and portBus
and returns
an OID of type inst
, pin
, and pinBus
, respectively.
The $db oid down …
command is similar to $db moduleOf …
/ $db primitiveOf …
and the $db oid up …
command is similar to $db parentInst …
/ $db parentModule …
.
Concat a Pin OID to a Module Inst
The following command converts a hierarchical instance OID to a tree-based pin oid, by appending a module-based pin OID or a relative path to a pin:
$db oid concat $inst $pin
$db oid concat $inst -pinpath $path
The works only if the $pin
OID is relative to the given $inst
OID.
The -pinpath
option can be used, if $path
is a list containing the
instance names and the pin name which should be appended to $inst
.
Check for Existence of OIDs
$db oid exists $oid
returns true if the given $oid
exists in $db
.
The given OID may be created from an other database.
Null OIDs
$db oid isnull $oid
returns true if the given $oid
is a "null OID".
Those "null OIDs" can show up in the $db foreach member …
loop
to identify "gaps" in a netBus definition; or as a return value from the
$db search …
commands.
Type of Null OIDs
$db oid nulltype $oid
returns the type for some special "null OIDs" or an empty string. They are used to identify e.g. source pos info for comments etc.
Compare OIDs
$db oid isequal $oid1 $oid2
$db oid cmp $oid1 $oid2
The first command returns true if both given OIDs are identical, otherwise it returns false.
The second command returns -1
, 0
, 1
for sorting the given OIDs (suitable for sorting a list of OIDs using Tcl’s lsort
command with the -command …
option).
These functions can be a speedup over "stringifying" them and comparing the strings.
Parasitic OIDs
$db oid isparasitic $oid
$db oid isparasiticmodinst $oid
$db oid convertFromParasitic $oid
$db oid convertToParasitic $oid $pTopOid
The first command returns true if the given OID is a parasitic module, or the referred object is contained in a parasitic module.
The second returns true if the given OID is a instance of a parasitic module.
The third converts the given OID to a "normal" OID.
The fourth converts a "normal" OID to a parasitic OID relative to the
given parasitic top module $pTopOid
or, if $oid
is a signal/net OID $pTopOId
can
be omitted and a parasitic module OID is returned.
Reset all OIDs
$db oid resetAllOIDs
resets the string representation of all Tcl variables referring to OIDs. The next access to the string representation of the variable will re-create the representation. The command returns the number of reset OIDs.
Additional OID Commands
$db oid
Oid sub-command.
$db oid cleanup_mem
No Documentation yet.
Usage:
$db oid cleanup_mem
Parameters:
No parameters.
Example:
# No example
$db oid cmp
Returns -1
, 0
, 1
for sorting the given OIDs (suitable for
sorting a list of OIDs using Tcl’s lsort
command with the
-command …
option).
Usage:
$db oid cmp oid1 oid2
Parameters:
oid1
-
Input OID.
oid2
-
Input OID.
Example:
$db oid cmp $oid1 $oid2
$db oid cname
Get the cell name. That is the module or primitive name of the given inst (or pin or pinBus).
Usage:
$db oid cname oid
Parameters:
oid
-
Input OID.
Example:
$db oid cname $oid
$db oid concat
No Documentation yet.
Usage:
$db oid concat
Parameters:
No parameters.
Example:
# No example
$db oid convertable
No Documentation yet.
Usage:
$db oid convertable
Parameters:
No parameters.
Example:
# No example
$db oid convertFromParasitic
Converts the given OID to a "normal" OID.
Usage:
$db oid convertFromParasitic oid
Parameters:
oid
-
Input OID.
Example:
$db oid convertFromParasitic $oid
$db oid convertPin
No Documentation yet.
Usage:
$db oid convertPin oid pinNo
Parameters:
oid
-
Input OID.
pinNo
-
Number of the pin.
Example:
$db oid convertPin $oid 0
$db oid convertTo
No Documentation yet.
Usage:
$db oid convertTo
Parameters:
No parameters.
Example:
# No example
$db oid convertToParasitic
No Documentation yet.
Usage:
$db oid convertToParasitic
Parameters:
No parameters.
Example:
# No example
$db oid convertToPin
No Documentation yet.
Usage:
$db oid convertToPin
Parameters:
No parameters.
Example:
# No example
$db oid convertToPort
No Documentation yet.
Usage:
$db oid convertToPort oid portNo
Parameters:
oid
-
Input OID.
portNo
-
Number of the port.
Example:
$db oid convertToPort $oid 0
$db oid create
No Documentation yet.
Usage:
$db oid create oidObj
Parameters:
oidObj
-
String or Oid String representation.
Example:
$db oid create {module top top}
$db oid create null
$db oid createFromString
This command can be used if the instance path and name of the object is
given by one string $str
. The string is split by the given hierarchy
separator $hiersep
.
Usage:
$db oid createFromString ?-autoPopulate? ?-delim delim? ?-escape escape? ?-escapeVerilog? ?-guess? ?-icase? ?-topInstName topInstName? type topModule str hiersep
Parameters:
-autoPopulate (optional)
-
Auto populate DB.
-delim delim (optional default is NULL)
-
If no optional delimiter is given, the hierarchy separator is used to find the last part of the string, used as an object name.
-escape escape (optional default is NULL)
-
Hierarchy separator and delimiter may be protected by preceding them with an optional escape character.
-escapeVerilog (optional)
-
Escape the identifiers using the Verilog standard.
-guess (optional)
-
Optional guessing by prepending an
X
to the Instance name used during searching may be enabled by-guess
. -icase (optional)
-
Ignore case.
-topInstName topInstName (optional default is NULL)
-
Can be used to short the path until the first match.
hiersep
-
Hierarchy separator.
str
-
Name to the object.
topModule
-
The oid of the containing top module. If {null} OID is given, top module is extracted from the given path string.
type
-
Type of oid.
Example:
$db oid createFromString inst {module top top} i1 .
$db oid createFromStringList
No Documentation yet.
Usage:
$db oid createFromStringList ?-autoPopulate? ?-guessName? ?-guessPath? ?-icase? type pathList name
Parameters:
-autoPopulate (optional)
-
Auto populate DB.
-guessName (optional)
-
Use extended rules to match the name.
-guessPath (optional)
-
Use extended rules to match the path.
-icase (optional)
-
Ignore case.
name
-
Name of the object.
pathList
-
List of the names to the object.
type
-
Type of oid.
Example:
$db oid createFromStringList inst {top} i1
$db oid createIcase
No Documentation yet.
Usage:
$db oid createIcase oidObj
Parameters:
oidObj
-
String or Oid String representation.
Example:
$db oid createIcase {module TOP TOP}
$db oid createIcase NULL
$db oid createModBased
No Documentation yet.
Usage:
$db oid createModBased oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid createNetSeg
No Documentation yet.
Usage:
$db oid createNetSeg
Parameters:
No parameters.
Example:
# No example
$db oid deleteSchematicCache
Delete the database schematic cache.
Usage:
$db oid deleteSchematicCache module
Parameters:
module
-
Delete the database schematic cache for this module.
Example:
$db oid deleteSchematicCache $module
$db oid down
No Documentation yet.
Usage:
$db oid down oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid exists
No Documentation yet.
Usage:
$db oid exists
Parameters:
No parameters.
Example:
# No example
$db oid getSchematicCache
Get the database schematic cache.
Usage:
$db oid getSchematicCache module
Parameters:
module
-
Get the database schematic cache for this module.
Example:
set layout [$db oid getSchematicCache $module]
$db oid iname0
No Documentation yet.
Usage:
$db oid iname0 oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid iname1
No Documentation yet.
Usage:
$db oid iname1 oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid insideprim
No Documentation yet.
Usage:
$db oid insideprim oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid isequal
Returns true if both given OIDs are identical, otherwise it returns false.
Usage:
$db oid isequal oid1 oid2
Parameters:
oid1
-
Input OID.
oid2
-
Input OID.
Example:
$db oid isequal $oid1 $oid2
$db oid isModBased
No Documentation yet.
Usage:
$db oid isModBased oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid isnull
No Documentation yet.
Usage:
$db oid isnull oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid isparasitic
No Documentation yet.
Usage:
$db oid isparasitic oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid isparasiticmodinst
No Documentation yet.
Usage:
$db oid isparasiticmodinst oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid isTopRoot
Returns a boolean; it is true if the $oid
's root
module is a top module.
Usage:
$db oid isTopRoot oid
Parameters:
oid
-
Input OID.
Example:
$db oid isTopRoot $oid
$db oid isvirtual
No Documentation yet.
Usage:
$db oid isvirtual oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid module
No Documentation yet.
Usage:
$db oid module oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid nulltype
No Documentation yet.
Usage:
$db oid nulltype oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid oname
Get the object’s name, e.g. instance name, net name, etc.
Usage:
$db oid oname oid
Parameters:
oid
-
Input OID.
Example:
$db oid oname $oid
$db oid path
No Documentation yet.
Usage:
$db oid path oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid pname
Get the pin name.
Usage:
$db oid pname oid
Parameters:
oid
-
Input OID.
Example:
$db oid pname $oid
$db oid pname0
No Documentation yet.
Usage:
$db oid pname0 oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid pname1
No Documentation yet.
Usage:
$db oid pname1 oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid print
Converts the given oid to a string representation.
Usage:
$db oid print ?-addrange? ?-addwidth? ?-delim delim? ?-escapeVerilog? ?-hiersep hiersep? ?-joinchar joinchar? ?-nameAttr? ?-noname? ?-nopath? ?-noroot? ?-notype? ?-tclname? ?-typeastitle? oid
Parameters:
-addrange (optional)
-
Add the range of a bus object.
-addwidth (optional)
-
Add the width of a bus object.
-delim delim (optional default is NULL)
-
Use the given character to separate the pin name.
-escapeVerilog (optional)
-
Escape the identifiers using the Verilog standard.
-hiersep hiersep (optional default is NULL)
-
Use the given hierarchy separator to print the OID.
-joinchar joinchar (optional default is NULL)
-
Join all OID elements using this char.
-nameAttr (optional)
-
Use the @name attribute for the object name.
-noname (optional)
-
Add the object name.
-nopath (optional)
-
Add the path to the object.
-noroot (optional)
-
Do not print the path of the OID.
-notype (optional)
-
Do not print the object type.
-tclname (optional)
-
Add Tcl conform object names.
-typeastitle (optional)
-
Print the type as title.
oid
-
The oid to print.
Example:
$db oid print {inst top i1}
$db oid resetAllOIDs
No Documentation yet.
Usage:
$db oid resetAllOIDs
Parameters:
No parameters.
Example:
# No example
$db oid root
No Documentation yet.
Usage:
$db oid root oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid searchTreeBased
No Documentation yet.
Usage:
$db oid searchTreeBased
Parameters:
No parameters.
Example:
# No example
$db oid setSchematicCache
Set the database schematic cache.
Usage:
$db oid setSchematicCache module schematicLayout
Parameters:
module
-
Set the database schematic cache for this module.
schematicLayout
-
The schematic layout string.
Example:
$db oid setSchematicCache $module "schematic layout"
$db oid statistics
No Documentation yet.
Usage:
$db oid statistics
Parameters:
No parameters.
Example:
# No example
$db oid tail
No Documentation yet.
Usage:
$db oid tail oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid type
Get the object type.
Usage:
$db oid type oid
Parameters:
oid
-
Input OID.
Example:
$db oid type $oid
$db oid up
No Documentation yet.
Usage:
$db oid up oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid validate
No Documentation yet.
Usage:
$db oid validate oid
Parameters:
oid
-
No Documentation yet.
Example:
$db oid virtualtype
No Documentation yet.
Usage:
$db oid virtualtype oid
Parameters:
oid
-
No Documentation yet.
Example:
Additional ZDB Commands
zdb check
Check if the $binfile
is valid for the current architecture.
zdb check
returns an error code if the check is negative.
Usage:
zdb check binfile
Parameters:
binfile
-
Path to a binfile.
Example:
zdb check "design.zdb"
zdb cone
No Documentation yet.
Usage:
zdb cone
Parameters:
No parameters.
Example:
# No example
zdb fileinfo
No Documentation yet.
Usage:
zdb fileinfo
Parameters:
No parameters.
Example:
# No example
zdb foreach
Can be used to loop over all active databases.
Usage:
zdb foreach var body
Parameters:
body
-
The executed code for each database.
var
-
The loop variable is set to the current database.
Example:
zdb foreach db {
# Do something with $db
}
zdb keyword
No Documentation yet.
Usage:
zdb keyword
Parameters:
No parameters.
Example:
# No example
zdb new
Create a new zdb object.
Usage:
zdb new ?-malloc? ?binfile?
Parameters:
-malloc (optional)
-
Create a malloc based database.
binfile (optional)
-
Path to a binfile.
Example:
set db [zdb new]
zdb open
Returns a "database handle" for the created database (like the zdb new
command) but also loads the database from the specified binfile.
The binfile is opened in read-only mode.
Usage:
zdb open ?-malloc? ?-populate? ?-quick? ?-writable? binfile
Parameters:
-malloc (optional)
-
Create a malloc based database.
-populate (optional)
-
The
-populate
option can be used to map the whole database into memory. This may slowdown the open command but speedup processing later. It has only an effect on Linux. -quick (optional)
-
Opening the binfile in quick mode will load the cell definitions and hierarchy information only. The contents for each module needs to be populated separately.
-writable (optional)
-
The binfile is opened writable and is updated whenever the database changes and (after a
$db close
) it is usable for subsequentzdb open
calls. binfile
-
Path to a binfile.
Example:
set db [zdb open "design.zdb"]
zdb parserbits
No Documentation yet.
Usage:
zdb parserbits
Parameters:
No parameters.
Example:
# No example
zdb primFuncList
No Documentation yet.
Usage:
zdb primFuncList
Parameters:
No parameters.
Example:
# No example
zdb primPrefix2Func
No Documentation yet.
Usage:
zdb primPrefix2Func
Parameters:
No parameters.
Example:
# No example
zdb profile
No Documentation yet.
Usage:
zdb profile
Parameters:
No parameters.
Example:
# No example
zdb sizeof
No Documentation yet.
Usage:
zdb sizeof
Parameters:
No parameters.
Example:
# No example
zdb source
No Documentation yet.
Usage:
zdb source
Parameters:
No parameters.
Example:
# No example
zdb synbool
No Documentation yet.
Usage:
zdb synbool
Parameters:
No parameters.
Example:
# No example
zdb valid
Can be used to check whether $db
is a valid database command returned
from e.g. zdb new
.
Usage:
zdb valid database
Parameters:
database
-
Name of a database.
Example:
zdb valid $db
zdb validate
Returns true if the $binfile
is ok, false otherwise.
Usage:
zdb validate binfile
Parameters:
binfile
-
Path to a binfile.
Example:
zdb validate "design.zdb"
zdb version
Prints the database version number.
Usage:
zdb version ?what?
Parameters:
what (optional)
-
What
Example:
zdb version
$db annotate
No Documentation yet.
Usage:
$db annotate
Parameters:
No parameters.
Example:
# No example
$db assertionModel
Create a model of the parasitic database.
Usage:
$db assertionModel
Parameters:
No parameters.
Example:
set assertionModel [$db assertionModel]
$db attr
No Documentation yet.
Usage:
$db attr
Parameters:
No parameters.
Example:
# No example
$db blocklevel
Create a new blocklevel object.
Usage:
$db blocklevel
Parameters:
No parameters.
Example:
set targetDB [zdb new]
set blocklevel [$db blocklevel $targetDB]
$db busOf
get bus of given member pin/port/net.
Usage:
$db busOf pinPortOrNet
Parameters:
pinPortOrNet
-
pin, port or net OID.
Example:
set oid [$db busOf $pin]
$db calc
No Documentation yet.
Usage:
$db calc
Parameters:
No parameters.
Example:
# No example
$db cdc
No Documentation yet.
Usage:
$db cdc
Parameters:
No parameters.
Example:
# No example
$db checkFunction
No Documentation yet.
Usage:
$db checkFunction
Parameters:
No parameters.
Example:
# No example
$db clearSchematicCache
Clear the database schematic cache for all modules.
Usage:
$db clearSchematicCache
Parameters:
Example:
$db clearSchematicCache
$db clone
No Documentation yet.
Usage:
$db clone
Parameters:
No parameters.
Example:
# No example
$db cloneDB
No Documentation yet.
Usage:
$db cloneDB
Parameters:
No parameters.
Example:
# No example
$db close
The $db close
command frees the used memory and deletes
the $db
Tcl command.
Usage:
$db close
Parameters:
No parameters.
Example:
$db close
$db cone
No Documentation yet.
Usage:
$db cone
Parameters:
No parameters.
Example:
# No example
$db coneToPG
No Documentation yet.
Usage:
$db coneToPG
Parameters:
No parameters.
Example:
# No example
$db connectedNet
get connected net of given pin or port.
Usage:
$db connectedNet pinOrPort
Parameters:
pinOrPort
-
pin or port OID.
Example:
set oid [$db connectedNet $pin]
$db count
No Documentation yet.
Usage:
$db count
Parameters:
No parameters.
Example:
# No example
$db deleteAllButFlat
No Documentation yet.
Usage:
$db deleteAllButFlat
Parameters:
No parameters.
Example:
# No example
$db deleteZombies
No Documentation yet.
Usage:
$db deleteZombies
Parameters:
No parameters.
Example:
# No example
$db directionOf
Get the direction of a pin or port.
Usage:
$db directionOf pin
Parameters:
pin
-
The OID of a parasitic module.
Example:
$db directionOf $pin
$db down
get down of given inst/pin.
Usage:
$db down instPinOrPinBus
Parameters:
instPinOrPinBus
-
inst, pin or PinBus.
Example:
set oid [$db down $inst]
$db dump
Dump the database contents to a file.
Usage:
$db dump ?-cell cell? ?-compress compress? ?flags? filename
Parameters:
-cell cell (optional default is NULL)
-
Dump flags.
-compress compress (optional default is ce_IOTypeStd)
-
Compression type.
filename
-
Name of the dump output file.
flags (optional)
-
Dump flags
Example:
$db dump "database.dmp"
$db efile
No Documentation yet.
Usage:
$db efile
Parameters:
No parameters.
Example:
# No example
$db extract
No Documentation yet.
Usage:
$db extract
Parameters:
No parameters.
Example:
# No example
$db find
No Documentation yet.
Usage:
$db find
Parameters:
No parameters.
Example:
# No example
$db flag
No Documentation yet.
Usage:
$db flag
Parameters:
No parameters.
Example:
# No example
$db flat
No Documentation yet.
Usage:
$db flat
Parameters:
No parameters.
Example:
# No example
$db flatattr
No Documentation yet.
Usage:
$db flatattr
Parameters:
No parameters.
Example:
# No example
$db flatflag
No Documentation yet.
Usage:
$db flatflag
Parameters:
No parameters.
Example:
# No example
$db flathilight
No Documentation yet.
Usage:
$db flathilight
Parameters:
No parameters.
Example:
# No example
$db flatid
No Documentation yet.
Usage:
$db flatid
Parameters:
No parameters.
Example:
# No example
$db flatoomr
No Documentation yet.
Usage:
$db flatoomr
Parameters:
No parameters.
Example:
# No example
$db foreach
No Documentation yet.
Usage:
$db foreach
Parameters:
No parameters.
Example:
# No example
$db get_all_bits
No Documentation yet.
Usage:
$db get_all_bits
Parameters:
No parameters.
Example:
# No example
$db get_attribute
No Documentation yet.
Usage:
$db get_attribute
Parameters:
No parameters.
Example:
# No example
$db get_cell
No Documentation yet.
Usage:
$db get_cell
Parameters:
No parameters.
Example:
# No example
$db get_driver
No Documentation yet.
Usage:
$db get_driver
Parameters:
No parameters.
Example:
# No example
$db get_inst
No Documentation yet.
Usage:
$db get_inst
Parameters:
No parameters.
Example:
# No example
$db get_instances_of_cell
No Documentation yet.
Usage:
$db get_instances_of_cell
Parameters:
No parameters.
Example:
# No example
$db get_load
No Documentation yet.
Usage:
$db get_load
Parameters:
No parameters.
Example:
# No example
$db get_net
No Documentation yet.
Usage:
$db get_net
Parameters:
No parameters.
Example:
# No example
$db get_para_port_name
No Documentation yet.
Usage:
$db get_para_port_name
Parameters:
No parameters.
Example:
# No example
$db get_pins
No Documentation yet.
Usage:
$db get_pins
Parameters:
No parameters.
Example:
# No example
$db get_ports
No Documentation yet.
Usage:
$db get_ports
Parameters:
No parameters.
Example:
# No example
$db get_top_design
No Documentation yet.
Usage:
$db get_top_design
Parameters:
No parameters.
Example:
# No example
$db getFuncPort
No Documentation yet.
Usage:
$db getFuncPort
Parameters:
No parameters.
Example:
# No example
$db getMember
No Documentation yet.
Usage:
$db getMember
Parameters:
No parameters.
Example:
# No example
$db getOriginalName
No Documentation yet.
Usage:
$db getOriginalName
Parameters:
No parameters.
Example:
# No example
$db guessedTopModules
No Documentation yet.
Usage:
$db guessedTopModules
Parameters:
No parameters.
Example:
# No example
$db hasParentInst
No Documentation yet.
Usage:
$db hasParentInst
Parameters:
No parameters.
Example:
# No example
$db hasParentMod
No Documentation yet.
Usage:
$db hasParentMod
Parameters:
No parameters.
Example:
# No example
$db hasRange
No Documentation yet.
Usage:
$db hasRange
Parameters:
No parameters.
Example:
# No example
$db hiersep
No Documentation yet.
Usage:
$db hiersep
Parameters:
No parameters.
Example:
# No example
$db highlight
No Documentation yet.
Usage:
$db highlight
Parameters:
No parameters.
Example:
# No example
$db hilight
No Documentation yet.
Usage:
$db hilight
Parameters:
No parameters.
Example:
# No example
$db htree
No Documentation yet.
Usage:
$db htree
Parameters:
No parameters.
Example:
# No example
$db identicalInterface
No Documentation yet.
Usage:
$db identicalInterface
Parameters:
No parameters.
Example:
# No example
$db ignore
No Documentation yet.
Usage:
$db ignore
Parameters:
No parameters.
Example:
# No example
$db info
No Documentation yet.
Usage:
$db info
Parameters:
No parameters.
Example:
# No example
$db infobox
No Documentation yet.
Usage:
$db infobox
Parameters:
No parameters.
Example:
# No example
$db isBusMember
No Documentation yet.
Usage:
$db isBusMember
Parameters:
No parameters.
Example:
# No example
$db isConnected
No Documentation yet.
Usage:
$db isConnected
Parameters:
No parameters.
Example:
# No example
$db isEmpty
No Documentation yet.
Usage:
$db isEmpty
Parameters:
No parameters.
Example:
# No example
$db isModule
No Documentation yet.
Usage:
$db isModule
Parameters:
No parameters.
Example:
# No example
$db isOneToOneConnection
No Documentation yet.
Usage:
$db isOneToOneConnection
Parameters:
No parameters.
Example:
# No example
$db isOperator
No Documentation yet.
Usage:
$db isOperator
Parameters:
No parameters.
Example:
# No example
$db isPgNet
No Documentation yet.
Usage:
$db isPgNet
Parameters:
No parameters.
Example:
# No example
$db istmptop
No Documentation yet.
Usage:
$db istmptop
Parameters:
No parameters.
Example:
# No example
$db isTop
No Documentation yet.
Usage:
$db isTop
Parameters:
No parameters.
Example:
# No example
$db load
No Documentation yet.
Usage:
$db load
Parameters:
No parameters.
Example:
# No example
$db memusage
No Documentation yet.
Usage:
$db memusage
Parameters:
No parameters.
Example:
# No example
$db mergeDB
No Documentation yet.
Usage:
$db mergeDB
Parameters:
No parameters.
Example:
# No example
$db moduleListModel
Create a new module list object.
Usage:
$db moduleListModel
Parameters:
No parameters.
Example:
set moduleListModel [$db moduleListModel]
$db moduleOf
get module of given inst/pin/pinBus.
Usage:
$db moduleOf instPinOrPinBus
Parameters:
instPinOrPinBus
-
inst, pin or PinBus.
Example:
set oid [$db moduleOf $inst]
$db oper
No Documentation yet.
Usage:
$db oper
Parameters:
No parameters.
Example:
# No example
$db orient
No Documentation yet.
Usage:
$db orient
Parameters:
No parameters.
Example:
# No example
$db parasiticNetModel
Create a model of the parasitic database.
Usage:
$db parasiticNetModel
Parameters:
No parameters.
Example:
set parasiticNetModel [$db parasiticNetModel]
$db parasiticSchemModel
Create a new Parasitic view object.
Usage:
$db parasiticSchemModel
Parameters:
No parameters.
Example:
set parasiticSchemModel [$db parasiticSchemModel]
$db parentInst
get parentInst of given inst|net|netBus|netSeg|signal.
Usage:
$db parentInst instNetNetBusNetSegSignal
Parameters:
instNetNetBusNetSegSignal
-
inst, net, netBus, netSeg or signal.
Example:
set oid [$db parentInst $inst]
$db parentModule
get parentModule of given oid.
Usage:
$db parentModule oid
Parameters:
oid
-
oid.
Example:
set oid [$db parentModule $inst]
$db populateCount
Populate sub-command to get current count of populated data.
Usage:
$db populateCount
Parameters:
No parameters.
Example:
set count [$db populateCount]
$db populateFlat
Populate sub-command to incrementally fill the database from a binfile.
Usage:
$db populateFlat ?moduleName?
Parameters:
moduleName (optional)
-
Populate the database with the flat data of the given module.
Example:
$db populateFlat "TOP"
$db populateModule
Populate sub-command to incrementally fill the database from a binfile.
Usage:
$db populateModule ?-noflat? ?-parasitic? ?moduleName?
Parameters:
-noflat (optional)
-
Do not automatically populate flat data.
-parasitic (optional)
-
Treat the given module name as a parasitic module.
moduleName (optional)
-
Populate the database with the contents of the given module.
Example:
$db populateModule "TOP"
$db populateSourceFileInfo
Populate sub-command to incrementally fill the source file information in the database for the source file with the given index.
Usage:
$db populateSourceFileInfo ?sfileIdx?
Parameters:
sfileIdx (optional)
-
Populate the database with the line file information of the sfile index.
Example:
$db populateSourceFileInfo 0
$db primFuncOf
No Documentation yet.
Usage:
$db primFuncOf
Parameters:
No parameters.
Example:
# No example
$db primitiveFuncOf
No Documentation yet.
Usage:
$db primitiveFuncOf
Parameters:
No parameters.
Example:
# No example
$db primitiveOf
get primitive of given inst/pin/pinBus.
Usage:
$db primitiveOf instPinOrPinBus
Parameters:
instPinOrPinBus
-
inst, pin or PinBus.
Example:
set oid [$db primitiveOf $inst]
$db print_oid_as_slash_path
No Documentation yet.
Usage:
$db print_oid_as_slash_path
Parameters:
No parameters.
Example:
# No example
$db print_oid_as_spef
No Documentation yet.
Usage:
$db print_oid_as_spef
Parameters:
No parameters.
Example:
# No example
$db rangeLsb
No Documentation yet.
Usage:
$db rangeLsb
Parameters:
No parameters.
Example:
# No example
$db rangeMsb
No Documentation yet.
Usage:
$db rangeMsb
Parameters:
No parameters.
Example:
# No example
$db refCount
No Documentation yet.
Usage:
$db refCount
Parameters:
No parameters.
Example:
# No example
$db reloadModule
No Documentation yet.
Usage:
$db reloadModule
Parameters:
No parameters.
Example:
# No example
$db reloadParasitic
No Documentation yet.
Usage:
$db reloadParasitic
Parameters:
No parameters.
Example:
# No example
$db report
No Documentation yet.
Usage:
$db report
Parameters:
No parameters.
Example:
# No example
$db save
Save the database as a binfile.
Usage:
$db save ?-legacy? binfile
Parameters:
-legacy (optional)
-
Use legacy file format.
binfile
-
The name of the created binfile.
Example:
$db save "design.zdb"
$db schematic
Create a new schematic object.
Usage:
$db schematic
Parameters:
No parameters.
Example:
set schem [$db schematic]
$db schematicModel
Create a new schematicModel object.
Usage:
$db schematicModel
Parameters:
No parameters.
Example:
set schem [$db schematicModel]
$db search
No Documentation yet.
Usage:
$db search
Parameters:
No parameters.
Example:
# No example
$db setPrimitive
No Documentation yet.
Usage:
$db setPrimitive
Parameters:
No parameters.
Example:
# No example
$db setXY
No Documentation yet.
Usage:
$db setXY
Parameters:
No parameters.
Example:
# No example
$db spos
No Documentation yet.
Usage:
$db spos
Parameters:
No parameters.
Example:
# No example
$db sposFilesModel
Create a SPOS file model.
Usage:
$db sposFilesModel
Parameters:
No parameters.
Example:
set model [$db sposFilesModel]
$db symdef
No Documentation yet.
Usage:
$db symdef
Parameters:
No parameters.
Example:
# No example
$db symlib
No Documentation yet.
Usage:
$db symlib
Parameters:
No parameters.
Example:
# No example
$db tableAlloc
No Documentation yet.
Usage:
$db tableAlloc
Parameters:
No parameters.
Example:
# No example
$db tdevice
No Documentation yet.
Usage:
$db tdevice
Parameters:
No parameters.
Example:
# No example
$db tools
No Documentation yet.
Usage:
$db tools
Parameters:
No parameters.
Example:
# No example
$db top
No Documentation yet.
Usage:
$db top
Parameters:
No parameters.
Example:
# No example
$db treeModel
Create a new hierarchy tree model object.
Usage:
$db treeModel
Parameters:
No parameters.
Example:
set treeModel [$db treeModel]
$db uniqueName
No Documentation yet.
Usage:
$db uniqueName
Parameters:
No parameters.
Example:
# No example
$db unusedTopCandidates
No Documentation yet.
Usage:
$db unusedTopCandidates
Parameters:
No parameters.
Example:
# No example
$db up
get up of given module/primitive/port/portBus.
Usage:
$db up modPrimPortOrPBus
Parameters:
modPrimPortOrPBus
-
module, primitive, port or portBus.
Example:
set oid [$db up $mod]
$db utils
No Documentation yet.
Usage:
$db utils
Parameters:
No parameters.
Example:
# No example
$db validate
No Documentation yet.
Usage:
$db validate
Parameters:
No parameters.
Example:
# No example
$db value
No Documentation yet.
Usage:
$db value
Parameters:
No parameters.
Example:
# No example
$db widthOf
No Documentation yet.
Usage:
$db widthOf
Parameters:
No parameters.
Example:
# No example
zdb formatvalue
zdb formatvalue sub-command.
zdb formatvalue changeverilogradix
Change the radix of a Verilog value. Returns the original value in case of errors.
Usage:
zdb formatvalue changeverilogradix radix inputValue
Parameters:
inputValue
-
Input value in the specified format to be formatted.
radix
-
Specify the output format: -bin|-oct|-dec|-hex.
Example:
zdb formatvalue changeverilogradix -hex 4'b1010
zdb formatvalue frombinary
Convert a given binary value into an octal, decimal or hexadecimal value.
Usage:
zdb formatvalue frombinary ?-noValueAsX? ?-prefix? ?-singleNoValue? ?-verilogPrefix? ?-width widthVal? radix inputValue
Parameters:
-noValueAsX (optional)
-
Convert '?' as 'X'.
-prefix (optional)
-
Adds 'O' for octal and '0x' for hexadecimal values at the beginning of the output value. prefix and verilogPrefix are mutually exclusive.
-singleNoValue (optional)
-
Convert multiple '?' novalues to only one '?'.
-verilogPrefix (optional)
-
Add [0-9]'[bodh] prefix in Verilog style to the value. prefix and verilogPrefix are mutually exclusive.
-width widthVal (optional default is 0)
-
Adds leading zeros to the input value before conversion to match the given width. Ignored for '-dec'. Ignored if width is too small.
inputValue
-
Input value in binary format to be formatted. Leading zeros are ignored.
radix
-
Set the target format with -bin|-oct|-dec|-hex.
Example:
zdb formatvalue frombinary -hex -prefix 1101
zdb formatvalue fromspice
Convert values from Spice notation to a real number. Returns '0.0' for erroneous inputs.
Usage:
zdb formatvalue fromspice ?-hspice? inputValue
Parameters:
-hspice (optional)
-
For inputs in hspice format. Enables the usage of 'a' (atto → 1e-18).
inputValue
-
Input value in Spice notation to be formatted.
Example:
zdb formatvalue fromspice 10m
zdb formatvalue fromspicestrict
Convert values in Spice format to decimal. Returns empty string for erroneous inputs.
Usage:
zdb formatvalue fromspicestrict ?-hspice? inputValue
Parameters:
-hspice (optional)
-
For inputs in hspice format. Enables the usage of 'a' (atto → 1e-18).
inputValue
-
Input value in Spice format to be formatted.
Example:
zdb formatvalue fromspicestrict 10m
zdb formatvalue fromverilog
Convert a given verilog value in binary, decimal, octal or hexadecimal format into a decimal value.
Usage:
zdb formatvalue fromverilog inputValue
Parameters:
inputValue
-
Input value in verilog format to be formatted.
Example:
zdb formatvalue fromverilog 8'b00000101
zdb formatvalue thousands
Add thousands separators to the input value.
Usage:
zdb formatvalue thousands inputValue ?sep?
Parameters:
inputValue
-
Input value in dec format to be formatted.
sep (optional)
-
Separator to be used. By default ',' is used.
Example:
zdb formatvalue thousands 1234567890
zdb formatvalue tobinary
Convert a number in binary, octal, decimal or hexadecimal format to a number in binary format.
Usage:
zdb formatvalue tobinary ?-prefix? ?-verilogPrefix? ?-width widthVal? radix inputValue
Parameters:
-prefix (optional)
-
Has to be set if the input starts with an 'O'/'0x' for octal/hexadecimal input formats.
-verilogPrefix (optional)
-
Add [0-9]'[bodh] prefix to the value.
-width widthVal (optional default is 0)
-
Number of bits for the result value. Is ignored if the number is too small.
inputValue
-
Input value in the specified format to be formatted.
radix
-
Specify the input format: -bin|-oct|-dec|-hex.
Example:
zdb formatvalue tobinary -oct -prefix O12
zdb formatvalue tospice
Convert a real number into a Spice value.
Usage:
zdb formatvalue tospice ?-hspice? inputValue
Parameters:
-hspice (optional)
-
For inputs in hspice format. Enables the usage of 'a' (atto → 1e-18).
inputValue
-
Input value to be formatted.
Example:
zdb formatvalue tospice 1e-7
zdb formatvalue toverilog
Convert a decimal number to a number in Verilog format with bin|oct|dec|hex radix.
Usage:
zdb formatvalue toverilog ?-separatorDistance separatorDistance? ?-width widthVal? radix inputValue
Parameters:
-separatorDistance separatorDistance (optional default is 0)
-
Set to insert underscore separators with the distance of <separatorDistance> between them.
-width widthVal (optional default is 0)
-
Number of bits for the result value. Is ignored if the number is too small.
inputValue
-
Input value in the specified format to be formatted.
radix
-
Specify the output format: -bin|-oct|-dec|-hex.
Example:
zdb formatvalue toverilog -bin -width 10 123
Foreach Loops
$db foreach $iter_type $oid variable $body
loops over all elements of type $iter_type
within the specified object.
For each element, the specified loop variable
is set and the $body
is executed.
The body can access the loop variable
.
The $body
may execute break
, continue
, and return
with the expected results.
The loop variable is actually another OID.
For each iteration step, a new OID is created internally and assigned to the
loop variable.
These new OIDs always have the same module root and path as the specified $oid
.
It is not safe to run operators modifying the database while using a $db foreach …
loop. Especially if the body of the $db foreach …
loop modifies the current iteration
type.
E.g. $db foreach pin $net
while using
$db oper disconnect $pin
in the body of the foreach loop will cause unpredictable results.
If the specified $oid
does not exist or architecturally cannot "contain"
elements of $iter_type
then the foreach-loop will immediately return an
error message (and will not execute the body).
Loop over Modules and Primitives
$db foreach top cur $body
$db foreach module cur $body
$db foreach primitive cur $body
$db foreach cell cur $body
$db foreach parasitic cur $body
loop over top-modules, modules or primitives.
-
the top-modules are a subset of the "modules" (often just one);
-
$db foreach cell …
loops over both modules and primitives; -
$db foreach parasitic …
loops over the so-called parasitic modules in random order (they are disjoint to the "module" list).
For each iteration step, the loop variable cur
is set to a new module OID
or primitive OID.
These five foreach-loops are the only ones that do not require an argument
$oid
(for initialization), since they are based on the database root.
Loop over Interface Ports
$db foreach port $mod cur $body
$db foreach portBus $mod cur $body
$db foreach oPort $dir $mod cur $body
Assuming $mod
is a module or primitive OID, these foreach-commands loop over
the interface ports and portBuses and set the loop variable cur
accordingly.
$db foreach port …
loops over single-bit ports (including bus members);
$db foreach portBus
loops over portBuses;
$db foreach oPort …
loops over both simultaneously, setting cur
to
either a port or a portBus; it does not include bus members and visits the
ports/portBuses in a predefined order (as defined by the
bus-level
functions,
where single-bit ports and portBuses are mixed); additionally, oPort
can filter
ports by direction $dir
:
|
loop over all ports and portBuses |
|
loop over input ports and input portBuses, skip output, inout and unknown directions |
|
loop over output ports/portBuses |
|
loop over inout ports/portBuses |
The commands
$db foreach couplingPort $parasitic cur $body
$db foreach couplingInst $parasitic cur $body
can be used to loop over all coupling connections and coupling instances of a parasitic module.
Loop over Instances, Nets and Buses
$db foreach inst $mod cur $body
$db foreach clocked $mod cur $body
$db foreach operator $mod cur $body
$db foreach primInst $mod cur $body
$db foreach net $mod cur $body
$db foreach netBus $mod cur $body
Assuming $mod
is a module OID, these foreach-commands loop over the module
contents and set the loop variable cur
accordingly.
$db foreach pin $inst cur $body
$db foreach pinBus $inst cur $body
$db foreach oPin $dir $inst cur $body
Assuming $inst
is an instance OID, $db foreach pin/pinBus …
loop over pins or pinBuses of a given
instance and set the cur
variable accordingly;
$db foreach oPin …
works analogous to "oPort".
Loop over Bus Information
$db foreach net $netBus cur $body
$db foreach member $netBus cur $body
$db foreach pin $pinBus cur $body
$db foreach port $portBus cur $body
Loop over single bit nets, pins or ports of a given bus object (as before,
$netBus
, $pinBus
, and $portBus
are OIDs).
The $db foreach net …
and $db foreach member …
are identical, except $db foreach net …
will skip null OIDs (representing gaps in a netBus definition).
Search Objects by Name
$db search ?-icase? top $name
$db search ?-icase? module $name
$db search ?-icase? primitive $name
$db search ?-icase? cell $name
$db search ?-icase? parasitic $name
Analogous to the foreach loop above, these commands
search for a top-module, module, or primitive by $name
;
$db search cell …
searches for a module or a primitive;
$db search parasitic …
searches for a so-called parasitic module.
If the option -icase
is specified then the object is searched in a
case insensitive manner.
$db search ?-icase? port $cell $name
$db search ?-icase? portBus $cell $name
Analogous to the foreach loop above, these commands search for
a port or portBus in the given module or primitive (as specified by $cell
).
$db search ?-icase? inst $mod $name
$db search ?-icase? net $mod $name
$db search ?-icase? netBus $mod $name
$db search ?-icase? pin $inst $name
$db search ?-icase? pinBus $inst $name
$db search ?-icase? member $nbus $name (deprecated)
Analogous to the foreach loop above, these commands
search for an inst, net or netBus in the given module ($mod
)
or for a pin or pinBus in the given instance ($inst
).
$db search ?-icase? net $netBus $name
$db search ?-icase? pin $pinBus $name
$db search ?-icase? port $portBus $name
Analogous to the foreach loop above, these commands search for a sub-net, sub-pin or sub-port in the given netBus, pinBus or portBus respectively.
Getting Bus Information
$db isBusMember $net
$db isBusMember $pin
$db isBusMember $port
$db busOf $net
$db busOf $pin
$db busOf $port
$db widthOf $netBus
$db widthOf $pinBus
$db widthOf $portBus
$db hasRange $bus
$db rangeLsb $bus
$db rangeMsb $bus
$db isBusMember $net/$pin/$port
returns a boolean value indicating whether the object is member of a bus;
$db busOf $net/$pin/$port
return the OID of the netBus, pinBus or portBus (or an error if the specified
$net
/$pin
/$port
is not a member of a bus);
$db widthOf $netBus/$pinBus/$portBus
returns an integer defining the bus width.
$db hasRange $bus
returns true if the given bus has a range direction.
$db rangeLsb $bus
returns the index of the bus' LSB.
$db rangeMsb $bus
returns the index of the bus' MSB.
By convention the parsers store the LSB of a bus first.
Getting Hierarchy Information
$db isTop $mod
$db isModule $inst|$pin|$pinBus|$mod|$prim
$db isOperator $inst
$db moduleOf $inst|$pin|$pinBus
$db primitiveOf $inst|$pin|$pinBus
The first three commands return a boolean value; the fourth command
returns the down-module OID (the module referred to by the specified instance)
or an error if $inst
is not a module; the last command
returns the primitive OID as referred to by the specified instance,
or an error if $inst
is not a primitive.
Instead of $inst
, a $pin
or $pinBus
is also accepted with the same effect.
$db isEmpty $module ?-checkDanglingNets?
$db isEmpty …
command returns true if the given module is empty
(contains no instance or net).
If the option -checkDanglingNets
is given then nets with no or only one
connection are ignored.
$db refCount $oid
$db refCount …
returns an integer representing the number of
instances referring to the Module or Primitive given as $oid
.
But, any other kind of OID can be given as $oid
— in that case,
the refCount
of the $oid
's parent module is returned.
$db hasParentInst $inst
$db parentInst $inst
The first command returns a boolean value; the second command returns an inst
OID for the instance one hierarchy level above.
Instead of $inst
, a $net
or $netBus
is also accepted with the same effect.
This only works for tree-based OIDs.
$db hasParentMod $oid
$db parentModule $oid
the first command returns a boolean value; the second command returns a module
OID, pointing to the module that "contains" the given $oid
.
If the $oid
itself is a tree-based module or primitive, then the path
is shortened by one element.
More hierarchy information is returned by the
$db oid down/up …
commands.
Getting Primitive Function
$db primFuncOf $prim
$db primFuncOf $mod
$db primFuncOf $inst
$db primFuncOf $pin
returns the name of the
primitive function, e.g.
NAND
, NMOS
etc. or UNKNOWN
.
For compatibility, the old command name $db primitiveFuncOf …
is also supported with the same function.
$db setPrimitive $level
Set a new primitive level according to the given value of $level which is
a combination of -clear
, -operator
, -libcell
, -celldefine
, -flag
and -symbol
.
-
The option
-clear
removes all primitive level settings. -
The option
-operator
specifies all cells with a known function (Operators) as primitives. -
The option
-libcell
specifies all cells flagged as library cells (e.g. coming from a binlib) as primitives. -
The option
-celldefine
specifies all cells surrounded by the Verilog macros`celldefine
and`endcelldefine
as primitives. -
The option
-flag
specifies all modules flagged with the leafcell flag as primitives. -
The option
-symbol
specifies all cells with a@symbol
attribute (from a symlib) as primitives.
$db oid insideprim $oid
returns true if the given $oid
is inside a primitive "module".
These OIDs are returned by the picklist
command if the -insideprim
option is given.
Compare Cell Interfaces
$db identicalInterface ?-icase? $cellA $cellB
Compare if the interfaces of two given cells are identical. If identical, then this function returns true, false otherwise.
The interface includes port and portBus names, direction and order.
Update $cellA
's port directions from $cellB
and vice versa, whatever has
more information: update unknown
by inout
/input
/output
and
update inout
by input
/output
.
If the optional argument -icase
is specified, then the port names are
compared in a case insensitive manner.
Report Module Size/Insts/Nets
$db report sizeOf $mod
$db report instCount $result $mod
$db report netCount $mod
$db report portCount $mod
$db report objCount ?-cell|-inst|-pin|-net|-netBus|port|portBus|-all?
?$mod|-hier?
$db report histogram
$db report designStatistics $filename
$db report sizeOf …
returns a triplet (list with 3 elements) containing the number
of ports, instances and nets of the given module.
$db report instCount …
computes the number of primitives and modules (all
instantiations) and stores the result into the given table ($result
is the
name of the array variable where the results are stored).
For each entry, the key is the primitive or module name (prefixed by the
character P
or M
) and the value is the number of instances.
$db report netCount/portCount …
compute and return the number of nets and ports, respectively (in all instantiations).
$db report objCount …
reports the number of inst, port and net objects in all
instantiations.
If the option -hier
is given then only one instance of a
module is used to count the total number of objects.
By adding a type option the returned object count can be limited to the given
type.
$db report histogram
report statistic (histogram) data for the given database.
$db report designStatistics
prints statistic information of the loaded design database into the given file.
Count Objects
$db count cell
$db count module
$db count primitive
$db count parasitic
$db count inst $mod
$db count net $mod
$db count netBus $mod
$db count port $cell
$db count portBus $cell
$db count member $netBus|$portBus
$db count pin $net ?-noport?
The $db count …
commands return the number of elements of the given type in the
database respectively given owner.
When using $db count pin $net
, connected ports may be excluded with -noport
.
Is Transistor Device
$db tdevice $inst|$prim
returns true if the given instance or primitive OID refers to a device function.
Is Polar Device
$db tdevice polar $inst|$prim
returns true if the given instance or primitive OID refers to a polar device function.
Get Opposite Pin
$db tdevice oppositePin $pin
Get Pin by Function
$db getFuncPort $cell|$inst ?-name? ?-noError? $orderedPort
Get the instance pin or cell port at the given ordered port number.
-
The option
-noError
will return a empty list for not matching ports. -
The option
-name
allows specifying one of the port functionsselect
,set
,reset
,clock
,enable
,drain
, andgate
as$orderedPort
.
Get Bus Member by Index
$db getMember $portBus|$netBus -index|-bit $idx ?-noError?
-
Get the member of a portBus or netBus at the given index number, if
-index
is used. -
Get the member of a portBus or netBus with the given bit subscript, if
-bit
is used. -
The option
-noError
will return a null oid for invalid options instead of raising a Tcl error.
Getting Pin Direction
$db directionOf $port
$db directionOf $pin
$db directionOf $portBus
$db directionOf $pinBus
returns one of input
, output
, inout
, and unknown
.
For primitive ports (and primitive instance pins), the return string may be
extended by a .neg
suffix to indicate that their function
is inverted, e.g. input.neg
.
Getting Connectivity Information
$db isConnected $pin
$db isConnected $port
$db connectedNet $pin
$db connectedNet $port
$db isOneToOneConnection ?-checksequence? $netBus $pinBus
$db isOneToOneConnection ?-checksequence? $netBus $portBus
-
The
$db isConnected …
command returns a boolean value indicating whether the object is connected to a net. -
The
$db connectedNet …
command returns a net OID (or an error if the object is not connected to a net). -
The
$db isOneToOneConnection …
command checks if all subnets of the given netBus are connected to the given pinBus or portBus. If-checksequence
is used, the first member of the netbus must be connected to first member of the pinBus or portBus and all other connections must be in sequence.
$db foreach pin $net cur $body
loops over the net connections.
For each iteration step, the loop variable
cur
is set to either a port OID or a pin OID.
The loops
$db foreach pinCon $net cur $body
$db foreach portCon $net cur $body
can be used to get only the pins or the ports connected to the given net object.
Top Module
$db top set $mod
$db top unset $mod
The $db top …
commands add or remove a module from the top list.
Clone Object
$db clone ?-bitblasted? ?-skipflaggedport $flag? ?-skipflaggedinst $flag?
?-skipcontent? ?-nospos? $oid ?$rename?
The $db clone …
command clones an object and returns the OID of
the newly created object. If the optional $rename
is missing,
a unique name is created. Currently only primitives and modules are supported.
If the option -bitblasted
is specified, then a bit-blasted version of
the primitive or module is created. If the original cell has a bus level
function then this function is not cloned.
The option -skipflaggedport $flag
will not clone ports flagged with the
given $flag
.
If the original cell has a function then this function is not
cloned if -skipflaggedport
is specified.
The option -skipflaggedinst $flag
will not clone instances inside the module to
be cloned flagged with the given flag. If -skipcontent
is given then this
option is not used.
The -nospos
option can be used to save memory by not cloning spos information.
Clone Database
$db cloneDB ?-into $otherdb?
?-keepcell $flag? ?-keepinst $flag?
?-keepnet $flag? ?-keepport $flag?
?-keeppin $flag?
?-nospos?
The $db cloneDB …
command clones the database with all flagged objects and returns
the new database.
The -keep…
options define the flags for objects which should be
cloned.
Flagged nets/netbuses and ports/portbuses are only cloned if the parent module
is flagged.
Flagged instances are only cloned if the parent module and the referenced
cell is flagged. The connections of pins is only cloned if the pins and nets
are flagged.
In none of the -keep…
options is given, all objects will be cloned.
The -into
option can be used to merge or clone flagged or all
object into the given database. This can be used to merge multiple databases.
The -nospos
option can be used to save memory by not cloning spos information.
Merge Database
$db mergeDB $fromDb ?-rename? ?-nospos?
The $db mergeDB …
command clones all cells from $fromDb
into $db
.
If the -rename
option is given, existing cells with the same
name get renamed. Otherwise the interface must match.
If a existing module has already contents the new contents is ignored.
Get/Set Attributes
$db attr $oid add $attr ?$attr $attr ...?
$db attr $oid set $attr ?$attr $attr ...?
$db attr $oid delete ?$name $name ...?
$db attr $oid get ?-sorted?
$db attr $oid getValue $name
$db attr $oid foreach cur_attr $body
Both, $db attr $oid add …
and $db attr $oid set …
append one or more attributes to the given $oid
— however, set
overwrites existing attributes (avoids duplicates) while add
simply appends.
The format of $attr
is name=value
.
$db attr $oid delete …
removes the attributes with the specified names from the given OID — or all attributes (if no names are specified).
$db attr $oid get …
returns a list of all attributes (list of name=value
elements).
If the optional switch -sorted
is given then a sorted list of all attributes is returned.
$db attr $oid getValue …
returns just the value of the specified attribute name (or an empty string if not found).
$db attr $oid foreach cur_attr $body
loops over the attributes of the specified object.
The loop variable cur_attr
is set to the current attribute string (in name=value
format).
All six functions accept -db
instead of $oid
— in this case, the database root attributes are processed.
Get/Set Flags
$db flag $oid|<SCOPE> set $flag
$db flag $oid|<SCOPE> clear $flag
$db flag $oid is $flag
$db flag $oid is_set $flag
$db flag $oid is_clear $flag
$db flag $oid get
$db flag $oid clear
$db flag $oid toggle $flag
$db flag $oid supported $flag
$db flag $type available
The set
and clear
sub-commands set and clear a flag at the specified object of at all objects of the specified scope.
If the scope is -db
then the given flag will be set or cleared at all database objects.
Further possible scopes are:
-cell
,
-module
,
-primitive
,
-inst
,
-net
,
-netBus
,
-port
,
-portBus
, and
-pin
to limit the processed object type.
$db flag $oid is $flag
returns true if the $flag
is set at the specified object;
$db flag $oid is_set|is_clear $flag
also return the current flag state (like $db flag $oid is $flag
), but afterwards set/clear the flag.
$db flag $oid get
returns a list of all set flags at the given object.
$db flag $oid supported $flag
returns true if $flag
is supported at the given $oid
.
$db flag $type available
returns a list of all supported flags for the given OID $type
.
|
Description |
Supported at |
|||
---|---|---|---|---|---|
cell |
inst |
net |
port/pin |
||
|
used by the
|
Yes |
Yes |
Yes |
|
|
general purpose, for Tcl Userware, they have no special
meaning in the database.
The |
Yes |
Yes |
Yes |
Yes |
|
general purpose |
Yes |
Yes |
Yes |
Yes |
|
hide this symbol port or portBus in the schematic windows
(all instantiations of modules and primitives are affected);
hiding primitive ports is limited to the
gate-level functions
|
Yes |
|||
|
bubble symbol port |
Yes |
|||
|
place this port at the top, bottom, left or right side. |
Yes |
|||
|
mark this port as a clock input pin |
Yes |
|||
|
mark this pin/port as a driver |
Yes |
|||
|
declare transistor primitives and instances to drive only a small current (is a weak transistor). |
Yes |
Yes |
||
|
this net is a power or ground or negative power net (or constant 1 or 0 in digital logic) |
Yes |
|||
|
this is a black-box (the parser was not able to get any information about that module) |
Yes |
|||
|
for incremental schematic navigation pass this buffer-like cell |
Yes |
|||
|
this is considered to be a library cell,
e.g. defined by |
Yes |
|||
|
a module flagged with as a |
Yes (module) |
|||
|
group flagged instances in the tree |
Yes |
|||
|
this object is not declared by the user |
Yes |
Yes |
||
|
for future use |
Yes |
Power/Ground Nets
$db isPgNet $oid
Service function to test if the given net or signal is flagged as power or ground.
Constant Nets
$db value $oid ?$value?
$db value $oid
returns the constant value of the $oid
($oid
must be of type net, netBus or signal).
If $oid
is a signal and there’s a value mismatch at the nets of the signal, and error is returned.
If called with the optional $value
argument, then a constant value is set at the
given net, netBus or signal object.
Possible values are: 0
, 1
, X
, and Z
.
If an empty string is specified, then the value at the net, netBus or signal
object is deleted.
Deal with Highlight Colors
The following commands can be used to highlight objects module based.
An object inside a module that is instantiated multiple times will be highlighted with the given color in each instance of this module.
The flathighlight
API can be used to highlight individual objects only in one specific instantiation path.
$db hilight $oid set $color ?-permanent?
$db hilight $oid get ?-permanent|-both?
$db hilight $oid delete ?-permanent|-both?
$db hilight * deleteAll ?$color? ?-permanent|-both?
The set
sub-command sets the highlight color for the object specified by $oid
to $color
.
The get
sub-command returns the current highlight color or an empty list ({}
) if nothing is set.
The delete
sub-command removes the highlight color from the object specified by $oid
.
With the deleteAll
sub-command all highlights are removed.
The optional $color
argument specifies the color of the objects which should be removed.
It may be omitted if all highlights should be removed.
There are two sets of highlight colors for each object. "normal" and
-permanent
colors. They can be set and deleted independent of each other.
If both are set, the "normal" color has priority over the permanent color.
$color
may be in the range 0..48.
Using the option -both
to get either the normal or permanent highlight color
will return the permanent value as a negative number to be able to
distinguish between normal highlight.
Helper with Highlight Colors
The following commands can be used to highlight objects in module based and flat data. Parasitic and database object are both handled if possible.
$db highlight $oid set $color ?-permanent?
$db highlight $oid get ?-permanent|-both?
$db highlight $oid delete ?-permanent|-both?
Get/Set Instance Orientation
$db orient $inst ?R0|R90|R180|R270|MY|MYR90|MX|MXR90?
$db orient $inst ?+R0|+R90|+R180|+R270|+MY|+MYR90|+MX|+MXR90?
$db orient $inst ?-R0|-R90|-R180|-R270|-MY|-MYR90|-MX|-MXR90?
$db orient …
gets or sets the orientation of the given
instance object.
If the value is prefixed with /-` the orientation is applied relative to the current position. The rotation is applied counter-clockwise if prefix is `
and clockwise if prefix is -
.
If the optional "orientation" argument is omitted, then the current orientation of the instance is returned, otherwise the orientation is set to the given value.
Validate
$db validate ?options?
Validate the integrity of the database.
The supported ?options?
are:
|
additionally validate object names in the database — to check if they are unique |
|
ditto, but perform the check in a case-insensitive way |
|
additionally validate source file positions |
|
perform extra checks on Prim Functions |
|
additionally check flat data |
|
additionally check for a cycle in the design hierarchy. |
Symlib Support
The symlib operations are used to maintain graphical symbol information in the database.
The typical usage is:
$db symlib add -fromattr|-fromfunc|-fromstr $str|$fname
$db symlib scan ?-force?
$db symlib clear
$db symlib remove
$db symlib copy
$db symlib scandef ?-icase? $symdef
$db symlib info
$db symlib create mySymbols.sym
The add
sub-command reads the given symlib file, @symbol
attributes or cell
functions and adds it to the database.
The scan
sub-command updates the symbol information of the database primitives,
modules, ports and power/ground nets.
The -force
option will overwrite symbol information if it already exists at a
given cell. Otherwise it will be left unchanged.
The clear
command removes all symlib information while the remove
command
only removes the symbol libraries add using the add
command.
The copy
command can be used to create database primitives and modules from
added symlib information.
scandef
splits the given symbol definition string into a list of separate
entries for each contained keyword.
info
can be used to get information contained in the symlib header of an
added file.
create
extracts the symbol information from the given database and creates
a symlib file. An existing file will be overwritten.
Details about the symlib file can be found in the Symlib Tutorial.
Symdef Support
The graphical symbol information for port and power ground symbols is stored
in the symdef table of a database and referenced by @sym
attributes
at the ports and power ground nets.
The symdef table is maintained by the following commands:
$db symdef set $name $def
$db symdef get $name
$db symdef delete $name
$db symdef list
The set
sub-command adds or overwrites a symbol definition with the given name.
The get
sub-command returns a list containing the stored symbol definition and
the optional io mapping info or an empty string if the given name is not stored
in the table.
With the delete
sub-command the information for the given symbol name is
removed from the table.
The list
sub-command returns a list of the names of all stored symbols.