Magic VLSI Layout Tool Version 8.2 *

cellsearch


Execute a TCL procedure on each cell definition or instance in the hierarchy

Usage:

cellsearch [instances] procedure

where procedure is the name of a predefined Tcl procedure (see Summary, below).

Summary:

The cellsearch command is a method for user access to the magic database search routines. It searches the hierarchical database for all cell definitions and applies the callback procedure to each. If the instances keyword is present, it searches the database for all cell instances and applies the callback procedure to each. The callback procedure must be defined as described below. Note that the callback method into Tcl is inherently slow and should only be used for non-compute-intensive tasks.

The Tcl callback procedure for the instances version of the cellsearch command is passed six values, the bounding box coordinates of the instance, the instance use name (id), and the name of the parent cell definition. The procedure must be defined to accept these six arguments, as in the following example:

	proc inst_callback {llx lly urx ury usename defname} {
	   puts stdout "Instance $usename of $defname bbox $llx $lly $urx $ury"
        }
     
The Tcl callback procedure for the cell definition search is passed one value, the name of the cell definition. The procedure must be defined to accept this single argument, as in the following example:
	proc def_callback {defname} {
	   puts stdout "Cell $defname"
        }
     

Implementation Notes:

cellsearch is implemented as an internal magic command that links to an external Tcl procedure as a callback function. This routine is experimental and subject to change without notice.

Bugs:

As currently implemented, there is no protection against calling a magic command from the callback procedure that will alter the internal cell hash table while it is being traversed, causing a crash. The implementation should be changed to a 2-step procedure that traverses the cell hash table first, creating an internal list of function arguments to pass for each cell, and then executes the callback function on each.

There are more efficient ways of executing the callback function than Tcl_EvalEx(). In particular, the procedure should be cast as a Tcl object and Tcl_EvalObjEx() used.

The callback function should allow in-line Tcl procedures and use the standard Tcl/Tk method of "%" escape sequences used as arguments to the callback function that allow the user to specify what arguments are passed to the callback function (as is done for the tag command).

See Also:

search

Return to command index

Last updated: March 7, 2020 at 1:06pm