Calbr DRV Ref
Calbr DRV Ref
Calbr DRV Ref
This document contains information that is proprietary to Mentor Graphics Corporation. The original recipient of this
document may duplicate this document in whole or in part for internal business purposes only, provided that this entire
notice appears in all copies. In duplicating any part of this document, the recipient agrees to make every reasonable
effort to prevent the unauthorized use and distribution of the proprietary information.
This document is for information and instruction purposes. Mentor Graphics reserves the right to make
changes in specifications and other information contained in this publication without prior notice, and the
reader should, in all cases, consult Mentor Graphics to determine whether any changes have been
made.
The terms and conditions governing the sale and licensing of Mentor Graphics products are set forth in
written agreements between Mentor Graphics and its customers. No representation or other affirmation
of fact contained in this publication shall be deemed to be a warranty or give rise to any liability of Mentor
Graphics whatsoever.
MENTOR GRAPHICS MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE.
MENTOR GRAPHICS SHALL NOT BE LIABLE FOR ANY INCIDENTAL, INDIRECT, SPECIAL, OR
CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS)
ARISING OUT OF OR RELATED TO THIS PUBLICATION OR THE INFORMATION CONTAINED IN IT,
EVEN IF MENTOR GRAPHICS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
U.S. GOVERNMENT LICENSE RIGHTS: The software and documentation were developed entirely at
private expense and are commercial computer software and commercial computer software
documentation within the meaning of the applicable acquisition regulations. Accordingly, pursuant to
FAR 48 CFR 12.212 and DFARS 48 CFR 227.7202, use, duplication and disclosure by or for the U.S.
Government or a U.S. Government subcontractor is subject solely to the terms and conditions set forth in
the license agreement provided with the software, except for provisions which are contrary to applicable
mandatory federal laws.
TRADEMARKS: The trademarks, logos and service marks ("Marks") used herein are the property of
Mentor Graphics Corporation or other parties. No one is permitted to use these Marks without the prior
written consent of Mentor Graphics or the owner of the Mark, as applicable. The use herein of a third-
party Mark is not an attempt to indicate Mentor Graphics as a source of a product, but is intended to
indicate a product from, or associated with, a particular third party. A current list of Mentor Graphics’
trademarks may be viewed at: www.mentor.com/trademarks.
Chapter 1
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Calibre DESIGNrev Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Calibre DESIGNrev Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Calibre Layout Viewer Key Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Calibre DESIGNrev Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Conventions Used in this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Chapter 2
Working in the Tcl Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Getting Help on Tcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Tcl Versus Tk and What the Distinction Means to You . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Extensions to Tcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Things You Must Know About Tcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Tcl is Case Sensitive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Many Characters Have Special Meanings in Tcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Tcl Comments Can Be Tricky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Tcl Objects Have Handles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Most Database Objects are not Tcl Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Questions and Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Chapter 3
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Command-Line Invocation Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Issuing Tcl Commands in Interactive Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Interactive GUI Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Interactive Shell Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Issuing Tcl Commands in Batch Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Batch Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Batch GUI Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Command Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Tcl and Shared Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Explorations in Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Example 1 - Listing the Cells in a Layout in Interactive Shell Mode. . . . . . . . . . . . . . . . . 38
Example 2 - Listing the Cells in an Open Layout in Interactive GUI Mode . . . . . . . . . . . 41
Example 3 - Listing the Cells in a Layout Using Batch Mode . . . . . . . . . . . . . . . . . . . . . . 44
Explorations In Writing Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Example 4 - Using a Simple Procedure to Write the Layout Hierarchy. . . . . . . . . . . . . . . 46
Example 5 - Using a Recursive Procedure to Write a Layout Hierarchy . . . . . . . . . . . . . . 51
Questions and Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Chapter 4
Writing Layout Viewer Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Scripts for Layout Generation and Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Script 1: Writing a Script to Generate a New Layout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Script 2: Setting up a Script to Accept Passed In Arguments. . . . . . . . . . . . . . . . . . . . . . . 60
Script 3: Debugging and Adding Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Script 4: Moving a Cell’s Origin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Chapter 5
Writing Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
How to Write a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Where To Put Macro Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Writing the Command Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Writing the GUI Plug-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Registering the Macro. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Simple Macro Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Explorations in Creating Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Example 1: Transforming a Simple Script into a Command Procedure. . . . . . . . . . . . . . . 77
Example 2: Exploring Ways to Obtain User-Supplied Data . . . . . . . . . . . . . . . . . . . . . . . 80
Example 3: Writing a GUI Plug-in Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Example 4: Displaying a Message to the User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Example 5: Putting the Macro on the Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Building In Error Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Setting up Your Macro to Load Automatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Complete Code for the Sample Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Macro Examples to Study and Learn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
List All Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
DRC EXTERNAL Spacing Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Questions and Answers About Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Chapter 6
Batch Commands for Layout Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
cwbWorkBench Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
$cwb bindKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
$cwb cget -_layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
$cwb cget -_layoutView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
$cwb deleteLayoutClbk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
$cwb getMenuPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
$cwb getRulerFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
$cwb getRulerUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
$cwb getSelectionPoint. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
$cwb getSelectionRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
$cwb getVisibleLayers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
$cwb hasSelectionPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
$cwb loadDefaultLayerProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
$cwb loadLayerProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
$cwb reloadLayoutClbk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
$cwb rulerMeasurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
$L SIZE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
$L SNAP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
$L srefsFromAref . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
$L textout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
$L topcell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
$L transcript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
$L transcript output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
$L transcript range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
$L transcript state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
$L units database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
$L units microns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
$L units user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
$L update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
$L viacell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
$L XOR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Peek Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
$P delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
$P file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
$P peek . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Overlay Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
overlay all . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
overlay create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
overlay delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
$O gdsout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
$O layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
$O layoutHandle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
$O oasisout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
$O overlayCells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
$O overlayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Macros create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Macros delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Macros menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
Macros show . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
StringFeature Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
StringFeature. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
$str addToLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
cwbLayoutView Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
$V cell. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
$V databaseToScreenUnits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
$V depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
$V exportView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
$V micronToScreenUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
$V screenToDatabaseUnits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
$V screenToMicrons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
version. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Appendix A
Example Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Opening a Data File for Writing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Determining the Layers and Topcell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Writing a Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Opening a Data File for Viewing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Review of Executed Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Creating a Batch Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Creating a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Index
Third-Party Information
End-User License Agreement
This chapter introduces the Calibre® DESIGNrev™ batch commands, and contains the following
sections related to using the product:
Regardless of whether you are using Calibre DESIGNrev, Calibre WORKbench, Calibre
LITHOview or Calibre MDPview, the information in this manual applies to you. You can
invoke any of these four layout viewer applications to run batch commands.
This manual covers only topics related to the Calibre layout viewer Tcl-based batch commands.
It introduces you to some of the Tcl and Tk basics you need to know to use the batch commands
for Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, and Calibre MDPview. It
is not designed to teach you Tcl/Tk. It is intended as a starting point, introducing you to topics
you may want to explore more deeply through classes, books, and websites available elsewhere.
Note
The Calibre DESIGNrev GUI commands are discussed in the Calibre DESIGNrev
Layout Viewer User’s Manual.
For information on using the Calibre layout viewers in your verification flow, see the Calibre
DESIGNrev Layout Viewer User’s Manual.
The Calibre layout viewers differ from full-featured layout editors in terms of the performance
and sophistication of key tasks. Layout viewers provide more sophisticated data loading and
reporting. Full-featured layout editors provide more sophisticated layout editing.
Calibre DESIGNrev was designed specifically to streamline tasks related to viewing and
inspecting data. It also contains sufficient editing capability for targeted fixes and finalizations
on your way to tape-out. Loading design data into Calibre DESIGNrev is much faster than
loading the same data into a full-featured layout editor.
Modes of Operation
You can run Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, and Calibre
MDPview in any of five modes, and you can use batch commands in all of these modes:
The batch commands for Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, and
Calibre MDPview are proprietary Tcl-based commands providing access to internal application
functions. You may ask, “Why Tcl?”
Books
• Practical Programming in Tcl and Tk (4th Edition), Brent B. Welch, Ken Jones,
Jeffrey Hobbs, Prentice Hall PTR (2003).
• Tcl/Tk in a Nutshell, Paul Raines, Jeff Tranter. O’Reilly and Associates, Inc. (1999).
• Tcl and the Tk Toolkit, John K. Ousterhout, Addison-Wesley Professional (1994).
• Tcl/Tk Tools, Mark Harrison, O'Reilly (1997).
Websites
• Tcl Developer Xchange — http://www.tcl.tk/scripting/
• TclTutor — http://www.msen.com/~clif/TclTutor.html
• Beginning Tcl — http://wiki.tcl.tk/298
• The Tcler’s Wiki — http://wiki.tcl.tk
• ActiveState.com — http://www.activestate.com/Products/ActiveTcl/
• Access manpages for Tcl and Tk commands at the Tcl Developers Exchange:
http://www.tcl.tk/man/tcl8.4/
• Find reference pages for the batch commands in “Batch Commands for Layout
Manipulation” on page 97 of this manual.
• To use either Tcl or Tk, your environment must be set up to give you access the proper
binary files, libraries, and necessary extensions.
• You can use Tcl without Tk.
• You cannot use Tk without Tcl. Hence, you often see the Tk toolkit written as Tcl/Tk.
• Any time you run one of the tools (Calibre DESIGNrev, Calibre WORKbench, Calibre
LITHOview, or Calibre MDPview), that tool loads everything you need to successfully
execute Tcl commands.
• If you run one of the tools in any of the graphical user interface modes, that tool also
loads everything you need to build a graphical user interface with Tk.
Note
If you are not running the tools in a GUI mode, you cannot use Tk. If the tool attempts to
execute a Tk command when the Tk software package is not loaded, it aborts with an
error.
The wbinit.tcl file is a script written in the Tcl programming language. It can contain any valid
Tcl and Tk commands. Calibre tools automatically ‘source’ (load and run the commands in)
wbinit.tcl files existing in the user’s home directory and the current directory. The wbinit.tcl file
is discussed in the Calibre DESIGNrev Layout Viewer User’s Manual.
Because many wbinit.tcl files contain Tk commands1 (though you may not be aware of it) and
because the tools process the wbinit.tcl file every time they invoke, users experience difficulties
when they attempt to invoke Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview,
or Calibre MDPview in -shell or any of the other non-GUI modes. You can avoid this sort of
difficulty by embedding the Tk commands within conditional statements instructing the tool to
execute them only if the Tk software package is loaded.
1. Setting GUI-related variables and creating macros both require use of Tk commands.
For example:
# protected Tk command
if [isTkLoaded] {
set filename [tk_getSaveFile]
}
Note
The Unix home directory wbinit.tcl is sourced first and then the local directory wbinit.tcl
file is sourced. This is important to know, as the local definition may supersede a Unix
home definition.
Extensions to Tcl
One of the reasons Tcl/Tk is used so widely is that it is relatively easy to create extensions to the
language. Tk was the first extension created. Many other publicly available extensions have
been created since. Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, and
Calibre MDPview mainly use one:
The layout viewer applications also rely on proprietary extensions. These extensions provide
you with the commands and objects that manage layout databases in memory. These extensions
are described in the reference chapters of this manual. Some of the proprietary commands are
not dependant on Tk, and so can be run in any mode. Others require Tk be available and can
only be in one of the GUI modes. Refer to the individual reference pages to determine the
requirements of each command.
Note
All Tcl statements must start with a command.
The core set of Tcl/Tk commands are all lower case, so when in doubt, use lower case.
However, when people write extensions to Tcl/Tk, they can choose whether or not to capitalize
the new commands. The reference pages in “Batch Commands for Layout Manipulation” on
page 97, display command syntax in the proper case.
"" Quotes instruct the Tcl interpreter to treat the enclosed words as a
single string. However, when the Tcl interpreter encounters variables
or commands within string in quotes, it evaluates the variables and
commands to generate a string.
Tricky Point 1: Evaluate does not equal parse. Despite the pound sign, the comment below
gives an error because Tcl detects an open lexical clause.
# if (some condition) {
if { new text condition } {
...
}
Tricky Point 2: The apparent beginning of a line is not always the beginning of a command. In
the following code snippet, the line beginning with “# -type” is not a comment, because the line
right above it has a line continuation character (\). In fact, the “#” confuses the Tcl interpreter,
resulting in an error when it attempts to create the tk_messageBox.
Tricky Point 3: The beginning of a command is not always at the beginning of a line:
Usually, you begin new commands at the beginning of a line. That is, the first character that is
not a space is the first character of the command name. However, you can combine multiple
commands into one line using the semicolon “;” to signal the end of the previous command:
The distinction here is between handles (system-generated instance names) and names (user-
defined names). The reason for making this distinction is to call attention to the differences
between the following:
Note
The “layout create mylayout.gds” command does not actually create the layout, it loads it
into memory, while the command, “layout create”, with no filename does actually create
an empty layout in memory.
• Names used as part of a command name versus those that are not:
o The Object Class Commands create and manipulate layout objects all begin with the
string “layout”.
o The Instance Commands manipulate the contents of a specific layout all begin with
the layout’s handle. For example, “layout0 create cell mytopcell”.
• cwbWorkBench
• layout
• layoutView
Many database objects are not Tcl objects. Within memory, they are actually stored as elements
of Tcl objects. The following are not Tcl objects:
• Layers
• Cells
• Polygons
• Text
• Paths
• Vertices
• SREFs (single cell references)
• AREFs (arrays of cell references)
You manipulate a database object that is not a Tcl object through the various instance
commands for the layout to which the object belongs. Thus, for most of the work you do on the
contents of a layout, you use the $L commands.
A: When you create an object, the command returns the layout handle of the newly created
object. In addition, many other commands return handles. For example, the cget method for the
cwbWorkBench class objects can return either layout handles or layoutView handles.
A: For objects that do not have layout handles, you must supply enough of a description of that
object to uniquely identify it. For example:
Q: Is there anything I can use besides the handle, like a name, to reference a Tcl object?
A: Yes, you can save handles to variables, and use the variable instead of the handle. It is a good
(almost necessary) practice to save the handles as variables for any object you may need to
manipulate. While handles and variable names are both strings, variables are easier to work with
because you decide what they are named. Handles are system generated, so you have no control
over what a particular object's handle is. Variables are also reusable, and context independent.
Q: I have a viewer open and I want to issue commands requiring that I know the layout
handle. How can I get it?
A: The following code saves the layout handle in the variable “layout”.
A: You can use the built-in handles in the table below, but with caution. Preferably, capture
handles as the application returns them, and assign them to a variable, to guarantee you are
pointing to the correct objects. Using built-in handles should be avoided in batch mode.
Note
Overlay objects behave like layoutn objects, however they have a few more operations
and are restricted in their use of edit commands.
You can run Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, and Calibre
MDPview in any of five modes:
Note
Used alone, the commands calibredrv, calibrewb, calibrelv, and calibremdpv invoke
the associated applications in interactive GUI mode. Do not start the application as a
background process or the Tcl shell locks up.
You invoke in interactive GUI mode whenever you issue the layout viewer command without a
script name or the -a or -shell arguments.
You invoke interactive shell mode by issuing the layout viewer command with the -shell
argument. Do not start the application as a background process or the Tcl shell locks up.
When you launch the application, the shell window prompt changes to the Tcl “%” prompt:
The application writes transcript information to the shell window as it does in GUI mode:
Type Count
----------------------------------
LAYER 13
CELL 9
PLACEMENT 214
ARRAY 0
RECTANGLE 757
POLYGON 52
PATH 0
TEXT 0
PROPERTY 0
layout0
The application also writes the data returned by commands directly to the shell window:
% $layout cells
lab2 a9500 a1620 a1220 a2311 a1720 a1230 a1240 a1310
Batch Mode
In standard Batch mode, only the Tcl software package is available to you. You can use this
mode any time you do not instruct the application to execute any Tk commands or any of the
Calibre layout viewer commands requiring GUI mode:
calibredrv myscript.tcl
• Tk command.
• Calibre layout viewer commands that require GUI mode.
To run in batch GUI mode, append the command argument -gui to the end of the invocation
command:
Command Mode
Command mode is a special mode that evaluates a single Tcl command and then exits. You can
use this mode any time you do not instruct the application to execute any Tk commands or any
of the Calibre layout viewer commands that require GUI mode.
If a batch command returns a data string, you can explicitly output the returned results to a file
or the screen using the puts command with a redirect:
2. When you see the “%” prompt, type the following command, then select Enter.
set my_layout [layout create sample.gds]
• layout create — one of the Layout Object Class Commands. It reads the GDS
file into a layout object it creates.
The brackets instruct Tcl to replace the brackets and everything between them with the
results it gets by executing the command inside the brackets. This is called command
substitution. In this case, the command it executes is layout create, and the result is
“layout0”, which is a system generated name (also called a handle) for the newly created
layout. Thus “set my_layout [layout create sample.gds]” becomes “set my_layout
layout0”.
When you select Enter after typing the first line, Calibre DESIGNrev processes the
command, displays the transcript information1 generated when loading the layout, then
prints the result of processing2, in this case “layout0”.
When processing is complete, the tool displays the “%”, indicating it is ready for you to
issue a new command.
% set my_layout [layout create sample.gds]
Collecting data...
Analyzing data...
Sorting data...
Type Count
----------------------------------
LAYER 24
CELL 3
PLACEMENT 234
ARRAY 0
RECTANGLE 712
POLYGON 50
PATH 0
TEXT 0
PROPERTY 0
layout0
3. At the “%” prompt, type the following command, then select Enter.
1. Whenever you run Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview or Calibre MDPview,
the application generates a transcript containing status information, errors, and warnings.
2. Printing the Tcl results to the terminal window is performed by the tool in interactive mode only. In batch
mode, the application only prints information to the terminal window if you explicitly program it to do so.
$my_layout cells
This line contains a single command. The first part of the command is $my_layout,
which is the variable you created with a dollar sign ($) in front of it. The $ tells Tcl to
substitute the value of the variable my_layout for the string “$my_layout”. Thus, the
line you typed translates into “layout0 cells”.
$my_layout cells is one of the Instance Commands. In Tcl, when you create an
instance of an object you also enable a set of commands that operate on that instance
(and only that instance). The name of the commands are always “<instance name>
<operation>”.
Within the reference material for this document, instance command names are written
using the format “$<variable name> <operation>”, representing the command line you
use if you save the instance name to the following variable names:
cwbWorkBench — cwb
Layout — L
Overlay — O
cwbLayoutView — V
StringFeature — str
Thus, you find reference information on $my_layout cells by looking up $L cells.
When the application evaluates the command “layout0 cells,” it returns a list of the cells
in layout0. In this case there are four: top_level_cell, cell_g, cell_h, and cell_i. When
processing is complete, it displays the “%”, indicating it is ready for you to issue a new
command.
Listing cells in shell mode:
% my_layout cells
cell_g cell_h cell_i top_level_cell
In “Example 1 - Listing the Cells in a Layout in Interactive Shell Mode”, you used the “layout0
cells” instance command to list the cells in layout0. Because the name of the command is of the
form <instance name> <operation>, you cannot use this command unless you know the name of
the layout instance. And since the layout instance name is system generated, the first thing you
must do when listing cells in an open layout is to obtain the name the application assigned to the
layout.
Example steps:
The -m option instructs Calibre DESIGNrev to open the specified layout file in the
Calibre database and the Calibre DESIGNrev GUI; in this case, this our sample file,
“sample.gds”.
Note
In Exercise 1, you used the layout create command to create a layout in the Calibre
database. However, layout create does not load the layout into the GUI (since it is not
a Tk command). Use the $cwb viewedLayoutClbk command to load a layout file into the
GUI.
2. Switch from the GUI window to the terminal window by clicking in the terminal
window. You many need to move, resize, or minimize the GUI.
3. Select Enter.
4. When you see the “%” prompt, type the following command, then select Enter.
set cwb [find objects -class cwbWorkBench]
• find objects — Finds any object of class cwbWorkBench. Since you have only one
Calibre DESIGNrev open in this session, the command returns only one value,
which is the system generated name for this object, in this case
“::cwbWorkBench::cwbWorkBench0”1.
Note
The examples in these sections assume you only have one layout viewer open. If you
have more than one window open, find objects returns multiple cwbWorkBench handles,
one for each display window.
You need to know the name of the cwbWorkBench object because one of the functions
it performs is to keep track of the names of layout objects.
Caution
Even if you are running one of the Calibre layout viewer applications other than Calibre
WORKbench, you need to create a Calibre WORKbench object. The application window
object is called cwbWorkBench, whether you are running Calibre DESIGNrev, Calibre
WORKbench, Calibre MDPview, or Calibre LITHOview. Some of the hardcoded
variable names and handles begin with “cwb”. These apply to all the applications, and not
just Calibre WORKbench.
When you select Enter after typing the first line, Calibre DESIGNrev prints the value of
the new variable wb, in this case “::cwbWorkBench::cwbWorkBench0”. It then displays
the Tcl prompt, indicating it is ready for the next command.
5. When you see the “%” prompt, type the following command, then select Enter.
set my_layout [$cwb cget -_layout]
Here you use the variable cwb as a shortcut to typing the name of the cwbWorkBench
object, which is also the first part of the command you must use to obtain the layout
name. The operation it performs is cget (get the value of a variable belonging to this
class of object), and the argument -_layout is the name of the variable you want to get,
which in this case is the variable that stores the handle for the current viewed layout.
This command creates the variable my_layout and assigns it the result of the $cwb cget
command. It combines both forms of substitutions:
Variable substitution replaces $cwb with the value of cwb, resulting in:
set my_layout [::cwbWorkBench::cwbWorkBench0 cget -_layout]
Command substitution replaces the brackets and everything between them with the
results of processing the command inside, resulting in:
1. The double colon “::” is an iTcl construct used to identify and manage namespaces. Unless you go on to
advanced Tcl programming, you need not worry about iTcl namespaces. Curious readers can find more
information on namespaces at the SourceFORGE website: http://incrtcl.sourceforge.net/itcl/namesp.html.
6. When you see the “%” prompt, type the following command, then select Enter.
$my_layout cells
Because of variable substituting, the line you typed translates into the instance command
“layout0 cells”.
When Calibre DESIGNrev evaluates the command “layout0 cells”, it returns a list of the
cells in layout0, then displays the “%”, indicating it is ready for you to issue a new
command.
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set my_layout [$wb cget -_layout]
layout0
% $my_layout cells
TOPCELL a463 a310 b561 c980 981
Note
In both Example 1 - Listing the Cells in a Layout in Interactive Shell Mode and Example
2 - Listing the Cells in an Open Layout in Interactive GUI Mode, it is just as easy to skip
the variables and simply retype the values returned by various Tcl commands. However,
in most real-life situations, you do much more complex work in which using variables
becomes necessary. When writing Tcl scripts, variables are a necessity.
If you wanted to list the cells in a layout using batch mode, the logical thing to do seems to be to
write a script containing only those commands you issued at the prompt when working in
interactive shell mode.
Unfortunately, there is a problem with this approach. Tcl discovers the names of the cells you
are looking for, but it does not display them for you to read! When working in interactive shell
mode, the shell does the displaying for you, and prints the return values for every command you
issue. In batch mode, Tcl only writes information to the terminal window when you explicitly
tell it to do so.
Example steps:
1. Edit the Tcl script, adding the puts command to the last line, and save as a new file,
DisplayCellList.tcl.
set my_layout [layout create sample.gds]
puts stdout [$my_layout cells]
The Tcl command puts takes two arguments, the output channel (where to print the
information) and the data (what to print). Because the purpose here is to display the cells
list, the output channel is stdout, which defaults to the terminal window.
2. Invoke Calibre DESIGNrev in batch mode by passing in the name of the script:
/labs/wb2 % calibrewb DisplayCellList.tcl
Collecting data...
Analyzing data...
Sorting data...
Type Count
----------------------------------
LAYER 13
CELL 9
PLACEMENT 214
ARRAY 0
RECTANGLE 757
POLYGON 52
PATH 0
TEXT 0
PROPERTY 0
/labs/wb2 %
In Interactive mode, Calibre DESIGNrev writes the results to the terminal window.
However, because listing the hierarchy involves several commands, the results are
interspersed between command lines. Writing to a file allows you to view the complete
hierarchy without any extraneous information.
The Tcl command open opens a file and returns the fileID it must use to communicate
with that file. The argument w (write) tells Tcl to open the file as write-only; Tcl creates
the file if it does not exist.
The puts command does the actual writing to the file. Remember this command takes
two arguments, the output channel (where to print the information) and the data (what to
print). Using the channelID as the first argument instructs the command to write the data
to the file rather than the terminal window (stdout). The string enclosed in quotes is the
data to write to the file. Since the whole string is the second argument, you must enclose
it in quotes, telling the command to treat all the words in the string as a single object.
5. Get the layout name:
set cwb [find objects -class cwbWorkBench]
set L [$cwb cget -_layout]
6. Write the topcell of the layout to the file. This is the first level of hierarchy.
puts $fileID "Topcell: [set top [$L topcell]]"
As in the previous puts command, the string enclosed in quotes is the data written to the
file. However, this string is different. Even though there are quotes around the string,
Tcl recognizes the brackets as indicating the need for command substitution and the $ as
indicating need for variable sustentation. This puts command writes the string
“Topcell:” followed by the value or values returned by processing the set command,
which is the value it assigns to the variable.
Since the set command is also written using command substitution, the variable top gets
set to the results of processing the instance command $L topcell. This command returns
only the name of the topcell, rather than the full list of cells you listed in the previous
exercises.
Note
If you wanted to print special characters such as “[” “]” or “$”, you could do so by
preceding them with a backslash “\”.
7. Next, write a procedure to print out the children of a given cell. You invoke the
procedure later. Here you define the procedure by specifying what it is called, the
arguments it takes, and what it does.
proc list_children { L F C} {
puts $F "Children of $C: [$L children $C]"
}
spans multiple lines and contains multiple commands. Think of this as a mini-
script. It contains any commands needed to perform the processing.
The body of this procedure prints the string “Children of” followed by the name
of the cell you are processing, followed by the list of children.
• This formatting follows the recommended standards, and is used to enhance
readability and code clarity.
8. Invoke the procedure to write the children of the topcell to the file. The children of the
topcell form the second level of hierarchy.
list_children $layout $fileID $top
9. Invoke the procedure again to write any children of the children of topcell to the file.
The children of the children form the third level of the hierarchy. To avoid issuing the
procedure for every child cell, use the foreach command to cycle through them.
foreach cell [$L children $top] {
list_children $layout $fileID $cell
}
The foreach command creates a loop variable (cell) and assigns it the values resulting
from processing the command in brackets. It cycles through the values one at a time,
evaluating the commands between the braces ({}).
10. Because you are working in interactive GUI mode, you can look at the cell hierarchy list
in the GUI to see if there are more levels of the hierarchy. In this case, you see that
std_des.gds has only three levels of hierarchy. If the layout contained four levels of
hierarchy, you add another foreach calling the procedure to list that next level:
foreach cell [$L children $top] {
foreach child [$L children $cell] {
list_children $layout $fileID $child
}
}
Since the third level of the hierarchy contains two cells, NAND2A and NOR, this is
equivalent to the following two foreach statements:
foreach cell [$L children NAND2A] {
list_children $layout $fileID $cell
}
foreach cell [$L children NOR] {
list_children $layout $fileID $cell
}
Working in interactive GUI mode, you can continue to add these looping statements as
needed to cover the walk through the entire hierarchy. This is an inefficient way to solve
the problem, because it depends on you being able to anticipate how many levels of
hierarchy the layout contains. For a more efficient approach, refer to “Example 5 -
Using a Recursive Procedure to Write a Layout Hierarchy”.
Since you had to close the file to save it, you must open it again. This time you use the
argument r (read), which tells Tcl you want to read the data in the file.
The Tcl command read requires at least one argument, the input channel (where to find
the information.) It returns the information it reads to the application. In either
interactive mode, the application prints the return values for all commands to the shell,
displaying it for you. If you are writing a script to be executed in batch mode, you need
to write the read command this way:
set data [read $fileID]
puts $data
You must always close any file you open to avoid data corruption and system resource
depletion.
Here’s a transcript of writing the layout hierarchy:
}
% close $fileID
% set fileID [open dump_hier.txt r]
file7
% read $fileID
This file displays the hierarchy for std_des.gds
Topcell: TOP
Children of TOP: NAND2A NOR
Children of NAND2A: NAND
Children of NAND:
Children of NOR:
% close $fileID
• Comments.
• Procedure arguments with default values.
• Recursive procedures.
• Local versus global variables.
For this example, you write a script that writes the layout hierarchy for any layout file,
regardless of how many levels there are in the hierarchy. You do this by writing a procedure that
traverses the hierarchy until it can go no further.
Example steps:
1. Copy the following script into a text file named hier_dump.tcl.
##############################################################
# PROC: dump_hier
# L = layout object name
# F = file to dump hierarchy to
# C = cell to start dumping from, "" means use topcell
# Indent = string used to format the hierarchy
##############################################################
#
# Step 1: open the layout
#
#
# Step 2: write the hierarchy to the file
#
#
# Step 3: Close (and save the file)
#
close $fileID
These first seven lines of the script are comment lines introduce the procedure that follows,
defining the name of the procedure and the arguments it takes.
##############################################################
# PROC: dump_hier
# L = layout object name
# F = file to dump hierarchy to
# C = cell to start dumping from, "" means use topcell
# Indent = string used to format the hierarchy
##############################################################
Procedures
The next nine lines contain the procedure itself.
Notice this list of arguments is different than the list of arguments in the procedure you wrote in
the previous exercise. It contains four arguments:
The first two arguments, L and F, are represented by their names alone because they have no
default values. The second two arguments, C and Indent, are enclosed in braces because they
have default values, in both cases an empty string.
The body is also more complex. First, it checks to see if you passed it a cell name. If you did not
pass it a cell name, the value of C is “ ”, which is the default value. In this case, the procedure
extracts the cell name using the $layout topcell instance command.
if {$C == ""} {
set C [$L topcell]
}
Next the procedure writes the name of the cell it is processing to the output file. $Indent and
“-->” add formatting to the output to help visualize the layout hierarchy.
The Tcl command append adds more characters to an existing variable (in this case, $Indent).
Here it is used to show the layout hierarchy graphically, forcing the name of a child cell to be
indented relative to the name of the parent cell.
The last thing this procedure does is cycle through the children of the cell, invoking itself to
print their names and children.
When a procedure calls itself, it is called a recursive procedure. It calls itself as many times as
needed, until it reaches a cell that has no children. It then pops back up one level of the
hierarchy and looks for children of the next cell.
Variables
Recursive procedures are possible because Tcl supports the concept of variable scope. Scope
defines where a variable has meaning. Scope can be either local or global:
• Local variables are variables that exist (have meaning) only within a single procedure.
When you execute a procedure, Tcl creates a local variable for each of the arguments to
that procedure. While Tcl is processing the body of the dump_hier procedure, it knows
what $L is. Once it exits the procedure, $L has no meaning.
• Global variables are variables that have meaning anywhere with the program1.
1. To use a global variable within a procedure, you must use special Tcl commands, such as global and
upvar.
When the recursive procedure calls itself, it launches a separate procedure, which happens to be
another instance of the same procedure. The result is procedure within a procedure, within a
procedure.
All the variables in your recursive procedure are local. That means the variable F in the lowest
level procedure, shown outlined with a green dotted line in Figure 3-2, is a completely different
variable from the variable F in the middle procedure, shown outlined with a red solid line in
Figure 3-2.
A: All these exercises do apply to you. Calibre DESIGNrev provides a subset of the capabilities
provided by the Calibre WORKbench tool. That means any scripts that run in Calibre
DESIGNrev also run in Calibre WORKbench. It also means you can invoke either program to
work through the exercises.
Q: This manual says when I run Calibre DESIGNrev, I create a Calibre WORKbench
object. Should I be creating a Calibre DESIGNrev object?
Q: I did some research on using Tcl, and read I must always start a Tcl script with #!
followed by the path to the Tcl interpreter. Why do the scripts in this manual not start
with #! ?
A: The scripts you pass to Calibre WORKbench for processing are not stand-alone scripts. They
are actually chunks of code that get evaluated by the Calibre WORKbench program, which did
begin with #!. This means if you try to run your scripts outside of Calibre WORKbench, they do
not work.
A: The backslash “\” at the end of a line indicates the command does not fit onto one line, and
the line that follows finishes the command. When you use the backslash as a command
continuation character, it must not be followed by any other characters. Even a space after it
creates an error.
Tcl scripts are stand-alone programs you write using the Tcl/Tk language, plus any extensions
you have available to you. Calibre WORKbench1 scripts are Tcl scripts written using the Calibre
layout viewer Tcl extensions and batch commands.
• In batch mode, by including the pathname for the script in the Calibre WORKbench
invocation:
calibredrv my_script.tcl
calibredrv my_script.tcl -gui
Note
Writing scripts for Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, and
Calibre MDPview involves working with the Calibre layout viewer extensions to Tcl/Tk.
The proprietary programming objects you are most likely to use in scripts are:
cwbWorkBench Object — the main layout editor widget
Layout Object — the Tcl object containing the layout data
1. Here, Calibre WORKbench is used as a generic term for the set of applications created with the
cwbWorkBench class of objects. These are: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview,
and Calibre MDPview.
Scripted Layout Generation involves creating or modifying a layout using batch processing.
Scripted layout generation has many applications, including:
The $L create cell command creates the cell TOP in the new layout. It is a topcell as
long as it is not referenced within any other cells.
3. Create a few layers in the layout:
$L create layer 1
$L create layer 2.7
The $L create layer command lets you create layers using either an integer layer
number or using the layer.datatype syntax, which defines a specific data type on a layer.
4. Add two polygons to layer 1:
$L create polygon TOP 1 0 0 100 100
$L create polygon TOP 1 0 0 0 40 30 40 30 80 45 80 45 25 15 25 15 0
The first $L create polygon command creates a rectangle, with opposite corners at
(0,0) (100,100). The second creates a polygon with eight vertices.
Save the new layout to a GDS file:
$L gdsout temp.gds
• argv
• lindex
• Using the return value from the set command.
• argc
• lrange
• Passing arguments to a Tcl script.
For this example, you expand upon the previous script, new_layout.tcl. Assume you want to
pass arguments to the script defining the name of the topcell, a layer number, the coordinates of
a polygon, and the name to use for saving the new GDS layout.
Procedure
These steps use a script to accept arguments:
1. Open new_layout.tcl and edit the second line:
change: $L create cell TOP
to: set my_cell [lindex $argv 0]
$L create cell $my_cell
The Tcl command lindex returns one or more elements in a Tcl list. In this case, the list
is argv, which is a list managed by the Tcl interpreter. It contains all the arguments
passed to a Tcl script.
In Tcl, all variables are strings. The Tcl interpreter recognizes how to handle the values
of the variables based on the commands you use to manipulate them. For example:
o expr — Treat the string as a number.
o lindex — Treat the string as a list, with spaces separating the items in the list.
o puts — Treat the string as a string.
In Tcl, the first element in a list has an index of 0. The last element in a list of length N
has an index of (N-1).
The command “set my_cell [lindex $argv 0]” extracts the first argument passed to
the script for use as the cell name in the following line of code.
2. Edit the lines that created the layers to: (a) create only one layer, and (b) get the layer
number from the argument list:
change: $L create layer 1
$L create layer 2.7
To extract the coordinates of the polygon from the list, you use the lrange command.
This command returns a new list containing all the elements with indices from
$first_coord through $last_coord.
If the arguments between the layer number and the name of the file are to be used as the
coordinates of the polygon, you know that $first_coord, the index of the first
coordinate, must be 2 (as 0 was the topcell, and 1 was the layer number).
The variable argc is a special variable managed by the Tcl interpreter that contains a
count of the number of arguments passed to the script. Recall the index of the last
element in a list of length N is (N-1). Since the last argument to be passed in is the name
of the file, the index of the final coordinate of the polygon must be ($argc -2).
The expr command instructs the Tcl interpreter to evaluate a mathematical operation
and in doing so, treats the values stored in the specified variables as numbers rather than
as strings. Thus, you can calculate last_coord using [expr $argc-2].
4. Delete the line that creates the rectangle, and edit the line that creates the polygon:
change: $L create polygon TOP 1 0 0 100 100
$L create polygon TOP 1 0 0 0 40 30 40 30 80 45 80 45 25 15 25 15 0
The eval command is a special command the builds a command string out of a set of
arguments and passes it to the Tcl interpreter for processing. When you must build a
command string using variable substitution or command substitution, you sometimes
end up with data in a format that does not match the command. For instance, in this case,
$L create polygon expects each coordinate value to be a separate string, but you are
passing in a single string($coords) containing all of them. The eval command expands
all the variables when it builds the command string, so the Tcl interpreter is able to
process the $L create polygon command.
5. Edit the final line, saving the file to the file you pass in as the last argument:
$L gdsout [lindex $argv end]
The command lindex recognizes the end of the string as representing the last index in a
list.
6. Save the script.
7. Run the script:
calibredrv new_layout.tcl topcell 2 0 0 0 40 30 40 30 80 45 80 45 25
15 25 new_file.gds
Procedure
These steps add an error to a script and then debug the script:
1. Modify new_layout.tcl, as shown in red, and save the script as error.tcl:
set L [layuot create] <-- Note spelling!
set my_cell [lindex $argv 0]
$L1 create cell $my_cell
$L create layer [set layer1 [lindex $argv 1]]
set first_coord 2
set last_coord [expr $argc - 2]
set coords [lrange $argv $first_coord $last_coord]
$L create polygon $my_cell $layer1 $coords
$L gdsout [lindex $argv end]
The Tcl interpreter encounters the first error (“layout” misspelled as “layuot”) and stops.
It writes an error message to the shell window:
% calibredrv error.tcl
Invalid command name "layuot" <-- Type of error
while executing "layout create"
Invoked from within "set L [layout create]"
(file "error.tcl" line 1) <-- Line number
%
Transcript:
% calibredrv error.tcl
Can’t read "L1": no such variable while executing
"$L create cell [lindex $argv 0]" invoked from within
"set my_cell [$L1 create cell [lindex $argv 0]]"
(file "error.tcl" line 2)
%
The Tcl interpreter recognizes the error is in a variable name, because it encountered the
$.
4. Edit error.tcl, changing $L1 to $L in the second line, save the file, then run the script
again.
calibredrv error.tcl
Transcript:
% calibredrv error.tcl
Error: layout0 create layer bad layer specification while executing
"$L create layer [set layer1] [lindex $argv 1]]"
(file "error.tcl" line 3)
%
The error message this time suggests the layer specification is bad. But you did not edit
this line, and the code worked fine before.
The problem here is that “[set layer [lindex $argv 1]]” has no meaning if argv is empty,
which it is, because you did not pass in any arguments.
5. Add the following code to the beginning of the script:
############################################################
#
# This script requires the following arguments:
# arg 0 --> cell name
# arg 1 --> layer number
# args 2 through n --> coordinates for polygon
# (minimum of 4 values)
# arg (n+1) --> file name
#
############################################################
if {$argc < 7} {
puts "wrong number of arguments"
puts "<cell name> <layer number> <coords> < file name>"
exit
}
This code checks to see you passed in enough arguments. If not, it tells the user exactly
what arguments to supply and exits the program.
6. Save the file, then run the script again with no arguments.
% calibredrv error.tcl
Wrong number of arguments
<cell name> <layer number> <coords> <file name> ...
From now on, you must supply at least seven arguments to run or debug your script.
7. Run the script again, this time specifying the minimum required arguments:
% calibredrv error.tcl top 4 0 0 100 100 test.gds
Usage: layout0 create polygon: cell L_D
[-prop attr string] * x1 y1 ... xn yn while executing
"$L create polygon $my_cell $layer1 $coords"
(file "error.tcl" line 25)
%
This error indicates the Tcl interpreter cannot decipher the $L create polygon
command. Notice that it does not give you much information about why it could not
execute the command. When a command that uses variable or command substitution
does not execute, try using eval before you assume the data is wrong.
If the eval command did not solve the problem, you should look at each of the variables,
in this case $my_cell, $layer, and $coords, and make sure they are passing in the
correct information.
8. Add the eval command back in front of $L create polygon, save the script and run it
again.
The script should run without errors.
9. Run the script again, this time passing in an odd number of coordinate values.
% calibredrv error.tcl top 4 0 0 100 100 70 test.gds
Error: layout0 create polygon top: found an unknown layer = ‘4’
or invalid polygon specification while executing
"layout0 create polygon top 4 0 0 100 100 70" ("eval" body line 1)
invoked from within
"eval $L create polygon $my_cell $layer1 $coords"
(file "error.tcl" line 26)
%
An odd number of coordinate values cannot define a polygon, hence you get an error
message when the Tcl interpreter attempts to evaluate the $L create polygon
command. To avoid this problem, you need to check the number of coordinates before
proceeding.
10. Add the following code just below the line that extracts the coordinates from the
arguments list:
set len [llength $coords]
if [expr $len % 2] {
puts "You must supply an even number of values for coordinates."
exit
}
The llength command returns the length of a list. Remember, any string in Tcl can be
treated as a string, in which spaces are characters, or a list, in which at least one space
separates one item from the item that precedes it.
Once you know how long the coordinates list is, you can check there are an even number
of coordinates using the remainder operator “%”. This operation divides the first value by
the second and returns only the remainder. The expr command is necessary because it
instructs the Tcl interpreter to treat a value as a number, not a string.
This if statement makes use of the fact that the condition portion of a Tcl if statement
can be a numerical value. The number 0 is equivalent to false or no. All other numbers
are equivalent to true or yes. Thus, the if statement translates into “if the remainder of
$len divided by 2 does not equal 0, then print the error message and exit.”
11. Run the script to verify it works, add comments to make the script more readable, and
save it to no_error.tcl.
If this were a real script for production use, you should try to anticipate all possible error
conditions and add conditional statements to keep them from causing problems. Things
you might consider doing to get more out of this exercise include:
o Use a catch statement with $L create layer. If there is an error, warn the user
the second argument must be a number.
o Use the string is command to check that coordinates are actually numbers.
o Use a catch statement with $L gdsout in case the program cannot open the file
for writing.
Note
Check a Tcl reference book or website for information on conditional statements to help
your code anticipate possible error conditions.
##############################################################
# Filename:
# no_error.tcl
#
# Description:
#
# Creates a new layout and populates it with a polygon.
#
##############################################################
# This script requires the following arguments:
# arg 0 --> cell name
# arg 1 --> layer number
# args 2 through n --> coordinates for polygon
# (minimum of 4 values)
# arg (n+1) --> file name
#
############################################################
if {$argc < 7} {
puts "wrong number of arguments"
puts "<cell name> <layer number> <coords> < file name>"
exit
}
set L [layout create]
set my_cell [lindex $argv 0]
$L create cell $my_cell
$L create layer [set layer1 [lindex $argv 1]]
#
# get polygon coordinates and create it
#
set first_coord 2
set last_coord [expr $argc - 2]
set coords [lrange $argv $first_coord $last_coord]
set len [llength $coords]
if [expr $len % 2] {
puts "You must supply an even number of values for coordinates."
exit
}
eval $L create polygon $my_cell $layer1 $coords
#
# save the layout to the file
#
• Creating cell references. Cell references exist at a specific location, and they contain no
geometric data.
• Moving the origin of a cell.
• Setting constants for convenience.
Prerequisite
For this example, assume you have a layout, and you want to move the origin of the topcell.
Note
You can also use $L modify origin command to change the origin of a specified cell.
Procedure
These steps move a cell’s origin:
1. Set a variable for the name of the original layout file, and one for the resulting layout.
set mylayout mylayout.gds
set myoutfile myoutfile.gds
2. Set variables for the X and Y deltas in user units (most of the time in microns).
set mydeltax 12.0
set mydeltay 15.0
4. Retrieve the database units (dbu). One micrometer (um) times precision equals one dbu.
set mydbunits [$L units user]
Macros are application extensions you write to add new functionality to the Calibre
DESIGNrev, Calibre WORKbench, Calibre LITHOview, or Calibre MDPview applications.
One of the many uses for macros is to provide access to the many Calibre batch tools (such as
DRC, LVS, the RET batch tools), essentially making them interactive from the graphical user
interface. However, you can use macros to perform many other functions as well.
You write macros using the Tcl programming language and the Macros create command. The
Macros create command registers the macro with the application. Once registered, the macro
name can be placed on the Macros pulldown menu as a menu item. The application generates
the Macros menu and menu items in response to the following application events:
• Startup
• Evaluation of a Macros menu command
When the application generates the menu, it creates a menu item for each currently registered
macro.
On installation, the Macros menu contains several Calibre layout viewer-supplied macros.
These macros provide useful functionality and also serve as examples of the sorts of
functionality you can add to the application.
This chapter describes how to write functional extensions for your application and how to make
the extensions accessible from the Macros menu. It is organized into the following sections:
• Inside the wbinit.tcl file — If you define the macro in the wbinit.tcl file, be sure to
embed it within a conditional statement instructing the application to ignore the macro
when the Tk software package is not loaded, as is described in “Tcl Versus Tk and What
the Distinction Means to You” on page 20. The wbinit.tcl file is discussed in the Calibre
DESIGNrev Layout Viewer User’s Manual.
• In a separate file — If you define the macro in a separate file, you need to load it into the
application. Three options for this are:
o Source the file on invocation, then issue the Macros menu command.
o Source the file from the shell window, then issue the Macros menu command.
o Source the file in the wbinit.tcl file. In this case, you do not need to issue the Macros
menu command because the application processes this file on invocation, before it
builds the menus.
The command procedure performs the actual data manipulation for the macro. You write it
using the standard Tcl proc format. Note, however, the procedure must follow these
conventions:
• It must be scriptable. That is, once the GUI plug-in invokes it, it requires no user
interaction and all processing occurs automatically.
• It must contain no Tk code.
• It can perform operations only on a layout object. That is, it should not depend on the
state of the Viewer.
There are no constraints on the arguments for command procedures, nor are there further
constraints on the types of processing it can perform. Any valid Tcl script is allowed.
• Use the handle for the application main widget plus the various methods for the
cwbWorkBench Object class (to which the application main widget belongs) to access
various sorts of state-dependent data.
• Query the user for additional information needed.
You can set up the application to load your new macro automatically by:
• Using the source command in the wbinit.tcl file to source the Tcl file that contains the
macro code.
If you use either of these methods, you should embed the source command in a conditional
statement, as described in “Tcl Versus Tk and What the Distinction Means to You” on page 20.
Or you can load the new macro as needed using either of the following methods:
• Calling the file containing the macro code on invocation, using the -s option on the
command line. Since the application evaluates this file after it creates the Macros menu,
you must issue the Macros menu command in the shell window to make the macro
available to you.
• Sourcing the file containing the macro code from the shell window, then issuing the
Macros menu command.
You start with an example Tcl script containing only a proc, named return_info, which runs
commands required by the user:
proc return_info { } {
tk_messageBox -message "Procedure return_info was called.” -type ok
...
}
You then add a second proc, return_info_plug_in, which invokes the command procedure from
the GUI plug-in. A GUI plug-in procedure is passed two arguments: the handle for the layout
viewer application and the handle for the window from which the macro is invoked:
The following Tcl script registers the original Tcl procedure as a macro:
Finally, to add the macro to the layout viewer Macros menu, source the macro from your
$HOME/wbinit.tcl file, and then invoke the layout viewer as always:
Note
To write a more complicated macro, it is easiest to first write the command script, and
then test the script. Following this, rewrite the script into a procedure. Finally, write a
GUI plug-in to obtain user input data, and register the macro.
The command procedure performs all the data processing for the macro. After you have written
and tested it, you write the GUI plug-in that calls this procedure.
Example steps:
1. Open dump_hier.tcl, from “Example 5 - Using a Recursive Procedure to Write a Layout
Hierarchy” on page 51 and look for ways to make it more flexible:
close $fileID
a. Name of file to open: For maximum flexibility, change the hard-coded file name
into a variable. Later, you write the GUI plug-in to get the full pathname for the file
from the user.
b. Layout handle: Macros only work from the GUI, and you can assume the layout is
already opened. Instead of using the create layout command, you can get the handle
for the current layout using the $cwb cget command.
2. Modify this portion of the script, then save the modified file as write_hier.tcl:
set fileID [open $File w]
set layout [$cwb cget -_layout]
dump_hier $layout $fileID
close $fileID
3. By examining the body of the procedure you have written, you can tell what arguments
you need to pass to the procedure. These are File and cwb. Modify the code, using the
proc command to pass this information to the code you have written:
Note
The remaining steps test the functioning of the command procedure.
The Tcl source command passes the contents of the file to the Tcl interpreter. It is
equivalent to typing the script directly into the shell window. Notice that because the Tcl
file contains only two procedures and no actual commands to evaluate, nothing appears
to happen.
9. Get the handle for the application:
set cwb [find objects -class cwbWorkBench]
10. Invoke the write_hier procedure, passing it the handle to the application plus the name
of a file to create:
write_hier $cwb "sample_hier.txt"
For example:
% source write hier.tcl
% set cwb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% write hier $cwb_sample_hier.txt
% cat sample_hier.txt
--> tcp_level_cell
--> cell_i
--> cell_g
--> cell_h
This script relies heavily on the Tcl commands puts and gets:
• It uses the puts command three times: to display a message to the user, to prompt
for input, and later, to report back on the data the user entered. Notice you need not
specify a channelID. The default channelID for puts is stdout, which is the shell
window.
• It uses the gets command to capture the data the user enters via the keyboard. The
gets command does not have a default channelID, so you must tell explicitly where
to get the information from. In this case, the information comes from stdin, which is
the keyboard.
2. Invoke Calibre DESIGNrev in GUI mode.
3. Switch from the GUI window to the terminal window by clicking in the terminal
window.
4. Select Enter. When you see the “%” prompt, type the following command, then select
Enter.
source prompt.tcl
When you source this script, it processes the first two lines, displaying the message and
the prompt, then waits for your input.
5. Type:
sample_file.txt
% source prompt.tcl
This macro creates a file containing the layout hierarchy.
Please enter the full pathname for the file to create.
sample_file.txt
You entered sample_file.txt
%
The problem with this method is that it assumes the person using the macro knows to
switch to the shell window to view the prompt and enter the data.
7. Create a new ASCII file called browser.tcl containing the following lines of code:
set filename [tk_getSaveFile]
puts "You entered $filename"
8. Source the script in the terminal window to invoke a file browser dialog box.
source browser.tcl
The Tk command tk_getSaveFile creates a file browser widget. When you enter a file
name, either by selecting a file or typing a name in directly, and click Save, the
command passes the file name back to the application. Thus, the variable filename gets
set to the file name the user specifies.
9. Type in the filename “sample_file.txt” and click Save.
10. Check the terminal window. The script tells you what filename you entered:
% source browser.tcl
You entered /user/cdoc/sample_file.txt
%
The command arguments for tk_getSaveFile lets you configure the file browser widget.
In the lines above, you define a title for the widget, and identify types of files the user
can display and select from.
12. Save the file, then source it from the Tcl prompt.
13. Navigate to an actual file and select it, then click Save.
The software displays a dialog box asking if you want to overwrite the file. One of the
added benefits of using the file browser widgets provided by Tk is they can simplify
writing code to manipulate files.
Example steps:
1. Open the file write_hier.tcl and add the contents of browser.tcl to the bottom of the file.
set title "Enter pathname for file"
set types {
{{Text Files} {.txt} }
{{All Files} * }
}
set filename [tk_getSaveFile -filetypes $types -title $title]
puts "You entered $filename"
A GUI plug-in procedure is always passed two arguments: the handle for the layout
viewer application, and the handle for the window from which the macro is invoked.
You rarely use the second variable (window), but you must include it in the procedure
definition; otherwise, the Tcl interpreter generates an error when it attempts to invoke
the macro.
3. Replace the line ‘puts “You entered $filename”’ with a call to the new procedure.
write_hier $wbHandle $filename
This procedure call passes to write_hier the two pieces of information it requires: the
handle for the layout viewer application, and the name of the file it is to create.
4. Add comments to ensure your script is readable by others.
##############################################################
# PROC: write_hier_plug_in
##############################################################
# wbHandle = the handle (internal name) for the application
# window = the pathname of the window where the macro was invoked.
##############################################################
5. Test the procedure by sourcing the file and calling the GUI plug-in procedure manually:
source write_hier.tcl
set wb [find objects -class cwbWorkBench]
write_hier_plug_in $wb any_string
To call the GUI plug-in procedure you must know the handle for the layout viewer
application. The Tcl interpreter expects a window handle as well, but this is not used so
you can pass it a nonsense string, in this case “any_string”.
6. When the file browser dialog box pops up, enter new_sample.txt, and click Save.
When the procedure finishes, the shell window displays the % prompt, indicating it is
ready for the next command.
7. Exit Calibre DESIGNrev, then open new_sample.txt to read the output data.
While the write_hier macro does not display any data to the user, it is helpful to display a
message box telling them the macro completed successfully.
Example steps:
1. Experiment with the command that displays the message box by typing it into the shell
window:
tk_messageBox -message "Test message." -type ok
The -type argument defines the buttons to place on this standard widget. There are
several different options. OK is the most appropriate one for this situation.
2. Now add tk_messageBox to the write_hier_plug_in procedure. Place it after the call to
the write_hier procedure and before the final close bracket.
proc write_hier_plug_in { wbHandle window} {
set title "Enter pathname for file"
set types {
{{Text Files} {.txt} }
{{All Files} * }
}
set filename [tk_messageBox -filetypes $types -title $title]
write_hier $wbHandle $filename
tk_messageBox -message "The layout hier was successfully written." \
-type OK
}
Note the backslash “\” at the end of the line beginning with tk_messageBox. This
indicates the command does not fit onto one line, and the line that follows finishes the
command. When you use the backslash as a command continuation character, it must
not be followed by any other characters. Even a space after it creates an error.
3. Save the file write_hier.tcl. and test it by sourcing the file and calling the GUI plug-in
procedure manually:
source write_hier.tcl
set wb [find objects -class cwbWorkBench]
write_hier_plug_in $wb any_string
##############################################################
# COMMAND PROC: write_hier
##############################################################
# Args:
# wb = Calibre WORKbench object handle
# File = path to file to write to
##############################################################
##############################################################
# PROC: dump_hier
##############################################################
# L = layout object name
# F = file to dump hierarchy to
# C = cell to start dumping from, "" means use topcell
# Indent = string used to format the hierarchy output
##############################################################
Example steps:
1. Add the following command to the end of the file write_hier.tcl.
Macros create "my macro" write_hier write_hier_plug_in
4. Also in the shell window, type the macros menu command, then select Enter.
Macros menu
5. Switch to the graphical user interface and click the Macros menu. You should see your
macro displayed.
The code you have written thus far displays a message box telling you the hierarchy was written
successfully to the file. However, what if it was not? How can you know, and how can the
program know?
Example steps:
With:
if [catch {open $File w} errMsg] {
tk_messageBox -message "$errMsg"}
Here you use the if command to set up a conditional statement. The syntax is:
if <condition> <action>
If <condition> is TRUE, yes, or a non-zero value, the Tcl interpreter performs the
<action>. Otherwise it skips those actions and moves on to the next portion of the script.
Because the Tcl open command used with the argument w opens the file for writing, the
command returns an error if you do not have write permission for the file. You can write
the <condition> based on whether or not you can open the file.
The catch command tracks whether or not a script1 returns an error. If a script executes
successfully, catch returns 0. If the script does not execute successfully, it returns an
error code.
The catch command takes an optional second argument, which is the name of a variable.
If the script executes successfully, catch sets the variable to the value returned by the
command. If the script does not execute successfully, catch sets the variable to the error
1. The term script refers to a block of code returning a single value. It can be a single command, a procedure,
or a full program.
message generated by the script. Using this optional argument, you can keep track of the
file address, as you did in the original code.
The <action> portion of the if command defines what to do if the <condition> occurs.
If an error occurs, you want to display a message box telling the user of the problem.
The easiest way is to display the actual error message, which catch saves to the variable
errMsg. Thus, the <action> is:
tk_messageBox -message $errMsg
The Tcl return command exits the procedure it is in. It also passes the string you
define, in this case “file_error”, back to the program as the return value1 for the
procedure.
4. In the file write_hier.tcl, edit the command procedure write_hier:
replace the line:
write_hier $wbHandle $filename
tk_messageBox -message "The layout hier was successfully written." \
-type OK
with:
set return [write_hier $wbHandle $filename]
if {$return == "file-error"} {
return
1. The return value for a procedure is the data it returns on completion. By default, the return value is the
return value for the last command executed in the procedure. The Tcl return statement lets you control what
this is. In many cases, you ignore the return value from a procedure.
} else {
tk_messageBox -message "The layout hier was successfully \
written” -type ok
}
The replacement code creates a conditional statement controlling whether to display the
message box telling you the layout was successfully written.
First, it uses the set command to track the value returned by the write_hier procedure.
It then uses an if statement to check what the return value was. If the return value was
“file-error” it exits the macro entirely. The else portion of this statement defines an
<action> to perform if the <condition> is not met. In this case, the action is to display
the macro successful message box.
5. Save write_hier.tcl and test it using the process described in step 2. Notice that this time
the macro completes after displaying the error message.
Example steps:
1. Invoke Calibre DESIGNrev in GUI mode, loading in std_des.gds.
calibredrv -m std_des.gds -s write_hier.tcl
Your new macro is not listed there.When the application starts, it processes the script
supplied using -s after it creates the menus.
3. To prove the application is aware of your macro:
a. Switch from the GUI window to the terminal window.
b. Select Enter to access the Tcl “%” prompt, and then enter the command to recreate
the Macros menu:
Macros menu
c. In the GUI window, check that your new macro is listed in the Macros menu.
4. Exit the application.
5. Open the configuration file wbinit.tcl in your favorite ASCII text editor, and add the
following line:
source write_hier.tcl
Your new macro is listed there. When the application starts, it processes the wbinit.tcl
file before creating the menus.
##############################################################
# COMMAND PROC: write_hier
##############################################################
# Args:
# wb = Calibre WORKbench object handle
# File= path to file to write to
##############################################################
##############################################################
# PROC: dump_hier
##############################################################
# L = layout object name
# F = file to dump hierarchy to
# C = cell to start dumping from, "" means use topcell
# Indent = string used to format the hierarchy
##############################################################
#
# Register the macro
#
Macros create LAYERNAMES MyShowLayers show_layers_plug_in
This simple example follows the required conventions: the plug-in handles any necessary user
interaction, and the macro command proc executes the action.
#
# INPUT: wbHandle – Handle to a Calibre WORKbench object
# window - Window name for Calibre WORKbench object
# OUTPUT: Prints out layers in shown layout.
#
proc drc_externalcheck_plug_in {wbHandle window} {
set L [$wbHandle cget -_layout]
set lv [$wbHandle cget -_layoutView]
if { $L == "" } {
error "Cannot continue without an open layout."
}
puts "Hierarchical or flat?"
set hierflat [gets stdin]
puts "Check which layer?"
set layer [gets stdin]
puts "What distance?"
set distance [gets stdin]
puts "What layer for output?"
set output [gets stdin]
drc_externalcheck $hierflat $L [$lv cell] \
[$lv depth] $distance $layer $output
}
#########################################################
# SETUP SOME BOILERPLATE VARIABLES
#########################################################
#####################################################
# GENERATE THE SVRF FILE
#####################################################
set buf "/////////////////////////////////////////////
// INPUT SECTION
/////////////////////////////////////////////
LAYOUT SYSTEM GDSII
LAYOUT PRIMARY \"$cell\"
LAYOUT PATH \"$inputgds\"
LAYOUT ERROR ON INPUT YES
[format "PRECISION %d\n" $precision]
/////////////////////////////////////////////
// OUTPUT SECTION
/////////////////////////////////////////////
DRC MAXIMUM RESULTS ALL
DRC MAXIMUM VERTEX 199
DRC RESULTS DATABASE \"$outputgds\" GDSII
DRC SUMMARY REPORT \"$reportfile\"
/////////////////////////////////////////////
// DRC CHECK SECTION
/////////////////////////////////////////////
LAYER L1 [lindex $layers 0 ]
MY_CHECK \{\n\
e1 = EXTERNAL \[L1\] < $distance\n
EXPAND EDGE e1 BY 0.01\} DRC CHECK MAP MY_CHECK $outputlayer
/////////////////////////////////////////////
// DONE
/////////////////////////////////////////////”
# send the buffer to a output function (not documented here)
DumpToFileRef $inputrules buf
####################################################
# GENERATE THE INPUT GDSII FILE
####################################################
if { $hierflat == "hier" } {
$handle gdsout $inputgds $cell
} else {
layout copy $handle tmp_handle $cell 0 $depth
tmp_handle gdsout $inputgds
layout delete tmp_handle
}
####################################################
# RUN CALIBRE
####################################################
if { $hierflat == "hier" } {
exec calibre -drc -hier $inputrules >@stdout
} else {
exec calibre -drc $inputrules >@ stdout
####################################################
# MERGE THE OUTPUT BACK INTO THIS LAYOUT
####################################################
set L2 [layout create $outputgds]
foreach L $outputlayer { $handle create layer $L }
$handle import layout $L2 FALSE append
layout delete $L2
}
# Register this as a macro
Macros create DRC_CHECK drc_externalcheck drc_externalcheck_plug_in
A: No. You can merge the two into a single procedure if you like. You can merge two separate
procedures into a single procedure. However, complex macros are easier to build and debug
when created as two separate procedures.
When you use a single procedure to create the macro, you must supply that proc name twice in
the Macros create command: Once for the command procedure and once for the GUI plug-in
procedure. For example:
This chapter lists all the supported layout manipulation commands available in Calibre
DESIGNrev, Calibre WORKbench, Calibre LITHOview, and Calibre MDPview. They are
arranged in the following groups:
Within this document, instance command names are written using the format:
• cwbWorkBench — cwb
• Layout — L
• Peek — P
• Overlay — O
• cwbLayoutView — V
• StringFeature — str
If you write a script that sets the Layout to a variable called $my_layout, then to use the $L cells
command, you actually enter the following in your script:
“$my_layout cells”
cwbWorkBench Object
Within the Tcl/Tk environment, the cwbWorkBench object manages the Calibre layout viewer
application. cwbWorkBench object methods1 give you access to information contained in the
application. This includes the handle for the current layout and the current view and other state-
dependant data.
Note
Even if you are running one of the layout viewer applications other than Calibre
WORKbench, you create a cwbWorkBench object to have access to information
contained in the application. The application window object is called cwbWorkBench,
whether you are running Calibre DESIGNrev, Calibre WORKbench, Calibre
LITHOview, or Calibre MDPview.
• When writing a macro, the cwbWorkBench handle is considered “known” because the
application passes it to the GUI plug-in procedure whenever you invoke a macro.
• When writing scripts or issuing commands at the Tcl prompt, you can get the
cwbWorkBench handle using the find command:
set wb [find objects -class cwbWorkBench]
• You can also use the find command to return multiple handles, that are allocated one per
display window (if you have multiple layout viewers open).
Note
In the reference pages that follow, the variable $cwb always refers to the handle of an
actual cwbWorkBench object.
1. With Tcl, an object is referenced by its handle. The handle also acts as a command for operations performed
on the object. Thus, the handle for the cwbWorkBench object becomes the name of the commands you use
to access state-dependant data.
$cwb bindKey
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Calibre DESIGNrev defines a set of standard key bindings and supports custom key bindings
using the file .calibrewb_workspace/keyprefs. This file contains bindKey commands binding
keys to predefined Calibre DESIGNrev actions or user-written Tcl procedures. These actions
allow updating of existing menu accelerators when they exist.
An example template key bindings file, holding some alternate key bindings, is located at
$CALIBRE_HOME/pkgs/icwb/pvt/templates/keyprefs.template. To make this file more
accessible, it is linked into each user’s .calibrewb_workspace directory when Calibre
DESIGNrev starts. If you rename it from “keyprefs.template” to “keyprefs”, it loads
automatically with the layout viewer.
The supported key names are a predefined set of Tcl key names. These are the only keyname
syntax formats accepted. Other Tcl variants for the same key names are not recognized. The
allowed key names are defined in Table 6-9.
Table 6-9. Supported Keyname Formats
Key Type Key Range
Alt Keys <Alt-A> — <Alt-Z>, <Alt-a> — <Alt-z>,
<Alt-Key-0> — <Alt-Key-9>
Control Keys <Control-a> — <Control-z>,
<Control-Key-0> — <Control-Key-9>,
<Control-F1> — <Control-F12>, <Control-period>,
<Control-comma>
Function Keys <Key-F1> — <Key-F12>
Regular Keys <Key-A> — <Key-Z>, <Key-a> — <Key-z>,
<Shift-F1> — <Shift-F12>, <Key-0> — <Key-9>
Special Keys <Key-KP_Subtract>, <Key-KP_Add>, <Key-Down>, <Key-
Left>, <Key-Right>, <Key-Up>
Note
Keys <Control-F1> through <Control-F12> as well as <Shift-F1> through <Shift-F12>
are reserved for customer use, and therefore Calibre DESIGNrev does not set them. Any
other keynames may be set by Calibre DESIGNrev.
• cwbAction
Is the name of an action to execute (the supported list is shown in Table 6-10).
• user_proc
Is the name of a user process to execute (this can be a Tcl script you have also defined and
loaded).
• null
Deletes the specified keybinding. If the keybinding also appeared on a menu, you must also
specify the menu_name and “menu_pick” arguments to remove the keybinding from the
menu.
• menu_name
Is the menu (File, Edit, and so on) containing the item to relabel with the new keybinding
(or remove it from if you are deleting a keybinding). When you create a new keybinding, the
application also automatically removes the label for the new keybinding from any menu
item that previously used it.
Note
Menu actions are independent from custom key bindings, and cannot be changed; this
feature only changes key bindings.
• "menu_pick"
Is the item on the menu specified in menu_name to relabel. The quotes (" ") are required,
and menu_pick must exactly match how the item appears on the menu.
Returns
A summary of your new key binding.
Examples
This example binds the F1 key to open the user manual, and adds the “F1” label to Help >
Open User Manual.
This next example erases the F1 keybinding, including removing the “F1” label from the Help
menu. It leaves the “Open User Manual” label in place.
Related Commands
None.
Related Commands
None.
Related Commands
None.
$cwb deleteLayoutClbk
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Closes the currently displayed layout and deletes the layout handle. If there have been edits, the
tool asks if you want to save your layout changes. Use this command in scripts working with a
displayed layout in the GUI.
Usage
$cwb deleteLayoutClbk
Arguments
None.
Returns
None.
Example
This example deletes the displayed layout:
Related Commands
$cwb reloadLayoutClbk $cwb viewedLayoutClbk
layout delete
$cwb getMenuPath
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Gets the cwbWorkBench object for the handle of the menus. Use this function to assist in
adding menus to your layout viewer menu bar.
Usage
$cwb getMenuPath
Arguments
None.
Returns
This command returns the handle of the menu bar path within the cwbWorkBench window.
Example
Here is an example of adding a new menu:
# File: userMenu.tcl
#
# Add menu titled "userMenu" to the cwbWorkBench0 menu bar
#
# Initial installation can be with: calibrewb -base -s ./userMenu.tcl
# Needs to be run in each new cwbWorkBench window.
#
set wb [find objects -class cwbWorkBench]
set mm [$wb getMenuPath]
set userMenuButton [menubutton $mm.userMenu -text "userMenu" \
-menu $mm.userMenu.menu -underline 1]
pack $userMenuButton -side left
set userMenu [menu $userMenuButton.menu -tearoff 0]
$userMenu add command -label "Flatten" -command "puts FLATTEN"
$userMenu add command -label "Another operation" -command "puts ANOTHER"
Related Commands
None.
$cwb getRulerFont
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns the rule font from the Preferences Ruler Font dialog value.
Usage
$cwb getRulerFont
Arguments
None.
Returns
Returns the ruler font.
Example
set wb [find objects -class cwbWorkBench]
$wb getRulerFont
fixed
Related Commands
$cwb setRulerFont $cwb rulerMeasurements
$cwb getRulerUnits
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns the ruler units. You can set the ruler units using the Units preference on the Ruler tab
of the Preferences dialog box.
Usage
$cwb getRulerUnits
Arguments
None.
Returns
Returns the ruler units. Possible return values are:
• um — microns
• nm — nanometers
• dbu — database units
Example
set wb [find objects -class cwbWorkBench]
$wb getRulerUnits
um
Related Commands
$cwb getRulerFont $cwb rulerMeasurements
$cwb getSelectionPoint
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns a list containing the coordinates of the last selection point used.
Usage
$cwb getSelectionPoint [dbu | microns]
Arguments
• dbu | microns
An optional argument indicating the type of units to use for the return data. The default is
microns. One micron (um) times the precision equals one dbu.
Returns
Returns the selection point.
Example
% set cwb [find objects -class cwbWorkBench]
% $cwb hasSelectionPoint
1
% $cwb getSelectionPoint dbu
3500 360000
Related Commands
$cwb hasSelectionPoint
$cwb getSelectionRect
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns a string consisting of either the selected analysis rectangle drawn in the View Center
window, or in a window defined by the actual viewed window, if no analysis rectangle has been
drawn.
Usage
$cwb getSelectionRect [dbunits | microns]
Arguments
• dbunits | microns
An optional argument indicating the type of units to use for the return data. The default is
microns. One micron (um) times the precision equals one dbu.
Returns
Returns a string consisting of {x1 y1 x2 y2}. The default unit for the return data is in microns.
Example
set wb [find objects -class cwbWorkBench]
$wb getSelectionRect dbunits
Related Commands
None.
$cwb getVisibleLayers
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns all layers set to visible in the layer palette for the current layout. The command operates
on layouts, overlays, and MDP jobdecks. Operates with either filtered mode (layer filter active)
or net extraction filtering.
Usage
$cwb getVisibleLayers
Arguments
None.
Returns
Returns the visible layers in the layer palette.
Example
set wb [find objects -class cwbWorkBench]
$wb getVisibleLayers
Related Commands
$L layers $cwb setLayerVisibility
$cwb hasSelectionPoint
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Determines if a selection point is set.
Usage
$cwb hasSelectionPoint
Arguments
None.
Returns
Returns 1 if selection point is set, or 0 if not set.
Example
% set cwb [find objects -class cwbWorkBench]
% $cwb hasSelectionPoint
0
// Set selection point in GUI
% $cwb hasSelectionPoint
1
% $cwb getSelectionPoint dbu
32000 45000
Related Commands
$cwb getSelectionPoint
$cwb loadDefaultLayerProperties
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Loads (or reloads) the default layer properties file, located in
~/.calibrewb_workspace/layerprops, or the file specified on the command line with the -dl
argument, if one was specified.
Usage
$cwb loadDefaultLayerProperties
Arguments
None.
Returns
None.
Example
set wb [find objects -class cwbWorkBench]
$wb loadDefaultLayerProperties
Related Commands
$cwb loadLayerProperties
$cwb loadLayerProperties
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Loads or reloads the specified layer properties file.
Usage
$cwb loadLayerProperties filename
Arguments
• filename
A required argument that specifies the filename of a layer properties file to load.
Returns
None.
Example
set wb [find objects -class cwbWorkBench]
$wb loadLayerProperties test.layerprops
Related Commands
$cwb loadDefaultLayerProperties
$cwb reloadLayoutClbk
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Reloads the currently displayed layout. Use this command in scripts working with a displayed
layout in the GUI.
Usage
$cwb reloadLayoutClbk
Arguments
None.
Returns
None.
Example
This example reloads the displayed layout.
Related Commands
$cwb deleteLayoutClbk
$cwb rulerMeasurements
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays ruler information for rulers in the specified layout. If specified on the command line, it
displays information for all active rulers.
Usage
$cwb rulerMeasurements
Arguments
None
Returns
Returns information for rulers in the following format:
P1 {x1 y1} P2 {x2 y2} Center {cx cy} Dx dx Dy dy Distance dist
Examples
% set wb ::cwbWorkBench::cwbWorkBench0
% $wb rulerMeasurements
{P1 {-133684 -14915} P2 {-110130 -11092} Center {-121907 -13004} Dx 23554
Dy 3823 Distance 23862.2347026}
{P1 {-124399 -11228} P2 {-124399 -14983} Center {-124399 -13105} Dx 0
Dy -3755 Distance 3755.0}
Related Commands
$cwb getRulerUnits $cwb setRulerFont
$cwb runMultiRveOnRveOutput
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Starts Calibre RVE, and informs you the layout viewer is loading the Calibre RVE graphical
debug program. It opens a new Calibre RVE session without closing existing Calibre RVE
sessions. This command is identical to the $cwb runRveOnRveOutput in all other respects.
Usage
$cwb runMultiRveOnRveOutput [databasefile]
Arguments
• databasefile
An optional argument that specifies a database file to load. If this argument is not specified,
Calibre RVE prompts you for a filename when it loads.
Returns
None
Example
set wb [find objects -class cwbWorkBench]
$wb runMultiRveOnRveOutput
Related Commands
$cwb runRveOnRveOutput
$cwb runRveOnRveOutput
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Starts a Calibre RVE session, and outputs the fact that the layout viewer is loading Calibre
RVE. Calibre layout viewers are designed to be used in conjunction with the Calibre RVE
graphical debug program when running checks and reviewing check results from most of the
Calibre batch tools.
Executing this command replaces the current opened Calibre RVE window with a new Calibre
RVE window. If you want existing Calibre RVE sessions to remain, use the $cwb
runMultiRveOnRveOutput command.
Note
You can only open one Calibre RVE window with this command.
Usage
$cwb runRveOnRveOutput [databasefile]
Arguments
• databasefile
An optional argument that specifies a database file to load. If this argument is not specified,
Calibre RVE displays a dialog box which prompts you for a filename when it loads.
Returns
None
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% $wb runRveOnRveOutput
Loading Calibre RVE...
Running RVE...
...
Related Commands
$cwb runMultiRveOnRveOutput $cwb show
$cwb selectionCloneToNewLayout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Copies all selected polygons, wires, and text to a new layout object, and displays the handle to
the new layout object. The topcell name stays the same, and it contains all cloned geometries.
References are not copied.
Usage
$cwb selectionCloneToNewLayout
Arguments
None.
Returns
The new layout handle, such as “layout3”.
Example
set wb [find objects -class cwbWorkBench]
$wb selectionCloneToNewLayout
Related Commands
None.
$cwb setDepth
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Sets the depth for the Calibre layout viewer object. You need to follow this command with a
$cwb updateDisplay command to see the effects of the command in GUI mode.
Usage
$cwb setDepth startDepth endDepth
Arguments
• startDepth endDepth
Sets the starting and ending depth to use for the specified Calibre layout viewer object.
Returns
None.
Example
set wb [find objects -class cwbWorkBench]
$wb setDepth 0 3
$wb updateDisplay
Related Commands
$cwb updateDisplay
$cwb setLayerVisibility
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Sets the visibility for one or more layers. Layers are specified either as a list of layer numbers or
as the name of a layer filter. The command operates on layouts, overlays, and MDP jobdecks.
Usage
$cwb setLayerVisibility layer operation
Arguments
• layer
A required argument that specifies the layer or layer filter.
• operation
A required argument that determines the operation to be performed by the command.
Allowed values are show, hide, and toggle:
o show — shows the layers.
o hide — hides the layers.
o toggle — shows any layers that are hidden; hides any layers that are shown.
Returns
None.
Example
You can put the layers of choice in a layer filter in the layer properties file:
layerFilters -add baselayers 5 1 11 7 3
Related Commands
$cwb getVisibleLayers
$cwb setRulerFont
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Sets the ruler font dynamically, updating the Preferences Ruler Font dialog value and the
preference value. The preference value is not immediately written to the preference file. This is
done at the next normal preference file update, such as exiting from the layout viewer.
Usage
$cwb setRulerFont font
Arguments
• font
The ruler font.
Returns
None.
Example
set wb [find objects -class cwbWorkBench]
$wb setRulerFont fixed
Related Commands
$cwb getRulerFont
$cwb show
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Redisplays the layout. It raises the window to the front if it is hidden by other windows.
Usage
$cwb show
Arguments
None.
Returns
Redisplays the layout.
Example
set wb [find objects -class cwbWorkBench]
$wb show
Related Commands
$cwb runRveOnRveOutput $cwb updateDisplay
$cwb showWithLayerFilterClbk
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Redraws the display with a filtered set of layers. Executing this command without a filter name
redraws all layers.
Usage
$cwb showWithLayerFilterClbk [layout_filter]
Arguments
• layout_filter
An optional argument that specifies the layout filter designator.
Returns
None.
Example
Unix> calibredrv -m layout.oas
% set wb [find objects -class cwbWorkBench]
% layout0 layerFilters -add mb 1 50 60 100
% $wb viewedLayoutClbk layout0
% $wb showWithLayerFilterClbk mb
--> Layers 1, 50, 60, and 100 are filtered for viewing.
Related Commands
$L layerFilters
$cwb updateDisplay
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Redraws the display, the layer panel, and the cell hierarchy panel. The command clears rulers,
selections, and contexts in the display. Use this command after using layout modification
commands.
Note
The redraw action performed from this command differs from the GUI redraw action; the
GUI redraw (View > Update Display) only redraws the display.
Usage
$cwb updateDisplay
Arguments
None.
Returns
None.
Example
set wb [find objects -class cwbWorkBench]
$wb updateDisplay
Related Commands
$cwb show
$cwb viewedLayoutClbk
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Changes the displayed layout to the layout corresponding to the specified layout handle, then
redisplays the layout.
Usage
$cwb viewedLayoutClbk layout_handle
Arguments
• layout_handle
A required argument that specifies the new layout to display.
Returns
None.
Example
set wb [find objects -class cwbWorkBench]
$wb viewedLayoutClbk layout2
$wb getSelectionRect dbunits
$wb viewedLayoutClbk layout4
$wb getSelectionRect dbunits
Related Commands
None.
$cwb waitForDrawing
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Measures the time it takes for the last-issued drawing command to complete. The command
measures time in microseconds.
Note
The command begins measuring time from the moment the command is called. This
functionality is useful in a script just after the drawing command is issued.
Usage
$cwb waitForDrawing [timeout]
Arguments
• timeout
An optional argument that specifies the maximum wait time in seconds, but not longer than
2 minutes (120 seconds).
Returns
Returns a time in microseconds.
Example
unix% cat script.tcl
set cwb ::cwbWorkBench::cwbWorkBench0
$cwb zoomToRectClbk 10 10 5000 5000
set dt [$cwb waitForDrawing]
puts "Update in $dt us"
Related Commands
$cwb zoomToRectClbk
$cwb zoomAllClbk
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Fills the display with the entire current cell, zooming as needed.
Usage
$cwb zoomAllClbk
Arguments
None.
Returns
None.
Example
set wb [find objects -class cwbWorkBench]
$wb zoomAllClbk
Related Commands
$cwb zoomToRectClbk
$cwb zoomToRectClbk
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Zooms to the specified rectangular region in the layout viewer.
Usage
$cwb zoomToRectClbk llx lly urx ury
Arguments
• llx lly urx ury
A required set of four arguments that specifies the coordinates (lower left, upper right) to
zoom to in the layout. The coordinates are in database units (dbu).
Returns
None.
Example
set wb [find objects -class cwbWorkBench]
$wb zoomToRectClbk 100 100 4900 4900
Related Commands
$cwb zoomAllClbk
Layout Object
The layout object manages all layout data loaded into the Calibre layout viewer applications.
Manipulating layout data through a script is performed using layout commands and layout
object methods:
• Layout commands let you manipulate entire layout objects, creating, deleting, merging,
and so on.
• Layout Object methods1 let you manipulate the data (or objects) within a layout. This
includes creating or deleting cells, polygons, references, and so on.
The layout object is referenced by its handle. You can load and edit or create any
number of layout databases within the Calibre DESIGNrev, Calibre WORKbench,
Calibre LITHOview, or Calibre MDPview interactive applications, each referenced by a
unique handle.
As with all Tcl and Tk objects, the layout handle also acts as a command for operations
performed on the layout.
Note
In the reference pages that follow, the variable $L always refers to the handle of an actual
layout object.
1. With Tcl, an object is referenced by its handle. The handle also acts as a command for operations performed
on the object. Thus, the handle for the layout you are working on becomes the name of the commands you
use to manipulate the layout data.
layout all
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns the handles of all layout objects existing within the application database.
Usage
layout all
Note
This is a great way to see what layouts are open in memory.
Arguments
None.
Returns
A list of all layout object handles.
Example
% layout all
layout2 layout3 layout4
Related Commands
overlay all
layout copy
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Flattens data and copies it from a source layout into a destination layout. Define which data to
copy by specifying the cell, a selection rectangle, and startDepth and endDepth.
Note
Most of the arguments for this method are order-dependent. The only way the software
can recognize what an argument signifies is by assessing its position in the command
string. Because of this, you cannot specify an argument towards the end of the command
string without specifying all the arguments that precede it. Thus, while most of the
arguments are technically optional, they may be necessary in many situations.
Usage
layout copy src [dest [cell [startDepth endDepth [x1 y1 x2 y2 [selMode]]]]]
[-preserveTextAttributes] [-preserveProperties] [-preserveHierarchy]
Arguments
• src
A required argument that specifies the handle of the source layout object to be copied.
• dest
An optional argument that specifies the handle of the layout object into which the data is
copied. Allowed values are a user-supplied string, which cannot currently be in use as the
handle of an existing layout.
When not specified, the software generates a layout handle for the new layout.
• cell
An optional argument that specifies the name of the cell in the source layout to be copied.
This cell becomes the topcell of the new layout. To copy the entire layout, specify the name
of the topcell.
• startDepth endDepth
Two optional arguments that specifies the hierarchy depth range containing the data to be
copied. Before copying, the application flattens the data between the startDepth and the
endDepth. Any data above the startDepth or below the endDepth is not copied.
o The default value for startDepth is 0.
o If endDepth is omitted, its default value is 1000.
• x1 y1 x2 y2
An optional argument set that specifies the coordinates of the rectangular selection area. The
first two values define the lower left corner, the second two define the upper right corner.
When not specified, the entire layout is copied. By default, coordinates are in database units
(dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• selMode
An optional argument that determines selection mode. Allowed values are 0, 1, or 2.
Alternatively, values can be contain, touch, or clip.
o 0 (contain) — copies all geometry contained within the selection region.
o 1 (touch) — copies all geometry that touch or are contained within the selection
region.
o 2 (clip) — clips geometries that are contained within the selection region. The
results of this option leave no polygons or wires outside the selection region.
The default is 0.
• -preserveTextAttributes
An optional argument instructing the software to preserve GDS Text Presentation and
Strans attribute data when reading data into or writing data from the application. Use this
argument when copying a layout from a GDS layout. The default is to preserve these
attributes.
• -preserveProperties
An optional argument instructing the software to preserve GDS geometry or reference
property data (PROPATTR and PROPVALUE) when reading data into or writing data from
the application. Use this argument when copying a layout from a GDS layout. The default is
to preserve these attributes.
• -preserveHierarchy
An optional argument that specifies SREF- and AREF-instances enclosed in the selection
rectangle are preserved. The default is to not preserve the hierarchy, creating a flat layout
copy.
Returns
The handle for the layout object that was created as a result of the copy.
Examples
This example copies the entire layout to a new flattened version of the original layout:
% layout all
layout2 layout3 layout4
% layout copy layout2 newlayout
newlayout
% layout all
newlayout layout2 layout3 layout4
This example copies a portion of the cell mycell to a new layout, and sorts through the data:
% info nameofexecutable
/clbr_latest/ic/ixl/Mgc_home/pkgs/icwb/pvt/calibrewb
% layout copy layout0 myHandle mycell 0 0 -135.2u -23.6u -101.0u 2.4u
% lsort [myHandle layers]
1 4 7
% foreach layer [lsort [myHandle layers]] {
foreach poly [lsort -dictionary \
[myHandle iterator poly mycell $layer range 0 end]] {
puts "layer($layer) $poly"
}
}
layer(1) -134000 -15000 -110000 -15000 -110000 -11000 -134000 -11000
layer(4) -114000 -12500 -105000 -12500 -105000 -11500 -114000 -11500
layer(7) -115000 -14000 -112000 -14000 -112000 -11000 -115000 -11000
layer(7) -132000 -16000 -127000 -16000 -127000 -11000 -132000 -11000
Related Commands
layout copy2
layout copy2
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Copies all geometry and cell references that touch or are contained within the selection region
to a new layout object, preserving any hierarchy that exists. Cell references exist at a specific
location, and they contain no geometric data.
Usage
layout copy2 src cell x1 y1 x2 y2 [-preserveTextAttributes] [-preserveProperties]
Arguments
• src
A required argument that specifies the handle of the layout object to be copied.
• cell
A required argument that specifies the name of the cell in the source layout to be copied.
This cell becomes the topcell of the new layout. To copy the entire layout, specify the name
of the topcell.
• x1 y1 x2 y2
A required argument set that specifies the coordinates of the rectangular selection area. The
first two values define the lower left corner, the second two define the upper right corner.
By default, coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• -preserveTextAttributes
An optional argument instructing the software to preserve GDS Text Presentation and
Strans attribute data when reading data into or writing data from the application. Use this
argument when copying a layout from a GDS layout. The default is to preserve these
attributes.
• -preserveProperties
An optional argument instructing the application to preserve GDS geometry or reference
property data (PROPATTR and PROPVALUE). Use this argument when copying a layout
from a GDS file. The default is to preserve these properties.
Returns
A system-generated handle for the layout object created as a result of the copy.
Examples
This example copies data from layout2 to a new layout, layout5:
% layout all
layout2 layout3 layout4
% layout copy2 layout2 a1220 0 0 200000 200000
layout5
This example copies a portion of the cell mycell to a new layout, and sorts through the data:
% set L_copy2 [layout copy2 layout0 mycell -135.2u -23.6u -101.0u 2.4u]
% lsort [$L_copy2 layers]
1 4 5 7
% foreach layer [lsort [$L_copy2 layers]] {
foreach poly [lsort -dictionary [ \
$L_copy2 iterator poly mycell $layer range 0 end]] {
puts "layer($layer) $poly"
}
}
layer(1) -94000 12500 -104500 12500 -104500 -8500 -94000 -8500 -94000 \
-7500 -103500 -7500 -103500 11500 -94000 11500
layer(1) -134000 -15000 -110000 -15000 -110000 -11000 -134000 -11000
layer(4) -105000 17000 -121000 17000 -121000 -45000 -104000 -45000 \
-104000 -43000 -119000 -43000 -119000 15000 -105000 15000
layer(4) -108000 -14000 -81000 -14000 -81000 -10000 -108000 -10000
layer(4) -108000 0 -103000 0 -103000 3000 -108000 3000
layer(4) -114000 -12500 -105000 -12500 -105000 -11500 -114000 -11500
layer(4) -131000 -13000 -131000 -73000 -104000 -73000 -104000 -71000 \
-129000 -71000 -129000 -13000
layer(5) -108000 -16000 -81000 -16000 -81000 -1000 -108000 -1000
layer(7) -105000 1000 -103000 1000 -103000 2000 -105000 2000
layer(7) -115000 -14000 -112000 -14000 -112000 -11000 -115000 -11000
layer(7) -132000 -16000 -127000 -16000 -127000 -11000 -132000 -11000
Related Commands
layout copy
layout create
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates a layout object and returns a layout object handle. When no arguments are supplied, this
command creates an empty layout object.
When a filename (or multiple filenames) are supplied, the command loads a layout containing
data loaded in from the specified GDS or OASIS file. When specifying a filename, you can also
specify a layer mapping to determine the layers to be loaded. You can load selected layers or
map layers and datatypes in the layout file to specific layers within the layout1 in the
application.
This command allows you to read an RDB file and convert it into a new layout. You can also
use the command to create a new layout from an existing LEF/DEF, OpenAccess (OA), or
Milkyway database.
Usage
Syntax 1: Creating a layout from a GDS or OASIS file
layout create [-handle handle] [-type {gds | oasis}] [-dt_expand] [-preservePaths]
[-ignoreGdsBoxes] [-preserveTextAttributes] [-preserveProperties]
Syntax 2: Creating a mapped layout
layout create [handle] fileName [-mapname Lname [LMAP]]… [{-map L D LMAP}…[-only]]
[-dt_expand] [-preservePaths] [-ignoreGdsBoxes] [-preserveTextAttributes]
[-preserveProperties] [-noReport] [-colorByDefinition] [-colorByPlacement]
[-incr [sync]] [-handle handle] [-levels level1 ... leveln] [-log logfile]
Syntax 3: Creating multiple layouts
layout create [handle] -files fileNameList [-mapname Lname [LMAP]]…
[{-map L D LMAP}…[-only]] [-dt_expand] [-preservePaths] [-ignoreGdsBoxes]
[-preserveTextAttributes] [-preserveProperties] [-noReport] [-colorByDefinition]
[-colorByPlacement] [-incr [sync]] [-handle handle] [-log logfile]
Syntax 4: Creating a layout from Milkyway, OA or LEF/DEF database files
layout create {LEFDEF -def {def_file | @def_empty} -lef {lef_files}}
{OA library cell view} | {MILKYWAY library cell view}
[-dt_expand] [-preservePaths] [-preserveTextAttributes] [-preserveProperties]
Syntax 5: Creating a layout from an ASCII RDB file
layout create [handle] [fileName] [-layer lindex] [-rdbChecks Lchecknames]
[-singleLayer] [-dt_expand] [-preserveProperties] [-handle handle]
1. Refer to the Calibre DESIGNrev Layout Viewer User’s Manual for information on layermap files.
Arguments
• handle
An optional argument that specifies the handle to assign to the newly created layout handle.
When not specified, the software assigns the layout a system-generated handle. The default
is “layoutN”, where N is the number of layouts created before this one. Thus, for the first
layout created, the default handle is layout0.
• fileName
An optional argument that specifies the name of a layout file to load into the newly created
layout object. Each fileName file must be either a file or a compressed file. If a file is a
compressed file, fileName must end with an extension of (.z, .Z or .gz) and the gzip program
must be accessible to read a compressed file.
Note
In the case of usage syntax 5, fileName is an ASCII RDB file rather than a layout file.
• -files fileNameList
For multiple layout files, separate each file in fileNameList with a space. Each file is loaded
as a separate, concatenated layout, associated with the same layout handle. To merge
layouts, use the layout merge command.
When you create a layout by loading in data from a layout file, the GUI for the application
references the layout by this name rather than its handle, however you must use the handle
in any layout commands or methods.
• {-mapname Lname LMAP}...
Optional arguments used to map a layer name, Lname, in the GDS or OASIS file to a layer
in the layout object, LMAP, when data is read into the new layout. LMAP is an optional
integer layer number. If LMAP is omitted, the layout object takes the Lname number.
Each -mapname keyword maps one layer name to a specific layout layer. You can include
multiple -mapname keywords to define more than one mapping.
All layers not specified in a -mapname argument are loaded and assigned the same layer
number as in the GDS or OASIS file.
• {-map L D LMAP}... -only
Optional arguments used to map a layout layer and datatype pair in the GDS or OASIS file
(L, D) to a layer in the layout object (LMAP, which must be an integer layer number; the
option is designed to map a layer datatype to a layer value) when data is read into the new
layout. A value of D < 0 matches any datatype.
Each -map keyword maps one layer and datatype pair to a specific layout layer. You can
include multiple -map keywords to define more than one mapping.
If you supply the optional argument -only, the application loads only those layers you
explicitly specify with -map. Without this argument, all layers not specified in a -map
statement are loaded and assigned the same layer number as in the GDS or OASIS file.
• LEFDEF -def {def_file | @def_empty} -lef lef_files
Optional arguments used to create a new layout from an existing LEF/DEF database. Use
@def_empty if there is no DEF file. Multiple LEF files are allowed.
• OA library cell view
Optional arguments used to create a new layout from an existing OpenAccess (OA)
database. OpenAccess must be installed to access the OA database and read the data.
• MILKYWAY library cell view
Optional arguments used to create a new layout from an existing Milkyway database. A
Synopsys Milkyway license is required to access the Milkyway database and read the data.
• -type {gds | oasis}
An optional argument that specifies the type for the layout. If this option is not specified, the
layout is created in GDS format.
• -dt_expand
An optional argument used to expand datatypes so that each layer and datatype combination
is mapped to a different layout layer. The layer number within the layout is layer.datatype,
such as “12.134”.
• -preservePaths
An optional argument used to preserve path definitions when reading layout files. By
default, paths are converted to polygons.
• -ignoreGdsBoxes
An optional argument used when creating a layout from a GDS file. Instructs the software to
ignore box records when reading the GDS file.
• -preserveTextAttributes
An optional argument instructing the software to preserve GDS Text Presentation and
Strans attribute data when reading data into or writing data from the application. Use this
argument when creating a layout from a GDS file. This option does not work with OASIS,
as there is no text attribute to be preserved in the OASIS format.
The default is to not load text attributes. Preserving text attributes does not affect the loading
of text objects, because text objects are always loaded.
• -preserveProperties
An optional argument used when creating a layout from a GDS or RDB file. Instructs the
application to preserve geometry and reference property data (PROPATTR and
PROPVALUE).
The default is to not preserve these properties.
• -noReport
An optional argument that instructs Calibre to skip printing the byte count during a file read
as well as the file summary when it finishes the file read. This is useful for procedures that
parse the terminal output transcript.
• -colorByDefinition
An optional argument that causes all layers within each jobdeck chip definition to be
colored the same. The same color is assigned to both the level layers and their contained
chip layers in the level and chip views. View modes can only be changed by closing the
layout and reloading it with a different mode setting.
Note
Writing layouts from a database formatted for this type of viewing does not result in an
optimized layout. Databases are loaded in Color By Chip mode when writing data in
layout format.
• -colorByPlacement
An optional argument that adds a visual distinction between unique jobdeck placement
definitions. Each jobdeck placement is assigned a separate color. Using this argument
causes the jobToOasis command to generate unique chips in the OASIS file, which could
result in large files; users of jobToOasis should leave the jobdeck in Color By Chip mode
(the default).
Note
Writing layouts from a database formatted for this type of viewing does not result in an
optimized layout. Databases are loaded in Color By Chip mode when writing data in
layout format.
• -handle handle
An optional argument used to indicate the handle name to assign to the newly created layout
handle. It can be used instead of the optional handle in the first argument position. The last
handle is used if both are entered or if there are multiple -handle arguments.
• -layer lindex
An optional argument used when creating a new layout from an RDB ASCII database
(usage syntax 5). lindex indicates what layer number to start the RDB ASCII database
conversion with. As additional layers are needed for the conversion, they are incremented
from the lindex startup layer.
• -rdbChecks Lchecknames
An optional list of RDB check names that selects only the results from the specified checks.
Check names are case-sensitive, and by default all checks are loaded. The ‘*’ wildcard finds
zero or more occurrences. For example, “ch*” finds ch1, check2, and chk3b.
• -singleLayer
An optional argument used when creating a new layout from an RDB ASCII database
(usage syntax 5). Specifies to use a single layer to represent multiple checks. By default,
each check is placed on its own layer. Layernames used are the check names.
• -incr [sync]
An optional argument used to invoke the layout viewer in incremental mode, which uses a
cache file to aid the initial drawing speed. The tool generates or updates a cache file as
needed. When a layout is incrementally loaded, only hierarchical structures are loaded.
If the optional sync is supplied, the tool forces syncing the cache file (Peek Cache
Repository, PCR) with the layout.
• -levels level1 ... leveln
An optional argument used only in Calibre MDPview. Specifies a list of levels used for
normal, extended, and flex MEBES job decks. This is used in conjunction with -m option.
Using a level list reduces load times and memory usage for job decks that have assigned
unique files to each level, since only those pattern or index files that match a level in the list
are loaded. Using a level list on the other job deck types (Hitachi, JEOL, VSB, Micronic)
has no effect.
• -log logfile
An optional argument used to write the information to a log file. Specify the file name using
logfile. To print the contents to the terminal window, specify “stdout” for logfile. This
option only works if the input file is GDS.
Returns
The handle for the new layout object.
Examples
The following examples create new layouts by loading in data from a GDS file:
This example only reads in layer 1, all datatypes (-1).
layout create f1.gds -map 1 -1 1 -only
This example reads in all layers and maps layer 1 (all datatypes, -1) to layer 101 and layer 2 to
layer 102.
layout create f1.gds -map 1 -1 101 -map 2 -1 102
This example reads in all layers and maps layer 1, datatype 7 to layer 101.
layout create f1.gds -map 1 7 101
This example reads in all layers, but maps layername LAYER101 to 101.
This example moves shapes from one layer to another without going through each shape. It
maps a layer name to overcome two duplicate layer names for the layer A28.
set L1 [layout create mylayout.oas -mapname A28 900 -dt_expand]
$L1 layernames 900 A28dup
$L1 oasisout mgc.oas -map 900 1 0 -map 323.228 323 228
This example reads an RDB file and converts it into a layout (usage syntax 5).
set L2 [layout create adder4_hier.rdb -preserveProperties -dt_expand]
$L2 gdsout rdb2gds.gds
This example uses an incremental load cache file. This is useful in helping reduce loading time
when reviewing Calibre results with very large layout files and mostly flat designs, such as the
output from MDP tools.
layout create f1.gds -incr
Related Commands
overlay create
layout delete
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the layout specified by handle.
Caution
This command should only be used for deleting layouts when running scripts in batch
mode without a GUI. If the script is working with a displayed layout in the GUI, use the
$cwb deleteLayoutClbk command to avoid generating errors.
Usage
layout delete handle
Arguments
• handle
A required argument that specifies the handle of the layout to be deleted.
Returns
None.
Examples
% layout all
layout2 layout3 layout4 layout5
% layout delete layout3
% layout all
layout2 layout4 layout5
Related Commands
$cwb deleteLayoutClbk overlay delete
layout droasis
Tools Supported: Calibre WORKbench, Calibre LITHOview, Calibre MDPview
Description
Loads a disk-resident OASIS file in read-only mode. A .fvi index file is automatically generated
in the directory containing the file if one is not available at load time.
This command is not supported in Calibre DESIGNrev.
You can also load a disk-resident OASIS file from the batch command line by specifying
the layout viewer tool invocation with the -v option.
Usage
layout droasis filename
Arguments
• filename
A required argument that specifies the filename of the OASIS file to read in. The filename
can be a relative or absolute pathname.
Returns
The layout handle.
Example
layout droasis hier.oas
Related Commands
None.
layout filemerge
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Performs a disk-based file merge on multiple GDS input files or multiple OASIS input files
without loading them into memory. The input files must be exclusively GDS files or OASIS
files, the two file types cannot be mixed. An import-style (one topcell is maintained) and merge-
style (each file is given its own topcell) of the output is supported.
Input and output files must be in the same format. For example, GDS input files must output a
GDS output file. OASIS input files must output an OASIS output file.
Gzipped input and output files are supported by this command. Input files are expanded on disk
at the location specified by the -tmp option. If -tmp is not specified, the command uses the
MGC_CWB_TMP_DIR environment variable. If this variable is not set, the command expands
files in the current directory. Output compression is driven by the .gz (or .GZ) file extension.
Merging of files that have different precision is allowed. The precision of the output file is the
highest precision among the input files. The x and y coordinates of records in the files at lower
precision are magnified. A message appears in the transcript for the file that is scaled by the
magnification factor.
Usage
layout filemerge -in input_file1 [layer_bump1]
-in input_file2 [layer_bump2]
[-in input_file3 [layer_bump3] ...]
[-infile {
-name filename
[-layerbump layer_bump]
[[-exclude_layer { layer1 ... }] |
[-include_layer { layer1 ... }]]
} ] ...
[-indir directory]
-out output_file
[-mode mode]
[-smartdiff]
[-exclude_layer { layer1 ... }] |
[-include_layer { layer1 ... }]
[-createtop cellname]
[-topcell topcellname]
[-map_cell cellname mapcellname]
[-cblockmode cmode]
[-preserve filterfile]
[-tmp tmpdir]
[-verbose]
Arguments
• -in input_file1 [layer_bump1] -in input_file2 [layer_bump2]
A required argument that specifies an input file name. At least two file names must be
specified. If you specify a layer_bump integer value, all of the layers in that file have their
layer number incremented by that value. You can specify the same input file multiple times.
• -infile { -name filename [-layerbump layer_bump] [[-exclude_layer { layer1 ... }] | [-
include_layer { layer1 ... }]]} ...
An optional argument that enables you to filter input layers. Multiple layouts can be
combined, taking some layers from each layout and merging them in an output layout,
excluding particular layers as desired.
• -name filename
An optional argument specifying an input file name for you to filter input layers. This option
is only used with the -infile option.
• -layerbump layer_bump
If this optional argument is specified, all of the layers in that file (-name filename) have their
layer number incremented by that value. This option is only used with the -infile option.
• -exclude_layer { layer1 ... }
If this optional argument is specified, the output file only receives objects not on the
specified layers. The -exclude_layer and -include_layer options are mutually exclusive.
You can specify the -exclude_layer and -include_layer options globally or specific to a file
within the -infile option. See the note below for additional information.
• -include_layer { layer1 ... }
If this optional argument is specified, the output file only receives objects on the specified
layers. The -exclude_layer and -include_layer options are mutually exclusive.
Note
You can specify the -exclude_layer and -include_layer options globally or specific to a
file within the -infile option. If a file-specific -exclude_layer or -include_layer is
specified, then global -exclude_layer and -include_layer options do not apply to that file.
For example, in the following command:
layout filemerge -in a.gds -infile { -name b.gds -exclude_layer 0 } \
-exclude_layer 1 -out out.gds
When writing out the out.gds GDS file, layer 1 of the a.gds file is excluded, and layer 0 of
the b.gds file is excluded.
• -indir directory
An optional argument and directory name that picks up all layout files in this directory as
input files.
• -out output_file
A required option that specifies an output file that cannot be the same name as any of the
input file names.
• -mode mode
An optional argument and mode defining how cellname conflicts are resolved when
merging. Allowed modes are:
o append — Concatenates the two cells contents together.
If the -smartdiff option is set, action is taken only if the cell contents are different.
This is the default.
o overwrite — Writes the second file cell contents over the contents of the first,
deleting the contents of the first file’s cell.
If the -smartdiff option is set, action is taken only if the cell contents are different.
o rename — Renames the new duplicate cell, to make it unique.
If the -smartdiff option is set, action is take only if the cell contents are different.
o forcerename — Renames original and new cellnames to be unique, by adding a
_WBx extension, where x is an integer).
• -smartdiff
If this optional argument is set, additional processing occurs when cellname conflicts occur.
In the case of a conflict, the command compares topologies in the cells, and it only alters
cells when the cell contents are different. This option provides you with a cleaner hierarchy
for the output file, and it minimizes the file size.
• -createtop cellname
An optional argument that, if specified, runs the command in merge mode. A topcell is
created with the supplied name and each input file is created with its topcell being a child of
the new topcell. If this argument is not specified, the input layouts are merged in import-
style and no topcell is created.
• -topcell topcellname
An optional argument that sets topcellname to the topcell of the merge result layout. This is
especially useful in removing unreferenced cells from an IP library file.
• -map_cell cellname mapcellname
An optional argument that renames cellname to mapcellname. The cells are renamed before
merging. This option can be issued multiple times, once per pair of cellnames. The cellname
parameter accepts the ‘*’ wildcard. This wildcard finds zero or more cell occurrences, and
using it in a search for ca*t finds cat and cart.
• -cblockmode cmode
An optional argument and mode that writes OASIS layout files using CBLOCK
compression. Allowed modes are:
o auto — If any of the input file contains CBLOCKs, write CBLOCKs in the output
file.
o 0 — Do not write CBLOCKs in the output file.
o 1 — Write CBLOCKs in the output file.
Note
This option has no effect if a gzipped output file is requested. In this case, CBLOCKs are
not written to the output file.
• -preserve filterfile
An optional priority cell list argument used to preserve cells during merging, which is useful
for enabling assembly of library files. The cells are specified in the filterfile, where each
priority file and cell is defined on a line as a pair value:
filename_x cellname_a
filename_x cellname_b
filename_z cellname_c
The filename portion of each pair value must be a full or relative pathname if located in a
different directory. If a cellname is specified more than once, with different file names, the
last pair value defined takes precedence.
Caution
If this argument is not used, and if a cellname conflict is discovered, the last input file in
the command line apends, overwrites, or renames cells in other input files.
The -preserve option makes controlled merges possible. When there is a cellname conflict
in filemerge overwrite mode, the last input file on the command line overwrites cells from
other input files. However, when more than one library file presents input, some cells may
not come from the last file in the command line. For example, if you want to use library cell
A from layout 1 and library cell B from layout 2, and both layout 1 and layout 2 have a cell
A and cell B. Without the -preserve option, you could only have A and B in the output from
the same layout. The -preserve option allows you to specify cell A, layout 1 and cell B,
layout 2, to preserve them in the final result.
The -preserve option ensures a cell and file pair gets preserved in the final merging result. In
other words, the cell in that specific file always overwrites other cells with the same name
from other files in the filemerge process.
Layout 1 A B
Merge and Preserve
layout 1/cell A and 2/B Output A B
Layout 2 A B
• -tmp tmpdir
An optional argument and directory name that allows you to specify the location of gzip
temporary expanded files for further indexing in -append or -rename mode, useful for
performance reasons. If you do not specify a directory, the file merge uses the
MGC_CWB_TMP_DIR environment variable, if set. If the environment variable is not set,
the file merge uses the current directory.
• -verbose
An optional argument that reports merge conflicts. Information generated indicates cells
causing name conflicts as well as actions taken for each conflict.
Returns
Returns the merged file written to the filename specified by output_file.
Examples
Example 1
This example combines the files “adder4_2.gds” and “adder4_1.gds” into the output file
“toto_import_rename.gds.” Any cells that have the same name are uniquely renamed.
The result is an import-style merging of the two layouts.
layout filemerge -in adder4_2.gds -in adder4_1.gds \
-out toto_import_rename.gds -mode rename
Example 2
This example combines the files “adder4_2.gds” and “adder4_1.gds” into the output file
“toto_rename60.gds.” All the layers in “adder4_2.gds” are incremented by 60. Any cells that
have the same name are uniquely renamed.
The result is a merging of the layouts; the output file has a topcell named TOP.
layout filemerge -in adder4_2.gds 60 -in adder4_1.gds \
-out toto_rename60.gds -rename -createtop TOP
Example 3
This example combines the files “adder4_2.gds” and “adder4_1.gds” into the output file
“toto_forcerename.gds.” All cells are uniquely renamed.
The result is a merge-style merging of the layouts; the output file has a topcell named TOP.
layout filemerge -in adder4_2.gds -in adder4_1.gds \
-out toto_forcerename.gds -mode forcerename -createtop TOP
Example 4
Examples of combining files using layer filtering to either include or exclude specified layers.
layout filemerge -in probemod.oas -in probemod2.oas -include_layer 8 58 \
-out probemod_filemerge_overwrite_include.oas -mode overwrite
layout filemerge -in probemod.oas -in probemod2.oas -exclude_layer 8 58 \
-out probemod_filemerge_overwrite_exclude.oas -mode overwrite
Related Commands
None.
layout merge
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Merges the contents of two layouts into a third layout, with automatic renaming of the cells to
prevent name conflicts. Cell contents are concatenated or combined according to the mode you
select.
Usage
layout merge [handle_out] {handle1| file1} {handle2| file2} bump [del1 del2] [-mode mode]
[-dt_expand] [-preservePaths] [-ignoreGdsBoxes] [-preserveTextAttributes]
[-preserveProperties] [-autoAlign]
Arguments
• handle_out
An optional argument defining a layout handle to assigned to the merged layout.
• handle1 | file1
A required argument that specifies the handle or filename of the first layout to be merged.
• handle2 | file2
A required argument that specifies the handle or filename of the second layout to be merged.
• bump
A required argument defining an integer value added to the layer numbers of each layer in
the second layout (handle2 or file2). During the merge, data on like-numbered layers in the
two layouts are merged. Be sure to specify a large enough value for bump to avoid having
like-numbered layers in the two layouts.
• del1 del2
Optional arguments that control whether the layouts used as input to the merge are deleted
as part of the copy. If you include one of these arguments, you must include both. Allowed
values for each are 0 | 1. del1 applies to the first layout to be merged, and del2 applies to the
second layout to be merged.
o 1 — delete input layout
o 0 — do not delete input layout
The default value for each is zero.
• -mode mode
An optional argument and mode defining how cellname conflicts are resolved when
merging. Allowed modes are:
o append — Copies the complete contents from the same named cells in both layouts
into one cell with that name. All cells from both layouts with unique names appear in
the final layout.
o overwrite — Copies the contents of the layout2 cell definition into the resulting
layout for same name cells. All cells from both layouts with unique names appear in
the final layout. Cell definitions contain geometric data, while cell references exist at
a specific location and contain no geometric data.
o rename — Copies both same-named cells into the final layout as unique cells with
unique names (adds _WBx extension, where x is an integer). All cells from both
layouts with unique names appear in the final layout.
o forcerename — Copies all cells from both layouts into the final layout as unique
cells with unique names. The new name is created by adding a _WBx extension to
the original name, where x is an integer. This is the default.
• -dt_expand
An optional argument used to expand datatypes so that each layer and datatype combination
is mapped to a different layout layer. The layer number within the layout is layer.datatype.
This option is ignored when merging data from previously loaded layouts (using handles for
both layouts).
• -preserveTextAttributes
An optional argument instructing the software to preserve GDS Text Presentation and
Strans attribute data when reading data into or writing data from the application. Use this
argument when merging a layout from a GDS file. The default is to preserve these
attributes.
This option is ignored when merging data from previously loaded layouts (using handles for
both layouts).
• -preserveProperties
An optional argument used when merging a layout from a GDS file. Instructs the
application to preserve GDS geometry and reference property data (PROPATTR and
PROPVALUE). The default is to preserve these properties.
Note
This option is ignored when merging data from previously loaded layouts (using handles
for both layouts).
• -autoAlign
An optional argument used only in Calibre MDPview. Calibre MDPview attempts to align
two merged layout areas on top of each other, where they do not intersect. The default is to
not to automatically align merged areas.
Note
If two GDS files are different sizes and a simple least common denominator cannot be
found, the tool uses a value rounded to the nearest 1e-n value for the smaller database unit
value, and scales the larger layout to that value. For best results, define the physical size
of the coordinate units of both layouts before merging them using the $L units database,
$L units user, and $L units microns commands.
For example, changing a GDS layout from precision 1000 to 2000, requires a change of the
database units from 1e-9 to 5e-10, the user units value from .001 to .0005, and the layout to be
scaled by 2. The scale changes an edge of say 1 dbu to 2 dbu, while maintaining the same
physical size:
• File_precision1000.gds:
$L units database = 1e-9
$L units user = 0.001
$L units microns = 1000 (this is the precision)
• File_precision2000.gds:
$L units database = 5e-10
$L units user = 0.0005
$L units microns = 2000
Returns
The new layout handle.
Example
% layout all
layout2 layout4 layout6
% layout merge mhandle layout2 layout4 1000
mhandle
Related Commands
None.
layout overlays
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays all defined overlay handles.
Usage
layout overlays
Arguments
None.
Returns
Returns all defined overlay handles.
Example
% layout overlays
overlay0
Related Commands
$O layoutHandle $O layouts
$O overlayCells $O overlayout
$L isOverlay $L isReferenced
$L layerFilters
layout peek
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays units, precision, list of cells, list of topcells, list of layers, and other information
without loading a layout file into memory.
Usage
layout peek fileName [-bbox cellname [-geometryonly]] [-cblock | -cblockcount]
[-cellcount] [-cells] [-child cellname] [-lastmodtime] [-layers] [-parent cellname]
[-precision] [-refcount cellname] [-topcell] [-topcells] [-indexable] [-format]
[-tableoffsets [-cellname] [-textstring] [-propname] [-propstring] [-layername] [-xname]]
[-strictmode] [-sproperty] [-undefcells] [-units] [-handle] [-cache directory]
Arguments
• fileName
A required argument that specifies the name of the results database to read in. If it is not in
the current directory, a path (relative or absolute) must be specified in this argument.
• -bbox cellname
An optional argument that queries the specified cellname and outputs the bounding box of
cellname as {x y width height}. x and y are the coordinates of the lower left corner of the
bounding box and width and height are given in um.
• -geometryonly
An optional argument used to indicate that the -bbox option should ignore text and empty
cell references.
Note
This option is only used with the -bbox option. This option is not available with the
-cache option.
• -cblock
An optional argument that queries for CBLOCK existence.
• -cblockcount
An optional argument that queries the number of CBLOCKs in this file.
• -cellcount
An optional argument that queries the number of cells in layout.
• -cells
An optional argument that queries all the cellnames available in layout.
• -child cellname
An optional argument that queries a list of children for the specified cellname.
• -lastmodtime
An optional argument that queries for creation date from GDS file. This option only accepts
GDS files.
• -layers
An optional argument that queries all layers available in layout.
• -parent cellname
An optional argument that queries the parent cell for the specified cellname.
• -precision
An optional argument that queries the precision, 1/units.
• -refcount cellname
An optional argument that queries a count of instances of references to the specified
cellname.
• -topcell
An optional argument that queries the topcell with the most descendants.
• -topcells
An optional argument that queries all topcells available in layout.
Note
Some layout designs, usually those resulting from a merged database, have a structure
containing more than one topcell. Unreferenced cells create multiple topcells.
• -indexable
An optional argument that queries whether the OASIS file is indexable. OASIS files are
indexable if for each cell, the S_CELL_OFFSET property is present in the layout file. If
indexable, multiple cells can be read in parallel.
• -format
An optional argument that queries whether the file format is GDS or OASIS.
• -tableoffsets [-cellname] [-textstring] [-propname] [-propstring] [-layername] [-xname]
An optional argument that queries for all six table-offsets present in the OASIS file,
returning a list containing {tablename table-flag table-offset} for each of the six table-
offsets.
The OASIS table-offsets structure consists of six pairs of unsigned integers. Each pair
contains a flag field and a corresponding byte-offset field, as shown in Table 6-11:
Table 6-11. OASIS Table Offset Order
Flag Byte-Offset
cellname flag cellname offset
textstring flag textstring offset
propname flag propname offset
propstring flag propstring offset
layername flag layername offset
xname flag xname offset
Note
To use the -tableoffsets option, you should be familiar with OASIS table-offsets. Refer to
the OASIS manual for more information concerning the table-offsets structure.
You can also peek data for specific table-offsets using the following options along with the
-tableoffsets option:
o -cellname
o -textstring
o -propname
o -propstring
o -layername
o -xname
For example:
% layout peek input.oas -tableoffsets -cellname -propname
{cellname 0 0} {propname 0 0}
• -strictmode
An optional argument that queries whether the OASIS file is in strict mode (OASIS-
STRICT-MODE). The file is in strict mode if the table-offsets flag for all six table offsets is
1. In this case the -strictmode option returns 1, otherwise the option returns 0.
• -sproperty property_name
An optional argument that queries values of OASIS standard properties present in the
OASIS layout file. Each standard property name, property_name, has a value you can
retrieve. The OASIS standard properties are listed in Table 6-12:
Table 6-12. OASIS Standard Properties
Property Name Value
File-Level Standard Properties
S_MAX_SIGNED_INTEGER_WIDTH Bytes to encode a signed integer.
S_MAX_UNSIGNED_INTEGER_WIDTH Bytes to encode an unsigned integer.
S_MAX_STRING_LENGTH Bytes allowed in any string.
S_POLYGON_MAX_VERTICES Vertices allowed in any polygon.
S_PATH_MAX_VERTICES Vertices allowed in any path.
S_TOP_CELL Name(s) of the topcell(s) of a cell hierarchy.
S_BOUNDING_BOX_AVAILABLE Available bounding boxes. A value of 0 means
bounding box properties are not provided. A
value of 1 means some bounding box properties
are provided. A value of 2 means there is a
bounding box property for every CELLNAME
record.
Cell-Level Standard Properties
S_BOUNDING_BOX Bounding box of the cell. The value consists of
the following five fields: flags, lower left X,
lower left Y, width, and height.
S_CELL_OFFSET Byte offset from the beginning of the layout file
to the corresponding CELL record.
Note
Refer to the OASIS manual for additional information concerning standard properties.
The element level property S_GDS_PROPERTY is not supported by the layout viewers.
For the cell-level S_BOUNDING_BOX and S_CELL_OFFSET properties, you can also list
the cellname in your query, as these properties are associated with individual cells. If no
cellname is specified, the property value for all cells having that property name is returned.
Here are the syntax variations available for the -sproperty command:
o -sproperty property_name
This syntax is used to peek any of the OASIS file-level standard properties.
• -bbox — Returns cell’s coordinate space as {x y width height} for the specified cellname. x
and y are the coordinates of the lower left corner of the bounding box. The width and height
of the bounding box are defined in um.
• -cblock — Returns 1 to indicate existence of one or more CBLOCKs, and 0 otherwise.
• -cblockcount — Returns the number of CBLOCKs in the layout.
• -cellcount — Returns the number of cells in the layout.
• -cells — Returns all cell names available in the layout.
• -child — Returns a list of children for the specified cellname.
• -lastmodtime — Returns creation date from the specified GDS file.
• -layers — Returns all layers available in the layout, including layers that are defined yet
contain no shapes. For OASIS, the result for each layer contains the layer number, the
datatype number, and the t layer name. For GDS, the result for each layer contains the layer
number and the datatype number.
• -parent — Returns the parent cell for the specified cellname.
• -precision — Returns 1/units.
• -refcount — Returns a count of reference instances to the specified cellname.
• -topcell — Returns the topcell with the most descendants.
• -topcells — Returns all topcells available in the layout.
• -indexable — Returns 1 if the OASIS file is indexable (for each CELLNAME record, the
S_CELL_OFFSET property is present), otherwise the option returns 0.
• -format — Returns GDS or OASIS file type.
• -tableoffsets — Returns list containing {tablename table-flag table-offset} for the six table-
offsets in the OASIS file.
• -strictmode — Returns 1 if the OASIS file is in strict mode, otherwise the option returns 0.
The file is in strict mode if the table-offsets flag for all the 6 offsets tables is 1.
• -sproperty — Does one of the following:
o -sproperty property_name — Returns the OASIS file-level standard property value.
o -sproperty S_CELL_OFFSET [cellname1 cellname2 ...] — Returns the cellname
and value. Returns the S_CELL_OFFSET value for all the cells if no cellname is
specified
o -sproperty S_BOUNDING_BOX [cellname1 cellname2 ...] — Returns the
S_BOUNDING_BOX value for all the cells if no cellname is specified. Otherwise,
the result is the cellname and list of 5 bounding box values (flags, lower left X,
lower left Y, width, and height).
• -undefcells — Returns cells referenced but not defined.
• -units —Returns the units in microns.
If no option is specified, the units are returned.
Examples
Issuing the following commands from inside the Calibre layout viewer shell results in the listed
output:
% layout peek mix.gds -bbox r3500
{r3500 {-2000 -2000 4000 4000}}
To use this command to create a peek handle, which is much like a layout handle, and to make
use of a cache:
set lay [lindex layout_file.gds 0]
puts "Generating cache file for $lay."
To use this command from the UNIX prompt, use the following configuration:
% calibredrv -a puts [layout peek mix.gds -cells -precision] >> out.txt
To set an alias at the UNIX prompt, use the following alias command:
% alias layers ’calibredrv -a "puts [layout peek \!* -layers]"’
% layers lab2.gds
Related Commands
$P delete $P file
$P peek $L holdupdates
layout tbmode
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Specifies how text extents are handled. Once a layout is loaded or created, the tbmode for that
layout is fixed.
Setting the tbmode with this command affects only text box attributes for layout objects yet to
be loaded. The command returns the new handling mode, though it does not exhibit in the
currently loaded design. After you load a new cell, it will have text box attributes of the last
layout tbmode command.
If a particular text box attribute is desired, the command should be executed before loading the
cell. For example:
layout tbmode ignore
set Ll [layout create layout0.gds]
Usage
layout tbmode [classic | origin | extent | ignore]
Arguments
• classic | origin | extent | ignore
An optional argument that specifies the mode to be used.
o classic — This is the default mode if this command is not specified. The text origin
is the lower-left coordinate of the extent and the height is fixed to .25 microns
independent of the actual text attributes or the user units set for the design. The text-
extent is added to the cell-extent.
o origin — This mode sets the text origin in the lower-left and upper-right coordinate
of the extent. The origin of the text is added to the cell-extent.
o extent — This mode sets the text extent to be database driven by the height of the
text object. Cell-bounding calculation behavior is similar to that of other major
layout viewers. The text-width is calculated by using the character length multiplied
by a fixed ratio of the height. This ratio is given by the font geometry used within the
application, and is currently set to 7/10.
The under-stroke of certain characters such as “g” may cause the lower-left
coordinate to be slightly lower than the origin of the text. If the text is rotated or
aligned this is reflected in the extent calculation. The text-extent is added to the cell-
extent.
In extent mode, text objects are not drawn using scaling and default height options
normally available in the Sessions tab. Text is drawn exactly as specified in the
layout database.
Example
This example sets the text extent to the lower-left and upper-right coordinate:
layout tbmode origin
Related Commands
$L bbox
$L allowupdates
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Provides a direct way to resume cell bounding box (bbox) calculation updates earlier or upon
request. This command can only be called from within a Tcl procedure. It cannot be called from
the command line.
Bbox calculations are performed for operations that modify the database. For mass edits, you
can postpone and resume bbox updates:
• The $L holdupdates command holds bbox updates until the end of the Tcl procedure that
the command was called in. Cascaded calls are allowed, and updates are held back until
the end of the procedure of the first call to $L holdupdates.
• The $L allowupdates command is not usually needed. It is useful for triggering a bbox
calculation update immediately, instead of waiting for the automatic trigger at the end of
the procedure.
If $L holdupdates is executed, it automatically calls $L allowupdates at the end of a Tcl
procedure.
Caution
If bbox updates are held by the $L holdupdates command, any queries that return the
bbox of the layout could potentially be incorrect as changes that modify the bbox of cells
have not yet been executed.
Usage
$L allowupdates
Arguments
None.
Returns
None.
Example
In this example, the create_layout_and_add_shapes_sample1 procedure calls the
create_many_shapes procedure, which holds bbox calculations. After the end of this procedure,
bbox calculation is triggered, and queries to get the cell bbox are now updated.
proc create_layout_and_add_shapes_sample2 {} {
set lay [layout create]
$lay create cell TOP
$L holdupdates
$L allowupdates
Related Commands
$L holdupdates
$L ancestors
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays unique ancestors of the specified cell. An ancestor is any cell that has the specified cell
in it’s subhierarchy. For example, if cell A references cell B which in turn references cell C,
executing the command with a cellName of C returns both A and B.
Usage
$L ancestors cellName
Arguments
• cellName
A required argument that specifies the name of the cell whose ancestors are to be returned.
Returns
Unique ancestors of the specified cell.
Examples
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout4
% $lay ancestors y3120
m1000
Related Commands
$L children
$L AND
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Performs a Boolean AND on the specified layers and merges the output to the layer Lout. The
Boolean AND operation is not a hierarchical operation.
Usage
$L AND L1in L2in Lout
Arguments
• L1in
A required argument that specifies the name of the first layer to be ANDed.
• L2in
A required argument that specifies the name of the second layer to be ANDed.
• Lout
A required argument that specifies the name of the output layer for the AND operation. The
output layer specified should not be an input layer.
Returns
None.
Example
This example ANDs layers 2 and 4, and then updates the GUI display:
% basename [info nameofexecutable]
calibrewb
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
% $lay AND 2 4 100
% $wb updateDisplay
Related Commands
$L NOT $L OR
$L XOR
$L asciiout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Writes a previously read-in results database out as an ASCII file.
• Layer names are written as rule check names.
• All text objects are written as rule check text lines.
• If more than one cell is present, it results in a user error.
Note
The layout type must be converted to ASCII before you can use this command. Use the
$L layoutType command to convert the layout.
Usage
$L asciiout fileName
Arguments
• fileName
A required argument that specifies the name of the file to write to. The filename may
include a relative or absolute path.
Returns
None.
Examples
Writes out an RDB file as an ASCII file:
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
$lay asciiout out.results
Related Commands
$L instancedbout
$L bbox
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays the bounding box of the specified cell, in database units. The first two values are the
lower left corner coordinates and the last two values are the upper right corner coordinates of
the bounding box.
Usage
$L bbox cellName [recompute]
$L bbox cellName [-s_bounding_box] (OASIS files only)
$L bbox -p44_chip_window (OASIS files only)
Arguments
• cellName
A required argument that specifies the name of the cell whose bounding box is being
returned.
• recompute
An optional argument that instructs the software to recompute and update the bounding box
for the specified cell.
Note
This option is not affected by layout tbmode commands executed after the layout is
loaded.
• -s_bounding_box
An optional argument that instructs the software to retrieve the S_BOUNDING_BOX
property value (for viewer compatibility with the OASIS.MASK standard). This option may
only be specified for OASIS-format files.
• -p44_chip_window
An optional argument that instructs the software to retrieve the P44_CHIP_WINDOW
property value (for viewer compatibility with the OASIS.MASK standard). This option may
only be specified for OASIS-format files.
Returns
Returns the bounding box coordinates of the specified cell, in database units.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
Related Commands
layout tbmode
$L cellname
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Renames the specified cell.
Usage
$L cellname oldName newName
Arguments
• oldName
A required argument that specifies the current name of the cell.
• newName
A required argument that specifies the new name for the cell.
Returns
None.
Examples
This example renames a cell:
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
$lay cellname a1620 a1620r
$wb updateDisplay
Related Commands
$L cells $L children
$L cells
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns a list of all the cells in the layout $L.
Usage
$L cells
Arguments
None.
Returns
A list of all the cells in the layout $L.
Examples
This example displays a list of all the cells in a layout:
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay cells
lab1 a1220 a9500 a1720 a1230 a1310
This example finds the layers used in each of the cells in a layout:
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
% set mycells [$lay cells]
lab2 a1500 a1890 a1900 a1960 a2010
% foreach cell $mycells {
puts "Layers used in cell $cell are: [$L layers -cell $cell]"
}
Layers used in cell lab2 are: 6 2
Layers used in cell a1500 are: 4 2 1
Layers used in cell a1890 are: 8 6 4 2
Layers used in cell a1900 are: 8 2 1
Layers used in cell a1960 are: 8 6 4 2
Layers used in cell a2010 are: 8 6 4
Related Commands
$L cellname $L children
$L layers
$L children
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns a list of unique children (but not subsequent descendants) of the specified cell. Use the
command with the Tcl foreach command for the best results.
Usage
$L children cellName
Arguments
• cellName
A required argument that specifies the name of the cell whose children are to be returned.
Returns
Returns unique children, but not subsequent descendants, of the specified cell.
Examples
This example finds the children of a cell:
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay cells
lab4 a1000 a2000 a3000
% $lay children lab4
a1000 a2000 a3000
% $lay children a2000
Related Commands
$L ancestors $L cellname
$L cells $L topcell
L clips
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Retrieve the set of clips for a particular cell. Clips are areas of interest you mark on a layout,
allowing you to represent rectangular regions of a layout with four coordinates. Created clips
are independent of the layout.
Usage
$L clips cellName
Arguments
• cellName
A required argument that specifies the name of the cell.
Returns
A Tcl list of lists of the attributes for the constituent clips. Each list contains:
1. Layer number.
2. Name of the clip.
3. Clip coordinates, starting with the lower left X and Y and followed by the upper right X
and Y.
4. Boolean stating whether to incrementally load the area of the clip.
5. Boolean stating whether to place a marker dot in the center of the clip when the clip is
drawn.
Example
set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
set lay [$wb cget -_layout]
layout0
$lay clips a1220
{1 {Clip 1} 1716 52549 16921 20622 false true}
Related Commands
$L clipsout $L create clip
$L delete clip
$L clipsout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Writes the currently loaded clip markers to a file that is loaded with the $L create clip command
in a separate, interactive instance of the layout viewer.
Usage
$L clipsout fileName cellName
Arguments
• fileName
A required argument that specifies the name of the generated file.
• cellName
A required argument that specifies the name of the cell.
Returns
None.
Examples
Example 1
This example specifies a clip filename with the $L clipsout command:
# script1.tcl - clipsout example
set L [layout create lab1.gds]
$L create clip lab1 -name {Clip 10} -mark -clip {36000 250000
359000 90000}
$L clipsout lab1.clips lab1
Example 2
The following example script creates two clip markers, one with a zero width and height, and
the other with non-zero width and height (showing a region to inspect). It then writes the clip
markers to a file that can be loaded in a separate, interactive instance of the viewer:
# script2.tcl - a sample script
layout create lab2.gds
set lay [lindex [layout all] 0]
set topcell [$lay topcell]
$lay create clip $topcell -name {Clip 1} -mark -clip {1000000 5000000 \
1000000 5000000}
$lay create clip $topcell -name {Clip 2} -mark -clip {1000000 4000000 \
2000000 5000000}
$lay clipsout lab2.clips $topcell
Related Commands
L clips $L create clip
$L delete clip
$L connect
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Specifies the connectivity layers that are associated with each other. Only original layout layers
can be used with this command. The layout viewer does not perform Boolean operations or
device extraction.
This command allows you to select layers by using wildcards or groupings. The ‘*’ wildcard
finds zero or more layers, and using it in a search for lay*x matches layx, layerx, and layersx.
Caution
The $L connect and $L disconnect commands ignore ordering of the layer1 and layer2
layers. The following commands are considered identical and results in only one
connection:
$L connect 1 2
$L connect 2 1
The $L connect command can be used on overlays. Existing layer connections in any overlaid
layouts are copied into the overlay, and then new connections can be added across the layouts’
layers.
Usage
$L connect layer1 layer2 [by layer3] [via viacell] [width width]
Arguments
• layer1
A required argument that specifies the first layer to connect.
• layer2
A required argument that specifies the second layer to connect.
• by layer3
An optional third layer used to contain shapes that connect the two layers.
• via viacell
An optional layer used to specify the cell name of a via cell.
• width width
An optional size used to specify the width of the box dropped on the layer to connect
different segments of a multi-layer path. By default, the width is in database units (dbu).
Coordinate lengths are specified as either an integer, an integer followed by the character ‘d’
for dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
Returns
Returns existing connection definitions for a specific layer. In this case, the command returns
layers connected to the specified layer. To distinguish a via layer, a non-via layer always lists
itself in the list of layers it connects to.
Note
Duplicate layer numbers are possible.
Examples
Here are several $L connect statements.
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
% $lay connect 1 3
% $lay connect 2 4 by 8 width 10.
% $lay connect 10 12 via 16.
Related Commands
$L disconnect
$L COPY
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Copies the specified layer to the output layer.
The COPY operation is performed on a cell-by-cell basis.
Usage
$L COPY Lin Lout
Arguments
• Lin
A required argument that specifies the layer number or layer.datatype designation for the
layer to be copied.
• Lout
A required argument that specifies the layer number or layer.datatype designation for the
layer that is a copy of Lin. If the layer does not exist, the tool creates it.
This command cannot be used to copy a single layer’s cell contents to another layer.
Instead, use the $L iterator (poly | wire | text) command.
Returns
None.
Example
The example copies layer 2 to layer 200:
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
% $lay COPY 2 200
% $wb updateDisplay
Related Commands
$L COPYCELL GEOM $L iterator (poly | wire | text)
$L COPYCELL GEOM
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Copies all geometries on a specific layer in a cell in a source layout into a cell in the target
layout, $L. The COPYCELL GEOM command is not a hierarchical operation.
Usage
$L COPYCELL GEOM srcLayout srcCell srcLayer destCell destLayer
Arguments
• srcLayout
A required argument that specifies the handle of the layout containing the geometry to copy.
• srcCell
A required argument that specifies the name of the cell containing the geometry to copy.
• srcLayer
A required argument that specifies the layer number or layer.datatype_number designation
for the layer containing the geometry to copy.
• destCell
A required argument that specifies the name of the cell into which the geometry is copied.
• destLayer
A required argument that specifies the layer number or layer.datatype_number designation
for the layer into which the geometry is copied.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
% $lay COPYCELL GEOM $srclayout $srccell $srclayer $destcell $destlayer
$lay a1220 28 a1230 280
% $wb updateDisplay
Related Commands
$L COPY
$L create cell
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates a new cell with the given name. By default, this method creates an empty cell.
Supplying the optional arguments handle2 and cell2 creates a cell containing the data contained
in cell2, which must be in the layout referenced by handle2. Used this way, the function acts
like an “import cell” function. It creates the named cell, and then copies all geometry (no
placements are copied) into the cell.
Usage
$L create cell cellName [handle2 cell2]
Arguments
• cellName
A required argument that specifies the name of the cell to be created. The name cannot be an
existing cell name.
• handle2
An optional argument that specifies the handle for the layout that contains cell2, whose
contents are copied into the new cell.
• cell2
An optional argument that specifies the name of the cell whose contents are copied into the
new cell.
Returns
None.
Example
Extracts a cell from an existing layout into a new GDS file:
# Load existing layout.
set Llayout [layout create mylayout.gds]
Related Commands
$L create layer $L create polygon
$L create ref $L create text
$L create wire
$L create clip
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates areas of interest called clips on a layout. Clips allow you to represent rectangular
regions of a layout and support description with four coordinates. Created clips are independent
of the layout.
The statement allows you to add markers with conventional zero width and height, and also
with non-zero width and height to highlight a region for inspection. You can also load clips
from an RDB file.
The $L clipsout command can be used to write the currently loaded clips to a file.
Usage
$L create clip
cellName
[-layer {layer | *}]
[-depth depth]
[-name name]
[-incr]
[-mark]
{
[-halo microns]
[-clip {llx lly urx ury}]
[-clipsFile fileName]
[-layout {handle | *} {cellName | *} layer]
[-rdb rdbFile {ruleCheck | *}]
} ...
Arguments
• cellName
A required argument that specifies the name of the cell.
• -layer {layer | *}
An optional argument that specifies one layer or all layers. By default, the statement uses all
visible layers in the layout viewer.
• -depth depth
An optional argument that specifies the layout hierarchy depth. By default, the statement
uses the layout viewer’s current settings. When not in GUI mode, the tool uses depth 0.
• -name name
An optional argument that specifies the name of the clip. The default is “clip #”.
• -incr
An optional argument that specifies to incrementally load the area of the clip, if the layout is
incrementally loaded.
• -mark
An optional argument that specifies to place a marker dot in the center of the clip when the
clip is drawn.
• -halo microns
An optional argument that specifies to create a halo around polygons, in microns. By
default, the statement sets no halo.
• -clip {llx lly urx ury}
An optional argument that specifies to load one area with user-supplied coordinates, lower
left X and Y and upper right X and Y. By default, the statement uses the coordinates of the
bounding box of the specified cell. The default coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• -clipsFile fileName
An optional argument that specifies to load a clips file containing areas of user-supplied
coordinates.
• -layout {handle | *} {cellName | *} layer
An optional argument that specifies to load a layout.
• -rdb rdbFile {ruleCheck | *}
An optional argument that specifies to load RDB results.
Returns
A list of IDs for each created clip.
Examples
Example 1
The following example script creates two clips, one with a zero width and height, and one with
non-zero width and height (perhaps showing a region to inspect). It then writes these clip
markers to a file that can be loaded in a separate, interactive instance of the layout viewer.
# script.tcl - a sample script
#
# This is how the script could be used:
# $ calibredrv -shell script.tcl
# $ calibredrv -m lab1.gds -incr lab1.clips
#
layout create lab1.gds
set lay [lindex [layout all] 0]
set topcell [$lay topcell]
$lay create clip $topcell -name {Clip 1} -mark -clip {1000000 5000000 \
1000000 5000000}
$lay create clip $topcell -name {Clip 2} -mark -clip {1000000 4000000 \
2000000 5000000}
$lay clipsout -fileName lab1.clips -cellname $topcell
Example 2
The following example loads all “lab1” cell clips from the results in an RDB file. The following
operates on the cell “lab1”, loads the RDB file “lab1.drc.results”, and uses a halo of 2 um.
The following only loads the results from the one check called “internal” in “lab1” cell.
Related Commands
L clips $L clipsout
$L delete clip
$L create layer
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates a new layer with the specified layer number.
Usage
$L create layer L
Arguments
• L
A required argument defining number for the layer to be created. Must be one of the
following:
o An integer in range 0…65535.
o A pair of integers separated by a period (.). This format is used to represent a layer
and datatype pair as layer.datatype.
Returns
None.
Example
% basename [info nameofexecutable]
calibrewb
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay create layer 420
% $wb updateDisplay
Related Commands
$L create cell $L create polygon
$L create ref $L create text
$L create wire
$L create polygon
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates a polygon on layer in cellName with given coordinates. The last coordinates should not
be the same as the first coordinates. Two point polygons are accepted and interpreted as
rectangles, for example, 10 10 40 80 are interpreted as 10 10 40 10 40 80 10 80.
Usage
$L create polygon cellName layer {[-prop attr string [G | U]]}… x1 y1 x2 y2 … xn yn
Arguments
• cellName
A required argument that specifies the name of the cell in which the polygon is created.
• layer
A required argument that specifies the layer number or <layer number>.<datatype number>
designation for the layer on which to create the polygon.
• -prop attr string [G | U]
An optional argument plus associated values defining polygon property data (PROPATTR
and PROPVALUE). More than one -prop argument can be specified.
For OASIS databases, specifying G for the third argument indicates that this is a standard
OASIS property that represents a GDS-style property. Use U to indicate an OASIS user
property.
G (GDS) is the default and is the only allowed option for GDS files. If you write a file
containing OASIS user properties (U) as a GDS formatted file, the OASIS properties are
discarded.
• x1 y1 x2 y2 .... x_n y_n
The coordinates of the vertices of the polygon. If only two coordinates are supplied, the
software interprets the polygon as a box. At least two coordinates are required. By default,
coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
Returns
None.
Examples
Example 1
This example creates and queries a polygon object:
Related Commands
$L create cell $L create layer
$L create ref $L create text
$L create wire $L delete polygon
$L create ref
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates a placement of refcell inside of incell with the origin located at (x.y). The arguments
mirror, angle, and mag define the orientation of the cell reference. Optional arguments are used
to create an array of cell references.
Usage
$L create ref incell refcell x y mirror angle mag [cols rows xspace yspace]
[-prop attr string [G | U]] [-force]
Arguments
• incell
A required argument that specifies the name of the cell that is the parent cell of the new cell
reference.
• refcell
A required argument that specifies the name of the cell that is to be referenced.
• xy
A required argument that specifies the coordinates at which to place the origin of the cell.
By default, coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• mirror
A required argument that specifies the mirror to apply to the cell reference. Allowed values
are 0 | 1.
o 0 — do not apply a mirror.
o 1 — mirror across the x axis of the cell.
• angle
A required argument that specifies the angle of rotation to apply to the cell reference in a
counter-clockwise direction around the cell origin. Allowed values are 0 through 360.
• mag
A required argument that specifies the magnification to apply to the cell reference. By
default, this is set to 1, which equates to no magnification. The value of mag is any real
number greater than 0.
# Export layout
$Lnew gdsout new.gds
Related Commands
$L create cell $L create layer
$L create polygon $L create text
$L create wire $L delete ref
$L create text
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates a text object in the specified cell.
Usage
$L create text cellName layer x y text [presentation [strans magnification angle]]
[-prop attr string [G | U]] [-yoffset yoff]
Arguments
• cellName
A required argument used to define the name of the cell in which the text object is created.
• layer
A required argument used to define the layer number or layer_number.datatype_number
designation for the layer containing the text object.
• xy
A required argument used to define the coordinates of the center of the new text object. By
default, coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• text
A required argument used to define the text string to be displayed. The text string can
contain newline characters, in which case the text is split into multiple text strings at each
newline character, and separate text objects are created for each string.
• presentation [strans magnification angle]
Optional text attribute values, usable only if the layout is type GDS and the text has these
GDSII compatible attributes associated with it. Requires either one or four arguments:
o presentation - Text presentation (font, vertical, horizontal)
o strans - Instructions for text transformation (reflection, absolute magnification,
absolute angle)
o magnification - Magnification factor (real number)
o angle - Angular rotation, clockwise in degrees (real number)
set a 0
foreach cellnametext $cells {
set cellnametextnum [lindex $cells $a]
$L create text $cellnametextnum 127 0 0 $cellnametextnum
incr a
}
Related Commands
$L create cell $L create layer
$L create polygon $L create ref
$L create wire $L delete text
$L create wire
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates a wire (also called a path) on layer in cellName with given coordinates.
Usage
$L create wire cellName layer width [-pathtype type [bgnextn endextn]]
[-prop attr string [G | U]] x1 y1 x2 y2 .... x_n y_n
Arguments
• cellName
A required argument that specifies the name of the cell in which the wire is created.
• layer
A required argument that specifies the layer number or layer_number.datatype_number
designation for the layer on which to create the wire.
• width
A required argument that specifies the width of the path to create. By default, width is in
database units (dbu).
A coordinate length is specified as either an integer, an integer followed by the character ‘d’
for dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• -pathtype type
An optional argument that specifies the type of path to create. Allowed values are:
o 0 — path with no extension at the beginning or end
o 2 — path with beginning and end extensions equal to 1/2 the path width
o 4 — custom path, with user supplied values for the beginning and end extensions
The default type is 0.
• bgnextn
An optional argument that specifies the length of the beginning extension for the path.
Required when the path type is 4 (custom path).
• endextn
An optional argument that specifies the length of the beginning extension for the path.
Required when the path type is 4 (custom path).
• -prop attr string [G | U]
An optional argument plus associated values defining polygon property data (PROPATTR
and PROPVALUE).
For OASIS databases, specifying G for the third argument indicates that this is a standard
OASIS property that represents a GDS-style property. Use U to indicate an OASIS user
property.
G (GDS) is the default, and is the only allowed option for GDS files. If you write a file
containing OASIS user properties (U) as a GDS formatted file, the OASIS properties are
discarded.
• x1 y1 x2 y2 .... x_n y_n
A required argument that specifies the coordinates of the vertices of the wire. By default,
coordinates are in dbu.
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
Returns
None.
Examples
Example 1
This example creates a path with given coordinates:
Related Commands
$L create cell $L create layer
$L create polygon $L create ref
$L create text $L delete wire
$L customLayerDrawOrder
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Changes the layer drawing order to the specified ordering. The new setting is held as a
preference.
The Layer palette ordering is updated in the layout viewer GUI once sorting by draw order is
set. You enable sorting by draw order by either selecting Layer > Sort By > Draw Order or by
using the drop down menu in the upper left corner of the Layer palette.
Usage
$L customLayerDrawOrder [layer_list]
Arguments
• layer_list
The new layer order, with each layer number separated by spaces. If this optional argument
is not specified, the command displays the current layer number ordering.
Returns
Returns current layer number ordering, if layer_list argument is not specified.
Example
This example changes the layer drawing order. The ordering is not updated in the layout viewer
GUI unless sorting by draw order is set.
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set layout [$wb cget -_layout]
layout0
% $layout customLayerDrawOrder 2 4 1 5 6 7 8 9 10
% $layout customLayerDrawOrder
2 4 1 5 6 7 8 9 10
Related Commands
None.
$L delete cell
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the cell and all references to that cell.
Usage
$L delete cell cellName
Arguments
• cellName
A required argument that specifies the name of the cell to delete.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
$lay delete cell a9500
$wb updateDisplay
Related Commands
$L delete layer $L delete polygon
$L delete polygons $L delete ref
$L delete text $L delete wire
$L delete clip
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the specified clip.
Usage
$L delete clip cellName [-id id]
Arguments
• cellName
A required argument that specifies the name of the cell to delete clips from.
• -id id
An optional argument that specifies the identifier to specify a particular clip.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
$lay clips a1220
{1 {Clip 1} 1716 52549 16921 20622 true false}
$lay delete clip a1220 -id 1
$wb updateDisplay
Related Commands
L clips $L clipsout
$L create clip
$L delete duplicate
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the specified duplicate array and cell references (AREF or SREF).
Usage
$L delete duplicate ref cell_0...cell_n [-out fileName]
Arguments
• ref
A required argument that specifies to delete duplicated array and cell references (AREF or
SREF).
• cell_0...cell_n
A required argument that specifies the cells to operate on. The wildcard character ‘*’ is
supported, and it finds zero or more cell occurrences. Using it in a search for ca*t finds cat,
cart, and chalet.
• -out fileName
An optional argument that specifies the name of an output file to contain a report. Using
“stdout” sends the report to the screen.
Returns
None.
Example
% layout0 delete duplicate ref lab2 -out stdout
Duplicates logfile
References duplicate summary:
-------------------------------
Sref duplicates found : 1
Aref duplicates found : 1
Related Commands
$L delete cell $L delete ref
$L delete layer
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the layer completely.
Usage
$L delete layer L
Arguments
• L
The layer number or layer_number.datatype_number designation of the layer to delete.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay delete layer 4
% $wb updateDisplay
Related Commands
$L delete cell $L delete polygon
$L delete polygons $L delete ref
$L delete text $L delete wire
$L delete polygon
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the polygon described by its layer and coordinates from the specified cell.
Usage
$L delete polygon cellName layer [-prop attr string [G | U]] x1 y1 x2 y2 … x_n y_n
Arguments
• cellName
A required argument that specifies the name of the cell containing the polygon to delete.
• layer
A required argument that specifies the layer number or layer_number. datatype_number
designation for the layer containing the polygon.
• -prop attr string [G | U]
An optional argument plus associated values defining polygon property data (PROPATTR
and PROPVALUE).
For OASIS databases, specifying G for the third argument indicates that this is a standard
OASIS property that represents a GDS-style property. Use U to indicate an OASIS user
property.
G (GDS) is the default, and is the only allowed option for GDS files. If you write a file
containing OASIS user properties (U) as a GDS formatted file, the OASIS properties are
discarded.
• x1 y1 x2 y2 … x_n y_n
The coordinates of the vertices of the polygon to delete. The complete list of coordinates is
required. By default, coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
Returns
None.
Examples
Example 1
This example deletes a polygon:
layout0
% $lay delete polygon a1310 29 1000 0 15000 0 15000 85000 1000 85000
% $wb updateDisplay
Example 2
This example creates and deletes a polygon object:
Related Commands
$L delete cell $L delete layer
$L delete polygons $L delete ref
$L delete text $L delete wire
$L delete polygons
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes all geometries from the specified layer of a specified cell
Usage
$L delete polygons cellName layer
Arguments
• cellName
A required argument that specifies the name of the cell containing the polygons to delete.
• layer
A required argument that specifies the layer number or layer_number. datatype_number
designation for the layer containing the polygons to be deleted.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay delete polygons a1220 8
% $wb updateDisplay
Related Commands
$L delete cell $L delete layer
$L delete polygon $L delete ref
$L delete text $L delete wire
$L delete ref
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the cell reference or array of references. Cell references exist at a specific location, and
they contain no geometric data.
Usage
$L delete ref incell refcell x y mirror angle mag [cols rows xspace yspace]
[-prop attr string [G | U]]
Arguments
• incell
The name of the cell containing the cell to be deleted.
• refcell
The name of the cell to be deleted.
• xy
The coordinates of the cell to be deleted. By default, coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• mirror
The mirror applied to the cell reference to be deleted. Allowed values are 0 | 1.
o 0 — do not apply a mirror
o 1 — mirror across the x axis of the cell
• angle
The angle of rotation applied to the cell reference.
• mag
The magnification applied to the cell reference.
• cols rows xspace yspace
A set of optional parameters, required when deleting an array of cell references. Refer to
“$L create ref” on page 204 for more information.
• -prop attr string [G | U]
An optional argument plus associated values defining polygon property data (PROPATTR
and PROPVALUE).
For OASIS databases, specifying G for the third argument indicates that this is a standard
OASIS property that represents a GDS-style property. Use U to indicate an OASIS user
property.
G (GDS) is the default, and is the only allowed option for GDS files. If you write a file
containing OASIS user properties (U) as a GDS formatted file, the OASIS properties are
discarded.
Returns
None.
Examples
This example deletes a cell reference:
Related Commands
$L delete cell $L delete layer
$L delete polygon $L delete polygons
$L delete text $L delete wire
$L delete text
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the text object described by its layer, coordinates, and text from the specified cell.
Generates an error if objects cannot be deleted.
Usage
$L delete text cellName layer x1 y1 text [presentation strans magnification angle]
[-prop attr string [G | U]]
Arguments
• cellName
The name of the cell containing the text object to delete.
• layer
The layer number or layer_number. datatype_number designation for the layer containing
the text object.
• x1 y1
The coordinates of the text object to be deleted. By default, coordinates are in database units
(dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• text
The text string to be deleted.
• presentation strans magnification angle
Used only if the layout is type GDS and the text has these GDSII compatible attributes
associated with it and the -preserveTextAttributes state is enabled when loading the design
(or using the layout create command).
o presentation — Text presentation (font, vertical, horizontal).
o strans — Instructions for text transformation (reflection, absolute magnification,
absolute angle).
o magnification — Magnification factor (real number).
o angle — Angular rotation, clockwise in degrees (real number).
Related Commands
$L create text $L delete cell
$L delete layer $L delete polygon
$L delete polygons $L delete ref
$L delete wire
$L delete wire
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the wire (also called a path) defined by the specified properties. (layer in cellName with
given width and coordinates.)
Usage
$L delete wire cellName layer width [-pathtype type [bgnextn endextn]]
[-prop attr string [G | U]] x1 y1 x2 y2 .... x_n y_n
Arguments
• cellName
A required argument that specifies the name of the cell from which the polygon is deleted.
• layer
A required argument that specifies the layer number or layer_number.datatype_number
designation for the layer containing the polygon.
• width
A required argument that specifies the width of the path to delete. By default, widths are in
database units (dbu).
Coordinate lengths are specified as either an integer, an integer followed by the character ‘d’
for dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• -pathtype type
An optional argument that specifies the type of path to delete. Allowed values are:
o 0 — path with no extension at the beginning or end
o 2 — path with beginning and end extensions equal to 1/2 the path width
o 4 — custom path, with user supplied values for the beginning and end extensions
The default type is 0.
• bgnextn
An optional argument that specifies the length of the beginning extension for the path.
Required when path type is 4.
• endextn
An optional argument that specifies the length of the beginning extension for the path.
Required when path type is 4.
Related Commands
$L delete cell $L delete layer
$L delete polygon $L delete polygons
$L delete ref $L exists cell
$L disconnect
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Disconnects connectivity layers previously created with the $L connect command. Only
original layout layers can be used with this command. This command allows you to modify
layer connectivity during a layout viewer session without exiting Calibre DESIGNrev and
restarting the tool.
Internally, layer names are translated into layer numbers, so if layer names are used to create $L
disconnect statements, a query on $L disconnect commands returns layer numbers. Layer names
must be loaded before using them in a $L disconnect statement.
This command can be used on both layouts and overlays.
Caution
The $L connect and $L disconnect statements ignore ordering of the layer1 and layer2
layers. The following commands are considered identical and results in only one
disconnection:
$L disconnect 1 2
$L dis connect 2 1
Usage
$L disconnect layer1 layer2 [by layer3] [via viacell] [width width]
Arguments
• layer1
A required argument that specifies the first layer to disconnect.
• layer2
A required argument that specifies the second layer to disconnect.
• by layer3
An optional third layer used to contain shapes that disconnect the two layers.
• via viacell
An optional layer used to specify the cell name of a via cell.
• width width
An optional size used to specify the width of the box dropped on the layer to disconnect
different segments of a multi-layer path. By default, widths are in database units (dbu).
Coordinate lengths are specified as either an integer, an integer followed by the character ‘d’
for dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
Returns
None
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
%
% $lay connect 1 3
% $lay connect 2 4 by 8 width 10.
% $lay connect 10 12 via 16.
%
% $lay disconnect 1 3
% $lay disconnect 2 4 by 8 width 10.
% $lay disconnect 10 12 via 16.
Related Commands
$L connect
$L duplicate cell
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Duplicates a cell, and adds it to the layout. The command is passed the name of a cell, which it
then duplicates.
Usage
$L duplicate cell cellname
Arguments
• cellname
A required argument that specifies the name of the cell to duplicate.
Returns
Name of duplicated cell.
Examples
layout0 duplicate cell c1250
Related Commands
$L create cell $L delete cell
$L exists cell
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Checks to see if the specified cell exists in the layout.
Usage
$L exists cell cellName
Arguments
• cellName
A required argument that specifies the name of the cell to check for.
Returns
Returns 1 if the cell exists, 0 if it does not.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay exists cell a2340
1
% $lay exists cell abc123def456
0
Related Commands
$L exists layer
$L exists layer
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Checks to see if the specified layer exists in the layout.
Usage
$L exists layer layer_num
Arguments
• layer_num
A required argument that specifies the layer number or layer_number.datatype_number
designation for the layer to check for.
Returns
Returns 1 if the layer exists, 0 if it does not.
Examples
This example checks if various layers exist:
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay exists layer 10
1
% $lay exists layer 14.4
1
% $lay exists layer 123456789
0
Related Commands
$L exists cell $L isLayerEmpty
$L expand cell
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Replaces all references to a specified cell with the contents of that cell. This brings all geometry
in the cell reference up one level of hierarchy, however references to cells within the cell are left
intact, and the cell definition is unaffected.
The cell definition itself is left intact and is not deleted from the design. Cell definitions contain
geometric data, while cell references exist at a specific location and contain no geometric data.
Note
Expanding a cell specifies the cell whose instance is to be expanded one level into the
space of the cells in which the expanded instances are placed. In expanding a cell, any
underlying hierarchy of the cell remains intact.
Flattening a cell specifies the cell whose instance is to be flattened up to the level of the
parent cells. The cell and its underlying hierarchy are replaced by a flattened view of the
shapes.
Usage
$L expand cell cellName
Arguments
• cellName
A required argument that specifies the name of the cell to expand.
Returns
None.
Examples
The following example expands cell b. Before expanding the cell, topcell contains an instance
of b and cell a also contains an instance of b. Expanding b results in the contents of b becoming
part of topcell as well as part of a:
# Before:
# topcell -> a -> b -> c -> d
# topcell -> c -> d
# topcell -> b -> c -> d
# After:
# topcell -> a -> c -> d
# topcell -> c -> d
# b -> c -> d
Related Commands
$L expand ref $L flatten cell
$L expand ref
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Replaces the specified reference(s) or array of references with the contents of a cell. It brings all
geometry in the cell up one level of hierarchy, and references to cells within the reference are
left intact.
Expand a cell reference when you want to include the cell contents directly into the design. This
places the cell geometry at the top level of the hierarchy and allows you to edit the geometry
without affecting the original cell.
Note
Expanding a cell reference cannot be undone, and it can only be done one cell reference
instance at a time. No other cell references are affected by an individual expansion. Once
a cell reference is expanded, it is no longer associated with the cell reference information
and is not updated by future changes to that cell. Cell references exist at a specific
location, and they contain no geometric data.
Usage
$L expand ref incell cellName x y mirror angle mag [cols rows xspace yspace]
Arguments
• incell
A required argument that specifies the cell containing the reference.
• cellName
A required argument that specifies the name of the cell being referenced.
• x y mirror angle mag [cols rows xspace yspace]
The location and orientation of the reference. This set of related arguments identifies exactly
which reference to flatten. The optional cols rows xspace yspace identifies an array of
references.
Returns
None.
Example
The following example expands a reference:
% info nameofexecutable
/clbr_latest/ic/ixl/Mgc_home/pkgs/icwb/pvt/calibrewb
% layout0 expand ref r172 b340 230 430 0 0 1
Related Commands
$L expand cell $L flatten ref
$L file
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays the filename for the current layout.
Usage
$L file
Arguments
None.
Returns
Returns the filename for this layout. If the layout was not created by loading in data from an
existing file, it returns the file handle.
If the “layout create -files” command is used to merge files during loading, an unexpected
pathname is returned with the file handle appended to the current working directory.
Example
% layout0 file
/home/labs/drvlab/lab2.gds
Related Commands
None.
$L flatten cell
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Flattens all levels of hierarchy of the specified cell across all instances of the cell. This impacts
the cell definition, and hence all references to the cell.
You flatten the hierarchy of a cell when you want to include the cell contents directly into the
design, allowing you to edit the geometry without affecting the parent cell, if not flattening the
topcell. Flattening a cell cannot be undone, and it can only be done one cell at a time.
Note
Flattening a cell specifies the cell whose instance is to be flattened up to the level of the
parent cells. The cell and its underlying hierarchy are replaced by a flattened view of the
shapes.
Expanding a cell specifies the cell whose instance is to be expanded one level into the
space of the cells in which the expanded instances are placed. In expanding a cell, any
underlying hierarchy of the cell remains intact.
Usage
$L flatten cell cellname [-withDelete]
Arguments
• cellname
A required argument that specifies the name of the cell to flatten.
• -withDelete
An optional argument which causes newly unreferenced cell definitions to be deleted from
the design as a result of the flatten operation.
Returns
None.
Examples
The following example flattens cell b. Before flattening the cell, cell b contains an instance of c
which in turn contains an instance of d. Flattening b results in the references to c and d that are
contained in b to be flattened into b:
# Before:
# topcell -> a -> b -> c -> d
# topcell -> b -> c -> d
# topcell -> c -> d
# After:
# d
# topcell -> a -> b
# topcell -> b
# topcell -> c -> d
# After:
# a -> b -> c -> d
# topcell
Related Commands
$L expand cell $L flatten ref
$L flatten ref
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Flattens all levels of polygons throughout the reference. This impacts the specified reference,
however the cell definition is unaffected.
Usage
$L flatten ref incell refcell x y mirror angle mag [cols rows xspace yspace]
[-prop attr string [G | U]]
Arguments
• incell
A required argument that specifies the cell containing the reference.
• refcell
A required argument that specifies the name of the cell being referenced.
• x y mirror angle mag [cols rows xspace yspace]
A required argument that specifies the location and orientation of the reference. This set of
related arguments identifies exactly which reference to flatten. The optional cols rows
xspace yspace identifies an array of references.
• -prop attr string [G | U]
An optional argument plus associated values defining polygon property data (PROPATTR
and PROPVALUE). More than one -prop argument can be specified.
For OASIS databases, specifying G for the third argument indicates that this is a standard
OASIS property that represents a GDS-style property. Use U to indicate an OASIS user
property.
G (GDS) is the default, and is the only allowed option for GDS files. If you write a file
containing OASIS user properties (U) as a GDS formatted file, the OASIS properties are
discarded.
Returns
None.
Example
The following example flattens a reference:
set inlayout [layout create "../input.oas" -dt_expand \
-preservePaths -preserveTextAttributes]
$inlayout flatten ref topcell b 4000 2000 0 0 1
$inlayout oasisout out.oas
Related Commands
$L expand ref $L flatten cell
$L gdsout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Writes the layout to a GDS-formatted file. This method does not work in read-only mode.
It prints the name of the output GDSII file to the transcript.
Usage
$L gdsout fileName[.gz | .Z] [cellName] [-place] [-texttype texttype]
[-map L [layer [datatype]]]... [-maxPolygonVertices value] [-maxPathVertices value]
[-depth depth] [-fixPolygons] [-noEmptyCells [noRefs]] [-log logfile]
[-clips name] [-clipsAll] [-clipsSplit] [-clipsScreen cellname ‘{’ llx lly urx ury ‘}’]
Arguments
• fileName[.gz | .Z]
A required argument that specifies the pathname for the file to which the layout is written. If
you append a .gz extension to the file name, the file is saved using gzip compression. If you
append a .Z to the file name, the file is saved using the “compress” command.
• cellName
An optional argument that instructs the method to write only that cell and its descendants to
the file. When not specified, the software writes all cells to the file.
• -place
Instructs the software to write ONLY the geometric contents of specified cell. When no cell
is specified, it writes the contents of the cell with the most sub hierarchy.
Without -place, this function writes the entire contents of the specified cell.
• -texttype texttype
A layer datatype to write the output text to. Overrides any datatype mapping that may be
present.
• -map L [layer [datatype]]
An optional argument and associated arguments used to control which layers are written to
the file, and, optionally, to map an application layer to a different layer and datatype in the
GDS file. More than one -map argument can be specified. If you do not specify the -map
keyword, all layers are written. L is the original layer, and if you specify a datatype for L, it
should be in the form “layer.datatype”.
Note
The layers specified with -map are also considered in the determination of whether a cell
is empty or not for the purposes of excluding it from being written out. Cells that contain
only shapes on layers that are not specified are considered empty and are not written out.
• -maxPolygonVertices value
If specified, sets a maximum polygon vertex amount that can exist in a single polygon in a
layout. If a polygon exceeds the vertex limit, the $L gdsout function segments the polygon
until it has a legal amount of vertices. Default is 8191, with a minimum of 3 and a maximum
of 8192 for the Calibre reader. (The GDS maximum is 8191; OASIS has no listed
maximum, but the listed value for the property is limited to an unsigned integer.)
• -maxPathVertices value
If specified, sets a maximum path vertex amount that can exist in a single path in a layout. If
a path exceeds the vertex limit, it is broken into smaller chains of paths. Default is 1024,
with a minimum of 2 and a Calibre reader maximum of 1024. (The GDS maximum is 8191;
OASIS has no listed maximum, but the listed value for the property is limited to an unsigned
integer.)
• -depth depth
An optional argument and associated depth used to allow writing a layout to a specific cell
hierarchy depth. Referenced cells above depth are written with full hierarchy. Referenced
cells at depth are not written, but references to them are written. Cells referenced first below
depth are not written, and their references are not written.
• -fixPolygons
An optional argument that instructs the tool to fix non-orientable (self-intersecting)
polygons. The vertices are rearranged so that the polygon is no longer self-intersecting, or
such that the polygon is split into multiple polygons. Choosing this option results in a
performance penalty, therefore the default is to not fix polygons.
• -noEmptyCells [noRefs]
An optional argument used to not write empty cell definitions when writing GDS files. If the
optional noRefs suboption is also specified, it suppresses the output of references to empty
cells as well as the empty cell definitions.
This option works recursively; if you suppress references within a cell that contained
references to only empty cells, the new empty cell that is created is also suppressed along
with its references.
• -log logfile
An optional argument used to write the information to a log file. Specify the file name using
logfile. To print the contents to the terminal window, specify “stdout” for logfile. The -log
option only works if the input file is GDS.
• -clips name
An optional argument and associated name of a clip that instructs the tool to write the clip to
a GDS file, cutting intersecting geometries.
• -clipsAll
An optional argument that instructs the tool to write all clips to a GDS file, cutting
intersecting geometries.
• -clipsSplit
An optional argument that instructs the tool to write all clips to a GDS file, generating a new
file for each clip. Each file written follows this rule for its name: design_name_clip_name
• -clipsScreen cellname ‘{’ llx lly urx ury ‘}’
An optional argument that, if specified, saves a clip version for a layout. The argument can
either save a screen view or a selected rectangular region. The coordinates specified are
lower left followed by upper right. Coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
Returns
None
Examples
This example outputs a GDSII file:
This example writes a GDSII file of all polygons in a given coordinate window:
This example renames all cells and writes out the new layout:
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
% set mycells [$lay cells]
foreach cell $mycells {
set newname "n20_$cell"
$lay cellname $cell $newname
}
$lay gdsout "n20_outfile3.gds"
# Write out layers 3 & 4, mapping them to 300 and 400.9 respectively
layout0 gdsout mix5.gds -map 3 300 0 -map 4 400 9
Related Commands
$L oasisout $O gdsout
$L gridsnap
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
This method manages the grid-snapping functionality provided by the application. Its function
varies according to the arguments supplied:
• Default (-checkonly not specified) — Snaps the data in all layers and all placements to
the specified value of gridsize. This method modifies the layout data, including
placements.
• If -checkonly is specified — Checks for geometries and cell references having
coordinates (origins or vertices) that do not fall on the grid points for a design grid of the
size gridsize. In this mode, any geometry that violates the grid is copied to the
outputlayer.
• The -c cellname option allows you to choose between performing the operation on the
full layout or just inside the specified cell.
Usage
$L gridsnap gridsize [-checkonly outputlayer] [-c cellname]
Arguments
• gridsize
A required argument, that specifies the size of the grid to which the layout data is snapped.
• -checkonly outputlayer
An optional argument and value pair that instructs the method to check for violations of the
grid defined by gridsize. When used, all data that violates the grid is copied to the
outputlayer.
o When polygon or text violate the grid, they are copied to outputlayer completely.
o When cell references violate the grid, a rectangle representing the bounding box of
the cell reference is created on outputlayer.
The outputlayer itself is not checked.
• -c cellname
An optional argument that signals the application to apply grid snapping or grid checking to
the specified cell rather than the entire layout.
Returns
None.
Example
layout0 gridsnap 20
Related Commands
$L SNAP
$L holdupdates
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Pauses cell bounding box (bbox) calculations. Bbox calculations are performed for operations
that modify the database, however for mass edits, you might want to postpone the bbox updates
until the end of a Tcl procedure.
The $L holdupdates command holds the updates until the end of the Tcl procedure that the
command was called in. Cascaded calls are allowed, and updates are held back until the end of
the procedure of the first call to $L holdupdates.
If $L holdupdates is executed, it automatically calls the function which resumes cell bbox
calculations, $L allowupdates, at the end of a Tcl procedure, therefore it is not necessary to pair
$L holdupdates and $L allowupdates commands by calling $L allowupdates directly. Use of $L
allowupdates is optional. Calling the $L allowupdates function directly gives you a way to
allow updates earlier than the end of the Tcl procedure.
Caution
If the bbox updates are postponed by the $L holdupdates command, queries that return
the bbox of the layout could potentially be incorrect as changes which modify the bbox of
cells have not yet been executed.
Note
$L holdupdates can only be called from within a Tcl procedure. It cannot be called from
the command line.
Usage
$L holdupdates
Arguments
None.
Returns
None.
Example
In this example, the create_layout_and_add_shapes_sample1 procedure calls the
create_many_shapes procedure, which holds bbox calculations. After the end of this procedure,
bbox calculation is triggered, and queries to get the cell bbox are now correct.
The create_layout_and_add_shapes_sample2 procedure suspends bbox calculations until the
call to allow updates. Any query of the bbox is wrong until the trigger of the bbox calculation
with allowupdates.
proc create_layout_and_add_shapes_sample1 {} {
set lay [layout create]
$lay create cell TOP
proc create_layout_and_add_shapes_sample2 {} {
set lay [layout create]
$lay create cell TOP
$L holdupdates
$L allowupdates
Related Commands
$L allowupdates
$L import layout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Imports the layout specified by the input handle into the layout object $L. You control how this
method resolves cell name conflicts with the mode argument.
Usage
$L import layout {handle | file} del mode [-dt_expand] [-preservePaths] [-ignoreGdsBoxes]
[-preserveTextAttributes] [-preserveProperties] [-ignoreDuplicateRefs]
Arguments
• handle | file
A required argument that specifies the handle or filename of the layout to import into $L.
Calibre searches the set of loaded files before searching on the disk.
• del
A required argument that specifies TRUE or FALSE, that sets whether to delete the input
layout (given by handle) while processing the import. Specifying TRUE conserves
memory.
• mode
A required keyword controlling how the application resolves cell name conflicts. Allowed
values are:
o append — If the cell already exists, the method appends imported elements to the
existing cell.
o overwrite — If the cell already exists, it is deleted and the new version of the cell is
used.
o rename — If cell already exists, the imported version gets renamed the extension
_WBx, where x is an integer.
• -dt_expand
An optional argument used to expand datatypes so that each layer and datatype combination
is mapped to a different layout layer. The layer number within the layout is
layer.datatype.
Note
This option is ignored when merging data from a previously loaded layout (using a
handle); it is only used if the imported layout is a file.
• -preservePaths
An optional argument used to preserve path definitions when reading layout files. By
default, paths are converted to polygons.
• -ignoreGdsBoxes
An optional argument used when creating a layout from a GDS file. Instructs the software to
ignore box records when reading the GDS file.
• -preserveTextAttributes
An optional argument instructing the software to preserve GDS Text Presentation and
Strans attribute data when reading data into or writing data from the application. This option
is ignored when merging data from a previously loaded layout (using a handle); it is only
used if the imported layout is a file. The default is to preserve these attributes.
• -preserveProperties
An optional argument used when merging a layout from a GDS file. Instructs the
application to preserve GDS geometry and reference property data (PROPATTR and
PROPVALUE). The default is to preserve these properties.
This option is ignored when merging data from a previously loaded layout (using a handle);
it is only used if the imported layout is a file.
• -ignoreDuplicateRefs
An optional argument. If specified, and the exact placements already exist, the command
does not append them.
Returns
None.
Example
The following object method imports all cells from another layout, and combines them.
layout0 import layout layout2 FALSE append
Related Commands
None.
$L instancedbout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Writes out instances of the specified cell to an ASCII results database as bounding boxes. This
command writes a single bounding box for an array of cell references (AREF).
Usage
$L instancedbout fileName cellName [inCell]
Arguments
• fileName
A required argument that specifies the pathname for the ASCII results database file to which
the cell data is written. This file is not appendable by subsequent runs of this command.
• cellName
A required argument that specifies the name of the cell to search for whose instances are
written to the ASCII results database file.
• inCell
An optional argument that specifies the name of a cell other than the topcell from which to
write the instance specified by cellName.
Returns
None.
Example
layout0 instancedbout frs.results TYcell
Related Commands
$L asciiout
$L isLayerEmpty
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Determines if no objects exist on the layer in the layout.
Usage
$L isLayerEmpty layer_num
Arguments
• layer_num
A required argument that specifies the layer number or layer_number.datatype_number
designation for the layer to check for.
Returns
Returns 1 if no objects exist on the layer, and 0 for any existing objects found on layer_num.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay isLayerEmpty 10
1
% $lay isLayerEmpty 60
0
Related Commands
$L exists layer
$L ismodified
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Determines if there have been any modifications made to the layout since the last save was
performed.
Usage
$L ismodified
Arguments
None.
Returns
Returns 1 if modifications are made to the layout since the last save, or 0 if no changes.
Examples
% $lay ismodified
1
% $lay gdsout saved.gds
Writing GDSII file: "saved.gds"
% $lay ismodified
0
Related Commands
None.
$L isOverlay
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Determines if the layout is an overlay.
Usage
$L isOverlay
Arguments
None.
Returns
Returns 1 if the layout is an overlay. Otherwise, returns 0.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
Related Commands
$O layoutHandle $O layouts
$O overlayCells $O overlayout
layout overlays $L isReferenced
$L layerFilters
$L isReferenced
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Determines if the layout is referenced in one or more overlays.
Usage
$L isReferenced
Arguments
None.
Returns
Returns 1 if the layout is referenced in one or more overlays. Otherwise, returns 0.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
Related Commands
$O layoutHandle $O layouts
$O overlayCells $O overlayout
layout overlays $L isOverlay
$L layerFilters
Usage
$L iterator {poly | wire | text} cell layer range startRange endRange
[-depth startDepth endDepth [-prop propName propValue]]
Arguments
• {poly | wire | text}
A required argument used to control the type of object being counted. Options are:
o poly — polygons and boxes.
o wire — GDS paths.
o text — text.
• cell
A required argument that specifies the name of the cell containing the objects to examine.
• layer
A required argument that specifies the layer_number or layer_number.datatype_number
designation for the layer containing the objects to count.
• range startRange endRange
A required argument (range) followed by a range of elements to return. The list returned
contains all elements in the original list with indices startRange through endRange,
inclusive. Indexes start at 0 for the first element. endRange can also be ‘end’ to specify the
last element in the list instead of an integer.
Non-Hierarchical Data
• Polygon — Each polygon returns:
{[{properties}] {x1 y1 x2 y2 ... xn yn}}
where:
o {properties} — a list of property attributes returned if the layout was read with
-preserveProperties. If the object has no properties associated with it when using
-preserveProperties, an empty list is returned. Without specifying
-preserveProperties, the list value is absent from the data.
o {x1 y1 x2 y2 ... xn yn} — ordered list of coordinates of the polygon vertices.
Coordinates are in database units (dbu).
Note
One of the more common uses for this command is to create a copy of an existing layer;
see the Examples section at the end of this reference page for important information.
where:
o width — path width, in database units (dbu).
o pathtype — path type values; is one of {0, 2, 4}.
o bgnextn endextn — the beginning line-end extent and ending line-end extent for the
path.
o {properties} — a list of property attributes returned if the layout was read with
-preserveProperties. If the object has no properties associated with it when using
-preserveProperties, an empty list is returned. Without specifying
-preserveProperties, the list value is absent from the data.
o {x1 y1 x2 y2 ... xn yn} — ordered list of coordinates of the path vertices. Coordinates
are in database units (dbu).
• Text — For each text object, returns the layer, coordinates, and string. The information is
returned in the following format:
{text x y [presentation [strans magnification angle]]}
where:
o x y — the coordinates of the text. Coordinates are in database units (dbu).
o text — the string displayed as text.
o [presentation [strans magnification angle]] — text attribute values, returned only if
the text has these attributes associated with it.
Hierarchical Data
• Polygon — Each polygon returns:
{[{properties}] {x1 y1 x2 y2 ... xn yn}} path {bbox}}
where:
o {properties} — a list of property attributes returned if the layout was read with
-preserveProperties. If the object has no properties associated with it when using
-preserveProperties, an empty list is returned. Without specifying
-preserveProperties, the list value is absent from the data.
o {x1 y1 x2 y2 ... xn yn} — ordered list of coordinates of the polygon vertices.
Coordinates are in database units (dbu).
o path — the path identifying the cell in which the polygon exists.
o {bbox} — the cell’s coordinate space as {x y width height}.
• Wire — Each wire returns:
{{width pathtype bgnextn endextn [{properties}] {x1 y1 x2 y2 ... xn yn}} path {bbox}}
where:
o width — path width, in dbu.
o pathtype — path type values; is one of {0, 2, 4}.
o bgnextn endextn — the beginning line-end extent and ending line-end extent for the
path.
o {properties} — a list of property attributes returned if the layout was read with
-preserveProperties. If the object has no properties associated with it when using
-preserveProperties, an empty list is returned. Without specifying
-preserveProperties, the list value is absent from the data.
o {x1 y1 x2 y2 ... xn yn} — ordered list of coordinates of the path vertices. Coordinates
are in database units (dbu).
o path — the path identifying the cell in which the wire exists.
o {bbox} — the cell’s coordinate space as {x y width height}.
• Text — For each text object, returns the layer, coordinates, and string. The information is
returned in the following format:
{{text x y [presentation [strans magnification angle]]} parent {bbox}}
where:
o x y — the coordinates of the text. Coordinates are in database units (dbu).
o text — the string displayed as text.
o [presentation [strans magnification angle]] — text attribute values, returned only if
the text has these attributes associated with it.
o parent {bbox} — the path identifying the parent cell in which the text exists and the
cell’s coordinate space as {x y width height}.
Examples
This example copies polygons from layer 2 in the cell called “nand”:
In designs with -preserveProperties specified, and with no properties attached to the polygons,
the coordinates are returned as a list starting with an empty list (denoted by braces) in front of
the coordinates:
{{ } x1 y1 x2 y2 .... xn yn}
The Tcl eval command is used to convert the coordinates to separate coordinates. The $L create
polygon command requires separate values for each coordinate.
Related Commands
$L COPY
Usage
$L iterator [export layer] {ref | sref | aref} cell range startRange endRange
[-depth startDepth endDepth [-filterCell cellname] [-prop propName propValue]]
[-arefToSrefs] [-duplicate]
Arguments
• export layer
Optionally, export your iterator result to a layer.
• {ref | sref | aref}
A required argument used to control which type of references are returned: single references
(sref), arrays (aref), or both (ref).
• cell
A required argument specifying the name of the cell containing the objects to examine.
• range startRange endRange
A required argument (range) followed by a range of elements to return. The list returned
contains all elements in the original list with indices startRange through endRange,
inclusive. Indexes start at 0 for the first element. endRange can also be ‘end’ to specify the
last element in the list instead of an integer.
o {properties} — a list of property attributes returned if the layout was read with
-preserveProperties. If the object has no properties associated with it when using
-preserveProperties, an empty list is returned.
• Aref — Returns the cell name, coordinates, and orientation, plus array dimensions and
spacing for each array of references. This command also returns any properties associated
with the reference. The information is returned in the following format:
{cell_name x y mirror angle mag cols rows xspace yspace [{properties}]}
where:
o cell_name, x, y, mirror, angle, mag — name of the referenced cell, and orientation in
the design.
o cols rows xspace yspace — array columns and rows, spacing along the X and Y
directions.
o {properties} — a list of property attributes returned if the layout was read with
-preserveProperties. If the object has no properties associated with it when using
-preserveProperties, an empty list is returned.
Hierarchical Data
• Sref — For each single reference, returns the coordinates, width, and height of the bounding
box of the reference, cell name, coordinates, and orientation. If the reference has properties
associated with it, the command also returns those properties. The information is returned in
the following format:
{{cell_name x y mirror angle mag [{properties}]} path {bbox}}
where:
o cell_name, x, y, mirror, angle, mag — name of the referenced cell, and orientation in
the design.
o {properties} — a list of property attributes returned if the layout was read with
-preserveProperties. If the object has no properties associated with it when using
-preserveProperties, an empty list is returned.
o path — the path identifying the cell in which the SREF exists.
o {bbox} — the cell’s coordinate space as {x y width height}.
• Aref — For each array of references, returns the coordinates, width, and height of the
bounding box of the reference, cell name, coordinates, and orientation, plus array
dimensions and spacing. If the reference has properties associated with it, the command also
returns those properties. The information is returned in the following format:
{{cell_name x y mirror angle mag cols rows xspace yspace [{properties}]} path {bbox}}
where:
o cell_name, x, y, mirror, angle, mag — name of the referenced cell, and orientation in
the design. Coordinates are in database units (dbu).
o cols rows xspace yspace — array columns and rows, spacing along the X and Y
directions.
o {properties} — a list of property attributes returned if the layout was read with
-preserveProperties. If the object has no properties associated with it when using
-preserveProperties, an empty list is returned.
o path — the path identifying the cell in which the AREF exists.
o {bbox} — the cell’s coordinate space as {x y width height}.
Examples
This first example displays a list of objects, reporting all duplicated placements in the mask.
Duplicated instances are in the RDB file, dup2200, as polygons.
set mylayout [layout create lab2.oas]
$mylayout create layer 2200
set totcnt 0
set cells [layout peek lab2.oas -cells]
foreach cell $cells {
set cnt [llength [$mylayout iterator export 2200 ref $cell \
range begin end -duplicate]]
incr totcnt $cnt
puts "Found $cnt duplicate(s) in $cell"
}
puts "Total duplicated $totcnt"
$mylayout rdbout dup2200 e13656z -layers 2200
Related Commands
None.
Arguments
• {poly | wire | text}
A required argument used to control the type of object being counted. Options are:
o poly — Polygons and boxes.
o wire — GDS paths.
o text — Text.
• cell
A required argument that specifies the name of the cell containing the objects to count.
• layer
A required argument that specifies the layer_number or layer_number.datatype_number
designation for the layer containing the objects to count.
• -depth startDepth endDepth
An optional argument used to specify the hierarchical output of objects between startDepth
and endDepth with the search beginning in cell. When traversing the hierarchy, each
instance within an AREF is traversed. This has the effect of hiding AREFs and returning all
placement locations, provided the depth is deep enough.
Returns
Returns the number of objects of the indicated type in the indicated cells and layers.
Example
% layout0 iterator count wire r2200 poly
2
Related Commands
None.
Arguments
• {ref | sref | aref}
A required argument used to control which type of references are returned: single references
(sref), arrays (aref), or both (ref).
• cell
The name of the cell containing the references to count.
• -depth startDepth endDepth
An optional argument used to specify the hierarchical output of objects between startDepth
and endDepth with the search beginning in cell. When traversing the hierarchy, each
instance within an AREF is traversed. This has the effect of hiding AREFs and returning all
placement locations, provided the depth is deep enough.
• -filterCell cellName
An optional argument used to return the count of objects only pertaining to cellName. The
-filterCell option is only valid for SREF and AREF-type iterators, and it is only supported
when the -depth option is specified.
• -arefToSrefs
Returns SREF objects representing the internal instances of any AREFs.
• -duplicate
Finds duplicate geometries, reporting all duplicated placements.
Returns
Returns the number of objects of the indicated type in the indicated cells and layers.
Example
The example checks a GDS database for empty cells.
% cat gdscheck.tcl
# Usage: calibredrv gdscheck.tcl file.gds
set gdsfile [lindex $argv 0]
set outf [open ./gdscheck.txt w]
set L [layout create $gdsfile -dt_expand]
set topblock [$L topcell]
set cells [$L cells]
set layers [$L layers]
# Report heading
puts $outf "Input File Path: [$L file]"
puts $outf "\nTopCell: [$L topcell all]"
Related Commands
None.
$L layerconfigure
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Configures a layer with the specified layer properties.
Usage
$L layerconfigure [-regular | -shadow | -all] layerNumber [layer_options]
Arguments
• -regular | -shadow | -all
An optional argument that specifies the type of layers to configure. Allowed values are:
o -regular — configures only regular layers; those that exists in the layout.
o -shadow — configures only shadow layers: those that no longer exist in the layout
but are saved in case they are needed at a later time.
o -all — configures all layers, regular and shadow.
The default is -regular.
• layerNumber
A required argument that specifies the layer number or layer_number.datatype_numer
designation for the layer to be configured.
• layer_options
An optional argument that specifies the layer property and value pairs to change. Those
properties not specified remain unchanged. The layer properties you can configure with this
command are:
o -fill fill_color — The fill color. Values can be any valid tcl color or the pound sign
“#” followed by the RGB color representation.
o -outline outline_color — The outline color. Values can be any valid tcl color or the
pound sign “#” followed by the RGB color representation.
o -outlinewidth line_width — The line width, expressed in pixels.
o -stipple fill_pattern — The fill pattern can be one of:
• clear
• diagonal_1
• diagonal_2
• wave
• brick
• circles
• speckle (formerly gray50)
• light_speckle (formerly gray12)
• solid
• @<pathname>
where pathname is the path to a .xbm file. It should be the full path to the file.
o -visible — A Boolean indicating whether the layer is visible or not.
• 0 — not visible
• 1 — visible
Returns
List of layer properties.
Example
% layout0 layerconfigure 4
-fill red -outline red -stipple gray12 -visible 1 -outlinewidth 1
Related Commands
None.
$L layerFilters
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Allows the definition of layer filters used to filter the layers shown in the Layers Browser.
Usage
$L layerFilters [-mdpChipView | -mdpLevelView] -names [layer] |
-layers filterName_0...filterName_n | -add filterName layer_0...layer_n
Arguments
• -mdpLevelView | -mdpChipView
For use with MDP jobdecks. Jobdecks support two sets of layer filters. One for each of the
level layer view, and the chip layer view.
• -names [layer]
Retrieve filter names defined in the layout. Optionally retrieve the filters for a specific layer
within the layout.
• -layers filterName_0...filterName_n
Retrieve a unique set of layers for the specified filter(s). Specifying multiple filters performs
an OR of the filter layers.
• -add filterName layer_0...layer_n
Add layer filter to the list of filters. filterName is the layout designator for the Calibre
DESIGNrev layer, and layer_0...layer_n is the list of layers, separated by spaces.
Returns
There are returns when the command is used as a query. The “$L layerFilters -names”
command returns filter names defined in the layout. The “$L layerFilters -layers” command
returns a unique set of layers for the specified filters.
Example
% cat mylayout.gds.layerprops
3 red diagonal_2 altmix 1 1
4 pink speckle 4 1 1
5 orange speckle Orange 1 1
7 purple speckle 7 1 1
11 blue speckle Blue 1 1
layerFilter ma 4
layerFilter mb 4 7
% $L layerFilters -names
# mb ma
$L layerFilters -layers mb
# 4 7
$L layerFilters -names 4
# mb ma
$L layerFilters -names 1
# ""
Related Commands
$O layoutHandle $O layouts
$O overlayCells $O overlayout
layout overlays $L isOverlay
$L isReferenced
$L layernames
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
This method manages layers within $L. Its function varies according to the arguments you
supply:
• No arguments — Returns a list of layer number and layer name pairs, with one pair for
every layer in the layout.
• Specify a single layer number — Returns the layer name associated with that layer
number.
• Specify a single layer number and layer name — Sets the layer name for that layer
number to be layerName.
• Specify -oasis — Outputs OASIS layer details.
Note
Previous to Calibre release 2011.4, the $L layernames command returned strings, and
layout viewer Tcl scripts passed these returned strings on to Tcl commands expecting true
Tcl lists. Under most conditions, script commands receiving a string treated as a Tcl list
(rather than receiving a true Tcl list) have no issues. However, occasionally these
returned strings led to floating point inaccuracies, improper handling of special
characters, poorly formatted lists, inconsistencies between formatted objects, and
unnecessary memory used to hold the strings. To correct these issues, the $L layernames
command has been updated to return true Tcl lists containing Tcl_Obj objects.
Usage
$L layernames [-regular | -shadow | -all] [layerNumber [layerName]]
$L layernames -oasis
Arguments
• -regular | -shadow | -all
An optional argument that specifies the type of layers the command operates on. Allowed
values are:
o -regular — operates on only regular layers; those that exists in the layout.
o -shadow — operates on only shadow layers: those that no longer exist in the layout
but are saved in case they are needed at a later time.
o -all — operates on all layers, regular and shadow.
• layerNumber
The layer number or layer_number.datatype_number designation for the layer whose layer
name is returned or set (if layerName is specified.)
• layerName
The string to which the layer name for layerNumber is set.
• -oasis
An optional argument that outputs a list of OASIS layer name details, as described in the
OASIS standard. The list format is as follows:
{{record_type n-String interval_type bound_a bound_b interval_type bound_a
bound_b} ...}
Returns
Returns a list of layer number, layer name pairs.
Example
% $lay layers
1 2 5
% $lay layernames 1 POLY
% $lay layernames 1
POLY
% $lay layernames
1 POLY 2 2 5 5
% $lay layernames 2 \$M1
% $lay layernames 2
$M1
% $lay layernames
1 POLY 2 {$M1} 5 5
Related Commands
None.
$L layers
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays list of all layer numbers in this layout.
Layer numbers are either integers, or integers followed by a period and a datatype. The syntax is
layernum.datatype. Datatypes are defined as sub-layers of the main layer number. The layout
viewer drops zero datatypes, therefore 10 and 10.0 represent the same layer and datatype pair.
Usage
$L layers [-regular | -shadow | -all] [-cell cellName] [-name layerName] [-layernum layerNum]
Arguments
• -regular | -shadow | -all
An optional argument indicating the type of layers to return in the list.
o -regular — returns only regular layers; those that exists in the layout.
o -shadow — returns only shadow layers: those that no longer exist in the layout but
are saved in case they are needed at a later time.
o -all — returns all layers, regular and shadow.
The default is -regular.
• -cell cellName
An optional argument indicating the output is only the layers used in the specified cell,
cellName.
• -name layerName
An optional argument to specify a layer name and returning the layer number (or layer
number and datatype if one is included).
• -layernum layerNum
An optional argument to specify a layer number and returning all layers with the same layer
number, including different datatypes.
Returns
If the -name argument is used, returns the defined layers for the specified layer name.
If the -layernum argument is used, returns all layers with the same layer number.
Otherwise, returns list of all the layers in the layout.
Examples
This example obtains defined layers for a layer name. First, this is the list of layer numbers,
including sub-layers:
% layout0 layers
1 2.1 2.2 2.4 2.6 4 5 6 7 8 9 10 28 29 30 60
This example filters by layer number. First, this is the list of layer numbers, including sub-
layers:
% $L layers
1 2 3 3.1 3.2 3.20 3.200 4 5
Returns all layers with the specified layer number, including different datatypes:
$L layers -layernum 3
3 3.1 3.2 3.20 3.200
This example finds the layers used in each of the cells in a layout:
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
% set mycells [$lay cells]
lab2 a1500 a1890 a1900 a1960 a2010
% foreach cell $mycells {
puts "Layers used in cell $cell are: [$L layers -cell $cell]"
}
Layers used in cell lab2 are: 6 2
Layers used in cell a1500 are: 4 2 1
Layers used in cell a1890 are: 8 6 4 2
Layers used in cell a1900 are: 8 2 1
Layers used in cell a1960 are: 8 6 4 2
Layers used in cell a2010 are: 8 6 4
Related Commands
$L cells
$L layoutType
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Checks or sets the supplied layout’s type property to the supplied type, useful in cases such as
when a file is loaded as GDS, but saved as OASIS. No type checking is performed by this
command. You use this command to indicate to the GUI File > Save option which layout type
to save the layout as.
Usage
$L layoutType [set {gds | oasis | ascii}]
Arguments
• set {gds | oasis | ascii}
An optional argument that specifies the new type for the layout.
Note
$L layoutType set is often used when creating a new layout handle.
Returns
If called with no options, it returns one of the following: gds, oasis, ascii, overlay, mdp.
Example
layout0 layoutType set gds
Related Commands
None.
$L libname
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Retrieves the GDS LIBNAME value if no library name is specified; sets the GDS LIBNAME
value if one is specified as an argument.
Usage
$L libname [library_name]
Arguments
• library_name
An optional argument that specifies the new value for GDS LIBNAME.
Returns
Returns the GDS library name if no library name is specified, otherwise there are no returns.
Examples
% basename [info nameofexecutable]
calibrewb
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay libname
mentor.db
% $lay libname dawas.db
% $lay libname
dawas.db
Related Commands
None.
$L maxdepth
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns the maximum depth of the selected cell in the layout.
If a cell name is not specified, the layout viewer returns the highest depth in the design.
Usage
$L maxdepth [cellName]
Arguments
• cellName
An optional cell name for which to determine the maximum depth. The default is to return
the highest depth in the design.
Returns
The result is an integer representing the depth.
Example
% layout0 maxdepth c32d
4
Related Commands
None.
$L MASK_LAYER_INFO
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Calculates the area and extent of a layer. The command flattens all geometries and references of
the specified cell and layers (or the layer subset, if the endDepth argument is supplied) to a
temporary data structure, and then merges found geometries so that nothing is overlapping. The
command then calculates the area and extent, based on the current database units.
This command is read-only and does not modify layers. It returns an error if a layer does not
contain objects.
Usage
$L MASK_LAYER_INFO cellName layer [endDepth]
Arguments
• cellName
A required argument that specifies a required name of a cell to start the hierarchical scan. If
the specifed cell does not exist, the command generates an error.
• layer
A required argument that specifies a required layer number to scan. If the layer contains no
objects the area returned is zero. If the layer does not exist, the command generates an error.
• endDepth
An optional depth down the hierarchy from the current level to complete the scan at. The
default is all levels.
Returns
The result is a list in the following format:
area llx lly width height
Example
% layout0 MASK_LAYER_INFO lab2 1
46259625000.0 20250 19750 415000 368250
Related Commands
None.
$L modify origin
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Changes the origin of a specified cell from (0, 0) to x y, in database units.
Usage
$L modify origin cellName x y [-anchor_refs]
Arguments
• cellName
A required argument that specifies the name of the cell whose origin is to be modified.
• xy
A required argument that specifies the coordinates at which to place the origin of the cell.
By default, coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• -anchor_refs
An optional argument used to force references to stay in place.
Returns
None.
Examples
This example changes the origin of a cell:
This example returns the bounding box of a cell and modifies the origin of the cell:
% $L bbox inv
-4000 -18000 23000 18000
% $L modify origin inv -100.0u 100.0u
% $L bbox inv
96000 -118000 123000 -82000
% $L modify origin inv 100.0u -100.0u
-4000 -18000 23000 18000
Related Commands
$L cells
$L modify text
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes an existing text object and creates a new one to replace it.
Usage
$L modify text cellName layer x1 y1 text layerNew x1New y1New textNew
Arguments
• cellName
A required argument that specifies the name of the cell in which the original text object
exists.
• layer
A required argument that specifies the layer number or layer_number.datatype_number
designation for the layer containing the original text object.
• x1 y1
A required argument that specifies the coordinates of the center of the original text object.
By default, coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• text
A required argument that specifies the text string displayed by the original text object.
• layerNew
A required argument that specifies the layer number or layer_number.datatype_number
designation for the layer containing the new text object.
• x1New y1New
A required argument that specifies the coordinates of the center of the new text object. By
default, coordinates are in dbu.
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• textNew
A required argument that specifies the text string to be displayed by the new text object.
Returns
None.
Example
layout0 modify text mix 2 -95800 -92000 "mytext" 2 -95800 -92000 "newtext"
Related Commands
None.
$L NOT
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Performs a Boolean NOT on the specified layers and writes the output to the layer Lout. Selects
all L1in polygon areas not common to L2in polygons. If L2in is empty, the function generates
output equivalent to the polygon data on L1in. The Boolean NOT operation is performed on a
cell-by-cell basis. It cannot be used as a hierarchical operation.
Figure 6-3 shows two Boolean NOT operations. The left operation selects all lay1 polygon area
not common to lay2 polygons. The right operation selects all lay2 polygon area not common to
lay1 polygons.
lay1
lay2
Usage
$L NOT L1in L2in Lout
Arguments
• L1in
A required argument that specifies the name of the first layer to be NOTed.
• L2in
A required argument that specifies the name of the second layer to be NOTed.
• Lout
A required argument that specifies the name of the output layer for the operation. The output
layer specified should not also be an input layer.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
% $lay NOT 2 4 101
% $wb updateDisplay
Related Commands
$L AND $L OR
$L XOR
$L oasisout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Writes the layout to a OASIS-formatted file. This method does not work in read-only mode.
Usage
$L oasisout fileName [.z | .gz | .Z] [cellName] [-place] [-map L [layer [datatype]]]...
[-maxPolygonVertices value] [-maxPathVertices value] [-depth depth]
[-fixPolygons] [-noEmptyCells [noRefs]] [-cBlocks] [-strictMode]
[-clips name] [-clipsAll] [-clipsSplit] [-clipsScreen cellname ‘{’ llx lly urx ury ‘}’]
[-noRefRepetition] [-noPathRepetition] [-noPolyRepetition] [-noStringRepetition]
[-noRepetition]
Arguments
• fileName[.z | .gz | .Z]
A required argument that specifies the pathname for the file to which the layout is written. If
you append a .z or .gz extension to the file name, the file is saved using gzip compression. If
you append a .Z to the file name, the file is saved using the “compress” command. gzip and
compress must be in your path for this compression to function.
• cellName
An optional argument that instructs the method to write only that cell and its descendants to
the file. When not specified, the software writes all cells to the file.
• -place
Instructs the software to write output only the geometric contents of specified cell. When no
cell is specified, it defaults to the cell with the most sub hierarchy.
• -map L [layer [datatype]]...
An optional argument used to control which layers are written to the file, and, optionally, to
map an application layer to a different layer and datatype in the OASIS file. More than one
-map argument can be specified. If you do not specify the -map keyword, all layers are
written.
Note
The layers specified with -map are also considered in the determination of whether a cell
is empty or not for the purposes of excluding it from being written out. Cells that contain
only shapes on layers that are not specified are considered empty and are not written out.
• -maxPolygonVertices value
If specified, sets a maximum polygon vertex amount that can exist in a single polygon in a
layout. If a polygon exceeds the vertex limit, the $L oasisout function segments the polygon
until it has a legal amount of vertices. The default is 8191, with a minimum of 3 and a
maximum of 8192. (The GDS maximum is 8191; OASIS has no listed maximum, but the
listed value for the property is limited to an unsigned integer.)
• -maxPathVertices value
If specified, sets a maximum path vertex amount that can exist in a single path in a layout. If
a path exceeds the vertex limit, it is broken into smaller chains of paths. The default is 1024,
with a minimum of 2 and a maximum of 1024. (The GDS maximum is 8191; OASIS has no
listed maximum, but the listed value for the property is limited to an unsigned integer.)
• -depth depth
An optional argument and associated depth used to allow writing a layout to a specific cell
hierarchy depth. Referenced cells above depth are written with full hierarchy. Referenced
cells at depth are not written, but references to them are written. Cells referenced first below
depth are not written, and their references are not written.
• -fixPolygons
An optional argument that instructs the tool to fix non-orientable (self-intersecting)
polygons. The vertices are rearranged so that the polygon is no longer self-intersecting, or
such that the polygon is split into multiple polygons. Choosing this option results in a
performance penalty, therefore the default is to not fix polygons.
• -noEmptyCells [noRefs]
An optional argument used to not write empty cell definitions when writing OASIS files. If
the optional noRefs suboption is also specified, it suppresses the output of references to
empty cells as well as the empty cell definitions.
This option works recursively; if you suppress references within a cell that contained
references to only empty cells, the new empty cell that is created is also suppressed along
with its references.
• -cBlocks
Writes CBLOCKS (compression cell blocks) at the cell level. (In the layout viewer, this
option is available in the File > SaveAs dialog box.)
• -strictMode
Writes OASIS files in strict mode (file type OASIS-STRICT-MODE), which may improve
subsequent Calibre batch run performance.
Note
Layout viewer strict mode arguments are set consistently with Calibre strict mode
arguments.
• -clips name
An optional argument and associated name of a clip that instructs the tool to write the clip to
an OASIS file, cutting intersecting geometries.
• -clipsAll
An optional argument that instructs the tool to write all clips to an OASIS file, cutting
intersecting geometries.
• -clipsSplit
An optional argument that instructs the tool to write all clips to an OASIS file, generating a
new file for each clip. Each file written follows this rule for its name:
design_name_clip_name
• -clipsScreen cellname ‘{’ llx lly urx ury ‘}’
An optional argument that, if specified, saves a clip version for a layout. The argument can
either save a screen view or a selected rectangular region. The coordinates specified are
lower left followed by upper right. Coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• -noRefRepetition
An optional argument that instructs the tool to prevent repeated cell placements from being
collapsed into repetitions. Arrays with rotated and non-integer scaled cells are created
regardless of whether -noRefRepetition is used.
• -noPolyRepetition
An optional argument that instructs the tool to disable polygon compression.
• -noPathRepetition
An optional argument that instructs the tool to disable path compression.
• -noStringRepetition
An optional argument that instructs the tool to disable string compression.
• -noRepetition
An optional argument that instructs the tool to disable reference, polygon, path, and string
repetitions.
Returns
It prints the name of the output OASIS file to the transcript.
Examples
This example outputs an OASIS file:
layout0
# Write out layers 3 & 4, mapping them to 300 and 400.9 respectively
$lay oasisout mix5.gds -map 3 300 0 -map 4 400 9
Related Commands
$L gdsout $O oasisout
$L options
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Checks to see the options that were set when the layout was created (using layout create).
Usage
$L options [report_mode]
Arguments
• report_mode
An optional argument that specifies the option to report on. At most one of the following
option arguments are allowed.
o -map — Returns the map options specified for the layout, or the null string (“”) if no
mapping options were specified when the layout was created. The map options are
returned in a list that has the following format:
{layer0 datatype0 mapped_layer0 ... layer_n datatype_n mapped_layern}
o -only — Reports on whether or not the -only (load mapped layers) option was
specified when the layout was created.
o -dt_expand — Reports on whether or not the -dt_expand option was specified when
the layout was created.
o -ignoreGdsBoxes — Reports on whether or not the -ignoreGdsBoxes option was
specified when the layout was created. This option is valid only for layouts to be
saved in GDS format.
o -preservePaths — Reports on whether or not the -preservePaths option was specified
when the layout was created.
o -preserveTextAttributes — Reports on whether or not the -preserveTextAttributes
option was specified when the layout was created. This option is valid only for
layouts to be saved in GDS format.
o -preserveProperties — Reports on whether or not the -preserveProperties option was
specified when the layout was created. This option is valid only for layouts to be
saved in GDS format.
Returns
If no argument is specified, returns a list of options set on the layout. If an argument is specified,
returns 0 or 1 (-map returns a string):
• 0 — the option was not used when the layout was created.
Related Commands
None.
$L OR
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Performs a Boolean OR on the specified layers and merges the output to the layer Lout. The
Boolean OR operation is not a hierarchical operation.
Usage
$L OR L1in L2in Lout
Arguments
• L1in
A required argument that specifies the name of the first layer to be ORed.
• L2in
A required argument that specifies the name of the second layer to be ORed.
• Lout
A required argument that specifies the name of the output layer for the operation. The output
layer specified should not also be an input layer.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
% $lay OR 2 4 102
% $wb updateDisplay
Related Commands
$L AND $L NOT
$L XOR
$L pushmarkers
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview
Description
Shifts error markers in a specified Calibre RVE ASCII database in the hierarchy to match
coordinates with polygons on the relevant cell level, and outputs the modified database to a new
file.
Normally, Calibre tools generate all error markers in the coordinates of the topcell and at the
highest depth. This command scans the design on layers specified in the -map arguments and if
there are shapes on that layer that interact (are touching or are overlapped by) an error marker,
the marker is pushed down to that level. If multiple polygons on different levels interact with
the marker, the markers are moved to the highest level that has interacting shapes.
Loading the Calibre RVE ASCII database that is output from this command shows the error
markers at their new levels.
Usage
$L pushmarkers input_file [-out output_file] [-cell cellName] [-only]
[-map {rulename1 | *} layer1[.datatype1]]
[-map {rulename2 | *} layer2[.datatype2]]
...
Arguments
• input_file
A required argument that specifies the Calibre RVE ASCII database to scan.
• -out output_file
An optional argument that specifies the output file to write. If this argument is not specified,
the name output.rdb is used by default.
• -cell cellName
An optional argument that specifies the name of the topcell in the input Calibre RVE ASCII
database. This is only used if the database topcell does not match the topcell in the layout
handle.
• -only
An optional argument. If specified, this command only outputs markers from rules that are
named in the -map argument.
Related Commands
None.
$L query
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Outputs the requested element nearest to the given (X,Y) coordinate and displays relevant
information about that element. The information returned varies according to the type of object.
If more than one object of the same type and distance from the search point exists at the
specified coordinates, the function outputs all of the objects and their properties.
Note
Only the closest or equally close objects are returned by the query.
To perform the search, the application creates a search area in the shape of a box, with (X,Y)
located at the center of the box. You can define the size of the box through the optional
arguments maxSearchDistanceX (width) and maxSearchDistanceY (height). By default, the box
is 1 micron square.
The input coordinates and output coordinates are all in database units.
Note
Previous to Calibre release 2011.2, the $L query command returned strings, and layout
viewer Tcl scripts passed these returned strings on to Tcl commands expecting true Tcl
lists. Under most conditions, script commands receiving a string treated as a Tcl list
(rather than receiving a true Tcl list) have no issues. However, occasionally these
returned strings led to floating point inaccuracies, improper handling of special
characters, poorly formatted lists, inconsistencies between formatted objects, and
unnecessary memory used to hold the strings. To correct these issues, the $L query
command has been updated to return true Tcl lists containing Tcl_Obj objects.
Usage
$L query {ref | polygon | wire | edge | vertex| closept | text} cell startDepth endDepth x y
[maxSearchDistanceX maxSearchDistanceY] [-path | -pathlist] [-list] [-inside]
Arguments
• {ref | polygon | wire | edge | vertex| closept | text}
A required argument used to control which type of object is being returned. Options are:
o ref — Returns information about the nearest cell reference(s). If the reference is an
array, the information also lists the array dimensions and spacing. When more than
one cell reference share the same closest point, query returns a list containing all
these cell references.
o polygon — Returns the polygon layer and vertices, followed by information about a
closest point on the polygon. When more than one polygon share the same closest
point, query returns a list containing all these polygons.
o wire — Returns path attributes and vertices, followed by information about a closest
point on the path. When more than one wire share the same closest point, query
returns a list containing all these wires.
o edge — Returns a nearest edge of a visible polygon.
o vertex — Returns a nearest vertex of a visible polygon.
o closept — Returns the nearest point of a visible polygon. When more than one
visible polygon has the same nearest point, query closept keeps only the first one
that it found.
o text — Returns the nearest text object. When more than one text object share the
same closest point, query returns a list containing all these text objects.
• cell
A required argument identifying the cell in which to search.
• startDepth endDepth
A pair of required arguments defining the levels of hierarchy to search. The query search
only returns objects that exist on a level between startDepth and endDepth, inclusive.
• xy
A pair of required arguments defining the (x,y) coordinates of the search point. By default,
coordinates are in database units (dbu).
Coordinates are specified as either an integer, an integer followed by the character ‘d’ for
dbu, or a floating point number (or integer) followed by the character ‘u’ for microns.
• maxSearchDistanceX maxSearchDistanceY
A pair of optional arguments defining the size of the search area. maxSearchDistanceX
defines the width of the search area. maxSearchDistanceY defines the height. When not
specified, these values default to 1 micron.
This argument acts as a filter on the results; if no objects meet the filter criteria (are located
within the specified distance), no results are returned.
• -path
An optional argument used to append the hierarchical path to the returned data. This option
only works for GDS and OASIS layouts, and it does not apply to MDP or view-only OASIS
data. The option cannot be used along with the -pathlist option.
• -pathlist
An optional argument used to append the hierarchical path as a Tcl list to the returned data.
This option only works for GDS and OASIS layouts, and it does not apply to MDP or view-
only OASIS data. The option cannot be used along with the -path option.
• -list
An optional argument which causes the return list to always contain sublists of the matching
database objects. This assists with the processing of multiple returned objects. The query
ref, query edge, and query vertex return object types already behave in this manner and
are unaffected.
• -inside
An optional argument to check if a point is inside a polygon. By default, the $L query
command allows you to specify the search distance. Using the -inside option indicates that
the search coordinate must be inside or on the polygon outline. For example:
$L query polygon TOPCELL 0 0 1600 2500 -inside
The results are all polygons that match. In this example, only polygons and paths are
returned which enclose the search coordinate, 1600 2500. If the point is on the edge of the
polygon, it is considered inside as well.
The -inside option works for all object types, including paths, text, and refs. Zero width
paths and text are only returned if the search point is on the center line or origin, and refs are
returned if the search coordinate is inside or on the extent (bbox) of the referenced cell.
Note
When the -inside option is used, the search distance is disabled. As no search distance is
given, the query returns all objects which enclose or touch the search point, regardless of
their proximity to the search point. The information on which edge or vertex is closest
and the actual distance from the search point are also returned with this option.
Returns
Returns a Tcl list containing Tcl objects. Floating point values are returned as Tcl floating
point objects. Special characters requiring escaping are escaped as necessary. For example, a
string object containing a single ‘}’ is escaped to prevent Tcl from parsing the ‘}’ as a closing
string or command clause. Strings containing special Tcl characters, such as cell names
containing $ or [1], and property text strings containing blanks, are enclosed in braces when
necessary.
Returns are specific to the object type being returned:
• ref — For each reference, returns the coordinates, width, and height of the bounding box of
the reference, cell name, coordinates, and orientation, plus array dimensions and spacing if
the reference is an array. If the layout is a GDS layout, and the reference has properties
associated with it, the command also returns those properties. The information is returned in
the following format:
{llcx llcy xlen ylen cell_name x y mirror angle mag [cols rows xspace yspace]
[{properties}]}
where:
o llcx and llcy — lower left corner of the bounding box of the reference.
o xlen and ylen — width and height of the bounding box of the reference, respectively.
o cell_name, x, y, mirror, angle, mag — name of the referenced cell and orientation in
the design. For returned X and Y values, the coordinate space of the specified cell is
used.
o cols rows xspace yspace — array information, returned only if the reference is an
array.
o {properties} — a list of property attribute name and value pairs, returned only if the
layout is type GDS and the reference has properties associated with it.
• polygon — For each polygon, returns the layer and vertices, followed by information about
the closest point on the polygon. If the layout is a GDS layout, and the polygon has
properties associated with it, the command also returns those properties. The information is
returned in the following format:
{layer [{properties}] {x1 y1 x2 y2 ... xn yn}} idx "v"|"e" dist {xpt ypt}
where:
o layer — layer polygon is on.
o {properties} — a list of property attribute name and value pairs, returned only if the
layout is type GDS and the polygon has properties associated with it.
o {x1 y1 x2 y2 ... xn yn} — ordered list of coordinates of the polygon vertices.
o idx — index of the vertex or edge containing the nearest point.
o "v”| "e" — "v" if the closest point is a vertex, "e" if the closest point is on an edge.
o dist — distance between the closest point and the query point.
o {xpt ypt} — coordinates of the closest point.
• wire — For each wire, returns the path attributes and vertices, followed by information
about the closest point on the path. If the layout is a GDS layout, and the wire has properties
associated with it, the command also returns those properties. The information is returned in
the following format:
{layer width pathtype bgnextn endextn [{properties}] {x1 y1 x2 y2 ... xn yn} idx "v"|"e" dist
{xpt ypt}}
where:
o layer — layer path is on.
o width — path width.
o pathtype — path type values is one of {0, 2, 4}.
o bgnextn endextn — the beginning line-end extent and ending line-end extent for the
path.
o {properties} — a list of property attribute name and value pairs, returned only if the
layout is type GDS and the wire has properties associated with it.
o {x1 y1 x2 y2 ... xn yn} — ordered list of coordinates of the path vertices.
o idx — index of the vertex or edge containing the nearest point.
o "v" | "e" — "v" if the closest point is a vertex, "e" if the closest point is on an edge.
o dist — distance between the closest point and the query point.
o {xpt ypt} — coordinates of the closest point.
• closept — Returns the nearest point on the nearest visible polygon. Information is returned
in the following format:
{layer x y [x1 y1 x2 y2]}
where:
o layer — the layer the polygon is on.
o x y — the coordinates of the nearest point.
o [x1 y1 x2 y2] — the coordinates of the vertices of the nearest edge. This information
is returned only if the nearest point is not a vertex of the polygon.
If more than one visible polygon has the same nearest point, then query closept keeps only
the first one that it found.
• vertex — Returns information about the nearest vertex on the nearest polygon. The
information is returned in the following format:
{{layer x1 y1 x2 y2 ... xn yn} vidx}
where:
o layer — the layer the polygon is on.
o x1 y1 ... xn yn — an ordered list of all the polygon vertexes.
o vidx — the index of the vertex in question, starting from x1, y1.
• edge— Returns information about the nearest edge on the nearest polygon. The information
is returned in the following format:
{{layer x1 y1 x2 y2 ... xn yn} eidx}
where:
o layer — the layer the polygon is on.
o x1 y1 ... xn yn — an ordered list of all the polygon vertexes.
o eidx — the index of the second x in the edges x,y pair.
• text — For each text object, returns the layer, coordinates, and string. The information is
returned in the following format:
{layer x y text [presentation [strans magnification angle]]}
where:
o layer — the layer the text is on.
o x y — the coordinates of the text.
o text — the string displayed as text.
o [presentation [strans magnification angle]] — text attribute values, returned only if
the layout is type GDS and the text has these attributes associated with it.
Examples
Example 1
These first three examples illustrate floating point representation:
% set cwb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set L [$cwb cget -_layout]
layout0
set end_depth 50
set top_cell "TopCell"
set refs_at_xy [$L query ref $top_cell $start_depth $end_depth $X $Y]
puts "Following cells were found at location \
[format “%.3f %.3f” [expr $X/$PREC] [expr $Y/$PREC]] under $top_cell:"
foreach {llcx llcy xlen ylen cellname rest} $refs_at_xy {
puts "Cell name = $cellname"
}
Example 4
This example illustrates escaped characters:
% $L query ref [$L topcell] 0 0 -104000 -58000
{-108000 -76000 27000 36000 \}_inv -104000 -58000 0 0.0 1.0 {}}
Related Commands
None.
$L rdbout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Convert all polygons on a layer into RDB output. They can subsequently be viewed with the
Calibre RVE graphical debug program.
When layer names are defined, they are output as checknames. If layernames are not available,
the command uses the following convention to generate checknames:
LAYER_layer_datatype
Usage
$L rdbout rdb_filename -cell cellName -layers layer_0...layer_n [-hier] [-properties]
Arguments
• rdb_filename
A required argument that specifies the output Calibre RVE ASCII database to create.
• -cell cellName
A required argument that specifies the name of the cell to start scanning the layer from.
• -layers layer_0...layer_n
A required argument that specifies the layers to scan.
• -hier
An optional argument that specifies to scan in hierarchical mode. The default is flat.
• -properties
An optional argument to specify preserving properties when scanning layers.
Returns
None.
Example
layout0 rdbout mylayer1.rdb -cell lab2 -layers 1
Related Commands
$L report
$L readonly
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Controls whether or not the layout can be saved.
Usage
$L readonly [1 | 0]
Arguments
• 0
An optional argument that specifies that layout is not read-only, and can be saved.
• 1
An optional argument that specifies that layout is read-only.
Returns
Returns a zero or one when used as a query, otherwise there are no returns.
Examples
% layout0 readonly
0
% layout0 readonly 1
% layout0 readonly
1
Related Commands
None.
$L refcount
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Retrieves the number of references to a specified cell or a total count of the instances beneath a
specified cell.
Usage
$L refcount [-parent cell] [cellName]
Arguments
• -parent cell
An optional argument that specifies to return the number of instance in cell.
• cellName
An optional argument that specifies to return the number of instances of cellName in the
design or in a specified parent cell.
Returns
None.
Examples
This example returns the number of instances in cellb40.
$L refcount -parent cellb40
Related Commands
layout peek
$L report
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Outputs duplicate cell reference information about a layout in ASCII format.
Usage
$L report duplicate ref cell_0...cell_n -out fileName
Arguments
• duplicate ref cell_0...cell_n
A required argument that specifies to report duplicated placements of the specified cell(s).
The wildcard character ‘*’ is supported, and it finds zero or more cell occurrences. Using
‘*’ in a search for ca*t matches cat, cart, and caught.
• -out fileName
A required argument that specifies the name of the file to contain the ASCII report. Using
“stdout” sends the report to the screen.
Returns
None.
Example
% layout0 report duplicate ref * -out stdout
Duplicates logfile
References duplicate summary:
-------------------------------
Sref duplicates found : 1
Aref duplicates found : 1
Related Commands
$L rdbout
$L scale
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Scales the layout by the given value. Due to the effects of grid snapping, scaling is reversible
only in the following situations:
• Scaling up by a value.
• Scaling down by a value N, when all data is known to be at coordinates that are
multiples of N.
For all other situations, this operation is irreversible.
Usage
$L scale F
Arguments
• F
A required argument that specifies the value by which the layout is scaled.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout4
$lay scale 2
% $wb updateDisplay
Related Commands
None.
$L SIZE
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Sizes the specified layers and writes the output to the layer Lout.
Caution
The SIZE operation is performed on a cell-by-cell basis, and input shapes are merged on
a per-cell basis. This command cannot be used as a hierarchical operation.
Usage
$L SIZE Lin Lout BY val
Note
SIZE and BY must be capitalized.
Arguments
• Lin
A required argument that specifies the layer number of the layer to be sized.
• Lout
A required argument that specifies the layer number of the output layer for the operation.
Note
If you are sizing a single layer, you can set Lin and Lout to the same layer, however the
original unsized geometries remain.
• BY val
A required argument used to specify the amount, in microns, by which the layer is sized.
Sizing is performed on a cell-by-cell basis. Hierarchical interactions are not accounted for.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
%
% set lay [$wb cget -_layout]
layout0
%
% $lay SIZE 1.1 2.1 BY 0.01
Sized layer by 0.01
Related Commands
None.
$L SNAP
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Snaps the data in layer Lin onto the new layer Lout. The SNAP operation is not a hierarchical
operation.
Usage
$L SNAP Lin Lout
Arguments
• Lin
A required argument that specifies the name of the layer to be snapped.
• Lout
A required argument that specifies the name of the output layer for the operation. The output
layer specified should not also be an input layer.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay scale [expr 10/9.0]
% $lay SNAP 10 65.4
Related Commands
$L gridsnap
$L srefsFromAref
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Takes the formatted output from the $L query ref command when run on an AREF. It displays
the list of SREF data formatted in the output format from the $L query ref command for an
SREF.
Coordinates and coordinate lengths are specified as either an integer, an integer followed by the
character ‘d’ for database units (dbu), or a floating point number (or integer) followed by the
character ‘u’ for microns.
If you are taking the output directly from the $L query ref command, you may need to remove
the enclosing braces ({}) before entering the output as an argument to this command.
Usage
$L srefsFromAref llx lly xlen ylen cellname x y mirror angle mag cols rows dx dy
[{properties}] [-noBbox]
Arguments
• llcx llcy
A required argument that specifies the lower left corner of the bounding box of the
reference. By default, coordinates are in database units (dbu).
• xlen ylen
A required argument that specifies the width and height of the bounding box of the
reference. By default, coordinate lengths are in dbu.
• cell_name x y mirror angle mag
A required argument that specifies the name of the referenced cell, coordinates, and
orientation in the design. By default, coordinates are in dbu.
• cols rows dx dy
A required argument that specifies the array information: dimensions (cols rows) and
spacing (dx dy). By default, coordinates are in dbu.
• {properties}
An optional list of property attribute name and value pairs, returned only if the layout is type
GDS and the reference has properties associated with it. Ignored for the current release if
specified.
• -noBbox
An optional argument that specifies output does not include the transformed SREF bbox
data.
Returns
A list of SREFs. Each SREF is enclosed in braces ({}).
Examples
This example returns a list of SREFs:
Related Commands
None.
$L textout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays all text elements in the given cell as a string.
Usage
$L textout cellName [-split]
Arguments
• cellName
A required argument that specifies the name of the cell containing the text to output.
• -split
An optional argument that formats the output string without braces surrounding the text
part:
{{layer x y text} ... {layer x y text}}
Returns
Returns all text elements in the given cell as a string formatted as follows:
{{layer x y {text}} ... {layer x y {text}}}
Example
Given a layout with the handle ar1 with the topcell TOP, the following code takes the text out of
the topcell and formats the data into individual lines:
foreach x [ar1 textout TOP] {puts $x}
Related Commands
None.
$L topcell
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns the name of the topcell in $L. A topcell is a cell that is not referenced within any other
cells.
Usage
$L topcell [all]
Arguments
• all
An optional argument used to return a list of the names of all cells that are not referenced
within other cells.
Returns
Returns the name of the topcell in $L. If $L contains multiple topcells, returns the one with the
most total descendants.
When the all option is specified, this object returns all topcells.
Note
Some layout designs, usually those resulting from a merged database, have a structure
containing more than one topcell. Unreferenced cells create multiple topcells.
Examples
This example finds the topcell in a layout:
% layout0 topcell
lab1
Related Commands
$L children
$L transcript
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Turns recording of the edit transcript information on or off. The edit transcript records
commands that modify the data in the layout database. The transcript does not include other
layout viewer commands, Tcl commands, or messages written to the terminal window. The edit
transcript includes commands issued by you at the command line as well as those issued by the
tool in response to your actions in the GUI.
Use this command with $L transcript output, which writes the transcript to a file.
Usage
$L transcript {1 | 0}
Arguments
• 0|1
A required argument that turns transcript recording off or on, respectively. The default is 1.
Returns
None.
Example
layout0 transcript 0
Related Commands
$L transcript output $L transcript range
$L transcript state
$L transcript output
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Writes the edit transcript to an output file. Used with $L transcript, which toggles recording.
Usage
$L transcript output fileName
Arguments
• fileName
A required argument that specifies the pathname for the file to which the transcript is
written.
Returns
None.
Example
layout0 transcript 1
layout0 transcript output trans.out
Related Commands
$L transcript $L transcript range
$L transcript state
$L transcript range
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays a range of edit transcript lines.
Usage
$L transcript range lo hi
Arguments
• lo
A required argument that defines the first (lowest numbered) line.
• hi
A required argument that defines the last (highest numbered) line returned.
Returns
A range of transcript lines.
Example
% layout0 delete layer 4
% layout0 delete layer 11
% layout0 transcript range 1 10
layout0 delete layer 4
layout0 delete layer 11
Related Commands
$L transcript $L transcript output
$L transcript state
$L transcript state
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns the edit transcript state (whether recording is on or off).
Usage
$L transcript state
Arguments
None.
Returns
1 — Transcript is being recorded.
0 — Transcript is not being recorded.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout0
% $lay transcript 1
% $lay transcript output trans.out
% $lay transcript state
1
Related Commands
$L transcript $L transcript output
$L transcript range
$L units database
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Sets or returns the size of database unit.
Usage
$L units database [val]
Arguments
• val
An optional argument used to set the size of the database unit, in meters.
There is no default value for this command. When not specified, the displays simply returns
the size of the database unit.
When you create a new database using batch commands, it is defined by default with a
database unit size of 10 -9, which corresponds to 1 nm. Because the database is also created
with a ratio of user units per database unit of 0.001, this corresponds to a user unit size of 1
micron (10 -9/.001 = 10 -6, which is 1 micron).
Automatic Re-Setting of $L units database
The value of $L units database is automatically changed if you issue the $L units microns
command.
Returns
When no argument is specified, returns the size of the database unit.
Example
% layout0 units database
1e-09
Related Commands
$L units microns $L units user
$L units microns
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Usage
$L units microns [units_per_micron]
Description
Simplifies setting $L units database and $L units user when the user unit size is 1 micron.
Note
This command is most convenient for use with OASIS databases, for which the user unit
size is 1 micron.
For GDS databases, if you need the user unit size to be something other than 1 micron,
you should set $L units database and $L units user separately.
You can interpret this command as “database units per micron.” The command does both of the
following:
1. Defines the size of the database unit in terms of database units per micron.
The command does this by issuing “$L units database (10-6/units_per_micron)”:
If $L units database = x
1 micron = 10 -6 meters
1 micron = x dbunits
1 dbu = 10 -6/x meters
2. Defines the ratio of user units per database unit to be 1/units_per_micron.
It does this by issuing the command “$L units user (1/units_per_micron)”. Combined
with “$L units database (10-6/units_per_micron)”, this results in a user unit size of 1
micron.
Arguments
• units_per_micron
An optional argument that specifies the number of database units per micron. There is no
default value for units_per_micron.
When you create a new database using batch commands, it is defined such that there are
1000 database units per micron, that is, the database unit is one nanometer.
Returns
When no argument is specified, returns current number of database units per microns.
Examples
Example 1
This example issues the command with an OASIS database:
$lay units microns 5
Issues the command $L units database (10 -6/5) or $L units database 0.0000002.
How this works:
1 micron = 10 -6 meters
There are 5 database units per micron.
Each database unit = 1/5 micron.
1 database unit = 10 -6/5 meters = 0.0000002
Example 2
This example issues the command with a GDS database:
$lay units microns 5
Issues the command $L units user 0.2. This translates into 0.2 user units in a database unit, or 1
user unit equals 5 database units. Since the database unit is 0.2 microns, the user unit is 1
micron. Also issues the command $L units database (10 -6/5) or $L units database 0.0000002.
This translates into .20 micron because 10 -6 is one micron, expressed in meters.
Related Commands
$L units database $L units user
$L units user
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Sets or returns a ratio representing the number of user units per database unit.
Note
For OASIS files this command is not recommended. Use the $L units microns command
because in OASIS the user unit size is always assumed to be 1 micron.
Usage
$L units user [val]
Arguments
• val
An optional argument used to define the ratio of user units per database unit for the layout.
There is no default value for this command. When not specified, the command returns the
ratio of user units per database unit.
When you create a new database using batch commands, it is defined such that the ratio of
user units per database unit is 0.001. Because the database is also created with a database
unit size of 10 -9, this corresponds to a user unit size of 1 micron.
Differences Between GDS and OASIS with Respect to Units
In GDS databases, you define the physical size of a database unit in meters. Changing $L units
user changes the size of the user unit.
In an OASIS database, the size of a user unit is fixed at 1 micron. Changing $L units user
without also changing the size of the database unit can result in data that appears corrupted. The
best way to avoid problems with data is by using the $L units microns command instead.
User Units, Precision, and Grids
The Precision statement in SVRF defines the database precision in terms of database units per
user unit. Another way to say this is that it defines the size of a database unit, expressed in user
units. The default is 1000. The $L units user batch command also defines the database precision,
but in terms of user units per database unit. Notice this is the inverse of PRECISION.
PRECISION and $L units user are important because they define the grid to which data is
snapped:
• SVRF PRECISION = The number of grid points from one user unit to the next.
• $L units user = The distance between grid points expressed in user units.
Figure 6-4. Relating User and Database Units to the Design Grid
user unit
database unit SVRF PRECISION = 10
3 1 uunit = 10 dbu
1
1 2 3
Returns
Returns the ratio of user units per database unit.
Example
% layout0 units user
0.001
Related Commands
$L units database $L units microns
$L update
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Updates the layout by recalculating the bounding boxes, topological ordering, and layer tables.
Usage
$L update
Arguments
None.
Returns
None.
Example
layout0 update
Related Commands
None.
$L viacell
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Specifies that the named cell is a via cell. Instances of via cells specified in the layer properties
file are processed flat during net extraction if connectivity is set to Top.
Note
This is an edit command, and it must be run at the layout level rather than from an
overlay.
Usage
$L viacell cellname
Arguments
• cellname
A required argument that specifies the name of the cell to be set as a via cell.
Note
Specifying an asterisk (*) in the cell name matches zero or more cell occurrences, and
using it in a search for ca*t finds cat, cart, and cataract.
Returns
None.
Example
$lay viacell c4400
Related Commands
None.
$L XOR
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Performs a Boolean XOR on the specified layers and writes the output to the layer Lout.
The Boolean XOR operation is performed on a cell-by-cell basis. It is not a hierarchical
operation.
Usage
$L XOR L1in L2in Lout
Arguments
• L1in
A required argument that specifies the name of the first layer to be XORed.
• L2in
A required argument that specifies the name of the second layer to be XORed.
• Lout
A required argument that specifies the name of the output layer for the operation.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set lay [$wb cget -_layout]
layout1
% $lay XOR 2 4 103
% $wb updateDisplay
Related Commands
$L AND $L NOT
$L OR
Peek Object
Peeking refers to probing for layout information without loading a layout file into memory.
Peek objects are created with the layout peek command that displays units, precision, list of
cells, list of topcells, list of layers, and other information about layout files. The layout peek
command supports two options that allow peek handles to be generated:
• -handle — Used to indicate the handle to assign to the newly created peek handle. Multiple
layout peek queries can use this option to avoid rereading layout files to extract the peek
information.
• -cache — Used to specify the location of a cache file to prevent re-reading the layout to
retrieve this information.
$P delete
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the peek handle defined in a previous layout peek -handle command, to release
memory.
Usage
$P delete [-preservecache]
Arguments
• -preservecache
An optional argument that prevents the cache file from being removed upon deletion of the
peek handle.
Returns
None.
Example
This example creates a peek handle, uses it, and then deletes it:
set layout [lindex lab2.gds]
Related Commands
layout peek $P file
$P peek
$P file
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns the file name for a peek handle defined in a previous layout peek -handle command.
Usage
$P file
Arguments
None
Returns
File name for a peek handle.
Example
This example creates a peek handle, returns the layout file name, and then deletes it:
set layout [lindex lab2.gds]
Related Commands
layout peek $P delete
$P peek
$P peek
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays units, precision, list of cells, list of topcells, list of layers, and other information for a
peek handle defined in a previous layout peek -handle command.
Usage
$P peek [-bbox cellname [-geometryonly]] [-cblock | -cblockcount] [-cellcount]
[-cells] [-child cellname] [-lastmodtime] [-layers] [-parent cellname] [-precision]
[-refcount cellname] [-topcell] [-topcells] [-indexable] [-format]
[-tableoffsets [-cellname] [-textstring] [-propname] [-propstring] [-layername] [-xname]]
[-strictmode] [-sproperty] [-undefcells] [-units]
Arguments
• -bbox cellname
An optional argument that queries the specified cellname and outputs the bounding box of
cellname as {x y width height}. x and y are the coordinates of the lower left corner of the
bounding box and width and height are given in um.
• -geometryonly
An optional argument used to indicate that the -bbox option should ignore text and empty
cell references.
Note
This option is only used with the -bbox option. This option is not available with the
-cache option.
• -cblock
An optional argument that queries for CBLOCK existence.
• -cblockcount
An optional argument that queries the number of CBLOCKs in this file.
• -cellcount
An optional argument that queries the number of cells in layout.
• -cells
An optional argument that queries all the cell names available in layout.
• -child cellname
An optional argument that queries a list of children for the specified cellname.
• -lastmodtime
An optional argument that queries for creation date from GDS file. This option only accepts
GDS files.
• -layers
An optional argument that queries all layers available in layout.
• -parent cellname
An optional argument that queries the parent cell for the specified cellname.
• -precision
An optional argument that queries the precision, 1/units.
• -refcount cellname
An optional argument that queries a count of instances of references to the specified
cellname.
• -topcell
An optional argument that queries the topcell with the most descendants.
• -topcells
An optional argument that queries all topcells available in layout.
Note
Some layout designs, usually those resulting from a merged database, have a structure
containing more than one topcell. Unreferenced cells create multiple topcells.
• -indexable
An optional argument that queries whether the OASIS file is indexable. OASIS files are
indexable if for each cell, the S_CELL_OFFSET property is present in the layout file. If
indexable, multiple cells can be read in parallel.
• -format
An optional argument that queries whether the file format is GDS or OASIS.
• -tableoffsets [-cellname] [-textstring] [-propname] [-propstring] [-layername] [-xname]
An optional argument that queries for all six table-offsets present in the OASIS file,
returning a list containing {tablename table-flag table-offset} for each of the six table-
offsets.
The OASIS table-offsets structure consists of six pairs of unsigned integers. Each pair
contains a flag field and a corresponding byte-offset field, as shown in Table 6-13:
Note
To use the -tableoffsets option, you should be familiar with OASIS table-offsets. Refer to
the OASIS manual for more information concerning the table-offsets structure.
You can also peek data for specific table-offsets using the following options along with the
-tableoffsets option:
o -cellname
o -textstring
o -propname
o -propstring
o -layername
o -xname
For example:
% $P peek -tableoffsets -cellname -propname
{cellname 0 0} {propname 0 0}
• -strictmode
An optional argument that queries whether the OASIS file is in strict mode (OASIS-
STRICT-MODE). The file is in strict mode if the table-offsets flag for all six table offsets is
1. In this case the -strictmode option returns 1, otherwise the option returns 0.
• -sproperty property_name
An optional argument that queries values of OASIS standard properties present in the
OASIS layout file. Each standard property name, property_name, has a value you can
retrieve. The OASIS standard properties are listed in Table 6-14:
Note
Refer to the OASIS manual for additional information concerning standard properties.
The element level property S_GDS_PROPERTY is not supported by the layout viewers.
For the cell-level S_BOUNDING_BOX and S_CELL_OFFSET properties, you can also list
the cellname in your query, as these properties are associated with individual cells. If no
cellname is specified, the property value for all cells having that property name is returned.
Here are the syntax variations available for the -sproperty command:
o -sproperty property_name
This syntax is used to peek any of the OASIS file-level standard properties.
o -sproperty S_CELL_OFFSET [cellname1 cellname2 ...]
This syntax is used to peek the value of the S_CELL_OFFSET property associated
with a cell. If no cellname is specified, the tool returns the value of
S_CELL_OFFSET for all cells. If the S_CELL_OFFSET property is not present for
a given cell, or if the cellname is not present, a warning is generated.
datatype number, and the t layer name. For GDS, the result for each layer contains the layer
number and the datatype number.
• -parent — Returns the parent cell for the specified cellname.
• -precision — Returns 1/units.
• -refcount — Returns a count of reference instances to the specified cellname.
• -topcell — Returns the topcell with the most descendants.
• -topcells — Returns all topcells available in the layout.
• -indexable — Returns 1 if the OASIS file is indexable (for each CELLNAME record, the
S_CELL_OFFSET property is present), otherwise the option returns 0.
• -format — Returns GDS or OASIS file type.
• -tableoffsets — Returns list containing {tablename table-flag table-offset} for the six table-
offsets in the OASIS file.
• -strictmode — Returns 1 if the OASIS file is in strict mode, otherwise the option returns 0.
The file is in strict mode if the table-offsets flag for all the 6 offsets tables is 1.
• -sproperty — Does one of the following:
o -sproperty property_name — Returns the OASIS file-level standard property value.
o -sproperty S_CELL_OFFSET [cellname1 cellname2 ...] — Returns the cellname
and value. Returns the S_CELL_OFFSET value for all the cells if no cellname is
specified
o -sproperty S_BOUNDING_BOX [cellname1 cellname2 ...] — Returns the
S_BOUNDING_BOX value for all the cells if no cellname is specified. Otherwise,
the result is the cellname and list of 5 bounding box values (flags, lower left X,
lower left Y, width, and height).
• -undefcells — Returns cells referenced but not defined.
• -units —Returns the units in microns.
If no option is specified, the units are returned.
Examples
This example creates a peek handle, uses it, and then deletes it:
% set layout [lindex mult.oas]
% $P peek -cblock
1
% $P peek -cblockcount
2
% $P peek -cellcount
9
% $P peek -cells
r1220 r1230 r1240 r1310 r1620 r1720 r2310 r3500 mult
% $P peek -layers
{1 0} {2 0} {4 0} {5 0} {6 0} {7 0} {8 0} {9 0} {10 0} {28 0} {29 0} {30 0}
% $P peek -precision
1000.0
% $P peek -topcell
mult
% $P peek -topcells
mult add1 add2
% $P peek -indexable
1
% $P peek -format
OAS
% $P peek -tableoffsets
{cellname 0 0} {textstring 0 0} {propname 0 0} {propstring 0 0}
{layername 0 0} {xname 0 0}
% $P peek -strictmode
1
% $P peek -format
OASIS
% $P peek -undefcells
% r1230
% $P peek -units
0.001
Related Commands
layout peek $P delete
$P file $L holdupdates
Overlay Object
The Overlay object is a collection of one or more superimposed layouts for the purpose of
visual comparison. You use overlays to find similarities and differences in your designs. The
overlay feature is only used to view layouts. Changing paths or polygons cannot be performed
with this feature. However, you can select objects in any of the layouts, take ruler
measurements, and use all layout viewing capabilities.
overlay all
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Outputs the handles of all overlay objects existing within the application database.
Usage
overlay all
Note
This function is a good way to see what overlays are open in memory.
Arguments
None.
Returns
A list of all overlay object handles. The overlay handles are of the form “overlayN” where N is
an increasing integer starting with zero.
Example
% overlay all
olobj1 olobj2 olobj5
Related Commands
layout all
overlay create
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates an overlay object from layout handles, and returns an overlay object handle. The
command takes one or more layouts, each specified as a Tcl list of a layout handle and zero or
more options.
A single layout handle can be specified. Otherwise, the Tcl list must have the layout handle as
its first element. The remaining elements must be pairs of option names and values, thus the
length of the list is always odd. The option pairs can be in any order.
Usage
overlay create {handle -cellname {cellname | *} [-mirror mirrorx] [-angle angle]
[-mag mag] [-align align] [-x dx] [-y dy]} ...
Arguments
• handle
A required argument that specifies the layout, by its handle, to include in the overlay being
created.
• -cellname {cellname | *}
A required argument that specifies the name of the cell to use. This can be set to either a
cellname or the literal ‘*’ as an alias for the topcell.
• -mirror mirrorx
An optional argument that specifies whether to mirror the layout. This can be set to 0 for
false and 1 for true.
o 0 — do not apply a mirror
o 1 — mirror across the x axis of the cell
• -angle angle
An optional argument that specifies the angle of rotation for the layout. This can be set to 0,
90, 180, or 270 degrees.
• -mag mag
An optional argument that specifies the magnification to apply to the layout. By default, this
is set to 1, which equates to no magnification. The value can be any real number greater than
0.
• -align align
An optional argument that specifies the alignment to apply to the overlay. This can be set to
“none”, “ll” (lower left), “ul” (upper left), “ur” (upper right), “lr” (lower right), or “center”.
• -x dx
An optional argument that specifies to change the coordinates by the X offset. Coordinates
are in database units (dbu).
• -y dy
An optional argument that specifies to change the coordinates by the Y offset. Coordinates
are in database units (dbu).
Returns
The handle for the new overlay object, such as “overlay0”.
Examples
The following examples create new overlays:
% layout create mix.gds
layout0
% layout create compare.gds
layout1
Related Commands
layout create
overlay delete
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Deletes the overlay specified by handle.
Usage
overlay delete handle
Arguments
• handle
A required argument that specifies the handle of the overlay to be deleted.
Returns
None.
Examples
% overlay all
overly2 overly3 overly4 overly5
% overlay all
overly2 overly4 overly5
Related Commands
layout delete
$O gdsout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
For overlays only, saves the overlay to a GDS database file. Only overlays composed of GDS
files can be exported as a GDS layout.
When exporting an overlay to a GDS layout file, first save your latest changes for each layout
handle of the overlay’s layout files, as this command saves each layout handle’s original file on
disk.
Usage
$O gdsout filename [topcell]
Arguments
• filename
A required argument that specifies the pathname for the GDS database file to which the
layout is written.
• topcell
An optional argument that specifies the name of the topcell to use in saving the overlay.
Note
If topcell is not specified, tool uses the overlay cell name as the topcell.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set O [$wb cget -_layout]
overlay0
% $O gdsout mix
Related Commands
$L gdsout $O oasisout
$O overlayout
$O layouts
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
For overlays only, displays all layouts within the overlay.
Usage
$O layouts
Arguments
None.
Returns
Returns all layouts within the overlay.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
Related Commands
$O layoutHandle $O overlayCells
$O overlayout layout overlays
$L isOverlay $L isReferenced
$L layerFilters
$O layoutHandle
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Returns the layout handle for an overlay Id.
Usage
$O layoutHandle overlayLayoutId
Arguments
• overlayLayoutId
A required argument identifying an overlay Id to return the layout handle for.
Returns
Returns the layout handle for the specified overlay Id.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
Related Commands
$O layouts $O overlayCells
$O overlayout layout overlays
$L isOverlay $L isReferenced
$L layerFilters
$O oasisout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
For overlays only, saves the overlay to an OASIS database file. Only overlays composed of
OASIS files can be exported as an OASIS layout.
When exporting an overlay to an OASIS layout file, first save your latest changes for each
layout handle of the overlay’s layout files, as this command saves each layout handle’s original
file on disk.
Usage
$O oasisout filename [topcell]
Arguments
• filename
A required argument that specifies the pathname for the OASIS database file to which the
layout is written.
• topcell
An optional argument that specifies the name of the topcell to use in saving the overlay.
Note
If topcell is not specified, tool uses the overlay cell name as the topcell.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set O [$wb cget -_layout]
overlay0
% $O oasisout mixoas
Related Commands
$L oasisout $O gdsout
$O overlayout
$O overlayCells
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
For overlays only, returns all overlaid cells in the overlay. Optionally, returns the overlaid cells
for just the layout specified by the overlay layout Id.
Usage
$O overlayCells [-layout overlayLayoutId]
Arguments
• -layout overlayLayoutId
An optional argument that specifies to only return the overlaid cells for overlayLayoutId.
Returns
Returns overlaid cells in the overlay.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
Related Commands
$O layoutHandle $O layouts
$O overlayout layout overlays
$L isOverlay $L isReferenced
$L layerFilters
$O overlayout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
For overlays only, saves the overlay as an ASCII setup data file.
Usage
$O overlayout [filename]
Arguments
• filename
An optional argument that specifies the name of a ASCII setup data file to save.
Returns
None.
Example
Calibre DESIGNrev GUI > Layouts pulldown > overlay0
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set O [$wb cget -_layout]
overlay0
% $O overlayout setup.ovly
% ls
setup.ovly
Related Commands
$O layoutHandle $O layouts
$O overlayCells layout overlays
$L isOverlay $L isReferenced
$L layerFilters
Macros
Macros are application extensions that you write to add new functionality to your application.
To use macros, you must first add them to the Macros menu. For a complete discussion of
creating macros, refer to Chapter 5, “Writing Macros”.
Macros create
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates a macro.
Usage
macros create macroName commandProc guiPlugin
Arguments
• macroName
A required argument assigning a name to the macro.
• commandProc
A required argument that specifies the Tcl procedure that performs the macro processing.
This procedure can have no dependence on the use of Tk.
• guiPlugin
A required argument that specifies the Tcl/Tk procedure that interfaces to the application.
Returns
None.
Example
Assuming you have a Tcl procedure which you want made into a macro, you have only to add a
second brief procedure and a call to the Macros create batch command to turn the original
procedure into a macro.
In the following example, a Tcl procedure has been expanded into a macro:
proc original_tcl_script { } {
...
}
proc new_macro_plug_in { wbHandle window} {
original_tcl_script
}
Macros create "my menu title" original_tcl_script new_macro_plug_in
To add the macro to the layout viewer Macros menu, source the macro from your wbinit.tcl file,
and then invoke the layout viewer as always:
echo "source macro_file.tcl" >> ~/.calibrewb_workspace/wbinit.tcl
calibredrv
Related Commands
Macros delete Macros menu
Macros show
Macros delete
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Removes the macro from the list of known macros. The macro still appears in the Macros
menu until the Macros menu command is re-invoked.
Usage
Macros delete macroName
Arguments
• macroName
A required argument that specifies the name of the macro to be deleted.
Returns
None.
Example
Macros delete menu_title
Related Commands
Macros create Macros menu
Macros show
Macros menu
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Re-creates the Macros menu with all your currently defined macros added.
Usage
Macros menu
Arguments
None.
Returns
None.
Example
Macros Menu
Related Commands
Macros create Macros delete
Macros show
Macros show
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays information about the macros currently registered with the application.
Usage
Macros show [macroName]
Arguments
• macroName
An optional argument that specifies the name of the macro about which you are requesting
information.
Returns
Returns information about the macros currently registered with the application.
• When no arguments are specified, the command returns a list of all registered macros.
• When the macroName is supplied, the command returns the names of the macro
command procedure, and the macro GUI plug-in procedure.
Example
% Macros show
{CUT REGION} {GRID CHECK} {WRITE HIERARCHY} EXTERNAL {EXECUTE TCL SCRIPT}
{DEBUG TCL SCRIPT}
Related Commands
Macros create Macros delete
Macros menu
StringFeature Object
The StringFeature object is a set of polygons in the shape of alphanumeric characters, which
you can place in a layout. This differs from the text objects in a layout in that StringFeature
objects are geometrical, while text objects are non-geometrical.
Note
In the reference pages that follow, the variable $str always refers to the handle of an
actual StringFeature object.
StringFeature
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Creates a string feature.
Usage
StringFeature name x y w h charsize "string" justify
Arguments
• name
A required argument that specifies the name of the StringFeature you are creating. Every
StringFeature must have a unique name, because the name is also used as its handle.
• xy
A required argument that specifies the X and Y coordinates of the lower left corner of the
bounding box for the StringFeature. When you place the StringFeature in a layout, these
coordinates are snapped to the grid defined in the addToLayout method. Coordinates are in
microns.
• wh
A required argument that specifies the width and height of the bounding box for the
StringFeature. Coordinate lengths are in microns.
• charsize
A required argument that specifies the size of the characters, in um. All characters are
designed to fit into a square box, with sides equal to charsize. If the charsize is too large to
fit the entire string into the bounding box, the application adjusts the charsize down to fit.
• "string"
A required argument that specifies the text to be represented as polygons. Must be enclosed
in quotes, and cannot include newline characters.
• justify
A required argument that defines how the string is justified in the bounding box. Allowed
values are on of the following:
o l — left
o r — right
o c — center
Returns
The handle of the stringfeature.
Example
Assume you have layout0, with TOP cell, and layer 1, you use the StringFeature command with
the $str addToLayout command as follows:
Related Commands
$str addToLayout
$str addToLayout
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Inserts a StringFeature into an existing layout. This is a StringFeature method, which means the
method name is preceded by the handle for the StringFeature to be added to the layout.
Usage
$str addToLayout layout_handle cellname grid layer
Arguments
• layout_handle
A required argument that specifies the handle of the layout into which you want to insert the
StringFeature.
• cellname
A required argument that specifies the name of the cell into which the StringFeature is
inserted.
• grid
A required argument that specifies the grid to which the character polygons are snapped,
specified in database units (dbu).
• layer
A required argument that specifies the layer on which the StringFeature is to be added.
Returns
None.
Example
$strobj addToLayout layout0 TOP 100 5
Related Commands
StringFeature
cwbLayoutView Object
The cwbLayoutView class holds information related to a view of a particular layout. The
cwbLayoutView objects are created for you automatically, hence there are no commands for
creating them. The cwbLayoutView object methods let you solicit information about what is
displayed there.
With Tcl, an object is referenced by its handle. The handle also acts as a command for
operations performed on the object. Thus, the handle for the layout you are working on
becomes the name of the commands you use to manipulate the layout data.
You reference the cwbLayoutView object by its handle. As with all Tcl and Tk objects, the
cwbLayoutView handle also acts as a command for operations related to that object. You can
access the cwbLayoutView handle using the $cwb cget -_layoutView command.
Note
In the reference pages that follow, the variable $V always refers to the handle of an actual
cwbLayoutView object.
$V cell
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays the name of the currently viewed cell.
Usage
$V cell
Arguments
None.
Returns
Returns the name of the currently viewed cell.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set V [$wb cget -_layoutView]
::cwbLayoutView0
% $V cell
a2311
Related Commands
None.
$V databaseToScreenUnits
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Translates a pair of X and Y coordinates from database units to screen units.
Usage
$V databaseToScreenUnits x y
Arguments
• xy
A required argument that specifies the X and Y coordinate values expressed in database
units (dbu) you want to have converted into screen units.
Returns
The X and Y coordinates expressed in screen units.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set V [$wb cget -_layoutView]
::cwbLayoutView0
% $V databaseToScreenUnits 40489 -39355
300.001055375 600.000661386
Related Commands
$V micronToScreenUnits $V screenToDatabaseUnits
$V screenToMicrons
$V depth
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays the current view depth.
Usage
$V depth
Arguments
None.
Returns
Returns the current view depth.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set V [$wb cget -_layoutView]
::cwbLayoutView0
% $V depth
4
Related Commands
None.
$V exportView
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Exports the current view as an image file.
Usage
$V exportView imagetype filename
Arguments
• imagetype
A required argument that specifies the image type to output, which must be one of the
following:
o jpg
o png
o gif
o bmp
o xpm
o ppm
o tiff
• filename
A required argument that specifies the file name to output the image as, which can include a
directory path as part of the filename. If a file already exists by that name in the destination
directory, it is overwritten.
Returns
None.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set V [$wb cget -_layoutView]
::cwbLayoutView0
% $V exportView gif a1720.gif
% ls
a1720.gif
...
Related Commands
None.
$V micronToScreenUnits
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Translates a pair of X and Y coordinates from microns to screen units.
Usage
$V micronToScreenUnits x y
Arguments
• xy
A required argument that specifies the x and y coordinate values expressed in microns you
want to have converted into screen units.
Returns
The X and Y coordinates expressed in screen units.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set V [$wb cget -_layoutView]
::cwbLayoutView0
% $V micronToScreenUnits 300 600
1037.68336634 -1217.42085032
Related Commands
$V databaseToScreenUnits $V screenToDatabaseUnits
$V screenToMicrons
$V screenToDatabaseUnits
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Translates a pair of X and Y coordinates from screen units to database units.
Usage
$V screenToDatabaseUnits x y
Arguments
• xy
A required argument that specifies the x and y coordinate values expressed in screen units
that you want to have converted into database units (dbu).
Returns
The X and Y coordinates expressed in database units.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set V [$wb cget -_layoutView]
::cwbLayoutView0
% $V screenToDatabaseUnits 300 600
40489 -39355
Related Commands
$V databaseToScreenUnits $V micronToScreenUnits
$V screenToMicrons
$V screenToMicrons
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Translates a pair of X and Y coordinates from screen units to microns.
Usage
$V screenToMicrons x y
Arguments
• xy
A required argument that specifies the x and y coordinate values expressed in screen units
that you want to have converted into microns.
Returns
The X and Y coordinates expressed in microns.
Example
% set wb [find objects -class cwbWorkBench]
::cwbWorkBench::cwbWorkBench0
% set V [$wb cget -_layoutView]
::cwbLayoutView0
% $V screenToMicrons 1037.68336634 -1217.42085032
300.0 600.0
Related Commands
$V databaseToScreenUnits $V micronToScreenUnits
$V screenToDatabaseUnits
version
Tools Supported: Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview, Calibre
MDPview
Description
Displays the product version string. It can be used in Tcl scripts and at the Tcl prompt to return
the product version string.
Usage
version
Arguments
None.
Returns
Returns the product version string.
Example
% version
2012.3_0.15
Related Commands
None.
Overview
Typically, the Calibre layout viewers are accessed using the Calibre DESIGNrev GUI.
Alternatively, layout viewer batch commands can be used. Additionally, these commands can
be combined into stand-alone programs called scripts. Scripts are a simple way to string
together a series of batch commands for execution together. It is often useful to develop a script
interactively, to see the output of each command as you step through them.
This chapter gives an example of writing a script to output layer and cell data about a layout,
and highlighting cells that are empty.
The batch commands for the Calibre DESIGNrev, Calibre WORKbench, Calibre LITHOview,
and Calibre MDPview layout viewers are Tcl-based commands, providing access to internal
application functions. Executing batch commands for Calibre layout viewers involves working
with the Calibre layout viewer extensions to Tcl/Tk. The proprietary programming objects you
are most likely to use in scripts are:
This example of looping through a layout database is a teaching aid for writing scripts rather
than a concise method for extracting database information. To rapidly extract information about
a layout file without loading it, use the layout peek command.
Procedure
First, invoke Calibre DESIGNrev in GUI mode, and load in a layout of your choosing:
calibredrv -m mylayout.gds
From the terminal window, select Enter to access the Tcl “%” prompt.
The Tcl command, set, tells Tcl to define a new variable “fileID” and to set its value. Tcl
recognizes the brackets as indicating the need for command substitution to determine the value
to place in the “fileID” variable.
The Tcl command, open, opens a file and returns the file ID it uses to communicate with that
file. The argument “w” tells Tcl to open the file as write-only. Tcl creates the file if it does not
exist and overwrite it if it does exist.
It is a good practice to save the handles as variables for any object you may need to manipulate.
If you assume the layout handle is “layout0” instead of obtaining the handle as in the previous
two Tcl commands, you run the risk of operating on the incorrect layout database.
puts $fileID "This file displays layer and cell information about the\
[$mylayout file] database."
The puts command writes to the opened file. The command takes two arguments, the file ID
(where to print the information) and the data (what to add to the file). Using the file ID as the
first argument instructs the command to write the data to the file rather than the terminal
window. The string enclosed in quotes is the data to write to the file. The quotes tell the
command to treat all of the words in the string as a single object.
Though there are quotes around the string, Tcl recognizes the brackets as indicating the need for
command substitution and the “$” as indicating a need for variable substitution. The instance
command, “$mylayout file”, is a layout viewer batch command that returns the name of the
layout file.
Procedure
The following command shows you how to write the database layers to the data file:
As in the previous puts command, the string enclosed in quotes is the data written to the file.
However, this string is more complex. This puts command writes the string “Layers:” followed
by the value or values returned by processing the instance command, “$mylayout layers”. This
layout viewer command returns the list of the layers in the database.
Write the topcell of the layout to the file. Topcells are cells with no references to them.
This puts statement is much like the previous one, except that it calls a different instance
command, “$mylayout topcell”, which returns the name of the topcell. You also have the option
of creating a variable to hold the name of the topcell returned by the instance command.
This string is more complex. The puts command writes the string “Topcell:” followed by the
value or values returned by processing the set command, which is the value it assigns to the
variable. Since the set command is also written using command substitution, the variable top
gets set to the results of processing the instance command, “$mylayout topcell”.
Note
If you want to print special characters such as “[” “]” or “$”, you can do so by preceding
them with a backslash “\”. In addition, “\n” represents a newline character, and “\t”
represents a tab character.
Writing a Procedure
You now write a Tcl procedure to print out the children of a given cell, and you invoke the
procedure at the end of this section. You define a Tcl procedure by specifying what it is called,
the arguments it takes, and what it does.
As you do not know the number of levels of cells in the layout database, you need to use either
a recursive or an iterative procedure to navigate the cell hierarchy. Recursion will be used here,
as it is generally more compact and useful when considering objects with a complex nested list
structure.
When a procedure calls itself, it is called a recursive procedure. Our procedure calls itself as
many times as needed, until it reaches a cell that has no children. It then pops back up one level
of the hierarchy and look for children of the next cell.
Procedure
Here is our Tcl procedure. Type or copy and paste it in:
The body of the procedure first checks to see if you passed it a cell name. If you did not, the
value of C is “”, which is the default value. In this case, the procedure extracts the cell name
using the “$mylayout topcell” instance command.
if {$C == ""} {
set C [$L topcell]
Next the procedure writes the name of the cell it is processing to the output file. $Indent and
“-->” add formatting to the output to help visualize the layout hierarchy.
The Tcl command, append, adds more characters to an existing variable (in this case, $Indent).
Here it is used to show the layout hierarchy graphically, forcing the name of a child cell to be
indented relative to the name of the parent cell.
The last thing the procedure does is cycle through the children of the cell, invoking itself to print
their names and children.
The foreach command creates a loop variable (child) and assigns it the values resulting from
processing the command in brackets. It cycles through the values one at a time, evaluating the
commands between the braces ({}).
Invoke the previously-created procedure to write the children of the topcell to the file:
Procedure
Close the data file to which you wrote you results, to save what you have written to the file:
close $fileID
Since you had to close the file to save it, you must open it again. This time you use the argument
“r”, which tells Tcl you want to read the data in the file.
The Tcl command, read, requires at least one argument, the file ID (where to find the
information). It returns the information it reads to the application. The layout viewer prints the
return values for all commands to the shell, displaying it for you.
close $fileID
You must always close any file you open to avoid data corruption and system resource
depletion.
/labs/drvbatch % ls
mylayout.gds
% ls
mylayout.gds
% puts $fileID "This file displays layer and cell information about\
the [$mylayout file] database."
% close $fileID
% read $fileID
This file displays layer and cell information about the
mylayout.gds database.
Layers: 7 8 9 10 11 30 31 1 2 3 4 5 6
Topcell: mp_core
--> mp_core
--> AOI32X4
--> aoi32_4xaww3wwwwwbhkbsly
--> XNOR2
--> AOI2BB2X1
--> OAI32X4
--> oai32_4xaww3wwwwwtdkunjy
--> AOI222X1
--> aoi222_1xawwpwwwwwl1f2fcy
--> OAI31X1
--> oai31_1xawwewwwwwukxutty
--> AOI21X2
--> aoi21_2xaww9wwwwwcvsiymy
...
% close $fileID
% exit
/labs/drvbatch % ls
mylayout.gds
myoutput.txt
Procedure
You run your layout viewer script in batch mode, by including the pathname for the script in the
Calibre DESIGNrev invocation. You also add arguments to the script for the layout database
pathname and the data output filename:
The code is expanded to include an example of writing a recursive procedure that checks
whether a cell has contents. The resulting script outputs layer and cell data about a layout, and it
highlights whether any particular cell is empty.
In addition to adding a new Tcl procedure, the commands you typed into the console in the
previous section have been modified to convert them to a script. Here is an example of the batch
commands discussed, placed into a script format:
# Filename: myscript.tcl
# Argument processing.
if {$argc == 0} {
close $fileID
set fileID [open $outputfilename r]
read $fileID
close $fileID
-------------------------------------------------------------------------
----- LAYOUT FILE OBJECT SUMMARY -----
-------------------------------------------------------------------------
Type Count
----------------------------------
LAYER 13
CELL 149
PLACEMENT 135112
ARRAY 0
RECTANGLE 131797
POLYGON 1440
PATH 0
TEXT 0
PROPERTY 0
-------------------------------------------------------------------------
----- LOAD LAYOUT SUMMARY -----
-------------------------------------------------------------------------
/labs/drvbatch %
This file displays layer and cell information about the mylayout.gds
database.
Layers:
--> 1
--> 2
--> 3
--> 4
--> 5
--> 6
--> 7
--> 8
--> 9
--> 10
--> 11
--> 30
--> 31
Cells:
--> mp_core
--> AOI32X4
--> aoi32_4xaww3wwwwwbhkbsly
--> XNOR2
--> AOI2BB2X1
--> OAI32X4
--> oai32_4xaww3wwwwwtdkunjy
--> AOI222X1
--> aoi222_1xawwpwwwwwl1f2fcy -- Empty cell
--> OAI31X1
--> oai31_1xawwewwwwwukxutty
--> AOI21X2
--> aoi21_2xaww9wwwwwcvsiymy
...
Creating a Macro
You can add new functionality to the layout viewer by writing application extensions, called
macros. Once you create a macro, it is available through the Macros menu. By default, the
Macros menu contains several Calibre layout viewer-supplied macros. These macros provide
useful functionality and also serve as examples of the sorts of functionality you can add to the
application.
Prerequisite
Assume you have the following simple Tcl procedure you want made into a macro:
Procedure
This example shows how to wrap a layout viewer Tcl script with commands to convert it to a
macro, and to also make that macro accessible from the layout viewer Macros menu.
The following Tcl script changes expand the original Tcl procedure into a macro. These
changes are discussed at length in the Writing Macros chapter:
proc myfunction { } {
# your commands...
}
To add the macro to the layout viewer Macros menu, source the macro from your wbinit.tcl file,
and then invoke the layout viewer:
Index
IMPORTANT INFORMATION
USE OF ALL SOFTWARE IS SUBJECT TO LICENSE RESTRICTIONS. CAREFULLY READ THIS LICENSE
AGREEMENT BEFORE USING THE PRODUCTS. USE OF SOFTWARE INDICATES CUSTOMER’S
COMPLETE AND UNCONDITIONAL ACCEPTANCE OF THE TERMS AND CONDITIONS SET FORTH IN
THIS AGREEMENT. ANY ADDITIONAL OR DIFFERENT PURCHASE ORDER TERMS AND CONDITIONS
SHALL NOT APPLY.
This is a legal agreement concerning the use of Software (as defined in Section 2) and hardware (collectively “Products”)
between the company acquiring the Products (“Customer”), and the Mentor Graphics entity that issued the
corresponding quotation or, if no quotation was issued, the applicable local Mentor Graphics entity (“Mentor
Graphics”). Except for license agreements related to the subject matter of this license agreement which are physically
signed by Customer and an authorized representative of Mentor Graphics, this Agreement and the applicable quotation
contain the parties’ entire understanding relating to the subject matter and supersede all prior or contemporaneous
agreements. If Customer does not agree to these terms and conditions, promptly return or, in the case of Software
received electronically, certify destruction of Software and all accompanying items within five days after receipt of
Software and receive a full refund of any license fee paid.
2. GRANT OF LICENSE. The software installed, downloaded, or otherwise acquired by Customer under this Agreement,
including any updates, modifications, revisions, copies, documentation and design data (“Software”) are copyrighted, trade
secret and confidential information of Mentor Graphics or its licensors, who maintain exclusive title to all Software and retain
all rights not expressly granted by this Agreement. Mentor Graphics grants to Customer, subject to payment of applicable
license fees, a nontransferable, nonexclusive license to use Software solely: (a) in machine-readable, object-code form (except
as provided in Subsection 5.2); (b) for Customer’s internal business purposes; (c) for the term of the license; and (d) on the
computer hardware and at the site authorized by Mentor Graphics. A site is restricted to a one-half mile (800 meter) radius.
Customer may have Software temporarily used by an employee for telecommuting purposes from locations other than a
Customer office, such as the employee’s residence, an airport or hotel, provided that such employee’s primary place of
employment is the site where the Software is authorized for use. Mentor Graphics’ standard policies and programs, which vary
depending on Software, license fees paid or services purchased, apply to the following: (a) relocation of Software; (b) use of
Software, which may be limited, for example, to execution of a single session by a single user on the authorized hardware or for
a restricted period of time (such limitations may be technically implemented through the use of authorization codes or similar
devices); and (c) support services provided, including eligibility to receive telephone support, updates, modifications, and
revisions. For the avoidance of doubt, if Customer provides any feedback or requests any change or enhancement to Products,
whether in the course of receiving support or consulting services, evaluating Products, performing beta testing or otherwise, any
inventions, product improvements, modifications or developments made by Mentor Graphics (at Mentor Graphics’ sole
discretion) will be the exclusive property of Mentor Graphics.
3. ESC SOFTWARE. If Customer purchases a license to use development or prototyping tools of Mentor Graphics’ Embedded
Software Channel (“ESC”), Mentor Graphics grants to Customer a nontransferable, nonexclusive license to reproduce and
distribute executable files created using ESC compilers, including the ESC run-time libraries distributed with ESC C and C++
compiler Software that are linked into a composite program as an integral part of Customer’s compiled computer program,
provided that Customer distributes these files only in conjunction with Customer’s compiled computer program. Mentor
Graphics does NOT grant Customer any right to duplicate, incorporate or embed copies of Mentor Graphics’ real-time operating
systems or other embedded software products into Customer’s products or applications without first signing or otherwise
agreeing to a separate agreement with Mentor Graphics for such purpose.
4. BETA CODE.
4.1. Portions or all of certain Software may contain code for experimental testing and evaluation (which may be either alpha or
beta, collectively “Beta Code”), which may not be used without Mentor Graphics’ explicit authorization. Upon Mentor
Graphics’ authorization, Mentor Graphics grants to Customer a temporary, nontransferable, nonexclusive license for
experimental use to test and evaluate the Beta Code without charge for a limited period of time specified by Mentor
Graphics. This grant and Customer’s use of the Beta Code shall not be construed as marketing or offering to sell a license
to the Beta Code, which Mentor Graphics may choose not to release commercially in any form.
4.2. If Mentor Graphics authorizes Customer to use the Beta Code, Customer agrees to evaluate and test the Beta Code under
normal conditions as directed by Mentor Graphics. Customer will contact Mentor Graphics periodically during Customer’s
use of the Beta Code to discuss any malfunctions or suggested improvements. Upon completion of Customer’s evaluation
and testing, Customer will send to Mentor Graphics a written evaluation of the Beta Code, including its strengths,
weaknesses and recommended improvements.
4.3. Customer agrees to maintain Beta Code in confidence and shall restrict access to the Beta Code, including the methods and
concepts utilized therein, solely to those employees and Customer location(s) authorized by Mentor Graphics to perform
beta testing. Customer agrees that any written evaluations and all inventions, product improvements, modifications or
developments that Mentor Graphics conceived or made during or subsequent to this Agreement, including those based
partly or wholly on Customer’s feedback, will be the exclusive property of Mentor Graphics. Mentor Graphics will have
exclusive rights, title and interest in all such property. The provisions of this Subsection 4.3 shall survive termination of
this Agreement.
5. RESTRICTIONS ON USE.
5.1. Customer may copy Software only as reasonably necessary to support the authorized use. Each copy must include all
notices and legends embedded in Software and affixed to its medium and container as received from Mentor Graphics. All
copies shall remain the property of Mentor Graphics or its licensors. Customer shall maintain a record of the number and
primary location of all copies of Software, including copies merged with other software, and shall make those records
available to Mentor Graphics upon request. Customer shall not make Products available in any form to any person other
than Customer’s employees and on-site contractors, excluding Mentor Graphics competitors, whose job performance
requires access and who are under obligations of confidentiality. Customer shall take appropriate action to protect the
confidentiality of Products and ensure that any person permitted access does not disclose or use Products except as
permitted by this Agreement. Customer shall give Mentor Graphics written notice of any unauthorized disclosure or use of
the Products as soon as Customer becomes aware of such unauthorized disclosure or use. Except as otherwise permitted for
purposes of interoperability as specified by applicable and mandatory local law, Customer shall not reverse-assemble,
reverse-compile, reverse-engineer or in any way derive any source code from Software. Log files, data files, rule files and
script files generated by or for the Software (collectively “Files”), including without limitation files containing Standard
Verification Rule Format (“SVRF”) and Tcl Verification Format (“TVF”) which are Mentor Graphics’ proprietary
syntaxes for expressing process rules, constitute or include confidential information of Mentor Graphics. Customer may
share Files with third parties, excluding Mentor Graphics competitors, provided that the confidentiality of such Files is
protected by written agreement at least as well as Customer protects other information of a similar nature or importance,
but in any case with at least reasonable care. Customer may use Files containing SVRF or TVF only with Mentor Graphics
products. Under no circumstances shall Customer use Software or Files or allow their use for the purpose of developing,
enhancing or marketing any product that is in any way competitive with Software, or disclose to any third party the results
of, or information pertaining to, any benchmark.
5.2. If any Software or portions thereof are provided in source code form, Customer will use the source code only to correct
software errors and enhance or modify the Software for the authorized use. Customer shall not disclose or permit disclosure
of source code, in whole or in part, including any of its methods or concepts, to anyone except Customer’s employees or
on-site contractors, excluding Mentor Graphics competitors, with a need to know. Customer shall not copy or compile
source code in any manner except to support this authorized use.
5.3. Customer may not assign this Agreement or the rights and duties under it, or relocate, sublicense or otherwise transfer the
Products, whether by operation of law or otherwise (“Attempted Transfer”), without Mentor Graphics’ prior written
consent and payment of Mentor Graphics’ then-current applicable relocation and/or transfer fees. Any Attempted Transfer
without Mentor Graphics’ prior written consent shall be a material breach of this Agreement and may, at Mentor Graphics’
option, result in the immediate termination of the Agreement and/or the licenses granted under this Agreement. The terms
of this Agreement, including without limitation the licensing and assignment provisions, shall be binding upon Customer’s
permitted successors in interest and assigns.
5.4. The provisions of this Section 5 shall survive the termination of this Agreement.
6. SUPPORT SERVICES. To the extent Customer purchases support services, Mentor Graphics will provide Customer with
updates and technical support for the Products, at the Customer site(s) for which support is purchased, in accordance with
Mentor Graphics’ then current End-User Support Terms located at http://supportnet.mentor.com/about/legal/.
7. LIMITED WARRANTY.
7.1. Mentor Graphics warrants that during the warranty period its standard, generally supported Products, when properly
installed, will substantially conform to the functional specifications set forth in the applicable user manual. Mentor
Graphics does not warrant that Products will meet Customer’s requirements or that operation of Products will be
uninterrupted or error free. The warranty period is 90 days starting on the 15th day after delivery or upon installation,
whichever first occurs. Customer must notify Mentor Graphics in writing of any nonconformity within the warranty period.
For the avoidance of doubt, this warranty applies only to the initial shipment of Software under an Order and does not
renew or reset, for example, with the delivery of (a) Software updates or (b) authorization codes or alternate Software under
a transaction involving Software re-mix. This warranty shall not be valid if Products have been subject to misuse,
unauthorized modification, improper installation or Customer is not in compliance with this Agreement. MENTOR
GRAPHICS’ ENTIRE LIABILITY AND CUSTOMER’S EXCLUSIVE REMEDY SHALL BE, AT MENTOR
GRAPHICS’ OPTION, EITHER (A) REFUND OF THE PRICE PAID UPON RETURN OF THE PRODUCTS TO
MENTOR GRAPHICS OR (B) MODIFICATION OR REPLACEMENT OF THE PRODUCTS THAT DO NOT MEET
THIS LIMITED WARRANTY. MENTOR GRAPHICS MAKES NO WARRANTIES WITH RESPECT TO:
(A) SERVICES; (B) PRODUCTS PROVIDED AT NO CHARGE; OR (C) BETA CODE; ALL OF WHICH ARE
PROVIDED “AS IS.”
7.2. THE WARRANTIES SET FORTH IN THIS SECTION 7 ARE EXCLUSIVE. NEITHER MENTOR GRAPHICS NOR
ITS LICENSORS MAKE ANY OTHER WARRANTIES EXPRESS, IMPLIED OR STATUTORY, WITH RESPECT TO
PRODUCTS PROVIDED UNDER THIS AGREEMENT. MENTOR GRAPHICS AND ITS LICENSORS
SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON-INFRINGEMENT OF INTELLECTUAL PROPERTY.
10. INDEMNIFICATION. CUSTOMER AGREES TO INDEMNIFY AND HOLD HARMLESS MENTOR GRAPHICS AND
ITS LICENSORS FROM ANY CLAIMS, LOSS, COST, DAMAGE, EXPENSE OR LIABILITY, INCLUDING
ATTORNEYS’ FEES, ARISING OUT OF OR IN CONNECTION WITH THE USE OF MENTOR GRAPHICS PRODUCTS
IN OR FOR HAZARDOUS APPLICATIONS. THE PROVISIONS OF THIS SECTION 10 SHALL SURVIVE THE
TERMINATION OF THIS AGREEMENT.
11. INFRINGEMENT.
11.1. Mentor Graphics will defend or settle, at its option and expense, any action brought against Customer in the United States,
Canada, Japan, or member state of the European Union which alleges that any standard, generally supported Product
acquired by Customer hereunder infringes a patent or copyright or misappropriates a trade secret in such jurisdiction.
Mentor Graphics will pay costs and damages finally awarded against Customer that are attributable to such action.
Customer understands and agrees that as conditions to Mentor Graphics’ obligations under this section Customer must:
(a) notify Mentor Graphics promptly in writing of the action; (b) provide Mentor Graphics all reasonable information and
assistance to settle or defend the action; and (c) grant Mentor Graphics sole authority and control of the defense or
settlement of the action.
11.2. If a claim is made under Subsection 11.1 Mentor Graphics may, at its option and expense: (a) replace or modify the Product
so that it becomes noninfringing; (b) procure for Customer the right to continue using the Product; or (c) require the return
of the Product and refund to Customer any purchase price or license fee paid, less a reasonable allowance for use.
11.3. Mentor Graphics has no liability to Customer if the action is based upon: (a) the combination of Software or hardware with
any product not furnished by Mentor Graphics; (b) the modification of the Product other than by Mentor Graphics; (c) the
use of other than a current unaltered release of Software; (d) the use of the Product as part of an infringing process; (e) a
product that Customer makes, uses, or sells; (f) any Beta Code or Product provided at no charge; (g) any software provided
by Mentor Graphics’ licensors who do not provide such indemnification to Mentor Graphics’ customers; or
(h) infringement by Customer that is deemed willful. In the case of (h), Customer shall reimburse Mentor Graphics for its
reasonable attorney fees and other costs related to the action.
11.4. THIS SECTION 11 IS SUBJECT TO SECTION 8 ABOVE AND STATES THE ENTIRE LIABILITY OF MENTOR
GRAPHICS AND ITS LICENSORS, AND CUSTOMER’S SOLE AND EXCLUSIVE REMEDY, FOR DEFENSE,
SETTLEMENT AND DAMAGES, WITH RESPECT TO ANY ALLEGED PATENT OR COPYRIGHT
INFRINGEMENT OR TRADE SECRET MISAPPROPRIATION BY ANY PRODUCT PROVIDED UNDER THIS
AGREEMENT.
13. EXPORT. The Products provided hereunder are subject to regulation by local laws and United States (“U.S.”) government
agencies, which prohibit export, re-export or diversion of certain products, information about the products, and direct or indirect
products thereof, to certain countries and certain persons. Customer agrees that it will not export or re-export Products in any
manner without first obtaining all necessary approval from appropriate local and U.S. government agencies. If Customer wishes
to disclose any information to Mentor Graphics that is subject to any U.S. or other applicable export restrictions, including
without limitation the U.S. International Traffic in Arms Regulations (ITAR) or special controls under the Export
Administration Regulations (EAR), Customer will notify Mentor Graphics personnel, in advance of each instance of disclosure,
that such information is subject to such export restrictions.
14. U.S. GOVERNMENT LICENSE RIGHTS. Software was developed entirely at private expense. The parties agree that all
Software is commercial computer software within the meaning of the applicable acquisition regulations. Accordingly, pursuant
to U.S. FAR 48 CFR 12.212 and DFAR 48 CFR 227.7202, use, duplication and disclosure of the Software by or for the U.S.
government or a U.S. government subcontractor is subject solely to the terms and conditions set forth in this Agreement, which
shall supersede any conflicting terms or conditions in any government order document, except for provisions which are contrary
to applicable mandatory federal laws.
15. THIRD PARTY BENEFICIARY. Mentor Graphics Corporation, Mentor Graphics (Ireland) Limited, Microsoft Corporation
and other licensors may be third party beneficiaries of this Agreement with the right to enforce the obligations set forth herein.
16. REVIEW OF LICENSE USAGE. Customer will monitor the access to and use of Software. With prior written notice and
during Customer’s normal business hours, Mentor Graphics may engage an internationally recognized accounting firm to
review Customer’s software monitoring system and records deemed relevant by the internationally recognized accounting firm
to confirm Customer’s compliance with the terms of this Agreement or U.S. or other local export laws. Such review may include
FlexNet (or successor product) report log files that Customer shall capture and provide at Mentor Graphics’ request. Customer
shall make records available in electronic format and shall fully cooperate with data gathering to support the license review.
Mentor Graphics shall bear the expense of any such review unless a material non-compliance is revealed. Mentor Graphics shall
treat as confidential information all information gained as a result of any request or review and shall only use or disclose such
information as required by law or to enforce its rights under this Agreement. The provisions of this Section 16 shall survive the
termination of this Agreement.
17. CONTROLLING LAW, JURISDICTION AND DISPUTE RESOLUTION. The owners of certain Mentor Graphics
intellectual property licensed under this Agreement are located in Ireland and the U.S. To promote consistency around the
world, disputes shall be resolved as follows: excluding conflict of laws rules, this Agreement shall be governed by and construed
under the laws of the State of Oregon, U.S., if Customer is located in North or South America, and the laws of Ireland if
Customer is located outside of North or South America. All disputes arising out of or in relation to this Agreement shall be
submitted to the exclusive jurisdiction of the courts of Portland, Oregon when the laws of Oregon apply, or Dublin, Ireland when
the laws of Ireland apply. Notwithstanding the foregoing, all disputes in Asia arising out of or in relation to this Agreement shall
be resolved by arbitration in Singapore before a single arbitrator to be appointed by the chairman of the Singapore International
Arbitration Centre (“SIAC”) to be conducted in the English language, in accordance with the Arbitration Rules of the SIAC in
effect at the time of the dispute, which rules are deemed to be incorporated by reference in this section. Nothing in this section
shall restrict Mentor Graphics’ right to bring an action (including for example a motion for injunctive relief) against Customer in
the jurisdiction where Customer’s place of business is located. The United Nations Convention on Contracts for the
International Sale of Goods does not apply to this Agreement.
18. SEVERABILITY. If any provision of this Agreement is held by a court of competent jurisdiction to be void, invalid,
unenforceable or illegal, such provision shall be severed from this Agreement and the remaining provisions will remain in full
force and effect.
19. MISCELLANEOUS. This Agreement contains the parties’ entire understanding relating to its subject matter and supersedes all
prior or contemporaneous agreements. Some Software may contain code distributed under a third party license agreement that
may provide additional rights to Customer. Please see the applicable Software documentation for details. This Agreement may
only be modified in writing, signed by an authorized representative of each party. Waiver of terms or excuse of breach must be
in writing and shall not constitute subsequent consent, waiver or excuse.