Cadence AE use only: Do not distribute
SKILL® Language Programming
Version IC 6.1.5
Lecture Manual July 16, 2012
Cadence AE use only: Do not distribute
1990-2012 Cadence Design Systems, Inc. All rights reserved.
Printed in the United States of America.
Cadence Design Systems, Inc., 2655 Seely Avenue, San Jose, CA 95134, USA
Cadence Trademarks
Trademarks and service marks of Cadence Design Systems, Inc. (Cadence) contained in this document are attributed to Cadence with the appropriate
symbol. For queries regarding Cadence trademarks, contact the corporate legal department at the address above or call 800.862.4522.
1st Silicon Success® InstallScape™ Silicon Ensemble®
Allegro ®
Invisible Specman ®
Silicon Express™
® ™
Accelerating Mixed Signal Design IP Gallery SKILL®
Assura® Nano Encounter® SoC Encounter™
® ®
BuildGates NanoRoute SourceLink® online customer support
® ®
Cadence NC-Verilog SPECCTRA®
® ®
Concept NeoCell SPECCTRAQuest®
Conformal® NeoCircuit® Specman®
® ®
Connections Neo Circuit - RF Specman-Elite®
® ®
Diva NeoIP Spectre®
® ®
Dracula OpenBook online documentation library SpeedBridge®
ElectronStorm® OrCAD® Verifault-XL®
® ®
Encounter Palladium Verification Advisor®
® ®
EU CAD Pearl Verilog®
® ®
Fire & Ice PowerSuite Virtuoso®
First Encounter® PSpice® VoltageStorm®
® ®
HDL-ICE SignalStorm Xtreme®
® ™
Incisive Silicon Design Chain
Other Trademarks
Open SystemC, Open SystemC Initiative, OSCI, SystemC, and SystemC Initiative are trademarks or registered trademarks of Open SystemC Initiative,
Inc. in the United States and other countries and are used with permission.
All other trademarks are the property of their respective holders.
Confidentiality Notice
No part of this publication may be reproduced in whole or in part by any means (including photocopying or storage in an information storage/retrieval
system) or transmitted in any form or by any means without prior written permission from Cadence Design Systems, Inc. (Cadence).
Information in this document is subject to change without notice and does not represent a commitment on the part of Cadence. The information
contained herein is the proprietary and confidential information of Cadence or its licensors, and is supplied subject to, and may be used only by
Cadence customers in accordance with a written agreement between Cadence and its customers. Except as may be explicitly set forth in such
agreement, Cadence does not make, and expressly disclaims, any representations or warranties as to the completeness, accuracy or usefulness of the
information contained in this document. Cadence does not warrant that use of such information will not infringe any third party rights, nor does
Cadence assume any liability for damages or costs of any kind that may result from use of such information.
RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of
the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013.
UNPUBLISHED This document contains unpublished confidential information and is not to be disclosed or used except as authorized by written
contract with Cadence. Rights reserved under the copyright laws of the United States.
ii Cadence Design Systems, Inc. 7/30/12
Cadence AE use only: Do not distribute
Table of Contents
SKILL Language Programming
Module 1 About This Course ........................................................................................3
Lab 1-1 Locating Cadence Online Support Solutions
Lab 1-2 Customizing Notification and Search Preferences
Module 2 Locate SKILL Information ........................................................................... 17
Lab 2-1 Locating SKILL Functions with the SKILL Finder
Lab 2-2 Locating SKILL Functions with the Search Assistant
Lab 2-3 Locating SKILL Solutions and Examples
Module 3 SKILL Programming Fundamentals ........................................................... 33
Lab 3-1 Using the Command Interpreter
Lab 3-2 Exploring SKILL Numeric Data Types
Lab 3-3 Exploring SKILL Variables
Lab 3-4 Displaying Data in the CIW
Lab 3-5 Solving Common Input Errors
Module 4 Working with Lists ....................................................................................... 79
Lab 4-1 Creating New Lists
Lab 4-2 Extracting Items from Lists
Module 5 Windows and Bindkeys ............................................................................. 103
Lab 5-1 Opening Windows
Lab 5-2 Resizing Windows
Lab 5-3 Storing and Retrieving Bindkeys
Lab 5-4 Defining a Bindkey to Highlight Text in a Show File Window
Module 6 Database Queries ...................................................................................... 121
Lab 6-1 Querying Design Databases
Module 7 Menus and Toolbars .................................................................................. 143
Lab 7-1 Exploring Menus
Lab 7-2 Modifying a Toolbar Menu
7/30/12 Cadence Design Systems, Inc. iii
Cadence AE use only: Do not distribute
Module 8 Customization ........................................................................................... 155
Lab 8-1 Defining Bindkeys in the .cdsinit File
Module 9 SKILL Functions ........................................................................................ 173
Lab 9-1 Developing a SKILL Function
Module 10 The SKILL Interactive Debugging Environment (IDE) ............................ 191
Lab 10-1 Debugging a SKILL Program
Module 11 Flow of Control .......................................................................................... 207
Lab 11-1 Writing a Database Report Program
Lab 11-2 Exploring Flow of Control
Lab 11-3 More Flow of Control
Lab 11-4 Controlling Complex Flow
Module 12 File I/O ........................................................................................................ 227
Lab 12-1 Writing Data to a File
Lab 12-2 Reading Data from a Text File
Lab 12-3 Writing Output to a File
Lab 12-4 Reading and Writing Table Data
Module 13 List Construction ...................................................................................... 239
Lab 13-1 Revising the Layer Shape Report
Lab 13-2 Describing the Shapes in a Design
Module 14 SKILL Development Environment ........................................................... 253
Lab 14-1 Analyzing an Error
Lab 14-2 Running Debugger Sessions
Lab 14-3 Using SKILL Lint
Lab 14-4 Surveying the SKILL Code
Module 15 Cellview Data Model .................................................................................. 299
Lab 15-1 Enhancing the Layer Shape Report SKILL Program
Lab 15-2 Creating a Cellview
Lab 15-3 Aligning Rectangles
iv Cadence Design Systems, Inc. 7/30/12
Cadence AE use only: Do not distribute
Lab 15-4 Aligning Rectangles Using ROD Functions
Lab 15-5 Creating, Locating, and Deleting Markers
Lab 15-6 Exploring Hierarchy
Lab 15-7 Traversing a Hierarchical Design
Lab 15-8 Developing a Net-based Netlister
Lab 15-9 Developing an Instance-based Netlister
Lab 15-10 Exploring Vias
Lab 15-11 Exploring User-Defined Properties
Lab 15-12 Locating Database Objects
Module 16 User Interface ............................................................................................. 359
Lab 16-1 Exploring Fixed Menus
Lab 16-2 Exploring Dialog Boxes
Lab 16-3 Exploring List Boxes
Lab 16-4 Exploring Forms
Lab 16-5 Writing a Form Application
Lab 16-6 Modifying a Toolbar Menu
Lab 16-7 Creating a Toolbar Using SKILL Code
Module 17 Advanced Customization .......................................................................... 399
Lab 17-1 Adding a Menu Item to the Schematic Edit Window
Lab 17-2 Adding a Pull-Down Menu to a Schematic Editor Window
Lab 17-3 Reversing the Layout Editor Pull-Down Menus
Lab 17-4 Customizing the Initial Window Placement
Module 18 Data Structures .......................................................................................... 427
Lab 18-1 Exploring Associative Tables
Lab 18-2 Exploring Association Lists
Lab 18-3 Exploring Disembodied Property Lists
Module 19 Introduction to SKILL++ ............................................................................ 443
Lab 19-1 Implementing a Simple Counter Data Type in the SKILL Language
Lab 19-2 Implementing a SKILL++ Counter Data Type
Lab 19-3 Re-implementing the Counter Data Type (Optional)
7/30/12 Cadence Design Systems, Inc. v
Cadence AE use only: Do not distribute
Module 20 Next Steps.................................................................................................. 461
Appendix A Interprocess Communication ................................................................ 467
Lab A-1 Compiling a C Program
Lab A-2 Exploring Synchronous Communication
Lab A-3 Exploring Asynchronous Communication
Appendix B SKILL Debugger ...................................................................................... 487
Lab B-1 Analyzing the Error
Lab B-2 Running Debugger Sessions
Appendix C SKILL Examples ...................................................................................... 515
Appendix D Updating SKILL Code for New Objects ................................................. 521
Appendix E Other SKILL Changes ............................................................................. 567
Appendix F Using the OpenAccess Toolbox ............................................................ 595
vi Cadence Design Systems, Inc. 7/30/12
Cadence AE use only: Do not distribute
SKILL Language Programming
Version 6.1.5
July 16, 2012
SKILL Language Programming 1
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 2
SKILL Language Programming 2
Cadence AE use only: Do not distribute
About This Course
Module 1
July 16, 2012
SKILL Language Programming 3
Cadence AE use only: Do not distribute
Course Objectives
In this course, you
Locate SKILL® reference and user guides
Lookup SKILL source code examples on the Cadence Online Support
and Cadence IC Community web sites
Customize the Virtuoso® Design Environment using SKILL commands
Define Bindkeys, menus and toolbars to streamline design tasks
Build and parse lists of data
Access design data using SKILL database queries
Locate technology file information using the eclipse-based
Development Environment For Technology files (DEFT)
Create SKILL expressions using SKILL syntax, loop constructs and
conditional statements
Define, develop, and debug SKILL procedures using the Command
Interpreter Window(CIW) and the SKILL Integrated Debugging
Environment(IDE)
7/16/12 SKILL Language Programming 4
SKILL Language Programming 4
Cadence AE use only: Do not distribute
Course Agenda
About this Course Menus and Toolbars
Locate SKILL Information Customization
SKILL Programming SKILL Functions
Fundamentals
The SKILL Interactive
Working with Lists Debugging Environment (IDE)
Windows and Bindkeys Flow of Control
Database Queries
7/16/12 SKILL Language Programming 5
SKILL Language Programming 5
Cadence AE use only: Do not distribute
Course Agenda
File I/O Advanced Customization
List Construction Data Structures
SKILL Development Introduction to SKILL ++
Environment
Next Steps
Cellview Data Model ________________________
User Interface Interprocess Communication
SKILL Debugger
SKILL Examples
Updating SKILL Code for New
Objects
Other SKILL Changes
Using the OpenAccess Toolbox
7/16/12 SKILL Language Programming 6
SKILL Language Programming 6
Cadence
Custom DesignAE
withuse only:
and Do notTechnology
distribute
Learning Map for
Virtuoso Assura ® ®
7/16/12 SKILL Language Programming 7
For more information about Cadence® courses:
1. Go to [Link].
2. Click Support & Training.
3. Choose one of the catalogs to explore.
• Europe, Middle East, and Africa
• India
• North America
• China
• Japan
• Korea
• Taiwan
SKILL Language Programming 7
Cadence
Getting HelpAE use only: Do not distribute
There are three ways to get help.
Use Cadence Help to access tool-specific information.
cdnshelp
Access Cadence Online Support for documents and support.
[Link]
Go to the Cadence Community web site to stay current with tips and
tricks.
[Link]
[Link]
[Link]
7/16/12 SKILL Language Programming 8
SKILL Language Programming 8
Cadence AE use only: Do not distribute
Cadence Help
Cadence Help gives you access to the
Cadence online product documentation
system.
Documentation for each product is included
automatically when you install the product.
Documents are available in both HTML and
PDF format.
The Library window lets you access
documents by product family, product name,
or type of document.
You can access Cadence Help from
The graphical user interface
The Help menu in windows
The Help button on forms
The command line: cdnshelp
The Cadence Online Support system (if
you have a license agreement)
7/16/12 SKILL Language Programming 9
To access Cadence Help from a Cadence software application, choose Help – Cadence
Documentation from the pull-down menus. The browser displays the document page. After
the document page opens, click the Library button to open the Library window.
To access Cadence Help from a command line, enter cdnshelp & in a terminal window. When
the Library window appears, navigate to the manual you want by selecting the specific
product, and then double-click to open the manual in your browser.
SKILL Language Programming 9
Cadence AE Support
Cadence Online use only: Do not distribute
(COS)
Cadence Online Support
([Link] is a web site that
gives you access to support resources, including
An extensive knowledge base with
User guides
Reference manuals
Design topics
Frequently asked questions
Known problems and solutions
White papers
Application notes
Software updates for Cadence products
Access to Cadence customer support To view the demo of Cadence Online
engineers Support, click one of the links below:
Register now and take advantage of the many Online (iLS or Virtual)
benefits of Cadence Online Support. If you
do not have an active account, send email to Classroom
COS_Registration@[Link] and one
will be set up for you.
7/16/12 SKILL Language Programming 10
Searching the Knowledge Base
You can personalize the document types and products by editing your preferences.
To search the knowledge base for different document types:
1. Point your web browser to [Link].
2. Log in to the online support site.
3. Enter a search string in the Search field. (Put quotation marks around strings of two or
more words.)
4. Specify filters for document types and products.
5. Click the SEARCH button.
When search results are displayed, you can use the within option to refine your search. You can
also filter your results based on the year under Date Filters.
SKILL Language Programming 10
Cadence AEOnline
Using Cadence use only: Do not distribute
Support
Access Cadence Online
Support
[Link]
If you don’t find a solution at the online support site...
Submit Service
Request
From the online support site, fill out the
Service Request Creation form to...
Receive Customer
Support
If your problem requires more than
customer support, then it is escalated to
R&D for a solution.
7/16/12 SKILL Language Programming 11
You can use the Cadence Online Support site for service requests. Fill out the Service Request
Creation form and submit it. The request goes to Customer Support, and if necessary is escalated
to Cadence R&D for a solution.
Submitting a Service Request
1. Point your web browser to [Link].
2. Log in to the online support site.
3. Click Create Service Request to interact directly with Cadence Customer Support.
4. Select the product from the list of products.
5. Describe the problem.
6. Click Continue.
7. View documents that might solve your stated problem.
8. Set additional request attributes.
9. Click Submit SR.
SKILL Language Programming 11
Cadence AE Communities
Cadence Online use only: Do not distribute
Stay connected by visiting
resources, such as blogs and
forums.
1. Go to:
[Link]
community
2. Select your area of
interest.
7/16/12 SKILL Language Programming 12
SKILL Language Programming 12
Cadence AE use only: Do not distribute
Lab Exercises
Lab 1-1 Locating Cadence Online Support Solutions
Log in and run a search.
Lab 1-2 Customizing Notification and Search Preferences
Set preferences to improve search and receive email
notification.
7/16/12 SKILL Language Programming 13
SKILL Language Programming 13
Cadence AEPostcourse
Precourse and use only: Do not distribute
Assessments
Assessments are a way to help you determine what new knowledge you
have gained by completing this course.
You take a precourse assessment at the start of the course.
You take a postcourse assessment at the end of the course.
Both assessments have the same questions and take about
15 minutes.
You might not successfully answer most of the questions in the precourse
assessment because you have not yet completed the course.
By the end of the course, you can probably answer most of the questions
correctly.
7/16/12 SKILL Language Programming 14
SKILL Language Programming 14
Cadence AEPreclass
Completing the use only: Do not distribute
Assessment
1. In a web browser, enter [Link]
2. Log in to the exam server.
a. In the Name field, enter your complete email address, such as
joe@[Link].
b. In the Group field, enter your company’s email suffix, such as [Link].
3. Select the precourse assessment:
ES SKILL Language Programming IC 6.1.5 PRE
4. Complete the assessment. You do not need to answer all the questions.
5. Click Submit at the bottom of the assessment.
You receive a score but you do not see the answers until you take the
postcourse assessment.
7/16/12 SKILL Language Programming 15
SKILL Language Programming 15
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 16
SKILL Language Programming 16
Cadence AE use only: Do not distribute
Locate SKILL Information
Module 2
July 16, 2012
SKILL Language Programming 17
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn to
Locate SKILL® information, solutions and examples using:
Cadence® Help (cdnshelp) online documentation system
Cadence Online Support(COS) Product Manuals page
Cadence Online Support(COS) SKILL Information page
Cadence IC Community Blogs and Forums
Finder search utility and SKILL Quick Reference Manual
Virtuoso® Search assistant
7/16/12 SKILL Language Programming 18
SKILL Language Programming 18
Cadence AE use only: Do not distribute
Terms and Definitions
SKILL The SKILL programming language is a LISP-like language with
I/O structures based on those in the C language. It extends and
enhances the functionality of Cadence software.
7/16/12 SKILL Language Programming 19
SKILL Language Programming 19
Cadence AE use only:
The SKILL Documentation SetDo not distribute
These manuals cover the SKILL language independent of the design environment:
Cadence SKILL Language Reference
Cadence SKILL Language User Guide
Cadence SKILL Development Reference
SKILL Quick Reference Guide
Note: The interactive SKILL Finder utility is the online version of this manual
These manuals cover SKILL interfaces to the Virtuoso Design Environment:
Cadence User Interface SKILL Reference
Virtuoso Design Environment SKILL Reference
Virtuoso Layout Suite SKILL Reference
Virtuoso Analog Design Environment L SKILL Reference
Virtuoso Analog Design Environment XL SKILL Reference
These manuals cover additional SKILL related features:
Virtuoso Relative Object Design(ROD) User Guide
Virtuoso Parameterized Cell(Pcell) Reference
Virtuoso Parameterized Cell(Pcell) SKILL Reference
Cadence SKILL IDE User Guide
Virtuoso Platform: What's New
7/16/12 SKILL Language Programming 20
These links link to the SKILL related documentation on Cadence Online Support.
SKILL Language Programming 20
Cadence AE
Locate SKILL use only:
Information Do notHelp
in Cadence distribute
Previous Next Save to PDF
Tabs
Topic Topic
Search
Browse
7/16/12 SKILL Language Programming 21
SKILL Language Programming 21
Cadence AEExamples
Look Up SKILL use only: DoCOS
on the notSite
distribute
Cadence Online Support(COS) provides a Resources link to specific SKILL information:
All service request solutions that contain SKILL code
A collection of documented example SKILL programs
SKILL Solutions
7/16/12 SKILL Language Programming 22
If you scroll to the bottom of the Custom IC Design SKILL Code Library page, you can click a
link to download a compressed file of the entire SKILL code library.
SKILL Language Programming 22
Cadence AE useIConly:
Access the Cadence Do not distribute
Community
Access Blogs to read about current IC related topics, Forums to ask and
answer specific design and product questions, and relatedResources.
7/16/12 SKILL Language Programming 23
SKILL Language Programming 23
Cadence AE IC
Search Cadence use only: Do
Community not distribute
Forums
Enter topic
Click on item to
view discussion
7/16/12 SKILL Language Programming 24
SKILL Language Programming 24
Cadence AE use
Using the Cadence only:
SKILL APIDo notUtility
Finder distribute
The SKILL API Finder is a utility which provides quick online help for the
SKILL language functions. It displays the syntax and a brief description for
each SKILL function.
Example description of the strcat function:
strcat( t_string1 [t_string2 t_string3 ...] ) => t_result
Takes input strings and concatenates them.
You can access the Finder in three ways:
In a terminal window, enter
cdsFinder &
In the Tools – SKILL Development window, click the Finder button.
In the CIW, enter this command:
startFinder()
The Finder contains the same information as the SKILLQuick Reference
manual.
7/16/12 SKILL Language Programming 25
SKILL Language Programming 25
Cadence AEAPI
Cadence SKILL use only:
Finder Do not distribute
Example
You can also click a check box next to the matched command and click the
Save button to save the descriptions to a text file.
Enter partial string to match SKILL commands.
Select options for matching.
Select from matches, click on columns to sort.
View syntax and description of SKILL function.
7/16/12 SKILL Language Programming 26
The Cadence SKILL API Finder database varies according to the products on your system. Each
separate product loads its own language information in the Cadence hierarchy that the Finder
reads.
You can add your own functions locally for quick reference because the Finder can display any
information that is properly formatted and located.
To use the Finder, follow these steps:
Specify a name pattern in the Find what field. (regular expression syntax is allowed)
Click the Go button.
Select a function in the Matches window pane.
The Finder displays the abbreviated documentation for the selected function.
SKILL Language Programming 26
Cadence AEFunctions
Look Up SKILL use only:withDo notAssistant
Search distribute
The search assistant included with the Cadence application software has a
feature to search for SKILL commands.
Enter search string
Choose SKILL
The Search assistant pane is initiated from the Window – Assistants
pull-down menu.
7/16/12 SKILL Language Programming 27
The Search assistant lets you search through a variety of design information including SKILL
commands.
SKILL Language Programming 27
Cadence AE use only: Do not distribute
Lab Description
There are two types of labs in this course: operational and programming.
Operational labs
Enter an example SKILL expression into the Command Interpreter Window (CIW)
and observe the results. Modify the example.
Examine and run source code.
Solutions to questions are usually on the next page.
Programming labs
Section Description
Requirements Describe the functionality of the SKILL function you
write.
Recommendations Outline an approach to solving the problem.
Testing your solution Run some tests that your SKILL function must pass.
Sample solutions Study a solution that follows the recommendations.
7/16/12 SKILL Language Programming 28
SKILL Language Programming 28
Cadence AE
Lab Preview Video:
Locating SKILL use only:
Examples Do not
Using Cadence distribute
Online Support
7/16/12 SKILL Language Programming 29
SKILL Language Programming 29
Cadence AE use only: Do not distribute
Lab Exercises
Lab 2-1 Locating SKILL Functions with the Cadence SKILL API Finder
Lab 2-2 Locating SKILL Functions with the Search Assistant
Lab 2-3 Locating SKILL Solutions and Examples
The library definitions in the [Link] file are:
DEFINE cdsDefTechLib $(compute:THIS_TOOL_INST_ROOT)/tools/dfII/etc/cdsDefTechLib
DEFINE basic $(compute:THIS_TOOL_INST_ROOT)/tools/dfII/etc/cdslib/basic
DEFINE analogLib $(compute:THIS_TOOL_INST_ROOT)/tools/dfII/etc/cdslib/artist/analogLib
DEFINE US_8ths $(compute:THIS_TOOL_INST_ROOT)/tools/dfII/etc/cdslib/sheets/US_8ths
DEFINE gpdk090 ./gpdk090_v4.0/libs.oa22/gpdk090
DEFINE master ./master
DEFINE pCells ./pCells
DEFINE tutorial ./tutorial
DEFINE cellTechLib ./cellTechLib
7/16/12 SKILL Language Programming 30
SKILL Language Programming 30
Cadence AE use only: Do not distribute
Module Summary
This module included these topics:
Locating information about the SKILL language from:
The Cadence Help documentation system
The Cadence Online Support site
The Cadence IC Community site
The SKILL Finder utility
The Virtuoso Search Assistant
The format of the lab exercises
The libraries used in the course
7/16/12 SKILL Language Programming 31
SKILL Language Programming 31
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 32
SKILL Language Programming 32
Cadence AE use only: Do not distribute
SKILL Programming Fundamentals
Module 3
July 16, 2012
SKILL Language Programming 33
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn to
Interpret information in the Command Interpreter Window (CIW).
Examine the role of the SKILL® Evaluator and interpret return values
Interpret tags and results within the [Link] file
Write basic SKILL commands using correct SKILL syntax
Display data in the CIW output pane
Explain common SKILL error messages
7/16/12 SKILL Language Programming 34
SKILL Language Programming 34
Cadence AE use only: Do not distribute
Terms and Definitions
CIW Command Interpreter Window.
SKILL Evaluator The SKILL Evaluator runs SKILL programs in the Virtuoso®
Design Environment. It compiles the program’s source code
before running the program.
Compiler A compiler translates the source code into the machine
language of a target machine. The compiler does not execute
the program. The target machine can be a virtual machine.
Evaluation Evaluation is the process whereby the SKILL Evaluator
determines the value of a SKILL expression.
SKILL expression The basic unit of source code. An invocation of a SKILL
function, often by means of an operator supplying required
parameters.
SKILL function A SKILL function is a named, parameterizable body of one or
more SKILL expressions. You can run any SKILL function
from the CIW by using its name and providing appropriate
parameters.
SKILL procedure This term is used interchangeably with SKILL function.
7/16/12 SKILL Language Programming 35
SKILL Language Programming 35
Cadence AE use
What Is the SKILL only: Do not distribute
Language?
The SKILL programming language is a Example of defining a SKILL
procedure and running it in the CIW.
high-level, interactive language.
The SKILL language was developed from
LISP (LISt Processing language).
The I/O used in the SKILL language
resembles that of C.
It is the command language of the
Virtuoso Design Environment.
Whenever you use forms, menus, and
bindkeys, the Virtuoso Design
Environment software calls SKILL
functions to complete your task.
You can enter SKILL functions directly
into the CIW input pane to bypass the
normal user interface.
7/16/12 SKILL Language Programming 36
SKILL Language Programming 36
Cadence AE Functions
What Can SKILL use only:Do?
Do not distribute
The SKILL language acts as an extension to the Virtuoso Design
Environment.
Some SKILL functions control the Virtuoso Design Environment or perform
tasks in design tools. For example, SKILL functions can:
Open a design window.
Zoom in by 2.
Place an instance or a rectangle in a design.
Other SKILL functions compute or retrieve data from the Virtuoso Design
Environment or from designs. For example, SKILL functions can
Retrieve the bounding box of the current window.
Retrieve a list of all the shapes on a given layer purpose pair.
7/16/12 SKILL Language Programming 37
SKILL Language Programming 37
Cadence
Video: What AE
Can use
SKILLonly: Do not
Functions Do? distribute
7/16/12 SKILL Language Programming 38
SKILL Language Programming 38
Cadence AE use
The Return Value only:Function
of a SKILL Do not distribute
All SKILL functions compute a data value known as the return value of the
function. You can
Assign the return value to a SKILL variable.
; Store the data selected in the current design window in a variable
mySelectedData = geGetSelSet( )
Pass the return value to another SKILL function.
; Pass the data selected in the current design window to a function
TrPrintInfo( geGetSelSet( ) )
Any SKILL data can become a return value.
7/16/12 SKILL Language Programming 39
SKILL Language Programming 39
Cadence
Starting the AE useDesign
Virtuoso only: Environment
Do not distribute
You can choose from two types of sessions:
Graphic
Nongraphic
You can replay a Virtuoso Design Environment session.
Session UNIX command line Notes
Graphic virtuoso & Use an
ampersand (&)
Nongraphic virtuoso -nograph Do not use an
ampersand (&)
Replay a session virtuoso -replay ~/[Link] &
Note: In the table above virtuoso is the name of the executable. The & places the
application in background mode which you do not want for the nongraphic session
where you will be entering commands directly into a terminal window.
7/16/12 SKILL Language Programming 40
SKILL Language Programming 40
Cadence AE use
Virtuoso 32/64-Bit only: Options
Command Do not distribute
virtuoso \
[{-32 | -64 | -32only | -64only | -3264 | -6432}] [-quiet3264] [-debug3264] [-plat <platform>]
[-v3264] [-help3264] \
<application-specific-options>…
Option Action
-32 Select the 32bit version; if not available, print a warning and try to launch the 64bit version.
-64 Select the 64bit version; if not available, print a warning and try to launch the 32bit version.
-32only Select the 32bit version; if not available, print an error and exit with error.
-64only Select the 64bit version; if not available, print an error and exit with error.
-3264 Select the 32bit version; if not available, print an info and try to launch the 64bit version.
-6432 Select the 64bit version; if not available, print an info and try to launch the 32bit version.
-quiet3264 Suppress warning/error/info messages of the -32/-32only/-3264 and -64/-64only/-6432 options
-debug3264 Print the environment updated by the wrapper and the command launched.
-plat <platform> Allow to override the default platform selection when the tool is launched from the
directory:<install_root>/bin.
-v3264 Print the wrapper's version string.
Note: These command line options override the CDS_AUTO_64BIT variable for the virtuoso executable.
7/16/12 SKILL Language Programming 41
Some Cadence® applications have both 32- and 64-bit versions. The 64-bit versions of
applications are installed in the same tools hierarchy as the 32-bit versions. A wrapper for each
application determines which version of the application is run. The 64-bit version of an
application is located in the 64bit directory in the standard installation location of the
application. For example,
your_install_dir/tools/bin/64bit
your_install_dir/tools/dfII/bin/64bit
Notes on the CDS_AUTO_64BIT environment variable:
The default setting is to run applications in 32-bit unless the CDS_AUTO_64BIT environment
variable is set to ALL.
To run the 64-bit version of a Cadence application, do the following:
Verify that your operating system supports 64-bit applications. You should have a
minimum of 4GB of RAM to run Cadence 64-bit applications.
Verify that a 64-bit version of the application is installed.
Set the following environment variable:
CDS_AUTO_64BIT { ALL | NONE | list | INCLUDE:list | EXCLUDE:list }
SKILL Language Programming 41
Cadence AE
Initializing the use only:
Virtuoso Do
Design not distribute
Environment
During startup, the Virtuoso Design Example .cdsinit file is loaded when Virtuoso starts .
Environment initialization sequence
searches the following directories
for a .cdsinit file:
/tools/dfII/local
The current directory "."
The home directory
When the Virtuoso Design
Environment finds a .cdsinit file, it
stops searching and loads the
.cdsinit file.
Typically, you use the .cdsinit file to
define application bindkeys and load
customer-specific SKILL utilities.
7/16/12 SKILL Language Programming 42
SKILL Language Programming 42
Cadence AE
Initializing the use only:
Virtuoso Do
Design not distribute
Environment (continued)
The site administrator has three ways of controlling the user customization.
Policy Customization Strategy
The site administrator does all The <install_dir>/tools/dfII/local/.cdsinit
customization. contains all customization commands. There
are no ./.cdsinit or ~/.cdsinit files involved.
The administrator does the site The <install_dir>/tools/dfII/local/.cdsinit file
customization. The user can add contains a command to load the ./.cdsinit or
further customization. ~/.cdsinit files.
The user does all the The <install_dir>/tools/dfII/local/.cdsinit file
customization. does not exist.
All customization is handled by either the
./.cdsinit or ~/.cdsinit files.
Consult the /tools/dfII/cdsuser/.cdsinit file for sample user customizations.
7/16/12 SKILL Language Programming 43
SKILL Language Programming 43
Cadence AE use Window
Command Interpreter only: Do not distribute
Window Menu
Output pane
Manager Title banner
Running history of commands
Resizeable
Input and
Output panes
Color-coded
Syntax
Window Prompt pane
number License usage
Input pane indicator
Mouse button cues
SKILL functions or expressions
7/16/12 SKILL Language Programming 44
SKILL Language Programming 44
Cadence AE use Window
Command Interpreter only: Do not distribute (continued)
In a graphic session, the Command Interpreter Window (CIW) is the first window
you see.
CIW Area Description
Window manager title The title indicates the name of the transcript log file
Window menu banner The window banner contains several pull-down menus and a HELP
button.
Output pane This pane displays information from the session log file. You can
control the kind of information the output pane displays. Colored text
indicates warnings or errors.
Input pane You can enter one or more SKILL expressions on this multi-line pane.
The SKILL syntax is color-coded to assist you. When you type a
carriage return in this pane, your input line is sent to the SKILL
Evaluator.
Mouse button cues When you enter data, this pane indicates the action available to you
through the three mouse buttons. Other keys can also have a special
meaning at this time.
Prompt pane The pane displays the command prompt. When you enter data the
prompt indicates what you need to do next.
7/16/12 SKILL Language Programming 45
SKILL Language Programming 45
Cadence
CustomizingAE
CIW:use only: DoMultiline
Expandable, not distribute
Input
You can use the multiline input area to write and test SKILL code.
Set the number of input area lines in the User Preferences form, or
graphically stretch the input window with the mouse.
Set the number of input buffer lines in the User Preferences form. This specifies the
number of previous commands that you can edit.
Also use
the mouse
to stretch
the input
area
7/16/12 SKILL Language Programming 46
SKILL Language Programming 46
Cadence
Saving YourAE
CIW use only:
Settings [Link]
in the not distribute
File
The .cdsenv file lets you save settings for applications and restore them
when you start Virtuoso the next time. You can do this through the CIW
with Options – Save Defaults or by editing the .cdsenv.
Here are commands that you can enter in the .cdsenv file to control the
CIW:
Command Description Example
ciwCmdHistorySize Number of previously ui ciwCmdHistorySize int 50
executed commands that are
displayed
ciwCmdInputLines: The initial number of lines in ui ciwCmdInputLines int 20
the input area
ciwLogHistorySize The maximum number of ui ciwLogHistorySize int 1000
commands in the output log
ciwCmdExecuteOnEnter Specifies whether the entire ui ciwCmdExecuteOnEnter boolean t
line is evaluated to execute a
command when you press
Enter, regardless of the
position of the cursor
7/16/12 SKILL Language Programming 47
SKILL Language Programming 47
Cadence
Color-codedAE use
SKILL only: Do not distribute
Syntax
SKILL language keywords are highlighted in blue and strings in green.
Code groups between parens are shaded in gray as you type or by clicking on
a paren. In this example the let( … ) block of code is highlighted.
Complete procedures are shaded in light green as you type or by clicking on a
paren.
7/16/12 SKILL Language Programming 48
To turn OFF auto-highlighting, add the following line to your .cdsenv file:
ui ciwSyntaxHighlighting boolean nil
To control the highlight colors, there are .cdsenv settings under the ui category as follows:
ui ciwWarnColor string "#b87b00"
ui ciwErrorColor string "dark red"
ui ciwMatchParenColor string "#dcdcdc"
ui ciwMismatchParenColor string "red"
ui ciwMatchCmdColor string "#cce8c3“
SKILL Language Programming 48
Cadence AE Environment
Virtuoso Design use only: Do
Usernot distribute
Interface
Bindkey Wait
Menu Item
Read SKILL Expression
Form callback
Loading a File SKILL Evaluator
CIW Input Pane
Replay Log File Display Return Value
Linux Process
[Link] CIW Output
Pane
7/16/12 SKILL Language Programming 49
SKILL Evaluator
For each expression, the SKILL Evaluator parses it, compiles it, and then executes the
compiled code. SKILL Evaluator makes safety checks during each phase.
Bindkeys and Menu Items
Whenever you press a bindkey, choose a menu item, or click OK or Apply on a form, the
Virtuoso Design Environment activates a SKILL function call to complete your task.
Loading SKILL Source Code
You can store SKILL code in a text file. The load or loadi function evaluates each SKILL
expression in the file.
Replaying a Session File
You can replay a session file. The Virtuoso Design Environment successively sends each
SKILL expression in the session file to the SKILL Evaluator. Only the input lines (prefixed by
“\i”) and the accelerated input lines (prefixed by “\a”) are processed.
Sending a SKILL Expression from a UNIX Process
Using SKILL code, you can spawn a UNIX process that can send a SKILL expression to the
SKILL Evaluator.
SKILL Language Programming 49
Cadence
The [Link]
File use only: Do not distribute
The Virtuoso Design Environment software transcribes the session in a file called
~/[Link].
The log file adds a two-character tag that identifies the line.
The following text illustrates an example transcript file:
\p 1> prompt
\i x = 0 user type-in SKILL expression
\t 0 SKILL expression’s return value
\p 1> prompt
\i TrBump() user type-in SKILL expression
\o Old value: 0 New Value: 1 SKILL expression output
\t 1 SKILL expression’s return value
\p 1> Prompt
\a TrBump() Bindkey SKILL expression
\o Old value: 1 New Value: 2 SKILL expression output
\r 2 SKILL expression’s return value
\i TrBump() user type-in SKILL expression
\o Old value: 2 New Value: 3 SKILL expression output
\t 3 SKILL expression’s return value
7/16/12 SKILL Language Programming 50
The definition of the TrBump function is:
procedure( TrBump( )
printf( "Old value: %d New Value: %d\n" x ++x )
x
)
The following SKILL expression defines the <Key>F7 bindkey for the CIW:
hiSetBindKey( "Command Interpreter" "<Key>F7" "TrBump()" )
By default mouse drag events are not logged. You can turn on logging by entering in the CIW:
hiLogDragEvents( t )
SKILL Language Programming 50
Cadence
The [Link]
File use
Tags only: Do not distribute
and Descriptions
Tag Description
\p The prompt displayed in the CIW. This identifies the boundary between
two user-level commands.
\i A SKILL expression that the user typed into the CIW.
\o The output, if any, that the SKILL expression generates.
\w The warnings, if any, that the SKILL expression generates.
\e The error, if any, that the SKILL expression caused.
\t The return value for a SKILL expression that the user typed into the CIW.
\a The SKILL expression activated by a bindkey or menu item.
\r The return value for a SKILL expression activated by a bindkey or menu
item.
When you replay a log file, the replay function interprets each of these log
file codes and passes those that represent input to the SKILL interpreter.
7/16/12 SKILL Language Programming 51
SKILL Language Programming 51
Cadence AEFilter
Setting the Log usetoonly:
Filter Do notPane
Output distribute
Data
You can control the kinds of log file data that the CIW output pane displays
by setting the toggle options of the log filter in several ways.
Use the hiSetFilterOptions From the CIW, choose
function in your .cdsinit file. For Options – Log Filter to
example, the following line sets display the Set Log File Display
up the most unrestrictive filter. Filter form and check the boxes
hiSetFilterOptions(t t t t t t t) for the items to display.
Arg # Turns on/off output for
1 inputMenuCommands
2 inputPrompts
3 outputProgramResults
4 outputMenuCommands
5 outputUser
6 messageErrors
7 messageWarnings
Note: To turn off an item, use nil instead of t
7/16/12 SKILL Language Programming 52
SKILL Language Programming 52
Cadence AE
SKILL Syntax use only: Do not distribute
Summary
Syntax Category Item Example
Comments single line ; remainder of the line
multiple lines /*
several lines
*/
Data integer 5
floating point 5.3
text string "this is text"
list ( 1 "two" 3 4 )
Boolean t ;;; true
nil ;;; false
Variables naming Line_Count1
assignment x = 5
retrieval x
Function call C syntax strcat( "Good" " day" )
Lisp syntax ( strcat "Good" " day" )
Operators operator 4 + 5 * 6
functions plus( 4 times( 5 6 ))
7/16/12 SKILL Language Programming 53
Syntax Category Notes
1. Comments: Do not use a semicolon (;) to separate expressions on a line. You will
comment out the remainder of the line! Use /* .... */ to comment out one or more lines or
to make a comment within a line. For example, 1+/*add*/2.
2. Data: Includes integer, floating-point, text string, list, and Boolean data.
3. Variables: SKILL variables are case sensitive. The SKILL Evaluator creates a variable
automatically when it first encounters it during a session. When the evaluator creates a
variable, it gives the variable a special value to indicate you need to initialize the variable.
The evaluator generates an error if you access an uninitialized variable.
4. Function: SKILL function names are case sensitive. The SKILL Evaluator allows you to
specify a function call in two ways. You can put multiple function calls on a single line.
Conversely, you can span a function call across multiple lines. Separate arguments with
whitespace. => designates the return value of the SKILL function call.
5. Operators: SKILL parser rewrites operator expressions as function calls. Using operators
does not affect execution speed.
SKILL Language Programming 53
Cadence
Data Types AE use only: Do not distribute
Each SKILL data type has an input syntax and a print representation.
Use the input syntax to specify data as an argument or to assign a value to a variable.
The SKILL Evaluator uses the print representation as the default format when displaying
data, unless you specify another format.
An argument to a SKILL function usually must be a specific type. SKILL documentation
designates the expected type with a single or double character prefix preceding the variable
name. The letter g designates an unrestricted type.
The following table summarizes several common data types.
Data Type Input Syntax Print Type Example
Representation Character Variable
integer 5 5 x x_count
floating point 5.3 5.3 f f_width
text string "this is text" "this is text" t t_msg
list ’( 1 "two" 3 4 ) ( 1 "two" 3 4 ) l l_items
7/16/12 SKILL Language Programming 54
SKILL Language Programming 54
Cadence
Use the TypeAE use only:
Function Dothe
to Check not distribute
Data Type
When using the SKILL documentation to look up function details you see
the type character used as the start of the arguments. This tells you the
variable type that the argument expects.
To determine the type of a variable you use the type function.
The type function categorizes the data type of its single argument. The
return value designates the data type of the argument.
Examples
type( 4 ) => fixnum /* an integer */
type( 5.3 ) => flonum /* a floating point number */
type( "A SKILL program automates tasks" ) => string /* a string */
7/16/12 SKILL Language Programming 55
SKILL Language Programming 55
Cadence
Variables AE use only: Do not distribute
You do not need to declare variables in the SKILL language. The SKILL Evaluator
creates a variable the first time you use it.
Variable names can contain
Alphanumeric characters
Underscores ( _ )
Question marks
The first character of a variable cannot be a digit or a question mark. Variable
names are case-sensitive.
Use the assignment operator to store a value in a variable. Enter the variable name
to retrieve its value.
This example uses the type function to verify the data type of the current value of
the variable.
lineCount = 4 => 4
lineCount => 4
type( lineCount ) => fixnum
lineCount = "abc" => "abc"
lineCount => "abc"
type( lineCount ) => string
7/16/12 SKILL Language Programming 56
Variables
The SKILL language allows both global and local variables. In the module on Developing a
SKILL Function, see Grouping Expressions with Local Variables.
SKILL Symbols
The SKILL language uses a data type called symbol to represent both variables and functions.
A SKILL symbol is a composite data structure that can simultaneously and independently hold
the following:
Data value. For example x = 4 stores the value 4 in the symbol x.
Function definition. For example, procedure( x(a b) a+b) associates a function definition
with the symbol x. The function takes two arguments and returns their sum.
Property list. For example, [Link] = .5 stores the name-value pair raiseTime .5 on the
property list for the symbol x.
You can use symbols as tags to represent one of several values. For example,
strength = ’weak assigns the symbol as a value to the variable strength.
SKILL Language Programming 56
Cadence AE use only: Do not distribute
Function Calls
Function names are case sensitive.
SKILL syntax accepts function calls in three ways:
State the function name first, followed by the arguments in a pair of matching
parentheses. No spaces are allowed between the function name and the left
parenthesis.
strcat( "A" " SKILL" " program" " automates" " tasks" )
=> "A SKILL program automates tasks"
Alternatively, you can place the left parenthesis to the left of the function name.
( strcat "A" " SKILL" " program" " automates " " tasks" )
=> "A SKILL program automates tasks"
For SKILL function calls that are not subexpressions, you can omit the
outermost levels of parentheses.
strcat "A" " SKILL" " program" " automates " " tasks"
=> "A SKILL program automates tasks"
Use white space to separate function arguments. You can use all three syntax
forms together.
7/16/12 SKILL Language Programming 57
SKILL Language Programming 57
Cadence AE use only: Do not distribute
Multiple Lines
A literal text string cannot span multiple lines.
Function Calls
You can span multiple lines in either the CIW or a source code file.
strcat(
"A" " SKILL" " program"
" automates" " tasks" ) => "A SKILL program automates tasks"
Several function calls can be on a single line. Use spaces to separate
them.
gd = strcat( "Good" " day" ) println( gd )
The SKILL Evaluator implicitly combines several SKILL expressions on the
same line into a single SKILL expression.
The composite SKILL expression returns the return value of the last
SKILL expression.
All preceding return values are ignored.
7/16/12 SKILL Language Programming 58
You can span multiple lines with a single command. Be careful with this ability. When you send a
segment of your command to the SKILL compiler and it can be interpreted as a statement, the
compiler treats it as one.
Example
a=2
a + 2 * (3 + a) => 12
however,
a+2
* (3 + 2) =>
4
* error * - wrong number of arguments: mult expects 2 arguments
A text string can span multiple lines by including a \ before the return.
Example
myString = "this string spans \
two lines using a backslash at the end of the first line"
"this string spans two lines using a backslash at the end of the first line"
SKILL Language Programming 58
Cadence AE use only: Do not distribute
Function Arguments
Study the online documentation or the Cadence Finder to determine the
specifics about the arguments for SKILL functions.
The documentation for each argument tells you
The expected data type of the argument
Whether the argument is required, optional, or a keyword argument
A single SKILL function can have all three kinds of arguments. But the
majority of SKILL functions have the following type of arguments:
Required arguments with no optional arguments
Keyword arguments with no required and no optional arguments
The SKILL Evaluator displays an error message when you pass arguments
incorrectly to a function.
To see the list of arguments for a given function use thearglist function.
arglist( ’printf )
(t_string \@optional g_general "tg")
7/16/12 SKILL Language Programming 59
SKILL Language Programming 59
Cadence AE use
Function Argument only: Do not distribute
Examples
Required Arguments
You must provide each required argument in the prescribed order when you call the
function.
Optional Arguments
You do not have to provide the optional arguments. Each optional argument has a
default value. If you provide an optional argument, you must provide all the
preceding optional arguments in order.
view( t_file [g_boxSpec][g_title][g_autoUpdate ][l_iconPosition] )
Keyword Arguments
When you provide a keyword argument you must preface it with the name of the
formal argument. You can provide keyword arguments in any order.
geOpen(
?window w_windowId
?lib t_lib
?cell t_cell
?view t_view
?viewType t_viewType
?mode t_mode )
=> t / nil
7/16/12 SKILL Language Programming 60
SKILL Language Programming 60
Cadence
Operators AE use only: Do not distribute
The SKILL language provides operators that simplify writing expressions. Compare
the following two equivalent SKILL expressions.
( 3**2 + 4**2 ) **.5 => 5.0
expt( plus( expt( 3 2 ) expt( 4 2 )) .5 ) => 5.0
Use a single pair of parentheses to control the order of evaluation as this
nongraphic session transcript shows.
> 3+4*5
23
> (3+4)*5
35
> x=5*6
30
> x
30
> (x=5)*6
30
> x
5
However, when you use extra parentheses, they cause an error.
((3+4))*5
*Error* eval: not a function - (3 + 4)
7/16/12 SKILL Language Programming 61
SKILL Language Programming 61
Cadence AE use only: Do not distribute
Operator Precedence
In general, evaluation proceeds left
Operator Function Use
to right. Operators are ranked
according to their relative
precedence. The precedence of the ++a a++ preincrement Arithmetic
operators in a SKILL expression postincrement
determine the order of evaluation of a**b expt Arithmetic
the subexpressions.
Each operator corresponds to a a*b a/b times quotient Arithmetic
SKILL function.
a+b a-b plus difference Arithmetic
For more information, check the
online documentation and search a==b equal nequal Tests for
for preincrement. a!=b equality and
inequality.
a=b setq Assignment
7/16/12 SKILL Language Programming 62
SKILL Language Programming 62
Cadence AE use
Tracing Operator only: Do not distribute
Evaluation
To observe evaluation, turn on SKILL tracing before executing an
expression to observe evaluation. The arrow (-->) indicates return value.
Notice that the trace output refers to the function of the operator.
> tracef(t)
t
> (3+4)*5
|(3 + 4)
|plus --> 7
|(7 * 5)
|times --> 35
35
>
To turn off tracing, you use:
untrace()
tracef( nil ) will not turn tracing off
7/16/12 SKILL Language Programming 63
SKILL Output Explanation
>tracef(t) The user executes the trace function to turn on tracing.
t The SKILL Evaluator acknowledges successful completion of the function.
(3+4)*5 The user enters an expression for evaluation.
|(3 + 4) The SKILL Evaluator begins evaluation starting from left to right.
|plus --> 7 The SKILL Evaluator executes the "plus" function resulting in 7.
|(7 * 5) The 7 is returned to the original expression replacing
|times --> 35 The "times" function is executed resulting in 35.
35 The result of the expression evaluation is returned.
> The SKILL Evaluator is listening for the next command.
SKILL Language Programming 63
Cadence
Lab PreviewAE useCIW
Video: only: Do not
and SKILL distribute
Commands
7/16/12 SKILL Language Programming 64
SKILL Language Programming 64
Cadence AE use only: Do not distribute
Lab Exercises
Lab 3-1 Using the Command Interpreter Window
Lab 3-2 Exploring SKILL Numeric Data Types
Lab 3-3 Exploring SKILL Variables
7/16/12 SKILL Language Programming 65
SKILL Language Programming 65
Cadence AE inuse
Displaying Data only: Do not distribute
the CIW
Every SKILL data type has a
Data Type Print Representation
default display format that is called
the print representation.
The SKILL Evaluator displays a integer 5
return value with its print
representation. floating point 1.3
SKILL functions often display data
before they return a value.
text string "SKILL Programming"
Both the print and println functions
use the print representation to
display data in the CIW output list (123)
pane. The println function sends a
newline character.
7/16/12 SKILL Language Programming 66
SKILL Language Programming 66
Cadence AE inuse
Displaying Data only:
the CIW Do print
Using not and
distribute
println
The print and println Functions
Both the print and println functions return nil.
This nongraphic session transcript illustrates println.
> x = 8
8
> println( x )
8
nil
>
This nongraphic session transcript shows an attempt to use the println
function to print out an intermediate value 3+4 during the evaluation of
(3+4)*5. The println’s return value of nil causes the error.
> println(3+4)*5
7
*Error* times: can't handle (nil * 5)
>
7/16/12 SKILL Language Programming 67
SKILL Language Programming 67
Cadence AE with
Displaying Data useFormat
only:Control
Do not distribute
The printf functions writes formatted output to the CIW. This example displays a line
in a report.
printf(
"\n%-15s %-15s %-10d %-10d %-10d %-10d"
layerName purpose
rectCount labelCount lineCount miscCount
)
The first argument is a conversion control string containing directives.
%[-][width][.precision]conversion_code
[-] = left justify
[width] = minimum number of character positions
[.precision] = number of characters after the decimal
conversion_code
d - digit(integer)
f - floating point
s - string or symbol
c - character
n - numeric
L - default format
The %L directive specifies the default format. Use the print representation for each
type to display the value.
7/16/12 SKILL Language Programming 68
SKILL Language Programming 68
Cadence AE use only: Do not distribute
printf Examples
The printf Function
If the conversion control directive is inappropriate for the data item,printf
gives you an error message.
> printf( "%d %d" 5 6.3 )
*Error* fprintf/sprintf: format spec. incompatible with data - 6.3
>
The %L Directive
The %L directive specifies the print representation. This directive is a very
convenient way to intersperse application specific formats with default
formats. Remember that printf returns t.
> aList = '(1 2 3)
(1 2 3)
> printf( "This is a list: %L\n" aList )
This is a list: (1 2 3)
t
>
7/16/12 SKILL Language Programming 69
SKILL Language Programming 69
Cadence
Using sprintfAE use only:
to Create StringsDo not distribute
A related print command, sprintf, is used to create strings to be used within
a program or to create strings to be assembled prior to printing them to the
CIW for example.
sprintf has the same formatting controls as printf but assigns the result to a
variable which is the first argument to sprintf. The resulting string is also the
return value of sprintf.
Syntax
sprintf(
{s_Var | nil}
t_formatString
[g_arg1 … ]
)
Examples
sprintf( myMessage “Located data in file %s” fileName)
myMessage = sprintf( nil “Located data in file %s” fileName )
7/16/12 SKILL Language Programming 70
The newline ( \n ) and tab ( \t ) printf formatting controls are note evaluated by sprintf. They are
sent as is into the output string from sprintf. For example: sprintf( z “a\n b\t”) => ”a\n b\t”
SKILL Language Programming 70
Cadence AE use
Solving Common only: Do not distribute
Problems
These are common problems that you might encounter:
The CIW does not respond.
The CIW displays error messages.
You pass arguments incorrectly to a function.
7/16/12 SKILL Language Programming 71
SKILL Language Programming 71
Cadence AEDoesn’t
What If the CIW use only: Do not distribute
Respond?
Situation
You typed in a SKILL function.
You pressed Return.
Nothing happens.
You have one of these problems:
Unbalanced parentheses
Unbalanced string quotes
Solution
The following steps trigger a system response in most cases.
You might have entered more left parentheses than right parentheses.
Enter a ] character (a closing right square bracket). This character closes all
outstanding right parentheses.
If still nothing happens, enter the " character followed by the ] character.
Control-c cancels the current command and resets the SKILL Evaluator.
7/16/12 SKILL Language Programming 72
SKILL Language Programming 72
Cadence
White SpaceAE use only:
Sometimes DoErrors
Causes not distribute
White space can cause error messages.
Do not put any white space between the function name and the left
parenthesis.
The error messages:
Do not identify the white space as the cause of the problem.
Vary depending on the surrounding context.
Examples
A SKILL function to concatenate several strings
strcat ( "A" "SKILL" " program" " automates" " tasks" )
*** Error in routine eval:
Message: *Error* eval: illegal function A
An assignment to a variable
greeting = strcat ( "work" " smarter" )
*** Error in routine eval:
Message: *Error* eval: unbound variable strcat
7/16/12 SKILL Language Programming 73
SKILL Language Programming 73
Cadence AE use
Passing Incorrect only: Do
Arguments to a not distribute
Function
All built-in SKILL functions validate the arguments you pass. You must pass the
appropriate number of arguments in the correct sequence. Each argument must
have the correct data type.
If there is a mismatch between what the caller of the built-in function provides and
what the function expects, the SKILL Evaluator displays an error message.
Examples
The strcat function does not accept numeric data.
strcat( "A SKILL program " 5 )
Message: *Error* strcat: argument #2 should be either a string or
a symbol (type template = "S") - 5
The type template mentioned in the error message encodes the expected argument
types.
The strlen function expects at least one argument.
strlen()
*Error* strlen: too few arguments (1 expected, 0 given) - nil
7/16/12 SKILL Language Programming 74
SKILL Language Programming 74
Cadence AE use
Passing Incorrect only: Do
Arguments to a not distribute
Function (continued)
Use the Cadence Finder to verify the Character in Expected
following information for a SKILL Type Template Data Type
function:
The number of arguments that the x integer
function expects. f floating point
The expected data type of each
s symbol
argument.
The following table summarizes some of t text string
the characters in the type template S symbol or text
which indicate the expected data type of string
the arguments. The Cadence Finder and
the Cadence online SKILL g general
documentation follow the same
convention.
7/16/12 SKILL Language Programming 75
SKILL Language Programming 75
Cadence AE use only: Do not distribute
Lab Exercises
Lab 3-4 Displaying Data in the CIW
Lab 3-5 Solving Common Input Errors
7/16/12 SKILL Language Programming 76
SKILL Language Programming 76
Cadence AE use only: Do not distribute
Module Summary
This module included these topics:
The SKILL language, the command language for the Virtuoso Design
Environment
Defining what user interface action sends SKILL expressions to the
SKILL Evaluator
Exploring SKILL data, function calls, variables, and operators
Showing ways to solve common problems
7/16/12 SKILL Language Programming 77
SKILL Language Programming 77
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 78
SKILL Language Programming 78
Cadence AE use only: Do not distribute
Working with Lists
Module 4
July 16, 2012
SKILL Language Programming 79
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn to
Build lists
Retrieve list elements
Use lists to represent points and bounding boxes
7/16/12 SKILL Language Programming 80
SKILL Language Programming 80
Cadence AE List?
What Is a SKILL use only: Do not distribute
A SKILL® list is an ordered collection of SKILL data objects.
The elements of a list can be of any data type, including variables and other
lists. The special data item nil represents the empty list.
SKILL functions commonly return lists you can display or process.
Design database list examples:
Shapes in a design
Points in a path or polygon
Instances in a design
User interface list examples:
Virtuoso® Design Environment windows currently open
Pull-down menus in a window
Menu items in a menu
7/16/12 SKILL Language Programming 81
You can use a list to represent many different types of objects. The arbitrary meaning of a list is
inherent in the programs that manipulate it.
Object Example list representation
Two-dimensional point List of two numbers.
Each point is a sublist of two numbers.
Bounding box List of two points.
Each point is a sublist of two numbers.
Path List of all the points.
Each point is a sublist of two numbers.
Circle List of radius and center.
The center is a sublist of two numbers.
SKILL Language Programming 81
Cadence AEEvaluator
How the SKILL use only: Do not
Displays a Listdistribute
To display a list, the SKILL Evaluator surrounds the elements of the list with
parentheses.
( "rect" "polygon" "rect" "line" )
( 1 2 3 )
( 1 ( 2 3 ) 4 5 ( 6 7 ))
( ( "one" 1 ) ( "two" 2 ) )
( "one" one )
To display a list as a return value, the SKILL Evaluator splits the list across
multiple lines when the list:
Contains sublists
Has more than _itemsperline number of items
Use the printf or println functions to display a list. SKILL displays the output
on a single line. Consider the examples shown below based on these
assignments. The output is taken from a nongraphical session.
aList = '( 1 2 3 )
aLongList = '( 1 2 3 4 5 6 7 8 )
aNestedList = '( 1 ( 2 3 ) 4 5 ( 6 7 ))
7/16/12 SKILL Language Programming 82
> aList = '( 1 2 3 )
(1 2 3)
> println( aList )
(1 2 3)
nil
> printf( "This is a list: %L\n" aList )
This is a list: (1 2 3)
t
> aLongList = '( 1 2 3 4 5 6 7 8 )
(1 2 3 4 5
6 7 8
)
> println( aLongList )
(1 2 3 4 5 6 7 8)
nil
> printf( "This is a list: %L\n" aLongList )
This is a list: (1 2 3 4 5 6 7 8)
t
>aNestedList = '( 1 ( 2 3 ) 4 5 ( 6 7 ))
(1
(2 3) 4 5
(6 7)
)
> println( aNestedList )
(1 (2 3) 4 5 (6 7))
nil
> printf( "This is a list: %L\n" aNestedList )
This is a list: (1 (2 3) 4 5 (6 7))
t
SKILL Language Programming 82
Cadence AE
Creating New use only: Do not distribute
Lists
There are several ways to build a list of elements. Two straightforward
ways are to do the following:
Specify all the elements literally. Apply the ’ operator to the list.
Expressions Return results
’( 1 2 3 ) (1 2 3 )
’( "one" 1 ) ( "one" 1 )
’( ( "one" 1 ) ( "two" 2 ) ) ( ( "one" 1 ) ( "two" 2 ) )
Make a list by computing each element from an expression.
Pass the expressions to the list function.
Expressions Return results
a=1 (1 )
b=2 (2)
list( a b 3 ) (123)
list( a**2+b**2 a**2-b**2) (5-3)
7/16/12 SKILL Language Programming 83
Use Variables
Store the new list in a variable. Otherwise, you cannot refer to the list again.
The ’ Operator
Follow these guidelines when using the ’ operator to build a list:
Include sublists as elements with a single set of parentheses.
Do not use the ’ operator in front of the sublists.
Separate successive sublists with white space.
The list Function
The SKILL Evaluator normally evaluates all the arguments to a function before invoking the
function. The function receives the evaluated arguments. The list function allocates a list in
virtual memory from its evaluated arguments.
SKILL Language Programming 83
Cadence AE use
Adding Elements to anonly: DoList
Existing not distribute
Here are two ways to add one or more elements to an existing list:
Use the cons function to add an element to an existing list.
Expressions Return results
result = ’( 2 3 ) ( 2 3 )
result = cons( 1 result ) ( 1 2 3 )
Use the append function to merge two lists together.
Expressions Return results
oneList = ’( 4 5 6 ) ( 4 5 6 )
aList = ’( 1 2 3 ) ( 1 2 3 )
bList = append( oneList aList ) ( 4 5 6 1 2 3 )
7/16/12 SKILL Language Programming 84
The cons Function
The construct (cons) function adds an element to the beginning of an existing list. This
function takes two arguments. The first is the new element to be added. The second is the
list to add the element to. The result of this function’s execution is a list containing one
more element than the input list.
Store the return result from cons in a variable. Otherwise, you cannot refer to the list
subsequently. It is common to store the result back into the variable containing the target
list.
The append Function
The append function builds a new list from two existing lists. The function takes two
arguments. The first argument is a list of the elements to begin the new list. The second
argument is a list of the elements to complete the new list.
Store the return result from append in a variable. Otherwise, you cannot refer to the list
subsequently.
SKILL Language Programming 84
Cadence AE use only: Do not distribute
Points of Confusion
People often think that nil, cons, and the append functions violate common
sense. Here are some frequently asked questions.
Question Answer
What is the difference between nil and ’( nil )? nil is a list containing nothing. Its length is 0.
’( nil ) builds a list containing the single
element nil. The length is 1.
How can I add an element to the end of a list? Use the append and list functions.
aList = ’( 1 2 )
aList = append( aList list( 3 )) => ( 1 2 3 )
Can I reverse the order of the arguments to You either get different results or an error.
the cons function? Will the results be the cons( ’( 1 2 ) ’( 3 4 ) ) => ( ( 1 2 ) 3 4 )
same? cons( ’( 3 4 ) ’( 1 2 ) ) => ( ( 3 4 ) 1 2 )
cons( 3 ’( 1 2 ) ) => ( 3 1 2 )
cons( ’( 1 2 ) 3 ) =>
*** Error in routine cons
*Error* cons: argument #2 should be a list
What is the difference between cons and cons( ’( 1 2 ) ’( 3 4 ) ) => ( ( 1 2 ) 3 4 )
append? append( ’( 1 2 ) ’( 3 4 ) ) => ( 1 2 3 4 )
7/16/12 SKILL Language Programming 85
Question Answer
What is the difference between nil and ’( nil )? nil is a list containing nothing. Its length is 0.
’( nil ) builds a list containing a single element. The
length is 1.
How can I add an element to the end of a list? Use the list function to build a list containing the
individual elements. Use the append function to merge
it to the first list.
There are more efficient ways to add an element to the
end of a list. They are beyond the scope of this course.
Can I reverse the order of the arguments to the cons Common sense suggests that simply reversing the
function? Will the results be the same? elements to the cons function will put the element on
the end of the list. This is not the case.
What is the difference between cons and append? The cons function requires only that its second
argument be a list. The length of the resulting list is
one more than the length of the original list.
The append function requires that both its arguments
be lists. The length of resulting list is the sum of the
lengths of the two argument lists.
SKILL Language Programming 85
Cadence
Working withAE use Lists
Existing only: Do not distribute
Task Function Example Return result
Retrieve the first element of a list car numbers = ’( 1 2 3 ) (123)
car( numbers ) 1
Retrieve the tail of the list cdr cdr( numbers ) (23)
Retrieve an element given an nth nth( 1 numbers ) 2
index
Tell if a given data object is in a member member( 4 numbers ) nil
list member( 2 numbers ) (23)
Count the elements in a list length length( numbers ) 3
Retrieve the last element in the last last( numbers ) (3)
list
Reverse the order of the list reverse reverse( numbers ) (3 2 1)
Apply a filter to a list setof setof(
x
’( 1 2 3 4 )
oddp( x ) ) (1 3 )
7/16/12 SKILL Language Programming 86
The nth Function
Lists in the SKILL language are numbered from 0. The 0 element of a list is the first element,
the 1 element of a list is the second element and so on.
The member Function
The member function returns the tail of the list starting at the element sought or nil, if the
element is not found. Remember, if it is not nil - it is true.
The setof Function
The setof function makes a new list by copying only those top-level elements in a list that pass
a test. You must write the test in terms of a single variable. The first parameter to the setof
function identifies the variable you are using in the test.
The first argument is the variable that stands for an element of the list.
The second argument is the list.
The third argument is one or more expressions that you write in terms of the variable. The
final expression is the test. It determines if the element is included in the new list.
SKILL Language Programming 86
Cadence
Traversing aAE
List use only:
with the Do cdr
car and notFunction
distribute
A list can be conceptually represented as an inverted tree. To traverse a left
branch use car and to traverse a right branch use cdr.
1: alist = ’(1 (2 3)) ’( 1 ( 2 3 ) )
2: car( alist ) => 1
car
3: cdr( alist) => ( (2 3) ) cdr
4: car( cdr( alist )) = (2 3) 1
car cdr
4a:cadr( alist ) = (2 3)
5: car( car( cdr( alist ))) => 2
car
5a:caadr( alist ) => 2 cdr nil
2
6: car( cdr( car( cdr( alist )))) => 3
car cdr
6a:cadadr( alist ) => 3
3
7: cdr( cdr( alist )) => nil nil
7/16/12 SKILL Language Programming 87
You can use car and cdr to traverse a list. You can draw a tree as shown to layout your list structure. Make each
sub-list a sub-tree. Label each left branch with a car and each right branch with a cdr. From the item you wish to
locate in the list follow the tree back to the root and construct your nested car and cdr function calls.
You can abbreviate your nested car and cdr function calls by using just the "a" for car and "d" for cdr to create a
function call. For example, you can abbreviate car( cdr ( alist )) as cadr(alist).
The SKILL language provides a family of functions that combine car and cdr operations. You can use these
functions on any list. Bounding boxes provide a good example of working with the car and cdr functions.
Functions Combination Bounding box Expression
examples
car car( ... ) lower-left corner ll = car( bBox )
cadr car( cdr( ... ) ) upper-right corner ur = cadr( bBox )
caar car( car( ... ) ) x-coordinate of llx = caar( bBox )
lower-left corner
cadar car( cdr( car( ... ) ) y-coordinate of lly = cadar( bBox )
lower-left corner
caadr car( car( cdr( ... ) ) ) x-coordinate of urx = caadr( bBox )
upper-right corner
cadadr car( cdr( car( cdr( ... ] y-coordinate of ury = cadadr( bBox )
upper-right corner
SKILL Language Programming 87
Cadence AE use
Frequently Asked only: Do not distribute
Questions
Students often ask these questions:
Why are such critical functions as car and cdr called such weird
names?
What is the purpose of the car and cdr functions?
Can the member function search all levels in a hierarchical list?
How does the setof function work? What is the variable x for?
7/16/12 SKILL Language Programming 88
Questions Answers
Why are such critical car and cdr were machine language instructions on the first machine to run Lisp. car
functions as car and cdr stands for contents of the address register and cdr stands for contents of the
called such weird names? decrement register.
What is the purpose of the Lists are stored internally as a series of doublets. The first element is the list entry,
car and cdr functions? the second element of the doublet is a pointer to the rest of the list. The car function
returns the first element of the doublet, the cdr function returns the second. For any
list L it is true that cons( car( L ) cdr( L )) builds a list equal to L. This relates the
three functions cons, car, and cdr.
Can the member function No. It only looks at the top-level elements. Internally the member function follows
search all levels in a right branches until it locates a branch point whose left branch dead ends in the
hierarchical list? element.
How does the setof function The setof function makes a new list by copying only those top-level elements in a list
work? What is the variable that pass a test. The test must be written in terms of a single variable. The first
x for? parameter to the setof function identifies the variable you are using in the test.
SKILL Language Programming 88
Cadence AE use
Two-Dimensional only: Do not distribute
Points
The SKILL language represents a two-dimensional point as a two-element
list. The binary operator (:) builds a point from an x-value and a y-value.
xValue = 300
yValue = 400
P = xValue:yValue => ( 300 400 )
The xCoord and yCoord functions access the x-coordinate and the y-
coordinate.
xCoord( P ) => 300
yCoord( P ) => 400
y-axis
P = 300:400
400
x-axis
300
7/16/12 SKILL Language Programming 89
SKILL Language Programming 89
Cadence AE use only: Do not distribute
Computing Points
The : operator combines naturally with arithmetic operators. It has a lower
precedence than the + or the * operator.
3+4*5:4+7*8 => (23 60)
Computing a point from another point is [Link] example, given a point P,
apply an offset dx and dy in both directions.
y-axis
Q = xCoord( P )+dx:yCoord( P )+dy
dy
P
x-axis
dx
7/16/12 SKILL Language Programming 90
SKILL Language Programming 90
Cadence AE use only: Do not distribute
Bounding Boxes
The SKILL language represents a bounding box as a two-element list. The
first element is the lower-left corner and the second element is the upper-
right corner.
y-axis
ur = 500:450
ll = 300:400
x-axis
This is returned to you by the system as ( ( 300 400 ) ( 500 450 ) ).
7/16/12 SKILL Language Programming 91
Remember that : is a point operator.
’(300:400 500:450) does not create a list of two lists since the : operator is not evaluated.
Use list( 300:400 500:450) which will evaluate the point and thus create a list containing two lists
and so, in this case, also a bounding box.
SKILL Language Programming 91
Cadence AE useBox
Creating a Bounding only: Do not distribute
Use the list function to build a bounding box. Specify the points by variables
or by using the : operator.
ll = 300:400 ur = 500:450
bBox = list( ll ur ) =>
(( 300 400 ) ( 500 450 ))
bBox = list( 300:400 500:450 ) =>
(( 300 400 ) ( 500 450 ))
7/16/12 SKILL Language Programming 92
When you create a bounding box, put the points in the correct order. When the SKILL code
prompts you to digitize a bounding box, it returns the bounding box with the lower-left and
upper-right corner points correctly ordered, even though the user may have digitized the upper-
left and lower-right corners!
You may use the ’ operator to build the bounding box ONLY if you specify the coordinates as
literal lists.
bBox = ’(( 300 400 ) ( 500 450 ))
=> (( 300 400 ) ( 500 450 ))
SKILL Language Programming 92
Cadence AE usefrom
Retrieving Elements only: Do not
Bounding distribute
Boxes
Use the lowerLeft and upperRight functions to retrieve the lower-left corner
and the upper-right corner points of a bounding box.
lowerLeft( bBox ) => ( 300 400 )
upperRight( bBox ) => ( 500 450 )
These functions assume that the order of the elements is correct.
Use the xCoord and yCoord functions to retrieve the coordinates of these
corners.
xCoord( lowerLeft( bBox )) => 300
yCoord( upperRight( bBox )) => 450
7/16/12 SKILL Language Programming 93
SKILL Language Programming 93
Cadence AE use only: Do not distribute
Lecture Exercises
The exercises on the next few slides illustrate techniques for manipulating
bounding boxes:
Offsetting a box
Finding the smallest bounding box
Finding the intersection of two bounding boxes
7/16/12 SKILL Language Programming 94
SKILL Language Programming 94
Cadence AE use only: Do not distribute
Offsetting a Box
Assume the variable Box contains the lower-left bounding box. The upper-
right box is the same size as the lower-left box. Using variables, write an
expression for the upper-right bounding box.
y-axis
B
A
dy
dx x-axis
Use this template as a starting point for writing the expression.
boxLL = ... : ...
boxUR = ... : ...
list( boxLL boxUR )
7/16/12 SKILL Language Programming 95
Example Solution
boxLLx = xCoord( lowerLeft( box ) )+dx
boxLLy = yCoord( lowerLeft( box ) )+dy
boxURx = xCoord( upperRight( box ) )+dx
boxURy = yCoord( upperRight( box ) )+dy
list(
boxLLx:boxLLy
boxURx:boxURy)
SKILL Language Programming 95
Cadence AE useBounding
Finding the Smallest only: Do not distribute
Box
Write expressions that compute the smallest bounding box containing two
boxes A and B.
y-axis
B
A
x-axis
Use the xCoord, yCoord, lowerLeft, and upperRight functions in the
following template.
boxLL = min( ... ... ):min( ... ... )
boxUR = max( ... ... ):max( ... ... )
list( boxLL boxUR )
7/16/12 SKILL Language Programming 96
Example Solution
llAx = xCoord( lowerLeft( A ))
llBx = xCoord( lowerLeft( B ))
llAy = yCoord( lowerLeft( A ))
llBy = yCoord( lowerLeft( B ))
urAx = xCoord( upperRight( A ))
urBx = xCoord( upperRight( B ))
urAy = yCoord( upperRight( A ))
urBy = yCoord( upperRight( B ))
boxLL = min( llAx llBx ):min( llAy llBy )
boxUR = max( urAx urBx ):max( urAy urBy )
list( boxLL boxUR )
SKILL Language Programming 96
Cadence AE use only:
Finding the Intersection Do
of Two not distribute
Bounding Boxes
Write an expression that describes the overlap between two boxes A and B.
y-axis
B
A
x-axis
Use the xCoord, yCoord, lowerLeft, and upperRight functions in the
following template.
boxLL = max( ... ... ):max( ... ... )
boxUR = min( ... ... ):min( ... ... )
list( boxLL boxUR )
7/16/12 SKILL Language Programming 97
Example Solution
llAx = xCoord( lowerLeft( A ))
llBx = xCoord( lowerLeft( B ))
llAy = yCoord( lowerLeft( A ))
llBy = yCoord( lowerLeft( B ))
urAx = xCoord( upperRight( A ))
urBx = xCoord( upperRight( B ))
urAy = yCoord( upperRight( A ))
urBy = yCoord( upperRight( B ))
boxLL = max( llAx llBx ):max( llAy llBy )
boxUR = min( urAx urBx ):min( urAy urBy )
list( boxLL boxUR )
SKILL Language Programming 97
Cadence AE
Combinations of use only:
car and Do not distribute
cdr Functions
The SKILL language provides a family of functions that combine car and cdr
operations. You can use these functions on any list.
Bounding boxes provide a good example of working with the car and cdr functions.
Functions Combination Bounding box Expression
examples
car car( ... ) lower-left corner ll = car( bBox )
cadr car( cdr( ... ) ) upper-right corner ur = cadr( bBox )
caar car( car( ... ) ) x-coordinate of llx = caar( bBox )
lower-left corner
cadar car( cdr( car( ... ) ) y-coordinate of lly = cadar( bBox )
lower-left corner
caadr car( car( cdr( ... ) ) ) x-coordinate of urx = caadr( bBox )
upper-right corner
cadadr car( cdr( car( cdr( ... ] y-coordinate of ury = cadadr( bBox )
upper-right corner
7/16/12 SKILL Language Programming 98
Using the xCoord, yCoord, lowerLeft and upperRight functions is preferable in practice to access
coordinates, bounding boxes, and paths.
The functions cadr, caar, and so forth are built in for your convenience.
You can use any combination of four a’s and d’s when you construct the abbreviated commands,
such as aadd.
SKILL Language Programming 98
Cadence
Lab PreviewAE use
Video: only:with
Working Do Lists
not distribute
7/16/12 SKILL Language Programming 99
SKILL Language Programming 99
Cadence AE use only: Do not distribute
Lab Exercises
Lab 4-1 Creating New Lists
Lab 4-2 Extracting Items from Lists
7/16/12 SKILL Language Programming 100
SKILL Language Programming 100
Cadence AE use only: Do not distribute
Module Summary
This module included these topics:
SKILL lists can contain any type of SKILL data. nil is the empty list.
Using the ’ operator and the list function to build lists
Using the cons and append functions to build lists from existing lists
Using the length function to count the number of elements in a list
Using the member function to find an element in an existing list
Using the setof function to filter a list according to a condition
How two-dimensional points are represented by two-element lists
How bounding boxes are also represented by two element lists
7/16/12 SKILL Language Programming 101
SKILL Language Programming 101
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 102
SKILL Language Programming 102
Cadence AE use only: Do not distribute
Windows and Bindkeys
Module 5
July 16, 2012
SKILL Language Programming 103
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn to
Describe the window ID data type
Open design windows
Examine session windows
Define application bindkeys
Use the Bindkey Editor
Open read-only text windows
Manage windows
7/16/12 SKILL Language Programming 104
Terms and Definitions
Callback A callback is a SKILL® expression that the software sends to the
SKILL Evaluator in response to a keyboard or mouse event. To
retrieve the callback, the software notes where the cursor is when
the keyboard event happens.
Application type Each Virtuoso® Design Environment window has an application
type. The system uses this type to determine the table of bindkey
definitions.
Bindkey A bindkey associates a SKILL expression with a key or mouse
button.
SKILL Language Programming 104
Cadence AE Environment
Virtuoso Design use only: Do not distribute
Windows
Most Virtuoso® Design Environment windows have a window number.
CIW
Application windows
The Layer Selection Window (LSW) is not one of these windows.
The window function converts a window number to a window ID.
window( 3 ) => window:3
The data type wtype represents the underlying data structure for a window.
type( window( 3 ) ) => wtype
To make a window current, the user puts the mouse cursor in the window
and presses either a mouse button or a key.
The CIW is never the current window.
SKILL® functions act on the current window by default.
7/16/12 SKILL Language Programming 105
The hiGetWindowList Function
The hiGetWindowList function returns a list of the window IDs of the existing Virtuoso Design
Environment windows.
hiGetWindowList() => ( window:1 window:2 )
The hiGetCurrentWindow Function
The hiGetCurrentWindow function identifies the current window. If there is no current window,
the function returns nil.
hiGetCurrentWindow() => window:4
SKILL Language Programming 105
Cadence AE use only: Do not distribute
Session Windows
A session window:
Is a container for
design windows,
which are organized
using tabs
Provides for
dockable assistant
windows and
toolbars along the
edges
Has menu bars that
can be resized,
docked or floated
Session window # (window #)
7/16/12 SKILL Language Programming 106
Opening a new design window:
geOpen(...)
hiOpenWindow(...)
To locate a session window ID you provide the session window number.
swindow( # )
SKILL Language Programming 106
Cadence AE use
Opening a Design only: Do not distribute
Window
Use the geOpen function to open a design in a window.
The geOpen function
Loads the design into virtual memory.
Creates a window displaying the design.
Returns the window ID.
The following expression opens the master mux2 schematic view for
editing:
geOpen(
?lib "master"
?cell "mux2"
?view "schematic"
?mode "w"
) => window:12
The following expression displays the Open File form with the Library Name
field set to master.
geOpen( ?lib "master" )
7/16/12 SKILL Language Programming 107
The geOpen Function
Keyword Example Parameter Meaning
?lib “master” the library name
?cell “mux2” the cell name
?view “schematic” the view name
?mode “r” “a” or “w” read, append, overwrite
The geOpen function requires keyword parameter passing. Precede each argument with the
corresponding keyword. Keywords correspond to the formal arguments.
Prompt Line
By default every graphic window has a prompt line. This line tells the user what the command
requires next. You can remove the prompt line for the current window with the command:
hiRemovePromptLine()
Optionally, you can specify a window ID as an input parameter to the command.
SKILL Language Programming 107
Cadence AE use only: Do not distribute
Open File Example
The following expression displays the Open File form with the Library Name
field set to master.
geOpen( ?lib "master" )
7/16/12 SKILL Language Programming 108
SKILL Language Programming 108
Cadence AE use only: Do not distribute
Using Bindkeys
Bindkeys make frequently used commands easier for the user to execute.
There are several different uses for bindkeys:
To initiate a command, such as the Zoom In command.
To use the mouse during a command to enter points.
To perform subsidiary actions, such as panning the window, during a
command.
A bindkey associates a SKILL expression with a key or mouse button.
When the mouse cursor is in an application window, and the user presses a
key or mouse button, the SKILL Evaluator evaluates the bindkey
expression.
Each application can associate different SKILL expressions with the same
key or mouse button.
While the user digitizes points during a command, a key or mouse button
can trigger a different SKILL expression than it normally does.
7/16/12 SKILL Language Programming 109
This example illustrates the different uses of bindkeys.
1. With the mouse cursor in a Layout Editor window, press the z key to start the Zoom In
command.
2. You click the left mouse button to indicate the first corner of the region to zoom.
3. You press the Tab key to start the Pan command.
4. You click the left mouse button to indicate the center point of the pan command. The
Pan command finishes.
5. Finally, to indicate the second corner of the region, the user clicks the left mouse button
again. The Zoom In command finishes.
SKILL Language Programming 109
Cadence AE use only: Do not distribute
Defining Bindkeys
When you define a bindkey, you specify the following information:
The application type, which identifies the application by means of a text
string. Typical application types include the following:
"Command Interpreter"
"Layout"
"Schematics"
"Graphics Browser"
The keyboard or mouse event that triggers the SKILL expression.
Typical events include the following:
Press the a key.
Press the left mouse button.
Draw through with the left mouse button.
The mode that governs the bindkey. The bindkey is either modeless or
is in effect only when the user enters points.
The SKILL expression that the bindkey triggers.
7/16/12 SKILL Language Programming 110
The hiGetAppType Function
Use the hiGetAppType function to determine the appropriate application type.
hiGetAppType( window( 1 ) ) =>
"Command Interpreter"
The hiSetBindKey Function
Use the hiSetBindKey function to define a single bindkey.
hiSetBindKey( "Schematics"
"Shift Ctrl<Btn2Down>(2)"
"hiRaiseWindow( window(1))"
)
Use curly braces { } to group several SKILL expressions together when defining the callback (the
third argument in hiSetBindKey).
SKILL Language Programming 110
Cadence AE use only: Do not distribute
Describing Events
To determine the syntax to describe an event, do one of the following:
Study the Cadence® online documentation.
Display the bindkeys for an application that uses the event.
Examples
Event description Event syntax
The user pressed the a key. "<Key>a"
The user clicked the left mouse button. "<Btn1Down>"
The user draws through an area with the "<DrawThru1>"
left mouse button.
While holding down Shift and Control "Shift Ctrl<Btn2Down>(2)"
keys, the user double clicked the middle
mouse button.
To limit the event to entering points, append EF to the event syntax:
"<Btn1Down>EF"
7/16/12 SKILL Language Programming 111
Modes
If t_key ends with EF, you use the SKILL command in enterfunction mode. Otherwise, it is a
non-enterfunction mode command. If there is no enterfunction mode command defined when a
key or mouse event happens in enterfunction mode, the system uses the non-enterfunction
mode command for this key.
Note that even an empty string is a valid bindkey command. Therefore, if you want a non-
enterfunction mode command to be executed during an enterfunction, do not define an
enterfunction mode command for this key.
Enterfunctions
An enterfunction in the SKILL language is a built-in function which allows you to enter points
graphically. The enterfunctions then collect these points and pass them to your procedure which
uses the points to perform some action. These are very useful in the graphical environment.
The list of enterfunctions that collect points are
enterArc, enterBox, enterCircle, enterDonut, enterEllipse, enterLine, enterPath, enterPoint,
enterPoints, enterPolygon, enterScreenBox, enterSegment, enterMultiRep
Additional enterfunctions are enterNumber and enterString.
SKILL Language Programming 111
Cadence AEEditing
Displaying and use only: Do not distribute
Bindkeys
To display the current bindings for the application, perform these steps:
In the CIW, choose Options – Bind Keys to display the Bindkey
Editor.
Select
application
Double-click
Bindkey or
Command
to edit
7/16/12 SKILL Language Programming 112
You can save the displayed file and load it from your .cdsinit file.
The file uses the hiSetBindKeys function, instead of the hiSetBindKey function, to define the
bindkeys.
Can you describe the difference between the arguments for these two functions?
The hiGetBindKey Function
Use the hiGetBindKey function to determine the SKILL command associated with a mouse or
keyboard event.
hiGetBindKey( "Schematics" "None<Btn1Down>" ) =>
"schSingleSelectPt()"
hiGetBindKey( "Schematics" "<Key>z" ) => "hiZoomIn()“
The hiSetBindKeys Function
Use the hiSetBindKeys function to set multiple bindkeys for an application at one time. The
first parameter is the application type. The second parameter is a list of bindkey lists, where a
bindkey list is a two element list. The first element is the bindkey description, the second is the
bindkey action.
SKILL Language Programming 112
Cadence AE
Searching for use only:
a Command Do not
Assigned to distribute
a Bindkey
You can enter part of a SKILL command into the Search field on the
bindkey editor form to locate the bindkeys that match that definition.
In this example, the search locates all bindkeys that are mapped to SKILL
commands containing leHiCre. These are interactive layout editor
commands.
7/16/12 SKILL Language Programming 113
SKILL Language Programming 113
Cadence AE use
Standard Bindkey only: Do not distribute
Definitions
The following files contain the standard bindkey definitions:
/tools/dfII/samples/local/[Link]
/tools/dfII/samples/local/[Link]
Notice that these files use the aliasfunction to give a shorter name to the
hiSetBindKey function.
Examine the /tools/dfII/cdsuser/.cdsinit file, particularly the section entitled
LOAD APPLICATION BIND KEY DEFINITIONS, to study the SKILL code
that loads these two files. This is an example provided in the software for
your reference.
7/16/12 SKILL Language Programming 114
The alias Function
Use this function to give a more convenient name to a SKILL function. This example gives the
shorter name bk to the hiSetBindKey function.
alias( bk hiSetBindKey )
SKILL Language Programming 114
Cadence AEWindow
Opening a Text use only: Do not distribute
Use the view function to display a text file in a read-only window.
Example
This example displays the bindkey file from the Virtuoso® Schematic Editor.
view( prependInstallPath( "samples/local/[Link]" ))
7/16/12 SKILL Language Programming 115
Use the prependInstallPath function to make a pathname relative to the Virtuoso Design Environment installation
directory. This function prepends <install_dir>/tools/dfII to the path name. The view Function: The view function takes
several optional arguments.
Argument Status Type Meaning
file Required Text Pathname
winSpec Optional Bounding box/nil Bounding box of the window. If you pass nil, the default position is used.
Title Optional Text The title of the window. The default is the value of file parameter.
autoUpdate Optional t/nil If t, then the window updates for each write to the file. The default is no
autoUpdate.
appName Optional Text The application type for this window. The default is “Show File”.
Help Optional Text Text string for online help. The default means no help is available.
Example
This example displays the same file in a window titled Schematics Bindkeys.
view(
prependInstallPath( "samples/local/[Link]" )
’((406 506) (1032 806)) ;;; window bounding box
"Schematics Bindkeys" ;;; window title
) => window:6
SKILL Language Programming 115
Cadence
ManipulatingAE use only: Do not distribute
Windows
hiGetWindowName( window( 5 ) ) => "Virtuoso..."
Y hiRaiseWindow( window( 5 ) )
870
1
3
Virtuoso...
5
X
1140
7/16/12 SKILL Language Programming 116
Naming Windows
The hiGetWindowName Function
Use the hiGetWindowName function to retrieve a window title.
hiGetWindowName( window( 5 )) => "Virtuoso ...
The hiSetWindowName Function
Use the hiSetWindowName function to set a window title.
hiSetWindowName( window( 5 ) "My Title" ) => t
Raising and Lowering Windows
The hiRaiseWindow Function
Use the hiRaiseWindow function to bring a window to the top of the desktop.
hiRaiseWindow( window( 5 )) => t
The hiLowerWindow Function
SKILL Language Programming 116
Cadence AE use only: Do not distribute
Resizing Windows
The origin of the screen coordinate system is the lower-left corner.
The unit of measurement for screen coordinates is a pixel.
Y
hiResizeWindow( window( 3 ) list( 300:50 1000:600 ))
870
X
1140
7/16/12 SKILL Language Programming 117
The hiGetMaxScreenCoords Function
Use the hiGetMaxScreenCoords function to determine the maximum x-coordinate and
maximum y-coordinate value.
hiGetMaxScreenCoords() => ( 1140 870)
The hiGetAbsWindowScreenBBox Function
Use the hiGetAbsWindowScreenBBox function, passing t as the second argument, to retrieve
the bounding box of a window.
hiGetAbsWindowScreenBBox( window(1) t ) =>
((200 300) (650 700))
The hiResizeWindow Function
Use the hiResizeWindow function to resize a window. The bounding box you pass to the
hiResizeFunction will be the return value of the next call to the hiGetAbsWindowScreenBBox
function.
hiResizeWindow( window(1)
’((200 300) (650 700)) ) => t
SKILL Language Programming 117
Cadence AE use only: Do not distribute
Iconifying Windows
870
3
hiIconifyWindow( window( 3 ) )
X
1140
7/16/12 SKILL Language Programming 118
The hiIconifyWindow Function
The hiIconifyWindow function iconifies an open window.
hiIconifyWindow( window( 3 ) ) => t
The hiGetWindowIconifyState Function
The hiGetWindowIconifyState function returns nil if the window is uniconified. If the window is
iconified, it returns the upper-left corner of the iconified window.
hiGetWindowIconifyState( window( 3 ) ) => (1108 490
The hiDeiconifyWindow Function
The hiDeiconifyWindow function opens an iconified window.
hiDeiconifyWindow( window( 3 ) ) => t
SKILL Language Programming 118
Cadence AE use only: Do not distribute
Lab Exercises
Lab 5-1 Opening Windows
Lab 5-2 Resizing Windows
Lab 5-3 Storing and Retrieving Bindkeys
Lab 5-4 Defining a Bindkey to Highlight Text in a Show File Window
7/16/12 SKILL Language Programming 119
SKILL Language Programming 119
Cadence AE use only: Do not distribute
Module Summary
This module included these topics:
The window ID data type
Opening design windows
Defining application bindkeys
Using the Bindkey Editor
Opening read-only text windows
Managing windows
7/16/12 SKILL Language Programming 120
Category Functions
Basic window
hiGetWindowList
hiGetCurrentWindow
hiGetAbsWindowScreenBBox
Window manipulation hiGetWindowName,
hiSetWindowName
hiRaiseWindow
hiResizeWindow
hiGetWindowIconifyState,
hiIconifyWindow,
hiDeiconifyWindow
Opening design windows geOpen
Opening text windows view
Bindkeys hiGetAppType
hiGetBindKey
hiSetBindKey
SKILL Language Programming 120
Cadence AE use only: Do not distribute
Database Queries
Module 6
July 16, 2012
SKILL Language Programming 121
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn to
Use the SKILL® language to query design databases
What is the name of the design in the current window?
Are there any nets are in this design?
If so how many and what are the net names?
Are there any instances in this design?
If so, how many and what are the master cell names?
Are there any shapes in this design?
If so, what kinds of shapes are they?
Are there any vias in this design?
If so, what types of vias are they?
Describe database object concepts
Use the ~> operator to retrieve design data
7/16/12 SKILL Language Programming 122
Terms and Definitions
Library A collection of design objects referenced by logical name, such
as cells, views, and cellviews.
Cell A component of a design: a collection of different
representations of the components implementation, such as its
schematic, layout, or symbol.
Cellview A particular representation of a particular component, such as
the layout of a flip-flop or the schematic of a NAND gate.
View An occurrence of a particular viewType identified by its user-
defined name, "XYZ". Each "XYZ" view has an associated
viewType such as maskLayout, schematic, or symbolic.
Pin A physical implementation of a terminal.
Terminal A logical connection point of a component.
SKILL Language Programming 122
Cadence AE use only: Do not distribute
Database Objects
You can use the SKILL language to access schematic, symbol, and mask
layout design data.
Physical information (rectangles, lines, and paths)
Logical information (nets and terminals)
The SKILL Evaluator organizes design data in virtual memory in terms of
database objects. Each database object belongs to an object type that
defines a set of common attributes that describe the object. The set of
object types and their attributes is fixed by Cadence.
This module presents several object types and some of their attributes.
The cellView object type
The inst object type
The net object type
The Figure object types with their common attributes
The Shape object types with their common attributes
Each database object can have one or more user-defined properties.
7/16/12 SKILL Language Programming 123
User actions can create, modify, and save database objects to disk.
SKILL® variables can contain data of any type. However, for each attribute, the Database
Access software constrains the value of the attribute to one of these SKILL data types:
A string
An integer
A floating-point number
A database object
A list, possibly of database objects
SKILL Language Programming 123
Cadence AE
List of Object use only: Do not distribute
Types
This course describes a subset Cellview
of all the object types defined in
the Virtuoso® OpenAccess
database. Instances
The complete list of database
object types and attributes is instTerms
described in the Virtuoso Design
Environment SKILL Functions Nets
Reference manual.
See the “Attribute Retrieval and Shapes
Modification” section of the
manual for more details.
Vias
Properties
7/16/12 SKILL Language Programming 124
SKILL Language Programming 124
Cadence AE use only: Do not distribute
Querying a Design
When the design is in a graphics window, use the geGetWindowCellView function
to retrieve the database object for the design as in this example.
geOpen(
?lib "master"
?cell "mux2"
?view "schematic"
?mode "r" ) => window:7
mux2 = geGetWindowCellView( window(7)) db:38126636
Assign the database object to a SKILL variable to refer to it subsequently.
db:38126636 represents the database object.
The SKILL Evaluator does not accept db:38126636 as valid user input.
You can also use the geGetEditCellView function to retrieve the database object for
the design that is open in the window specified (default = current window).
mux2 = geGetEditCellView( ) db:38126636
7/16/12 SKILL Language Programming 125
The geGetWindowCellView Function
See the Cadence® online documentation to read about this function.
The geGetEditCellView Function
See the Cadence online documentation to read about this function.
These two functions are equivalent except when you are doing an edit-in-place. In that case
geGetEditCellview returns the cellview being edited rather than the cellview in the window
returned by geGetWindowCellView.
SKILL Language Programming 125
Cadence AE use only: Do not distribute
The ~> Operator
Use the ~> operator to access the attributes of a database object.
mux2~>objType => "cellView"
mux2~>cellViewType => "schematic"
Summary of ~> Syntax
Left side Right side Action
Database object Attribute or user- Retrieve value or nil if
defined property no such attribute or
property.
Database object ? Returns a list of
attribute names.
Database object ?? Returns list of name
and values.
List of database objects Attribute or user- Retrieves values
defined property individually and returns
them in a list.
7/16/12 SKILL Language Programming 126
The underlying function for the ~> operator is the getSGq function. You sometimes see
getSGq, get, or getq in error messages if you apply it to the wrong data.
The error message summarizes the data types to which the ~> operator is applicable. A
database object is a kind of user type.
mux2 = 5
mux2~>objType
*Error* get/getq: first arg must be
either symbol, list, defstruct or user type - 5
SKILL Language Programming 126
Cadence AE use
Querying Designs withonly:
the ~> Do not distribute
Operator
The queries stated in the objectives for this module are previewed in the
following table.
Query The ~> expression
What is the name of the design in cv = geGetWindowCellView( )
the current window? cv~>libName
cv~>cellName
cv~>viewName
How many nets are in the design? length( cv~>nets )
What are their names? cv~>nets~>name
What are the terminal names in the cv~>terminals~>name
design?
How many shapes are in the length( cv~>shapes )
design? What kinds of shapes are cv~>shapes~>objType
they?
7/16/12 SKILL Language Programming 127
SKILL Language Programming 127
Cadence
The cellViewAE use
Object only: Do not distribute
Type
Example: master mux2 schematic
7/16/12 SKILL Language Programming 128
The cellView object type includes the following attributes among others:
Attribute Data type Description
objType String “cellview”
libName String The library name of the design.
cellName String The cell name of the design.
viewName String The view name of the design.
cellViewType String The type of design data. Examples include
"schematic", "maskLayout", and
"schematicSymbol"
instances List of database objects The list of instances in the design.
Can be nil.
shapes List of database objects The list of shapes in the design.
Can be nil.
nets List of database objects The list of nets in the design.
Can be nil.
terminals List of database objects The list of terminals in the design.
Can be nil.
SKILL Language Programming 128
Cadence
Instances AE use only: Do not distribute
Example: Instance l1 of master mux2 schematic
In this design, each of the instances has user-defined properties that
describe the physical sizes of the transistors.
7/16/12 SKILL Language Programming 129
SKILL Language Programming 129
Cadence AEType
The inst Object use only: Do not distribute
You can apply the ~> operator to the result of another ~> expression as in
these examples:
The list of the instances in the design
mux2~>instances =>
( db:39520396 db:39523572 db:39522480 .... )
I1 = dbFindAnyInstByName( mux2 "I1" ) => db:38127508
The list of instance names
mux2~>instances~>name =>
( "I6" "I9" "I8" "I3" "I1"
"I0" "I5" "I7" "I4" "I2" )
The list of user-defined properties on the I1 instance
I1~>prop~>name =>("pw" "pl" "nl" "nw")
I1~>prop~>value => ("11" "1" "1" "11")
I1~>pw => "11"
The list of master cell names
mux2~>instances~>cellName
( "Inv" "gnd" "vdd" "nand2" "nand2"
"nand2" "opin" "ipin" "ipin" "ipin" )
7/16/12 SKILL Language Programming 130
The inst Object Type has the following attributes among others:
Attribute Data type Description
objType String “inst”
libName String The library name of the design.
cellName String The cell name of the design.
viewName String The view name of the design.
name String The instance name.
master A database object The mater cell view of this instance. Can be nil if
master hasn’t been read into virtual memory.
instTerms List of database objects The list of instance terminals. Can be nil.
The dbFindAnyInstByName Function
The dbFindAnyInstByName function returns the database object of the instance, given the
database object of the design and the instance name. See the Cadence online documentation to
read about this function.
SKILL Language Programming 130
Cadence
Nets AE use only: Do not distribute
Example: net SEL in master mux2 schematic
7/16/12 SKILL Language Programming 131
SKILL Language Programming 131
Cadence AEType
The net Object use only: Do not distribute
Use the ~> operator and cellView and net attributes to retrieve the
following:
The nets in the design
mux2~>nets => (
db:41088056 db:41087980 db:41087752 db:41087676
db:41087640 db:41087380 db:41087284 db:39523392
db:39522784 )
dbFindNetByName( mux2 "SEL" ) => db:41087284
The number of nets
length( mux2~>nets ) => 9
The names of the nets
mux2~>nets~>name =>
("B" "A" "net4" "Y" "net6"
"net7" "SEL" "gnd!" "vdd!" )
7/16/12 SKILL Language Programming 132
The net Object Type
The net object type has the following attributes among others:
Attribute Data type Description
objType String “net”
name String The name of the net.
term Database object The unique terminal. Can be nil if net
is internal
instTerms List of database objects The list of instance terminals.
The dbFindNetByName Function
See the Cadence online documentation to read about this function.
SKILL Language Programming 132
Cadence AE use only: Do not distribute
Instance Terminals
Instance terminals provide an interface between instance and the nets in a
design.
Each instance contains zero or more instance terminals.
Each net connects zero or more instance terminals.
Example: The B instance terminal on the I1 instance.
7/16/12 SKILL Language Programming 133
SKILL Language Programming 133
Cadence
The instTermAE useType
Object only: Do not distribute
You can retrieve the following data:
The names of instTerm objects associated with the I1 instance
dbFindAnyInstByName( mux2 "I1" )~>instTerms~>name =>
("B" "Y" "A")
The name of the net that attaches to the B instTerm
dbFindAnyInstByName( mux2 "I1" )~>instTerms~>net~>name =>
( "SEL" "net4" "B" )
7/16/12 SKILL Language Programming 134
SKILL Language Programming 134
Cadence
Terminals AE use only: Do not distribute
A terminal provides a way to connect to a net within the design.
Internal nets do not have terminals.
7/16/12 SKILL Language Programming 135
SKILL Language Programming 135
Cadence AE Type
The term Object use only: Do not distribute
Every design contains a list of its terminals. For example, the SEL terminal.
mux2~>terminals =>
(db:39521220 db:39520296 db:39895624 db:39895292)
mux2~>terminals~>name =>
("SEL" "Y" "B" "A")
dbFindTermByName( mux2 "SEL" ) => db:39521220
Every net connects to one terminal at most. nil means that the
corresponding net doesn’t connect to a terminal object.
mux2~>nets~>term =>
( db:27850008 nil nil db:27850348 db:27849804
nil nil db:27847992 nil )
Internal nets do not connect to any terminal. For example, the net4 net
does not connect to a terminal.
mux2~>nets~>name =>
("B" "net7" "net6" "Y" "A"
"vdd!" "gnd!" "SEL" "net4" )
7/16/12 SKILL Language Programming 136
The dbFindTermByName Function
The dbFindTermByName function returns the terminal database object, given the database object
of the design and the name of the terminal.
See the Cadence online documentation to read about this function.
SKILL Language Programming 136
Cadence
Figures and AE use only: Do not distribute
Shapes
Example: master mux2 layout with an instance, path and via selected
geGetSelSet: function used to retrieve the currently selected set
Example
mySet = geGetSelSet( ) => (db:0x1… db:0x2… db:0x3… )
mySet~>objType => (“path” “inst” “stdVia” )
7/16/12 SKILL Language Programming 137
Figures
Anything the user can select with the mouse is a Figure.
Every Figure is either an instance or database object such as a shape or via. Every Figure has a
bBox attribute that describes its bounding box.
Each net can have one or more associated Figures. In a schematic, these are wire segments with
objType "line".
The geGetSelSet Function
Use the geGetSelSet function to retrieve the selected set. See the Cadence online documentation to
read about this function.
The geSelectFig Function
Use the geSelectFig function to select a specific figure database object. See the Cadence online
documentation to read about this function.
SKILL Language Programming 137
Cadence
Vias AE use only: Do not distribute
Example: via of master mux2 layout
This via is a Standard Via defined in the cellTechLib technology library.
7/16/12 SKILL Language Programming 138
SKILL Language Programming 138
Cadence AEType
The via Object use only: Do not distribute
You can apply the ~> operator to the result of another ~> expression as in
these examples:
The list of the vias in the design
mux2~>vias =>
( db:39520396 db:39523572 db:39522480 .... )
The list of via names
mux2~>vias~>viaHeader~>viaDefName =>
("M1_POLY1" "M1_POLY1" "M1_POLY1" "M2_M1" "M2_M1“ ....)
The list of technology libraries where the vias are defined)
mux2~>vias~>viaHeader~>viaDef~>techFile~>libName
(“cellTechLib" “cellTechLib“ “cellTechLib“ .... )
The list of via locations
mux2~>vias~>bBox
( ((54.0 26.5) (56.0 28.5)) ((34.5 27.0) (36.5 29.0)) .... )
7/16/12 SKILL Language Programming 139
Attribute Data type Description
objType String “inst”
libName String The library name of the design.
cellName String The cell name of the design.
viewName String The view name of the design.
name String The instance name.
master A database object The mater cell view of this instance. Can be nil
if master hasn’t been read into virtual memory.
instTerms List of database objects The list of instance terminals. Can be nil.
SKILL Language Programming 139
Cadence
Locating ViaAE use only: Do not distribute
Definitions
The via definitions are stored in a technology library. To view the definitions
you can dump the technology file or use the Development Environment for
Technology files (DEFT) utility.
7/16/12 SKILL Language Programming 140
To view the technology files in DEFT, you need to:
1. CIW: Tools – Technology File Manager – The Technology Tool Box opens.
2. Click the DEFT button – The Eclipse IDE starts and the DEFT window opens.
Create a New Project First
3. Choose File – New Project – The New Project form opens.
4. Choose Cadence Virtuoso Platform + Virtuoso Techfile Project and click Next – the New Virtuoso
Project page opens.
5. Create a name for the project (ex. techfile_example), use the default location and installation and click
Finish – A new project is created.
Import a techfile from a technology library
6. From the DEFT utility, choose File – Import – the Import wizard opens.
7. Choose Cadence Virtuoso Platform – ASCII Technology Files from Virtuoso Technology Libraries
and click Next.
8. Browse to select the Library Definition File as the [Link] with the libraries needed and select the
techfiles to import.
9. Browse to select the Import Destination as the project you created in step 5 above and click Finish.
Expand the project (ex. techfile_example) in the DEFT Project Explorer assistant to see the techfiles to
view and edit within DEFT.
SKILL Language Programming 140
Cadence AE use only: Do not distribute
Lab Exercises
Lab 6-1 Querying Design Databases
In this lab, you open these designs:
master mux2 schematic
master mux2 layout
master mux2 extracted
master mux2 symbol
You enter SKILL expressions to answer the following questions:
How many nets are in the design?
What are the net names?
Are there any instances in the design?
Are there any shapes in the design?
Are there any vias in the design?
Optional: Create a DEFT project and import the cellTechLib to
view the via definitions.
7/16/12 SKILL Language Programming 141
SKILL Language Programming 141
Cadence AE use only: Do not distribute
Module Summary
This module included these topics:
Database object concepts
Several specific object types
The cellView object type
The inst object type
The various shape object types
The net object type
The via object type
The geGetWindowCellView function
The geGetSelSet function
Using the ~> operator to retrieve attributes and user-defined properties
7/16/12 SKILL Language Programming 142
SKILL Language Programming 142
Cadence AE use only: Do not distribute
Menus and Toolbars
Module 7
July 16, 2012
SKILL Language Programming 143
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn to
Create and display pop-up menus
Create pull-down menus
Install and remove pull-down menus from window banners
Modify a Toolbar to include a new action item
7/16/12 SKILL Language Programming 144
Terms and Definitions
Callback SKILL® code that the system calls when the user does something in
the user interface
SKILL Language Programming 144
Cadence AE use
Creating a Pop-Up only: Do not distribute
Menu
Use the hiCreateSimpleMenu function to build a pop-up menu with choices.
This example creates a pop-up menu with Example Menu as the title.
hiCreateSimpleMenu(
’TrExampleMenu
"Example Menu"
’( “Open" “Save" )
’( “deFileOpen()" “geSave()" )
) => hiMenu@0x3b2aae8
Use the hiDisplayMenu function to display the menu. After it is displayed,
Choosing Open causes Example Menu
deFileOpen( ) to execute. Open
Choosing Save causes Save
geSave() to execute.
7/16/12 SKILL Language Programming 145
deFileOpen is a built-in SKILL function that lets the user open design files.
geSave is a built-in SKILL function that lets the user save changes to a design.
Example Arguments Meaning
’TrExampleMenu The menu variable.
hiCreateSimpleMenu stores
the data structure of the menu in this variable.
TrExampleMenu => hiMenu@0x3b2aae8
"Example Menu" The title of the menu.
’( "One" "Two" ) The list of the choices. No repetitions.
’( The list of callbacks.
"println( \"One\" )" Each callback is a string representing a single expression.
"println( \"Two\" )" Use \" to embed a single quote.
) Use curly braces, { }, to group multiple expressions into a single
expression.
SKILL Language Programming 145
Cadence
Displaying aAE useMenu
Pop-Up only: Do not distribute
1. Use the hiDisplayMenu function to hiSetBindKey( “Layout"
display a pop-up menu. "Shift Ctrl<Btn2Down>(2)"
2. Pass the menu data structure to "hiDisplayMenu( TrExampleMenu )")
the hiDisplayMenu function.
This example defines a bindkey for the Layout application. The bindkey displays
your pop-up menu.
1. Define bindkey for menu. 2. Click bindkey. 3. Choose Item. 4. Enter Information.
7/16/12 SKILL Language Programming 146
Example arguments Meaning
TrExampleMenu Use the variable you passed to hiCreateSimpleMenu.
Do not apply the ’ operator to the TrExampleMenu variable
because you want to refer to the value of the variable.
SKILL Language Programming 146
Cadence AE useMenu
Creating a Pull-Down only: Do not distribute
General characteristics of a pull-down menu include the following:
You can insert a pull-down menu in one or more menu banners or
in slider menus.
These menus can contain textual, iconic, or slider items.
TrOpenItem = hiCreateMenuItem(
?name ’TrMenuItemOpen
1. Use the hiCreateMenuItem ?itemText “Open"
function to create the menu ?callback “deFileOpen()”
items. Create a separate )
menu item for each one. TrSaveItem = hiCreateMenuItem(
2. Use the ?name ’TrMenuItemSave
?itemText “Save"
hiCreatePulldownMenu ?callback “geSave()”
function to create a pull-down )
menu.
hiCreatePulldownMenu(
3. Pass the list of menu items to ’TrPulldownMenu ;menu name
the hiCreatePulldownMenu "Example Menu“ ;menu title
function. list( TrOpenItem TrSaveItem)
)
7/16/12 SKILL Language Programming 147
Formal argument Actual argument Meaning
?name ’TrMenuItemOne The symbolic name of the item.
Quote this variable.
Make sure that you also store the return
result in this variable.
?itemText “One” The text that appears on the menu.
?callback "println( \"One\" )" The action triggered by this menu item.
Example arguments Meaning
’TrPulldownMenu The menu variable. Quote this variable.
The function stores the pull-down data
structure menu in this variable.
"Example Menu" The menu title.
list( TrMenuItemOne TrMenuItemTwo ) The list of menu items.
SKILL Language Programming 147
Cadence AE use Menu
Inserting a Pull-Down only: Do not distribute
Assume that a single window is already open.
Use the hiInsertBannerMenu function to insert a pull-down menu in the
window menu banner.
The following line inserts a pull-down menu in the leftmost position of the
CIW: hiInsertBannerMenu( window( 1 ) TrPulldownMenu 0 )
7/16/12 SKILL Language Programming 148
The hiInsertBannerMenu function works only on a single window.
If you attempt to insert a pull-down menu that is already present in a window banner, the
following actions occur:
You get a warning message.
Your request is ignored.
To replace a pull-down menu, first delete the menu that you want to replace.
Example argument Meaning
window( 1 ) The window ID
TrPulldownMenu The data structure for the pull-down menu.
Use the variable you passed to
hiCreatePulldownMenu.
Do not apply the ’ operator to the
hiCreatePulldownMenu variable because
you want to refer to its contents.
0 The index of the menu after it has been
inserted.
0 is the leftmost.
SKILL Language Programming 148
Cadence AE useMenu
Deleting a Pull-Down only: Do not distribute
Use the hiDeleteBannerMenu function to remove a pull-down menu from
the window banner.
The pull-down menus on the right move one position to the left.
This example removes the leftmost menu in the CIW.
Notice that the hiDeleteBannerMenu function requires the index of the pull-
down menu. You can use the result of hiGetBannerMenus() to figure out
the index by counting down the list to the position of the menu. The first
menu in the list is index 0.
7/16/12 SKILL Language Programming 149
The hiDeleteBannerMenu Function
Example argument Meaning
window( 1 ) The window ID
0 The index of the menu.
0 is the leftmost.
SKILL Language Programming 149
Cadence AE use only: Do not distribute
Toolbar Customization
Toolbars provide consistent icon menus across windows and applications.
They are available for all applications. Some examples are:
File Edit
Schematic
Layout
You can customize the toolbars by modifying a definition file. The default
toolbar definition file is located at:
<install_dir>/share/cdssetup/dfII/toolbars/byApplication/[Link]
Here is an example from the [Link] file:
(( nil
name leFileToolbar
Text “File”
Items ( ( *** item1 definition ***)
( *** item2 definition ***)
)
) ...
7/16/12 SKILL Language Programming 150
SKILL Language Programming 150
Cadence AE use only:
Toolbar Customization Do not distribute
Example
The toolbar name (such as leFileToolbar) must be unique across all
applications. The text the program uses for the toolbar title and tooltip text
(such as File) need not be unique.
(( nil
name leFileToolbar
text "File"
items (( nil
type action
name leFileToolbarOpen
text "Open"
iconFile "[Link]"
callback "deFileOpen()"
disabled t
)
( nil
type action
name leFileToolbarSave
text "Save"
iconFile "[Link]"
callback "geSave()"
enableCondition modified
)
)...
7/16/12 SKILL Language Programming 151
You can create your own icons using an image editor like GIMP. You need to be able to save the icon file in the PNG format. Be sure
to set the pixel size to 24x24 so they will display correctly in the toolbar. You can also locate free icons on the internet.
The iconFile is looked up in the standard [Link] locations prefixed by the path icons/24x24. The standard locations include
<install_dir>/share/cdssetup
./.cadence
~/.cadence
A complete explanation of each field can be found in the Virtuoso Design Environment User Guide. See “Customizing Toolbars” in the
“Customizing Your Design Environment” section.
Toolbar Customization File Definition
Main Toolbar
Mandatory fields: name, text, items
Optional Fields: Invisible, toolButtonStyle (textOnly, iconOnly, textBesideIcon, textUnderIcon)
Item Type: action
Mandatory Fields: type (action), name, text, callback, iconFile (.png format)
Optional Fields: subAction, disabled, checkable, checked
Item Type: comboBox
Mandatory Fields: type (comboBox), name, toolTip, items, callback, width
Optional Field: disabled
Item Type: typein
Mandatory Fields: type (typein), name, toolTip, callback, value, width
Optional Field: disabled
Item Type: separator
Mandatory Fields: type (separator), name
Item Type: inheritToolbarsFrom
Mandatory Fields: inheritToolbarsFrom (application)
SKILL Language Programming 151
Cadence AE use only: Do not distribute
Lab Exercises
Lab 7-1 Exploring Menus
Exploring Pop-Up Menus
Exploring Pull-Down Menus
Exploring Toolbars
Lab 7-2 Modifying a Toolbar Menu
7/16/12 SKILL Language Programming 152
SKILL Language Programming 152
Cadence AE use only: Do not distribute
Module Summary
This module included these topics:
Creating and displaying a pop-up menu
Creating a pull-down menu
Installing a pull-down menu in a window banner
Deleting a pull-down menu from a window banner
Modifying a toolbar
7/16/12 SKILL Language Programming 153
Function Description
hiCreateSimpleMenu Builds a pop-up menu with text choices only.
hiCreateMenu Builds a pop-up menu text or icon choices.
hiDisplayMenu Displays a pop-up menu built by
hiCreateSimpleMenu or hiCreateMenu.
hiCreateMenuItem Builds a menu item. Several menus can share
this item simultaneously.
hiCreatePulldownMenu Builds a pull-down menu with text or icon
choices.
hiInsertBannerMenu Installs a pull-down menu in a window
banner.
hiDeleteBannerMenu Removes a pull-down menu from the banner.
SKILL Language Programming 153
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 154
SKILL Language Programming 154
Cadence AE use only: Do not distribute
Customization
Module 8
July 16, 2012
SKILL Language Programming 155
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn to
Customize your .cdsinit Virtuoso startup file
Define the SKILL path to locate SKILL files
Load and execute SKILL functions
Define bindkeys to map key sequences to SKILL commands
Position Virtuoso windows
7/16/12 SKILL Language Programming 156
Terms and Definitions
Context A SKILL context is a binary file containing compiled SKILL code.
Each SKILL application is associated with one or more contexts.
SKILL Language Programming 156
Cadence AE
Virtuoso Design use only:
Environment Do not
Initialization distribute
Sequence
Cadence® partitions applications into one or more SKILL contexts. A SKILL
context is a binary file containing compiled SKILL code and SKILL data
structures.
When you start the Virtuoso Design Environment, it loads these items:
1. Loads one or more SKILL contexts (pre-loaded sets of functions).
2. Loads all .cdsenv files (environment variables for applications).
3. Loads the .cdsinit customization file.
However, a .cdsinit can load other .cdsinit files.
4. Responds to user activity by loading other SKILL contexts. For
example when the user opens a schematic for the first time.
virtuoso & Timeline
1 1 1 1 2 3 4
geView menuBuilder schView selectSv .cdsenv .cdsinit schematic
7/16/12 SKILL Language Programming 157
The search order for the .cdsinit file is /tools/dfII/local, the current directory, and the home
directory. Once the environment finds a .cdsinit file, the search stops.
The context files are in the <install_dir>/[Link]/etc/context directory.
Each executable (ex. Schematic, Layout, etc. ) loads different contexts.
Study the log file to determine the contexts that your executable loads prior to the .cdsinit
file.
The icfb executable loads these contexts, as the following excerpt for the [Link] indicates.
Loading [Link]
Loading [Link]
Loading [Link]
Loading [Link]
SKILL Language Programming 157
Cadence AE use only: Do not distribute
The .cdsinit File
The site administrator has three strategies to control the user
customization.
Policy Customization Strategy
The site administrator The /tools/dfII/local/.cdsinit contains all
does all the customization. customization commands. There are no
./.cdsinit or ~/.cdsinit files involved.
The site administrator does The /tools/dfII/local/.cdsinit file contains a
some customization. Each command to load the ./.cdsinit or ~/.cdsinit
user can customize further. files.
Each user does all his/her The /tools/dfII/local/.cdsinit file does not
own customization. exist.
All customization handled by either the
./.cdsinit or ~/.cdsinit files.
Study the <install_dir>/tools/dfII/cdsuser/.cdsinit file for sample user
customizations.
7/16/12 SKILL Language Programming 158
SKILL Language Programming 158
Cadence AE use
The Basic .cdsinit only: Do not distribute
Tasks
Make the .cdsinit file accomplish these three tasks:
Set the SKILL path.
The SKILL path is a list of directories containing SKILL source code
and data files. The load, loadi, view, and other file system interface
functions refer to the SKILL path to resolve relative pathnames.
Load your SKILL utilities.
Use the load function or the loadi functions.
Define application bindkeys.
Use the either the hiSetBindKey function or the hiSetBindKeys
functions.
For maximum flexibility, implement your .cdsinit file so that another .cdsinit
file can load it as in these examples:
Another .cdsinit file can set the SKILL path before loading your .cdsinit
file.
Set the SKILL path to the current SKILL path plus the directories that
contain your SKILL source code files.
7/16/12 SKILL Language Programming 159
The SKILL Path
The getSkillPath Function
The getSkillPath function returns a list of directory pathnames in search order.
The setSkillPath Function
The setSkillPath function sets the path to a list of directory pathnames.
SKILL Language Programming 159
Cadence AESource
Loading SKILL use only:
Code Do not distribute
Use the load or loadi functions to load SKILL source code.
The load functions returns t if all SKILL expressions run without errors.
Any error causes the load function to abort.
The loadi function executes every SKILL expression in the file,
regardless of errors.
Examples
Load standard Virtuoso Schematic Editor bindkey definitions.
load( prependInstallPath( "samples/local/[Link]" ) )
Load customized Virtuoso Layout Editor bindkey definitions. In this case
they are stored in the user’s home directory in a directory called mySKILL.
loadi( “~/mySKILL/[Link]" ) )
In the loadi example, if there is an error with a single bindkey definition in
[Link] the rest of the layout bindkeys will still load.
7/16/12 SKILL Language Programming 160
Standard Bindkey Definitions
These files contain standard bindkey definitions for the Virtuoso software.
Application Pathname
Virtuoso Schematic Editor /tools/dfII/samples/local/[Link]
Virtuoso Layout Editor /tools/dfII/samples/local/[Link]
SKILL Language Programming 160
Cadence
Other UsefulAE useFunctions
.cdsinit only: Do not distribute
SKILL functions can answer the following questions:
What is the installation path?
What is the value of a particular shell environment variable?
Does a particular file exist?
What are all the files in a directory?
Use the Cadence online documentation to study the functions on the next
few slides.
7/16/12 SKILL Language Programming 161
SKILL Language Programming 161
Cadence
DeterminingAE use only:Path
the Installation Do not distribute
Use the prependInstallPath function to make a pathname relative to the
Virtuoso Design Environment installation directory. The function prepends
<install_dir>/tools/dfII to the path name.
Example
This example code adds three directories to the front of the current SKILL
path. The three directories are in the installation hierarchy.
TrSamplesPath = list(
prependInstallPath( "etc/context" )
prependInstallPath( "local" )
prependInstallPath( "samples/local" )
)
setSkillPath( ;;; requires a list of strings
append(
TrSamplesPath ;;; a list of strings
getSkillPath() ;;; the current SKILL path
) ; append
) ; setSkillPath
7/16/12 SKILL Language Programming 162
SKILL Language Programming 162
Cadence AEUNIX
Interfacing with useFiles
only: Do
and not distribute
Directories
Use the simplifyFilename function to determine the full pathname to a file. It
correctly deals with the following items:
The user’s home directory
The current working directory
Example
simplifyFilename( "~/SKILL" ) => "/usr1/mnt/skilldev/SKILL“
simplifyFilename( "./.cdsinit" )=>"/usr1/mnt/skilldev/SKILL/.cdsinit“
The isFile function returns t if the files exists and returns nil otherwise. Use the
isFile function to test for the existence of the file in the SKILL search path before
attempting to load the file.
Example
when( isFile( "[Link]" )
loadi( "[Link]" )
) ;when
7/16/12 SKILL Language Programming 163
The simplifyFilename Function
The simplifyFilename function expands the specified path to a full path. The tilde, /, and ./ are
resolved, and redundant backslashes are removed. This shows exactly where the files are accessed
for reporting information or error reporting by functions that require paths.
The when Function
The when function evaluates the first expression to determine whether or not to evaluate the
subsequent expressions in its body.
SKILL Language Programming 163
Cadence AE use
Loading All SKILL Filesonly: Do not distribute
in a Directory
You can create a loop in the .cdsinit to load all SKILL files in a directory.
This is useful to allow you to add new SKILL functions by simply adding
them to the directory. You do not need to edit the c. dsinit every time you
create or use a new SKILL function.
Use getDirFiles to retrieve the files and subdirectories in a directory. Then
use rexMatchList to select just the files which end in .il using the regular
expression “.il$”.
Example
allFiles = getDirFiles( "Menus" ) =>
("." ".." "Solutions" "[Link]" "[Link]“ "[Link]"
"[Link]" )
allSkillFiles = rexMatchList( “.il$” allFiles ) => ("[Link]"
"[Link]“ "[Link]“ "[Link]" )
foreach( skillFile allSkillFiles load( skillFile ) ) =>
("[Link]" "[Link]“ "[Link]“
"[Link]" )
7/16/12 SKILL Language Programming 164
foreach is an iteration (loop) function which goes through all elements in a list and extracts one at
a time to process in the loop. This will be covered in more detail in the Flow of Control module.
The rexMatchList Function creates a new list of those strings or symbols in the given list that
match a regular expression pattern.
Syntax:
rexMatchList(
t_pattern
l_targets
) => l_results | nil
SKILL Language Programming 164
Cadence AE
Reading Shell use only:Variables
Environment Do not distribute
Use the getShellEnvVar function to determine the value of a shell
environment variable.
For example, the following line returns the value of the USER variable.
user = getShellEnvVar("USER")=> “JohnG“
Another example, is to extract a variable that would define the PROJECT
the user is working on.
project = getShellEnvVar(“PROJECT")=> “GPU1“
These along with other environment variables can be combined to create
paths, directories or files which uniquely identify the user for specific SKILL
applications.
7/16/12 SKILL Language Programming 165
SKILL Language Programming 165
Cadence
ManipulatingAE use
a List only: Do not distribute
of Strings
Use the buildString function to make a single string from a list of strings.
The buildString function provides separating space by default. The optional
second argument can be used to specify a different separator like “/”.
Example
buildString( list( project user “status" “[Link]" )) =>
“GPU1 JohnG status [Link]“
buildString( list( project user “status" "[Link]" ) "/" ) =>
“GPU1/JohnG/status/[Link]"
Use the parseString function to parse a single string into a substring based
on delimiter characters.
Example
parseString( “GPU1 JohnG status [Link]" ) =>
( “GPU1" “JohnG" “status" "[Link]" )
parseString(“GPU1/JohnG/status/[Link]" "/" ) =>
( “GPU1" “JohnG" “status" "[Link]" )
7/16/12 SKILL Language Programming 166
SKILL Language Programming 166
Cadence
ManipulatingAE
the use only:
CIW in Do not
the .cdsinit Filedistribute
You can accomplish the following optional tasks in [Link] file:
Positioning the CIW
hiResizeWindow(window(1) list( 10:10 750:200))
Adding pull-down menus to the CIW. Consider the following example
from the previous module.
hiInsertBannerMenu( window( 1 ) TrPulldownMenu 0 )
Removing pull-down menus from the CIW menu banner. Consider the
following example from the previous module.
hiDeleteBannerMenu( window( 1 ) 0 )
7/16/12 SKILL Language Programming 167
SKILL Language Programming 167
Cadence AE use
SKILL Development only:Tasks
.cdsinit Do not distribute
SKILL programmers can accomplish the following optional tasks in the
.cdsinit file:
Set the log filter options.
The CIW will display the maximum amount of SKILL information.
hiSetFilterOptions( t t t t t t t )
Install the SKILL debugger.
The SKILL debugger will be available to trap errors.
installDebugger()
alias( q debugQuit )
alias( c continue )
7/16/12 SKILL Language Programming 168
SKILL Language Programming 168
Cadence
Lab PreviewAE use only: Do not distribute
In the lab, you make several bindkey definitions immediately available
when the Virtuoso Design Environment starts.
You define a bindkey for both the Schematics and Layout applications to
raise the Command Interpreter Window.
You define a bindkey for the Command Interpreter application to raise the
current window.
With a single key stroke, you can toggle back and forth between the current
window and the CIW. This feature has the following benefits:
You can keep the CIW large without loosing track of your current
window.
You can bury the CIW until you need it.
7/16/12 SKILL Language Programming 169
SKILL Language Programming 169
Cadence AE use only: Do not distribute
Lab Exercises
Lab 8-1 Defining Bindkeys in the .cdsinit File
7/16/12 SKILL Language Programming 170
SKILL Language Programming 170
Cadence AE use only: Do not distribute
Module Summary
This module included these objectives:
Customize your .cdsinit Virtuoso startup file
Define the SKILL path to locate SKILL files
Load and execute SKILL functions
Define Bindkeys to map key sequences to SKILL commands
Position Virtuoso windows
7/16/12 SKILL Language Programming 171
SKILL Language Programming 171
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 172
SKILL Language Programming 172
Cadence AE use only: Do not distribute
SKILL Functions
Module 9
July 16, 2012
SKILL Language Programming 173
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn to
Group several SKILL® expressions into a single SKILL expression.
Declare local variables.
Declare a SKILL function.
Define required, optional and keyword parameters.
Describe the SKILL software development cycle:
Load your SKILL source code
Redefine a SKILL function
7/16/12 SKILL Language Programming 174
Terms and Definitions
load A SKILL procedure that opens a file and reads it one SKILL expression at a
time. The load function evaluates immediately.
Usually, you set up your .cdsinit file to load your SKILL source code during
the initialization of the Virtuoso® Design Environment.
SKILL Language Programming 174
Cadence AE Expressions
Grouping SKILL use only: Do not distribute
Together
Sometimes it is convenient to group several SKILL statements into a single
SKILL statement.
Use the curly braces, { }, to group a collection of SKILL statements into a
single SKILL statement.
The return value of the single statement is the return value of the last SKILL
statement in the group. You can assign this return value to a variable.
This example computes the height of the bounding box stored inbBox.
bBox = list( 100:200 350:450 )
bBoxHeight = {
ll = lowerLeft( bBox )
ur = upperRight( bBox )
lly = yCoord( ll )
ury = yCoord( ur )
ury - lly
}
=> 250
The variables ll, ur, lly, and ury are global variables. The curly braces, { },
do not make them local variables.
7/16/12 SKILL Language Programming 175
Curly Braces
The following statements refer to the example above:
The ll and ur variables hold the lower-left and upper-right points of the bounding box
respectively.
The xCoord and yCoord functions return the x and y coordinate of a point.
The ury-lly expression computes the height. It is the last statement in the group and
consequently determines the return value of the group.
The return value is assigned to the bBoxHeight variable.
All of the variables, ll, ur, ury, lly, bBoxHeight and bBox are global variables.
SKILL Language Programming 175
Cadence AE use only:
Grouping Expressions Do Variables
with Local not distribute
Use the let function to group SKILL expressions and declare one or more
local variables.
Include a list of the local variables followed by one or more SKILL
expressions.
These variables will be initialized to nil.
The SKILL expressions compose the body of the let function. The let
function returns the value of the last expression computed within its body.
This example computes the height of the bounding box stored in bBox.
bBox = list( 100:200 350:450 )
bBoxHeight = let(( ll ur lly ury )
ll = lowerLeft( bBox )
ur = upperRight( bBox )
lly = yCoord( ll )
ury = yCoord( ur )
ury - lly ) ; let
=> 250
The local variables ll, ur, lly, and ury are initialized to nil.
The return value is the ury-lly.
7/16/12 SKILL Language Programming 176
The let Function
You can freely nest let statements.
You can access the value of a variable any time from anywhere in your program. SKILL Evaluator
transparently manages the value of a variable like a stack. Each variable has a stack of values.
The current value of a variable is simply the top of the stack.
Assigning a value to a variable changes only the top of the stack.
Whenever the flow of control enters a let function, the SKILL Evaluator pushes a temporary value
onto the value stack of each variable in the local variable list. The local variables are normally
initialized to nil.
When the flow of control exits a let function, SKILL Evaluator pops the top value of each variable
in the local variable list. If a variable with the same name existed outside of the let it will have the
same value that it had before the let was executed.
SKILL Language Programming 176
Cadence AE
Two Common let use only: Do not distribute
Errors
The two most common let errors are
Including whitespace after let.
The error message depends on whether the return value of the let is
assigned to a variable.
let ( ( ll ur lly ury )
ll = lowerLeft( bBox )
ur = upperRight( bBox )
lly = yCoord( ll )
ury = yCoord( ur )
ury - lly
) ; let
*Error* let: too few arguments (at least 2 expected, 1 given)
Omitting the list of local variables.
The error messages vary and can be obscure and hard to decipher.
let(
ll = lowerLeft( bBox )
ur = upperRight( bBox )
lly = yCoord( ll )
ury = yCoord( ur )
ury - lly
) ; let
7/16/12 SKILL Language Programming 177
SKILL Language Programming 177
Cadence AEFunctions
Defining SKILL use only: Do not distribute
Use the procedure function to associate a name with a group of SKILL
expressions. The name, a list of arguments, and a group of expressions
compose a SKILL function declaration.
The name is known as the function name.
The group of statements is the function body.
Example
bBox = list( 100:200 350:450 ) Write global variable
procedure( TrBBoxHeight() Define function
let( ( II ur lly ury ) Local variables
ll = lowerLeft( bBox ) Read global variable
ur = upperRight( bBox ) Read global variable
lly = yCoord( II )
ury = yCoord( ur )
ury – lly Return value
) ; let
) ; procedure
bBoxHeight = TrBBoxHeight() Invoke function
7/16/12 SKILL Language Programming 178
The procedure Function
Local Variables
You can use the let syntax function to declare the variables ll, ur, ury, and lly to be local variables.
The arguments presented in an argument list of a procedure definition are also local variables. All
other variables are global variables.
Global Variable
The bBox variable is a global variable because it is neither an argument nor a local variable.
Return Value
The function returns the value of the last expression evaluated. In this example, the function
returns the value of the let expression, which is the value of the ury-lly expression.
SKILL Language Programming 178
Cadence AEprocedure
Three Common use only: Do not distribute
Errors
The three most common procedure errors are
Including whitespace after the procedure function
procedure ( TrBBoxHeight( ) ...
) ; procedure
*Error* procedure: too few arguments (at least 2 expected, 1 given)
Including whitespace after your function name
procedure( TrBBoxHeight ( ) ...
) ; procedure
*Error* procedure: illegal formal list - TrBBoxHeight
Omitting the argument list
procedure( TrBBoxHeight ...
) ; procedure
*Error* procedure: illegal formal list - TrBBoxHeight
Notice that the error message refers to the procedure function. The
arguments to procedure are the function name, the argument list of the
function, and the expression composing the body of the function.
7/16/12 SKILL Language Programming 179
SKILL Language Programming 179
Cadence AE use
Defining Required only:Parameters
Function Do not distribute
The fewer global variables you use, the more reusable your code is.
Turn global variables into required parameters. When you invoke your
function, you must supply a parameter value for each required parameter.
In our example, make bBox be a required parameter.
procedure( TrBBoxHeight( bBox )
let( ( ll ur lly ury )
ll = lowerLeft( bBox )
ur = upperRight( bBox )
lly = yCoord( ll )
ury = yCoord( ur )
ury - lly
) ; let
) ; procedure
To execute your function, you must provide a value for the bBox parameter.
bBoxHeight = TrBBoxHeight( list( 50:150 200:300 ) )
=> 150
7/16/12 SKILL Language Programming 180
You can use the let function to declare the variables ll, ur, ury, and lly to be local variables.
In the example, the variable bBox occurs both as a global variable and as a formal parameter.
Here’s how the SKILL Evaluator keeps track. When you call the TrBBoxHeight function, the
SKILL Evaluator:
Saves the current value of bBox.
Evaluates list( 50:150 200:300 ) and temporarily assigns it to bBox.
Restores the saved value of bBox when the TrBBoxHeight function returns.
SKILL Language Programming 180
Cadence AE use
Defining Optional only:Parameters
Function Do not distribute
Include @optional before any optional function parameters.
Use parentheses to designate a default value for an optional parameter.
procedure( TrOffsetBBox( bBox @optional (dx 0)(dy 0))
let( ( llx lly urx ury )
...
list( ;;; return the new bounding box
llx+dx:lly+dy
urx+dx:ury+dy
)
) ; let
) ; procedure
To call the TrOffsetBBox function, specify the required and the optional arguments
as follows:
TrOffsetBBox( someBBox )
dx and dy default to 0.
TrOffsetBBox( someBBox 0.5 )
dy defaults to 0.
TrOffsetBBox( someBBox 0.5 0.3 )
7/16/12 SKILL Language Programming 181
The procedure above takes as input the original bounding box and the desired change in the x and
y directions. The procedure returns a new bounding box that has been offset.
Unless you provide a default value for an optional parameter in the procedure declaration, the
default value will be nil. This can lead to an error if nil is not appropriate for the operations
executed using the parameter. This is the case for the procedure shown here.
You provide a default value for a parameter using a list (<parameter> <default value>).
SKILL Language Programming 181
Cadence AE use
Defining Keyword only:Parameters
Function Do not distribute
Include @key before keyword function parameters.
Use parentheses to designate a default value for a keyword parameter.
procedure( TrOffsetBBox( bBox @key (dx 0)(dy 0))
let( ( llx lly urx ury )
...
list(
llx+dx:lly+dy
urx+dx:ury+dy
)
) ; let
) ; procedure
To call the TrOffsetBBox function, specify the keyword arguments as follows:
TrOffsetBBox( someBBox ?dx 0.5 ?dy 0.4 )
TrOffsetBBox( someBBox ?dx 0.5 )
dy defaults to 0.
TrOffsetBBox( someBBox ?dy 0.4 )
dx defaults to 0.
7/16/12 SKILL Language Programming 182
Keyword parameters free you from the need for a specific order for your parameters. This can be
very valuable when you have a significant number of optional parameters. When you must
preserve the order for optional parameters you need to supply values for all parameters preceding
the one you actually want to set.
Keyword parameters are always syntactically optional. Care should be taken however that the
procedure will give correct results without a parameter specified. If you cannot do this check each
parameter for an acceptable value and emit an error message when execution of the function will
not yield a sensible answer.
As with all parameters, unless you provide a default value for a keyword parameter the default
value will be nil
SKILL Language Programming 182
Cadence AE use
Collecting Function only: Dointo
Parameters not distribute
a List
An @rest argument allows your procedure to receive all remaining
arguments in a list. Use a single @rest argument to receive an
indeterminate number of arguments.
Example
The TrCreatePath function receives all of the arguments you pass in the
formal argument points.
procedure( TrCreatePath( @rest points )
printf(
"You passed these %d arguments: %L\n"
length( points ) points
)
) ; procedure
The TrCreatePath function simply prints a message about the list contained
in points. To call the TrCreatePath function, specify any number of points.
TrCreatePath( 3:0 0:4 )
TrCreatePath( 3:0 0:4 0:0 )
7/16/12 SKILL Language Programming 183
The @rest parameter structure allows you to specify input parameters even when you do not know
how many input elements the user will want to operate on. This type of argument specification is
perfect for functions like dbCreatePath or dbCreatePolygon. It is also very convenient for
inputting the elements of an arbitrary length list.
As written, the TrCreatePath function doesn’t really create a path. You can make it create a path
in a cellview by passing the list points to the dbCreatePath function.
SKILL Language Programming 183
Cadence AE useCycle
SKILL Development only: Do not distribute
Yes
Define Functions
Using a text editor: like gvim or emacs which In Virtuoso: enter code in the CIW multiline input
recognize SKILL syntax area or in the SKILL IDE
Test Functions
In CIW: Load or paste code in the CIW and In SKILL IDE: load and run the code. Debug
examine error messages source code, trace variables, set breakpoints, etc.
Bug? Yes
In CIW: Correct in CIW or in text editor and re-load In SKILL IDE: Correct in SKILL IDE or in Text
SKILL code Editor and reload SKILL code
No
Enhance? Yes
In CIW: Update in CIW or in text editor and re-load In SKILL IDE: Update in SKILL IDE or in Text
SKILL code Editor and reload SKILL code
No
Done
Optional: Create Context files of groups of
Document and archive procedures
procedures to allow for faster loading
7/16/12 SKILL Language Programming 184
Defining SKILL Functions
The SKILL Evaluator allows you to redefine functions without exiting the Virtuoso Design
Environment. A rapid edit-and-run cycle facilitates bottom-up software development.
Launching an Editor from the Virtuoso Design Environment
The edit function launches the editor from the Virtuoso Design Environment. When you use a path
name, the edit function uses the UNIX path variable.
edit( "~/SKILL/[Link]" )
Before you use the edit function, set the editor global to a string that contains the UNIX shell
command to launch your editor.
editor = "xterm -e vi"
If you install the SKILL Debugger before you load your code, you can edit the source code for
one of your functions by passing the function name to the edit function.
edit( TrExampleFunction )
Testing SKILL Functions
You can initially test your application SKILL functions directly in the CIW. Then, you can create
a user interface for your application.
SKILL Language Programming 184
Cadence AE Code
Loading Source use only: Do not distribute
The load function evaluates each expression in a given SKILL source code
file. You use load function to define SKILL functions and execute
initialization expressions.
The load function returns t if all expressions evaluate without errors. Typical
errors include:
Syntax problems with a procedure definition.
Attempts to load a file that does not exist.
Any error aborts the load function. The load function does not evaluate any
expression that follows the offending SKILL expression.
When you pass a relative pathname to the load function, the load function
resolves it in terms of a list of directories called the SKILL path.
You usually establish the SKILL path in your .cdsinit file by using the
setSkillPath or getSkillPath functions.
7/16/12 SKILL Language Programming 185
The loadi Function
The loadi function also loads the SKILL code contained in a file. The difference in this function is
that it continues despite errors completing all the statements within the file. Error messages are
still passed to the user and loadi always completes with a return value of t. This function is very
valuable when the statements within a file are independent, for examples statements that set the
bindkeys for a session.
The SKILL Path Functions
The getSkillPath function returns the current list of directories in search order.
The setSkillPath function sets the path to a list of directories.
SKILL Language Programming 185
Cadence AECode
Pasting Source useinto
only:
the Do
CIW not distribute
The load function accesses the current version of a file. Any unsaved edits
are invisible to the load function.
Sometimes you want to define a function without saving the source code
file. You can paste source code into the CIW with the following procedure:
1. Use the mouse in your editor to select the source code.
2. Move the cursor over the CIW input pane.
3. Click the middle mouse button.
Your selection is displayed in the CIW input pane.
4. Press Return.
Your entire selection is displayed in the CIW output pane.
7/16/12 SKILL Language Programming 186
If you are using the vi editor, make sure line numbering is turned off. Otherwise, when you paste
your code into the CIW, the line numbers become SKILL expressions in the virtual memory
definition of your functions. To turn off line numbers, enter the following into your vi window:
:set nonumber
Make sure you select all the characters of the SKILL function definition. Be particularly careful to
include the final closing parentheses.
If you paste the definition of a single SKILL function into the CIW, then the function name is the
last word displayed in the CIW output pane.
Why is that?
Because the SKILL procedure function returns the function symbol.
SKILL Language Programming 186
Cadence AE From
Collecting Input use the
only: Doenterfunctions
User: not distribute
Sometimes it is more intuitive for a user to use the mouse to select points in
the design window than to type the coordinates into a form or the CIW.
An enterfunction in the SKILL language is a built-in function that lets you
enter points graphically using the mouse. The enterfunction then collects
these points and passes them to your procedure, which uses the points to
perform some action. These are very useful in the graphical environment.
The list of enterfunctions that collect points are
enterArc, enterBox, enterCircle, enterDonut, enterEllipse, enterLine,
enterPath, enterPoint, enterPoints, enterPolygon, enterScreenBox,
enterSegment, enterMultiRep
In the optional lab for this module, you use the enterBox function to collect
the user’s mouse click locations, which are passed to a function you create.
7/16/12 SKILL Language Programming 187
Additional enterfunctions are enterNumber and enterString.
SKILL Language Programming 187
Cadence AE use only: Do not distribute
Lab Exercises
Lab 9-1 Developing a SKILL Function
Develop a SKILL function, TrBBoxArea, to compute the area of a
bounding box. The bounding box is a parameter.
Model your SKILL function after the example SKILL function
TrBBoxHeight.
7/16/12 SKILL Language Programming 188
SKILL Language Programming 188
Cadence AE use only: Do not distribute
Module Summary
This module included these objectives:
Group several SKILL® expressions into a single SKILL expression.
Declare local variables.
Declare a SKILL function.
Define required, optional and keyword parameters.
Describe the SKILL software development cycle:
Load your SKILL source code
Redefine a SKILL function
7/16/12 SKILL Language Programming 189
SKILL Language Programming 189
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 190
SKILL Language Programming 190
Cadence AE use only: Do not distribute
The SKILL Interactive Debugging
Environment (IDE)
Module 10
July 16, 2012
SKILL Language Programming 191
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn to
Understand the SKILL IDE use model
Step through a SKILL IDE debugging session
7/16/12 SKILL Language Programming 192
SKILL Language Programming 192
Cadence AEIDE
Cadence SKILL use only: Do not distribute
Features
SKILL IDE is an interactive source-level symbolic debugger that helps
you develop, test, and refine SKILL procedures.
It is a multifile editor that provides common editing and debugging
capabilities, including:
Auto indenting of source code
Color syntax highlighting of source code
Single stepping execution through SKILL programs
Setting breakpoints to suspend execution graphically
Tracing and editing the values of variables during execution
Displaying variable scope
Displaying a stack trace of the hierarchy of functions
7/16/12 SKILL Language Programming 193
The SKILL® Interactive Debugging Environment (IDE) is an extension of the basic SKILL
Debugger and provides an interactive interface to it.
SKILL Language Programming 193
Cadence
Starting the AE use
SKILL IDE only: Do not distribute
7/16/12 SKILL Language Programming 194
SKILL Language Programming 194
Cadence AEInterface
SKILL IDE User use only: Do not distribute
Overview
Search / Set Breakpoint / Run Function
Tool
Bars
Variable
Trace
Source Assistant
Code Window
Pane
Stack Trace
Assistant
Status
Window
Bar
Click in column to set and unset breakpoints
7/16/12 SKILL Language Programming 195
The SKILL IDE interface is user-friendly and easy-to-learn, and it eliminates the need to learn
complex debugging commands. It consists of menus, toolbars, dialog boxes, and windows that
help you control your debugging operations.
SKILL Language Programming 195
Cadence AEModel
SKILL IDE Use use only: Do not distribute
•SKILL functions
The flowchart shows the typical steps used
Open •Pcell definitions in to debug a SKILL program with the
File
SKILL IDE.
•Check syntax
•Analyze errors
Load
Program Load a SKILL file in the SKILL IDE to
evaluate code and flag syntax errors in the
•Select variables
Trace
•Add to Trace source code view.
window
Variables
Set variables to trace and view their value
•Set interactively
Set •Set conditionals changes as the code executes.
Breakpoints
•Run function
Set breakpoints, run the program and single
Execute
code
•Step/Continue step or continue to control code evaluation.
•Edit source Edit the source code in the source code
•Save changes
Modify
Code view and reload it to continue debugging or
enhancing your SKILL program.
7/16/12 SKILL Language Programming 196
SKILL Language Programming 196
Cadence AE
Open a SKILL use File
Source only:
for Do not distribute
Debugging
•SKILL functions
Open •Pcell definitions
File
•Check syntax
Load •Analyze errors
Program
•Select variables
•Add to Trace
Trace window
Variables
•Set interactively
Set •Set conditionals
Breakpoints
•Run function
Execute •Step/Continue
code
•Edit source
Modify •Save changes
Code
7/16/12 SKILL Language Programming 197
SKILL Language Programming 197
Cadence AE
Open a SKILL use File
Source only: Do not distribute
for Debugging (continued)
•SKILL functions
Open •Pcell definitions
File
•Check syntax
Load •Analyze errors
Program
Use Window – Assistants to open
•Select variables the Trace window to trace variables
•Add to Trace
Trace window
Variables
Use Window – Assistants to open
the Stack Trace window
•Set interactively
Set •Set conditionals
Breakpoints Open help file
windows as
needed.
•Run function
Execute •Step/Continue
code
•Edit source
Modify •Save changes
Code
Position the CIW so it is visible
as warning and errors will be
reported here.
7/16/12 SKILL Language Programming 198
SKILL Language Programming 198
Cadence AEProgram
Run the SKILL use only: Do not
to Evaluate thedistribute
Code
•SKILL functions
Open •Pcell definitions
File
•Check syntax
Load •Analyze errors
Program
•Select variables
•Add to Trace
Trace window
Variables
•Set interactively
Set •Set conditionals
Breakpoints
•Run function
Execute •Step/Continue
code
•Edit source Check the CIW for
Modify •Save changes warnings or errors,
Code Correct the code and
run again
7/16/12 SKILL Language Programming 199
SKILL Language Programming 199
Cadence
Set VariablesAE use only: Do not distribute
to Trace
•SKILL functions
Open •Pcell definitions
File
•Check syntax
Load •Analyze errors
Program
•Select variables
•Add to Trace
Trace window
Variables
•Set interactively
Set •Set conditionals
Breakpoints Select the variables to
trace. As you step
•Run function
through the code and
Execute •Step/Continue the values change you
code can observe them in the
trace window.
•Edit source
Modify •Save changes
Code
7/16/12 SKILL Language Programming 200
Initially the variable values are unbound, because we have not started to run the code.
SKILL Language Programming 200
Cadence AE Interactively
Set Breakpoints use only: Do not distribute
•SKILL functions
Open •Pcell definitions
File
•Check syntax
Load •Analyze errors
Program
•Select variables
•Add to Trace
Trace window
Variables
•Set interactively Set the breakpoint on
Set •Set conditionals the first statement in the
Breakpoints
code. Execution will
stop and you can single
•Single step step to the next lines of
Execute •Continue
code
code to observe the
execution.
•Edit source Left-click in the column to add
Modify •Save changes or remove a breakpoint
Code
7/16/12 SKILL Language Programming 201
SKILL Language Programming 201
Cadence AEtouse
Run Procedure Firstonly: Do not distribute
Breakpoint
•SKILL functions
Open •Pcell definitions
File
•Check syntax
Load •Analyze errors
Program
•Select variables
•Add to Trace
Trace window
Variables
The SKILL evaluator
stops at first
•Set interactively
•Set conditionals
breakpoint. Initial
Set
Breakpoints values of local
variables are set to nil.
• Run function
Execute • Step/Continue
code
•Edit source
Modify •Save changes
Code
7/16/12 SKILL Language Programming 202
SKILL Language Programming 202
Cadence AEView
Single Step and useValues
only:Assigned
Do nottodistribute
Variables
•SKILL functions
Open •Pcell definitions
File
•Check syntax
Load •Analyze errors
Program
•Select variables
Trace •View values
Variables
•Set interactively
Set •Set conditionals
Breakpoints
•Run function
Execute •Step/Continue
code
•Edit source
Modify •Save changes
Code
7/16/12 SKILL Language Programming 203
Initially the variable values are unbound, because we have not started to run the code.
SKILL Language Programming 203
Cadence
Modify CodeAE
and use
Rerunonly: Do not
the SKILL distribute
Program
•SKILL functions
Open •Pcell definitions
File
•Check syntax
Load •Analyze errors
Program
•Select variables Modify the code in the source pane,
• Add to Trace
Trace window save, and rerun to fix bugs or
Variables
enhance the procedure.
•Set interactively
Set •Set conditionals
Breakpoints
•Run function
Execute •Step/Continue
code
•Edit source
Modify •Save changes
Code
7/16/12 SKILL Language Programming 204
SKILL Language Programming 204
Cadence AE use
Lab Video Preview: only:
Using the Do not
SKILL IDEdistribute
7/16/12 SKILL Language Programming 205
SKILL Language Programming 205
Cadence AE use only: Do not distribute
Lab Exercises
Lab 10-1 Debugging a SKILL Program
7/16/12 SKILL Language Programming 206
SKILL Language Programming 206
Cadence AE use only: Do not distribute
Flow of Control
Module 11
July 16, 2012
SKILL Language Programming 207
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn to
Review relational operators used for comparing values
Use logical operators to make decisions in programs
Design branching statements to control program flow
Examine several methods of iteration to process data
7/16/12 SKILL Language Programming 208
Terms and Definitions
Iteration To repeatedly run a collection of SKILL® expressions.
SKILL Language Programming 208
Cadence AE use only: Do not distribute
Relational Operators
Use the following operators to compare data values.
These operators all return t or nil.
Operator Arguments Function Example Return value
< numeric lessp 3<5 t
3<2 nil
<= numeric leqp 3 <= 4 t
> numeric greaterp
>= numeric geqp
== numeric string list equal 3.0 == 3 t
“abc” == “ABc” nil
!= numeric string list nequal “abc” != “ABc” t
7/16/12 SKILL Language Programming 209
Use parentheses to control the order of evaluation. This example assigns 3 to x, returning 3, and
next compares 3 with 5, returning t.
(x=3)<5 => t
The SKILL Evaluator generates an error if the data types are inappropriate. Error messages
mention the function in addition to the operator.
1 > "abc"
*** Error in routine greaterp:
Message: *Error* greaterp: can’t handle (1 > "abc")
SKILL Language Programming 209
Cadence AE use only: Do not distribute
Logical Operators
The SKILL® Evaluator considers nil as FALSE and any other value as
TRUE. The SKILL language provides generalized boolean operators.
Operator Arguments Function Example Return value
! general null !3 nil
!nil t
!t nil
&& general and 3x = 1 y = 5 5
x < 3 && y < 4 nil
x < 3 && 1/0 ***Error
y < 4 && 1/0 nil
|| general or x < 3 || y < 4 t
x < 3 || 1/0 t
y < 4 || 1/0 ***Error
The && and || operators only evaluate their second argument if they must to
determine the return result.
The && and || operators return the value last computed.
7/16/12 SKILL Language Programming 210
The && Operator
Evaluates its first argument. If it is nil, then && returns nil.
The second argument is not evaluated.
If the first argument evaluates to non-nil, then && evaluates the second argument. The &&
operator returns the value of the second argument.
The || Operator
Evaluates its first argument. If it is non-nil, then || returns the value of the first argument. The
second argument is not evaluated.
If the first argument evaluates to nil, then the second argument is evaluated. The || operator
returns the value of the second argument.
SKILL Language Programming 210
Cadence
Using the &&AE
anduse only: Do
|| Operators not distribute
to Control Flow
You can use both the && and || operators to avoid cumbersome if or when
expressions.
Example of Using the || Operator
Suppose you have a default name, such as "noName" and a variable, such
as userName. To use the default name if userName is nil, use this
expression:
theUser = userName || "noName"
7/16/12 SKILL Language Programming 211
SKILL Language Programming 211
Cadence
Branching AE use only: Do not distribute
Branching task Function
Binary branching if
when
unless
Multiway branching case
cond
Arbitrary exit prog return
7/16/12 SKILL Language Programming 212
SKILL Language Programming 212
Cadence AE use only: Do not distribute
The if Function
Use the if function to selectively evaluate two groups of one or more
expressions.
The selection is based on whether the condition evaluates to nil or non-nil.
The return value of the if expression is the value last computed.
if( shapeType == "rect" then
println( "Shape is a rectangle" )
++rectCount
else
println( "Shape is not a rectangle" )
++miscCount
) ; if rect
In this expression:
If the shapeType is rect the return value is the value of rectCount.
If the shapeType is not rect the return value is the value of miscCount.
7/16/12 SKILL Language Programming 213
Alternatives expressions:
Use if( exp ... ) instead of if( exp != nil ... )
Use if( !exp ... ) instead of if( exp == nil ... )
SKILL Language Programming 213
Cadence AE
Two Common use only: Do not distribute
if Errors
Two common if errors are:
Including whitespace after if
if ( shapeType == "rect"
...
)
*** Error in routine if
Message: *Error* if: too few arguments ...
Including a right parenthesis after the conditional expression
if( shapeType == "rect" )
***Error* if: too few arguments (at least 2 expected, 1 given)
7/16/12 SKILL Language Programming 214
The SKILL Evaluator does most of its error checking during execution. Error messages involving
if expressions can be obscure.
Remember
To avoid whitespace immediately after the if syntax function.
To place parentheses as follows:
if( ... then ... else ... )
SKILL Language Programming 214
Cadence AE use
Nested if-then-else only: Do not distribute
Expressions
Be careful with parentheses. Comment the closing parentheses and indent
consistently as in this example.
if( shapeType == "rect" then
++rectCount
else
if( shapeType == "line" then
++lineCount
else
++miscCount
) ; if line
) ; if rect
7/16/12 SKILL Language Programming 215
SKILL Language Programming 215
Cadence AE
The when and useFunctions
unless only: Do not distribute
Use the when function whenever you have only then expressions.
when( shapeType == "rect"
println( "Shape is a rectangle" )
++rectCount
) ; when
when( shapeType == "ellipse"
println( "Shape is a ellipse" )
++ellipseCount
) ; when
Use the unless function to avoid negating a condition.
unless(
shapeType == "rect" || shapeType == "line"
println( "Shape is miscellaneous" )
++miscCount
) ; unless
7/16/12 SKILL Language Programming 216
The when and unless functions both return the last value evaluated within their body or nil.
SKILL Language Programming 216
Cadence AE use only: Do not distribute
The case Function
The case function sequentially compares a candidate value against a series of
target values. The target must be a value and cannot be a symbol or expression
that requires evaluation.
When it finds a match, it evaluates the associated expressions and returns the
value of the last expression evaluated.
case( shapeType Candidate value
( "rect" Target
++rectCount
println( "Shape is a rectangle" )
)
( "line" Target
++lineCount
println( "Shape is a line" )
)
( "label" Target
++labelCount
println( "Shape is a label" )
)
( t Catch all
++miscCount
println( "Shape is miscellaneous" )
)
) ; case
7/16/12 SKILL Language Programming 217
If you have expressions to evaluate when no target value matches the candidate value, then
include those expressions in an arm at the end. Use t for the target value for this last arm. If the
flow of control reaches an arm whose target value is the t value, then the SKILL Evaluator
unconditionally evaluates the expressions in the arm.
When target value of an arm is a list, the SKILL Evaluator searches the list for the candidate
value. If the candidate value is found, all the expressions in the arm are evaluated.
case( shapeType
( "rect"
++rectCount
println( "Shape is a rectangle" )
)
( ( "label" "line" )
++labelOrLineCount
println( "Shape is a line or a label" )
)
( t
++miscCount
println( "Shape is miscellaneous" )
)
) ; case
SKILL Language Programming 217
Cadence AE use only: Do not distribute
The cond Function
Use the cond function when your logic involves multiway branching.
cond(
( condition1 exp11 exp12 ... )
( condition2 exp21 exp22 ... )
( condition3 exp31 exp32 ... )
( t expN1 expN2 ... )
) ; cond
The cond function
Sequentially evaluates the conditions in each arm, until it finds one that
is non-nil. It then executes all the expressions in the arm and exits.
Returns the last value computed in the arm it executes.
The cond function is equivalent to
if condition1 then exp11exp12 ...
else if condition2 then exp21exp22 ...
else if condition3 then exp31exp32 ...
...
else expN1expN2 ....
7/16/12 SKILL Language Programming 218
This example TrClassify function includes the cond function and the numberp function.
procedure( TrClassify( signal )
cond(
( !signal nil )
( !numberp( signal ) nil )
( signal >= 0 && signal < 3 "weak" )
( signal >= 3 && signal < 10 "moderate" )
( signal >= 10 "extreme" )
( t "unexpected" )
) ; cond
) ; procedure
The numberp, listp, stringp, and symbolp Functions
The SKILL language provides many functions that recognize the type of their arguments,
returning t or nil. Traditionally, such functions are called predicates. Their names end in "p".
Each function takes one argument, returning t if the argument is of the type specified, otherwise
returning nil. See the Cadence® online documentation to read more about this function.
SKILL Language Programming 218
Cadence
Iteration AE use only: Do not distribute
Iteration task Function
Numeric range for
List of values foreach
While a condition while
is non-nil
7/16/12 SKILL Language Programming 219
These functions repeat a statement block for a specific number of times, or through each element
of a list, or until a certain condition is satisfied.
SKILL Language Programming 219
Cadence AE use only: Do not distribute
The for Function
This example adds the integers from 1 to 5 using a for function.
sum = 0
for( i 1 5
sum = sum + i
println( sum )
)
The for function increments the index variable by 1.
The for function treats the index variable as a local variable.
Saves the current value of the index variable before evaluating the loop
expressions.
Restores the index variable to its saved value after exiting the loop.
Returns the value t.
The SKILL Evaluator does most of its error checking during execution. Error
messages about for expressions can be obscure. Remember
The placement of the parentheses: for( ... ).
To avoid putting whitespace immediately after the for syntax function.
7/16/12 SKILL Language Programming 220
The only way to exit a for loop early is to call the return function. To use the return function, you
must enclose the for loop within a prog expression. This example finds the first odd integer less
than or equal to 10.
prog( ( )
for( i 0 10
when( oddp( i )
return( i )
) ; when
) ; for
) ; prog
SKILL Language Programming 220
Cadence
The foreach AE use only: Do not distribute
Function
Use the foreach function to evaluate one or more expressions for each
element in a list of values.
rectCount = lineCount = miscCount = 0
shapeTypeList = ’( "rect" "polygon" "rect" "line" )
foreach( shapeType shapeTypeList
case( shapeType
( "rect" ++rectCount )
( "line" ++lineCount )
( t ++miscCount )
) ; case
) ; foreach
=> ( "rect" "polygon" "rect" "line" )
When evaluating a foreach expression, the SKILL Evaluator determines the
list of values and repeatedly assigns successive elements to the index
variable, evaluating each expression in the foreach body.
The foreach expression returns the list of values over which it iterates.
7/16/12 SKILL Language Programming 221
In the example,
The variable shapeType is the index variable. Before entering the foreach loop, the SKILL
Evaluator saves the current value of shapeType. The SKILL Evaluator restores the saved
value after completing the foreach loop.
The variable shapeTypeList contains the list of values. The SKILL Evaluator successively
assigns the values in shapeTypeList to shapeType, evaluating the body of the foreach loop
once for each separate value.
The body of the foreach loop is a case statement.
The return value of the foreach loop is the list contained in the shapeTypeList variable.
SKILL Language Programming 221
Cadence
The prog andAE useFunctions
return only: Do not distribute
If you need to exit a collection of SKILL statements conditionally, use theprog
function.
prog( ( local variables ) your SKILL statements )
Use the return function to force the prog function to immediately return a value. The
prog function does not execute any more SKILL statements.
If you do not call the return function within the prog body, prog returns nil.
For example, the TrClassify function returns either nil, "weak", "moderate",
"extreme", or "unexpected", depending on the signal argument. This prog example
does not use any local variables.
procedure( TrClassify( signal )
prog( ()
unless( signal return( nil ))
unless( numberp( signal ) return( nil ))
when( signal >= 0 && signal < 3 return( "weak" ))
when( signal >= 3 && signal < 10 return( "moderate" ))
when( signal >= 10 return( "extreme" ))
return( "unexpected" )
) ; prog
) ; procedure
7/16/12 SKILL Language Programming 223
Use the prog function and the return function to exit early from a for loop. This example finds the
first odd integer less than or equal to 10.
prog( ( )
for( i 0 10
when( oddp( i )
return( i )
) ; when
) ; for
) ; prog
A prog function can also establish temporary values for local variables. All local variables receive
temporary values initialized to nil.
The current value of a variable is accessible at any time from anywhere.
The SKILL Evaluator transparently manages a value slot of a variable as if it were a stack.
The current value of a variable is simply the top of the stack.
Assigning a value to a variable changes only the top of the stack.
Whenever your program invokes the prog function, the SKILL Evaluator pushes a temporary
value onto the value stack of each variable in the local variable list.
When the flow of control exits, the system pops the temporary value off the value stack, restoring
the previous value.
SKILL Language Programming 223
Cadence AE use only: Do not distribute
Lab Exercises
Lab 11-1 Writing a Database Report Program
You write a SKILL function to count the shapes in a design.
Lab 11-2 Exploring Flow of Control
You write a SKILL function to validate 2-dimensional points.
Lab 11-3 More Flow of Control
You write a SKILL function to compare 2-dimensional points.
Lab 11-4 Controlling Complex Flow
You write a SKILL function to validate a bounding box.
7/16/12 SKILL Language Programming 224
SKILL Language Programming 224
Cadence AE use only: Do not distribute
Module Summary
This module included these topics:
Category Function
Relational operators <
<=
>
>=
==
!=
Logical operators !
&&
||
Branching if when unless
case
cond
Iteration for
foreach
while
Miscellaneous prog return
7/16/12 SKILL Language Programming 225
SKILL Language Programming 225
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 226
SKILL Language Programming 226
Cadence AE use only: Do not distribute
File I/O
Module 12
July 16, 2012
SKILL Language Programming 227
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn how to
Write UNIX text files
Read UNIX text files
Open a text window
Read and write table data
7/16/12 SKILL Language Programming 228
SKILL Language Programming 228
Cadence
Writing DataAE
to a use
File only: Do not distribute
Instead of displaying data in the CIW, you can write the data to a file.
Both print and println accept a second, optional argument that must be an output
port associated with the target file.
Use the outfile function to obtain an output port for a file. Once you are finished
writing data to the file, use the close function to release the port.
This example uses the for function to execute the println function iteratively. The i
variable is successively set to the values 1,2,3,4, and 5.
myPort = outfile( "/tmp/myFile" ) => port:"/tmp/myFile"
for( i 1 5
println( list( "Number:" i) myPort )
) => t
close( myPort ) => t
myPort = nil
After you execute the close function, /tmp/myFile contains the following lines:
("Number:" 1)
("Number:" 2)
("Number:" 3)
("Number:" 4)
("Number:" 5)
7/16/12 SKILL Language Programming 229
The print and println Functions
Notice how the SKILL® Evaluator displays a port in the CIW.
myPort = outfile( "/tmp/myfile" )
port:"/tmp/myfile"
Use a full pathname with the outfile function. Keep in mind that outfile returns nil if you do not
have write access to the file, or if you cannot create the file in the directory you specified in the
pathname.
The print and println functions raise an error if the port argument is nil. Observe that the type
template uses a p character to indicate a port is expected.
println( "Hello" nil )
*** Error in routine println:
Message: *Error* println: argument #2 should be an I/O port
(type template = "gp")
The close Function
The close function does not update your port variable after it closes the file. To facilitate robust
program logic, set your port variable to nil after calling the close function.
SKILL Language Programming 229
Cadence
Writing DataAE
to a use
File only: Do not distribute
(continued)
Unlike the print and println functions, the printf function does not accept an
optional port argument.
Use the fprintf function to write formatted data to a file. The first argument
must be an output port associated with the file.
Example
myPort = outfile( "/tmp/myFile" )
for( i 1 5
fprintf( myPort "\nNumber: %d" i )
) ; for
close( myPort )
The example above writes the following data to /tmp/myFile:
Number: 1
Number: 2
Number: 3
Number: 4
Number: 5
7/16/12 SKILL Language Programming 230
SKILL Language Programming 230
Cadence AE
Reading Data use
from only: Do not distribute
a File
Use the infile function to obtain an input port on a file.
The gets function reads the next line from the file.
This example prints every line in ~/.cshrc to the CIW.
let( ( inPort nextLine )
inPort = infile( "~/.cshrc" )
when( inPort
while( gets( nextLine inPort )
println( nextLine )
); while
close( inPort )
) ; when
) ; let
7/16/12 SKILL Language Programming 231
The infile Function
The gets Function
The gets function reads the next line from the file. The arguments of the gets function are the:
Variable that receives the next line.
Input port.
The gets function returns the text string or returns nil when the end of file is reached.
The when Function
The first expression within a when expression is a condition. The SKILL Evaluator evaluates the
condition. If it evaluates to a non-nil value, then the SKILL Evaluator evaluates all the other
expressions in the when body. The when function returns either nil or the value of the last
expression in the body.
The while Function
The SKILL Evaluator repeatedly evaluates all the expressions in the while body as long as the
condition evaluates to a non-nil value. The while function returns nil.
SKILL Language Programming 231
Cadence AE use only: Do not distribute
The fscanf Function
The fscanf function reads data from a file according to conversion control
directives. The arguments of fscanf are
The input port
The conversion control string
The variables that receive the matching data values.
The fscanf function returns the number of data items matched.
This example prints every word in ~/.cshrc to the CIW.
let( ( inPort word )
inPort = infile( "~/.cshrc" )
when( inPort
while( fscanf( inPort "%s" word )
println( word )
); while
close( inPort )
) ; when
) ; let
7/16/12 SKILL Language Programming 232
The format directives commonly found include the ones in this table.
Format specification Data type Scans input port
%d integer for next integer
%f floating point for next floating point
%s text string for next string
The following is an example of output from the ~/[Link].
\o "#.cshrc"
\o "for"
\o "Solaris"
\o "#Cadence"
\o "Training"
\o "Database"
\o "setup"
\o "for"
\o "the"
\o "97A"
\o "release"
\o "#"
SKILL Language Programming 232
Cadence AEWindow
Opening a Text use only: Do not distribute
Use the view function to display a text file in a read-only window.
view( "~/SKILL/.cdsinit" ) => window:5
The view function is very useful for displaying a report file to the user.
The view function resolves a relative pathname in terms of the SKILL® path.
This is a list of directories you can establish in your .cdsinit.
See Module 8, “Customization”, for specifics on the SKILL path.
To select text from your [Link] file, try the following:
view(
"~/[Link]" ;;; pathname to [Link]
nil ;;; default location
"Log File" ;;; window title
t ;;; auto update
) => window:6
7/16/12 SKILL Language Programming 233
The view Function
The view function takes several optional arguments.
Argument Status Type Meaning
file Required Text Pathname
winSpec Optional Bounding box/nil Bounding box of the window. If you pass nil, the
default position is used.
title Optional Text The title of the window. The default is the value of
the file parameter.
autoUpdate Optional If t, then the window updates for each write to the
file. The default is nil.
appName Optional Text The Application Type for this window. The default is
"Show File".
help Optional Text Text string for online help. The default means no
help is available.
SKILL Language Programming 233
Cadence
SKILL Table AE use only: Do not distribute
Overview
Tables are used in SKILL to store data that is accessed using a key.
Key Value
“met1width” 1.1
“met2width” 2.5
“met3width” 3.6
The makeTable function creates a table
WidthTable = makeTable( “Width” nil )
nil in the above command is the default value returned if the key is not in the
table
To access an value from the table use tablename[ key ]
WidthTable[ “met2width” ] => 2.5
WidthTable[ “met4width” ] => nil
7/16/12 SKILL Language Programming 234
SKILL Language Programming 234
Cadence
Reading andAE usea only:
Writing Do not
SKILL Table distribute
from/to a File
Use the writeTable function to write the entire contents of a SKILL
table to a text file.
writeTable(“width_table.txt” WidthTable)
The file will be created if it does not exist.
Use the readTable function to read a text file into a SKILL table.
readTable(“width_table.txt” WidthTable)
The table must exist in SKILL before callingreadTable (see makeTable)
The format of the text file is one key / value per line.
You can create the text file table entries using a text editor and then
read them into SKILL.
If you are not sure of the text file format, create and example of the table in
SKILL and use write table write the table to a file.
Check output text file for the correct syntax to use.
7/16/12 SKILL Language Programming 235
SKILL Language Programming 235
Lab Preview Video:
Cadence
Reading andAE usea only:
Writing Do not
SKILL Table distribute
from/to a File
7/16/12 SKILL Language Programming 236
SKILL Language Programming 236
Cadence AE use only: Do not distribute
Lab Exercises
Lab 12-1 Writing Data to a File
Lab 12-2 Reading Data from a Text File
Lab 12-3 Writing Output to a File
Enhance your TrShapeReport function to write the output to
a file.
Lab 12-4 Reading and Writing Table Data
7/16/12 SKILL Language Programming 237
SKILL Language Programming 237
Cadence AE use only: Do not distribute
Module Summary
In this module, we covered
Writing text data to a file by using
The outfile function to obtain an output port on a file
An optional output port parameter to the print and println functions
A required port parameter to the fprintf function
The close function to close the output port
Reading a text file by using
The infile function to obtain an input port
The gets function to read the file a line at a time
The fscanf function to convert text fields upon input
The close function to close the input port
Reading and writing table data
The readTable and write Table functions facilitate this
7/16/12 SKILL Language Programming 238
SKILL Language Programming 238
Cadence AE use only: Do not distribute
List Construction
Module 13
July 16, 2012
SKILL Language Programming 239
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn how to
Describe the techniques for building a list:
The ’ operator
The list function
The cons function
The append function
Use the foreach mapcar function to make a list that corresponds one to
one with a given list
Use the setof function to make a filtered copy of a list
Use the foreach mapcar function and setof function together to make a
list that corresponds one to one with a filtered list
7/16/12 SKILL Language Programming 240
SKILL Language Programming 240
Cadence
List Review AE use only: Do not distribute
You can make a new list by
Specifying all the elements literally
’( ( "one" 1 ) ( "two" 2 ) )
=> ( ( "one" 1 ) ( "two" 2 )
Computing each element from an expression
a = 1 => 1
b = 2 => 2
list( a**2+b**2 a**2-b**2) => ( 5 -3 )
You can add one or more elements to an existing list by
Adding an element to the front of a list
result = ’( 2 3 ) => ( 2 3 )
result = cons( 1 result ) => ( 1 2 3)
Merging two lists together
oneList = ’( 4 5 6) => ( 4 5 6 )
aList = ’( 1 2 3 ) => ( 1 2 3 )
bList = append( oneList aList ) => ( 4 5 6 1 2 3 )
7/16/12 SKILL Language Programming 241
SKILL Language Programming 241
Cadence
The foreach AE useFunction
mapcar only: Do not distribute
Use the foreach mapcar function to build a list in one-to-one
correspondence with a base list.
The body of the foreach mapcar loop computes each element in the new
list from the corresponding element in the base list.
Base list New list
Example
L = ’( 1 2 3 )
foreach( x L x**2 ) => ( 1 2 3 )
Squares = foreach( mapcar x L x**2 ) => ( 1 4 9 )
7/16/12 SKILL Language Programming 242
The foreach mapcar function and the foreach function behave similarly with one exception.
Although they compute the same values during each loop iteration, they return different lists.
The foreach mapcar function returns the list of values that each loop iteration computes.
The foreach function returns the base list.
Questions Answers
The foreach function The foreeach mapcar function
What happens to the Each loop result is Each loop result is collected into
return result of the last ignored. a new list.
expression in the loop
body?
What is the return result? The original base list is The new list is the return result.
the return list.
SKILL Language Programming 242
Cadence AE use
Extended foreach only:
mapcar Do not distribute
Example
Suppose we want to build a list of the window titles for all the open
windows.
Use the foreach mapcar function together with the hiGetWindowList
function and the hiGetWindowName function.
winNames = foreach( mapcar wid hiGetWindowList()
hiGetWindowName( wid )
) ; foreach
As an alternative to using the foreach mapcar function, you can use the
normal foreach function.
However, you are responsible for collecting the return results. Use the
cons function.
In addition, the list will be in reverse order. Use the reverse function to
make a copy of the list in the correct order.
winNames = nil
foreach( wid hiGetWindowList()
winNames = cons( hiGetWindowName( wid ) winNames )
) ; foreach
winNames = reverse( winNames )
7/16/12 SKILL Language Programming 243
SKILL Language Programming 243
Cadence
The mapcar AE use only: Do not distribute
Function
The SKILL Language Reference Manual documents the mapcar function.
You can use the foreach mapcar expressions without understanding
mapcar.
The mapcar function accepts two arguments:
A function of one argument
A list
The mapcar function
Invokes the function for each element of a list.
Returns the list of results.
Examples
A foreach mapcar expression
foreach( mapcar x ’( 1 2 3 4 ) x**2 )
An equivalent mapcar expression
procedure( TrSquare( x ) x**2 )
mapcar( ’TrSquare ’( 1 2 3 4 ) ) => ( 1 4 9 16 )
7/16/12 SKILL Language Programming 244
During compilation, each foreach mapcar expression is translated into a mapcar function call. You can use the trace
facility to reveal the details in these examples:
A trace of a foreach expression
foreach( x ’(1 2 3 ) x**2 )
|(1**2)
|expt --> 1
|(2**2)
|expt --> 4
|(3**2)
|expt --> 9
(1 2 3)
A trace of a foreach mapcar expression
funobj:0x21980a8 represents the function that the SKILL® Evaluator dynamically generates to represent x**2.
foreach( mapcar x ’(1 2 3 ) x**2 )
|mapcar(funobj:0x21980a8 (1 2 3))
||(1**2)
||expt --> 1
||(2**2)
||expt --> 4
||(3**2)
||expt --> 9
|mapcar --> (1 4 9)
(1 4 9)
SKILL Language Programming 244
Cadence AE use only: Do not distribute
Filtering Lists
The setof function makes a filtered copy of a list, including all elements that
satisfy a given filter.
For example, you can build a list of the odd elements of ( 1 2 3 4 5 ).
Filtered list
The oddp function returns t/nil if its argument is odd/even.
setof( x ’( 1 2 3 4 5 ) oddp( x ) ) => ( 1 3 5 )
7/16/12 SKILL Language Programming 245
SKILL Language Programming 245
Cadence AE use only: Do not distribute
The setof Function
The setof function accepts several arguments:
A local variable that holds a list element in the filter expressions.
The list to filter.
One or more expressions that compose the filter.
For each element of the list, the setof function:
Binds each element to the local variable.
Evaluates the expressions in its body.
Uses the result of the last expression to determine whether to include
the element.
The setof function returns the list of elements for which the last body
expression returned a non-nil value.
7/16/12 SKILL Language Programming 246
The following nongraphic session uses the trace facility to illustrate how the setof function works.
> tracef( t )
t
> setof( x ’( 1 2 3 4 5 ) oddp( x ) )
|oddp(1)
|oddp --> t
|oddp(2)
|oddp --> nil
|oddp(3)
|oddp --> t
|oddp(4)
|oddp --> nil
|oddp(5)
|oddp --> t
(1 3 5)
> untrace()
t
SKILL Language Programming 246
Cadence AE use only: Do not distribute
A setof Example
Suppose you want to retrieve all the rectangles in a design.
The following code uses the setof function to retrieve all rectangles in a
design.
cv = geGetWindowCellView()
setof( shape cv~>shapes shape~>objType == "rect" )
The cv~>shapes expression retrieves the list of shape database
objects.
The shape~>objType == "rect" expression returns t/nil if the database
object is/isn’t a rectangle.
7/16/12 SKILL Language Programming 247
SKILL Language Programming 247
Cadence AE
Another setof use only: Do not distribute
Example
Suppose you want to compute the intersection of two lists.
One way to proceed is to use the cons function as follows:
procedure( TrIntersect( list1 list2 )
let( ( result )
foreach( element1 list1
when( member( element1 list2 )
result = cons( element1 result )
) ; when
) ; foreach
result
) ; let
) ; procedure
The more efficient way is to use the setof function.
procedure( TrIntersect( list1 list2 )
setof(
element list1
member( element list2 ))
) ; procedure
7/16/12 SKILL Language Programming 248
SKILL Language Programming 248
Cadence AE
Transforming use only:
Elements Do not
of a Filtered Listdistribute
You can build a list by transforming elements of a filtered list.
setof foreach mapcar
Use the setof function to filter the list.
Use the foreach mapcar function to build the resulting list.
7/16/12 SKILL Language Programming 249
This example computes the list of squares of odd integers.
procedure( TrListOfSquares( aList )
let( ( filteredList )
filteredList =
setof( element aList oddp( element ))
foreach( mapcar element filteredList
element * element
) ; foreach
) ; let
) ; procedure
TrListOfSquares( ’( 1 2 3 4 5 6 )) => ( 1 9 25 )
SKILL Language Programming 249
Cadence AE use only: Do not distribute
Lab Exercises
Lab 13-1 Revising the Layer Shape Report
Rewrite your Shape Report program to count shapes by
using the length and setof functions. For example, to count
the rectangles, use this code:
rectCount = length(
setof( shape cv~>shapes shape~>objType == "rect" )
)
Lab 13-2 Describing the Shapes in a Design
Develop a function TrShapeList to return a list of shape
descriptions for all the shapes in a design. A shape
description is a list that identifies the object type, the layer
name, and the layer purpose as in this example:
( "rect" "metal1" "drawing" )
7/16/12 SKILL Language Programming 250
SKILL Language Programming 250
Cadence AE use only: Do not distribute
Module Summary
In this module, we covered
The foreach mapcar function to build lists
The setof function to make a filtered copy of a list
The foreach mapcar function and the setof function used together to
build a list by transforming each element
7/16/12 SKILL Language Programming 251
SKILL Language Programming 251
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 252
SKILL Language Programming 252
Cadence AE use only: Do not distribute
SKILL Development Environment
Module 14
July 16, 2012
SKILL Language Programming 253
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn how to
Describe common bugs
Identify mistakes to avoid
Describe the most useful facilities of the SKILL® debugger
Single-step tracing
Function tracing
Trapping SKILL errors
Setting and clearing breakpoints
Single-step execution
Use about SKILL Lint
Use about the SKILL Profiler
Use about the SKILL Surveyor
7/16/12 SKILL Language Programming 254
SKILL Language Programming 254
Cadence AE use
SKILL Development only: Do not distribute
Tips
The Virtuoso® Design Environment includes
The capability to write your own SKILL programs and run the SKILL
programs of others as well as your own.
The SKILL documentation accessible through the Cadence® online
documentation.
In theory, this is all you need to develop SKILL programs.
7/16/12 SKILL Language Programming 255
SKILL Language Programming 255
Cadence AE use only: Do not distribute
Common Bugs
When a SKILL program does not behave according to its specifications,
you need to determine the underlying cause and correct the program
accordingly.
Consider a Shape Report Program with a bug in it. Here are some possible
outcomes when you run the program.
No Shape Report window appears.
SKILL Evaluator displays the following error message:
*Error* postincrement: can't handle add1(nil)
No Shape Report window appears.
SKILL displays the following error message:
*Error* fprintf/sprintf:
format spec. incompatible with data - nil
The Shape Report window appears. The rect counter is 0.
The Shape Report window appears. All the counters are 0.
7/16/12 SKILL Language Programming 256
The cause for each of the above problems are as follows:
The program incremented a variable that was initialized to nil instead of initialized to 0.
The program called the printf function to display the value of a variable when the value was
nil.
The program used "Rect" instead of "rect" in as a target value in a case expression.
Consequently, none of the rectangles were identified.
The program includes a case expression that used the shape~>ObjType instead of
shape~>objType to retrieve the objType attribute. The program was not written to handle the
value nil. None of the shapes were correctly identified.
SKILL Language Programming 256
Cadence AE use only: Do not distribute
Using Print Statements
Use println or printf statements to
Verify the flow of control.
Determine the values of function arguments and local variables.
Observe the following guidelines:
Avoid inserting debugging print statements at the end of a function.
Doing so can adversely affect the return of the function.
Remove debugging print statements before distributing your program
to others.
Use the println function or the %L format with the printf function to
avoid introducing errors.
7/16/12 SKILL Language Programming 257
The problems with relying on print statements include the following:
You might not have access to the source code.
The print statements that you insert might cause their own set of problems.
You have to remember to remove such println and printf statements before distributing your
program to others.
SKILL Language Programming 257
Cadence
Checking forAE use only:
Common Errors Do not distribute
Check for the following mistakes:
Make sure that the source code you examine matches the source code
that you are running. You might have forgotten to load the latest
version of one of your functions.
Check all of the ~> attributes in your program for spelling.
Check the data types you pass to the ~> operator.
The next several pages discuss these suggestions in greater detail.
7/16/12 SKILL Language Programming 258
SKILL Language Programming 258
Cadence AE use
Check the Running only:
Source Do not distribute
Code
Have you ever edited your program and forgotten to reload the new source
code? When debugging your function, use the pp function to verify that you
have loaded your latest version of the function.
The pp function displays the definition of a SKILL function.
The pp function does not use the file system. Instead, it accesses the
definition of the function in virtual memory.
Example
This example displays the definition of the TrExample function that is
currently in memory.
procedure( TrExample( x y ) x+y )
pp( TrExample )
procedure(TrExample(x y)
(x + y)
)
nil
7/16/12 SKILL Language Programming 259
The pp Function
The pp function only works on the SKILL functions that you define.
You cannot use pp to inspect the following kinds of SKILL functions:
Built-in SKILL functions defined in C
Encrypted SKILL functions
SKILL functions defined in a context
The pp function accepts an optional port argument. The following code declares the TrExample
function and writes its definition to the /tmp/[Link] file.
procedure( TrExample( x y )
x+y
) ; procedure
let( ( FILE )
FILE = outfile( "/tmp/[Link]" )
pp( TrExample FILE )
close( FILE )
) ; let
SKILL Language Programming 259
Cadence AE use
Check All Attribute andonly: DoNames
Property not distribute
Check the spelling of the database object attribute and window property
names that you use in your program.
Remember that the ~> operator returns nil when the object does not have a
given attribute or property. This situation has several symptoms:
A printf error caused by nil.
A foreach loop that does nothing.
Example
Can you spot the problem in the following fragment of code?
procedure( TrCountRectangles( cv )
let( ( count )
count = 0
foreach( shape cv~>shaps
++count
) ; foreach
count
) ; let
) ; procedure
7/16/12 SKILL Language Programming 260
SKILL Language Programming 260
Cadence AE use only: Do not distribute
Verify Data Types
The ~> operator works on many different kinds of objects. Different types of
objects are likely to contain different attributes or properties.
Example
Can you spot the problem in the following fragment of code?
hiSetBindKey( "Layout" "<Key>F8"
"println( TrCountRectangles( hiGetCurrentWindow()))" )
procedure( TrCountRectangles( cv )
let( ( count )
count = 0
foreach( shape cv~>shapes
++count
) ; foreach
count
) ; let
) ; procedure
What do you need to do to fix the problem?
7/16/12 SKILL Language Programming 261
In the example,
The input required for TrCountRectangles is the databaseid of a cell view.
The input passed to the function is a windowid.
SKILL Language Programming 261
Cadence AE
Programming use only: Do not distribute
Defensively
Consider designing your code to make bugs easier to track down. Bugs that
raise an error far away from the root cause are harder to track down.
For example,
Declare the expected argument types of one or more of your functions.
You can either have SKILL Evaluator perform the argument type
checking or write your own code to check.
Include assertions in your code that check for a condition that holds if
things are in working order.
Write a function to check that a condition holds and raise an error if the
condition does not hold.
The next slides discuss these suggestions in greater detail.
7/16/12 SKILL Language Programming 262
SKILL Language Programming 262
Cadence
Include DataAE
Typeuse only: Do not distribute
Checks
You can have SKILL Evaluator check the argument type by providing a type
template when you declare the function. Using this technique you can find
errors at their source.
The type template is a string. Each character of the string encodes the
expected data type of the corresponding argument.
Follow these guidelines:
Place the type template at the end of the argument list.
Use the same character to encode a data type that the Cadence®
Finder uses. Here are some examples:
Character Data type Comment
w window ID
d database object
g general indicates more than one data type works
l list
x integer
7/16/12 SKILL Language Programming 263
Using type templates has the following limitations:
You cannot control the wording of the error message.
You can only check the SKILL data type of arguments. For example, you cannot check for
database objects with a specific objType attribute value.
You cannot specify that the SKILL data type be one of several possible types. You have to
use the "g" character for this situation.
You can use type templates only for required arguments.
SKILL Language Programming 263
Cadence
An Example AE
Typeuse only: Do not distribute
Template
The TrCellNameMatch function returns the cellView database object if the
name contains phrase; otherwise it returns nil. The expected types of the
two arguments are
cv, a database object
phrase, a text string
The "dt" is called a type template. It encodes the expected argument types.
procedure( TrCellNameMatch( cv phrase "dt" )
let( ((name cv~>cellName))
when( rexMatchp( phrase name ) cv )
) ; let
) ; procedure
If you call TrCellNameMatch with a window ID instead of a database object,
SKILL Evaluator raises an error:
\i TrCellNameMatch( window(6) "nand2" )
\o *** Error in routine TrCellNameMatch:
\o Message: *Error* TrCellNameMatch:
argument #1 should be dbobject (type template = "dt") - window:6
7/16/12 SKILL Language Programming 264
If you do not declare the TrCellNameMatch function with a type template, then the error message
is more obscure since it comes from the rexMatchp function.
\i TrCellNameMatch( window(6) "nand2" )
\o *** Error in routine rexMatchp:
\o Message: *Error* rexMatchp:
argument #2 should be either
a string or a symbol (type template = "tS")
When you use type templates, you cannot control the wording of the error message.
Also, type templates only specify the SKILL type of arguments. You cannot use a type template to
check that an argument is a database object with a specific objType attribute
SKILL Language Programming 264
Cadence AE use only: Do not distribute
The error Function
You can call the error function when your code determines that further
evaluation is impossible or pointless.
Pass the following two arguments to the error function:
A format string which contains the error message.
Arguments to be substituted into the format string.
Example
The following version of the TrCellNameMatch function checks specifically
that the first argument obj is a cellView database object.
procedure( TrCellNameMatch( obj phrase )
cond(
( !dbobjectp( obj ) || obj~>objType != "cellView“
error(
" TrCellNameMatch: obj is not cellView - %L" obj )
)
( ... ) ;;; Other checks
( t ... ) ;;; This alternative contains the rest of the function
) ; cond
) ; procedure
7/16/12 SKILL Language Programming 265
Use the %L format string to specify the default print representation of the argument.
SKILL Language Programming 265
Cadence AE use
Using an Optional only:
Debug Do not distribute
Parameter
You can add an optional debug parameter to your top-level SKILL functions that
allows you to turn debug print statements on and off as needed. Use a when
statement to test the value of debug.
Definition
procedure( TrShapeReport( wid @optional (debug nil) )
...
foreach( shape cv~>shapes
when( debug printf( “in shape loop : %L\n” shape~>objType))
...
) ; foreach
...
) ; procedure TrShapeReport
Usage
Debug off: TrShapeReport( window(3) )
Debug on: TrShapeReport( window(3) t )
Rather than removing print statements you use for debugging, you can leave them
in and turn them on as needed with the optional parameter.
7/16/12 SKILL Language Programming 266
SKILL Language Programming 266
Cadence
DevelopmentAE
Tip use only: Do not distribute
Summary
The following techniques are often very effective for isolating or minimizing
problems:
Develop working programs incrementally, adding functionality in
stages.
Become familiar with common problems and their symptoms.
Examine your source code for common problems.
Document your source code. Often, as you annotate your code, you
uncover problems.
Use println or printf statements to clarify the flow of control or display
the values of local variables.
Define an optional debug parameter.
Program defensively to identify problems as soon as they occur.
7/16/12 SKILL Language Programming 267
SKILL Language Programming 267
Cadence AE use
SKILL Development only: Do not distribute
Environment
The SKILL Development Environment is a separate product from the
Design Framework II environment. It contains several utilities to help you
perform a variety of SKILL development tasks.
Utility Task
SKILL Debugger Trap errors.
Suspend execution.
Monitor execution.
SKILL Lint Identify potential errors, oversights, and inefficient constructs.
SKILL Profiler Measure performance and memory usage.
SKILL Surveyor Survey SKILL code to determine what changes are needed to
migrate to a new version of Cadence software.
7/16/12 SKILL Language Programming 268
The SKILL Development Environment tools help you to
Reduce the time it takes to develop or migrate your SKILL program.
Improve the quality and efficiency of your SKILL program.
SKILL Language Programming 268
Cadence AE use
SKILL Development only: Do not distribute
Window
You can access all of the capabilities of the SKILL Development
Environment through SKILL functions. Alternatively, the SKILL
Development window is an interface to many of the facilities of the SKILL
Development Environment.
In the CIW, the Open—SKILL Development command opens the SKILL
Development window.
Control a debugging session
Analyze source code for common errors
Measure CPU time and memory usage per function
Display a tree of function calls within a requested function
Trace values of functions, variables or properties
Locate Cadence functions providing syntax and synopsis
Scan code to identify functions that changed between revisions
7/16/12 SKILL Language Programming 269
SKILL Language Programming 269
Cadence AE use
Using Single-Step only:
Tracing Do notandistribute
to Analyze Error
When your program causes a SKILL error, the following happens:
Your program aborts before completing.
The CIW displays an error message.
Often, single-step tracing provides enough information for you to determine
the cause of the error.
To use single step tracing follow these steps:
1. In the CIW, turn on single-step tracing.
tracef( t )
2. Run your application.
The SKILL Debugger displays the arguments and the return value of each
function [Link]
Evaluator displays an error message.
3. In the CIW, turn off single-step tracing.
untrace()
7/16/12 SKILL Language Programming 270
Single-step tracing can be very effective, but it has the following drawbacks:
Single-step tracing produces a lot of output. If the SKILL error does not occur early in the
run, you can easily get confused or lost looking at the output.
The output shows each function call with evaluated arguments. It can be hard to correlate the
output with your source code.
The Tracing Form
The Tracing command is in both the SKILL Debugger Toolbox and the SKILL Development
Toolbox. It brings up the Tracing form. You can use this form to control tracing instead of using
the tracef and untrace functions.
SKILL Language Programming 270
Cadence AE
A Single-Step use
Trace only: Do not distribute
Example
Examine the lines preceding the error message for evidence.
\i TrShapeReport( window(3))
\o |window(3)
\o |window --> window:3
\o |TrShapeReport(window:3)
\o ||outfile("/tmp/[Link]")
\o ||outfile --> port:"/tmp/[Link]"
\o ||TriShapeReport(window:3 port:"/tmp/[Link]")
\o |||(window:3~>libName)
\o |||getSGq --> nil
\o |||(window:3~>cellName)
\o |||getSGq --> nil
\o |||(window:3~>viewName)
\o |||getSGq --> nil
\o |||fprintf(port:"/tmp/[Link]" "%s %s %s contains:" nil nil nil)
\e *Error* fprintf/sprintf: format spec. incompatible with data – nil
Can you spot what causes the fprintf/sprintf error?
7/16/12 SKILL Language Programming 271
In this example, the trace output indicates that the code expects a cellview database object but is
dealing with a window ID.
SKILL Language Programming 271
Cadence AE useTrace
Another Single-Step only: Do not distribute
Example
Can you determine the cause of the error from the following trace?
\i TrShapeReport( window( 4 ))
\o |window(4)
\o |window --> window:4
\o |TrShapeReport(window:4)
\o ||outfile("/tmp/[Link]")
\o ||outfile --> port:"/tmp/[Link]"
\o ||TriShapeReport(window:4 port:"/tmp/[Link]")
\o |||geGetWindowCellView(window:4)
\o |||geGetWindowCellView --> db:41474092
\o |||(db:41474092~>libName)
\o |||getSGq --> "master"
\o |||(db:41474092~>cellName)
\o |||getSGq --> "mux2"
\o |||(db:41474092~>viewName)
\o |||getSGq --> "layout"
\o |||fprintf(port:"/tmp/[Link]"
"%s %s %s contains:" "master" "mux2" "layout")
\o |||fprintf --> t
\o |||(db:41474092~>shapes)
\o |||getSGq --> (db:41517992 db:41517736 db:41517480 db:41517224 db:41528864 ... )
\o |||(db:41517992~>objType)
\o |||getSGq --> "textDisplay"
\e *Error* postincrement: can't handle add1(nil)
Sometimes trace output yields no evidence.
You can use the SKILL IDE to help debug this code.
7/16/12 SKILL Language Programming 272
procedure( TrShapeReport( wid )
let( ( thePort )
thePort = outfile( "/tmp/[Link]" )
when( thePort
TriShapeReport( wid thePort )
close( thePort )
) ; when
view( "/tmp/[Link]" TrReportBBox "Shape Report" )
) ; let
) ; procedure
procedure( TriShapeReport( wid outport )
let( ( rectCount polygonCount pathCount miscCount )
cv = geGetWindowCellView( wid )
fprintf( outport "%s %s %s contains:"
cv~>libName cv~>cellName cv~>viewName )
foreach( shape cv~>shapes
case( shape~>objType
( "rect" rectCount++ )
( "polygon" polygonCount++ )
( "path" pathCount++ )
( t miscCount++ )
) ; case
) ; foreach
fprintf( outport "\n%-10s %-10d" "Rectangles" rectCount )
fprintf( outport "\n%-10s %-10d" "Polygons" polygonCount )
fprintf( outport "\n%-10s %-10d" "Paths" pathCount )
fprintf( outport "\n%-10s %-10d" "Misc" miscCount )
list( cv~>libName cv~>cellName cv~>viewName )
) ; let
) ; procedure
SKILL Language Programming 272
Cadence AEtheuse
SKILL IDE and only:
SKILL Do not distribute
Debugger
The SKILL IDE is the graphical source code debugger which is an
extension of the basic command-line SKILL debugger.
You can use the command-line SKILL debugger or the new SKILL IDE
to analyze and debug your code.
This module will focus on the new SKILL IDE use model and features.
The command-line SKILL debugger is described in an appendix to this
course.
7/16/12 SKILL Language Programming 273
SKILL Language Programming 273
Cadence AE IDE
Using the SKILL usetoonly: DoAnalyze
Trap and not distribute
an Error
Normally, when your program causes a SKILL error, your program is aborted.
SKILL discards the knowledge about the program state at the time of the error. This
knowledge includes the following:
The values of local variables
The sequence of function calls under evaluation at the time of the SKILL error
This information can help you determine the cause of the error. To examine this
information before SKILL discards it, you must trap the error:
1. Start the SKILL IDE
2. Open and Load your program
3. Run your application to reproduce the error.
The SKILL IDE debugger traps the error and highlights the source-code line.
4. View the SKILL execution stack using the Stack assistant
5. View the values of local variables using the Trace assistant.
6. Analyze the program and fix any errors in the source-code pane.
The following slides cover more details of this debugging approach.
7/16/12 SKILL Language Programming 274
SKILL Language Programming 274
Cadence
Starting the AE use
SKILL IDE only: Do not distribute
You start the SKILL IDE from the CIW by choosingTools – SKILL IDE to
open the SKILL IDE window:
7/16/12 SKILL Language Programming 275
When you open a file in the SKILL IDE, it automatically opens the file in the SKILL editor. You
can open multiple files and they are viewed in tabs.
SKILL IDE is an interactive source-level symbolic debugger that helps you develop, test, and
refine SKILL procedures. It is a multifile editor that provides common editing and debugging
capabilities, including:
• Auto indenting of source code
• Color syntax highlighting of source code
• Single stepping execution through SKILL programs
• Setting breakpoints to suspend execution graphically
• Tracing and editing the values of variables during execution
• Displaying variable scope
• Displaying a stack trace of the hierarchy of functions
SKILL Language Programming 275
Cadence AEInterface
SKILL IDE User use only: Do not distribute
Overview
Search / Set Breakpoint / Run Function
Tool
Bars
Variable
Trace
Source Assistant
Code Window
Pane
Stack Trace
Assistant
Status
Window
Bar
Click in column to set and unset breakpoints
7/16/12 SKILL Language Programming 276
The SKILL IDE interface is user-friendly and easy-to-learn, and it eliminates the need to learn
complex debugging commands. It consists of menus, toolbars, dialog boxes, and windows that
help you control your debugging operations.
SKILL Language Programming 276
Cadence AEthe
Open and Load use only:
SKILL Do not
Program distribute
to Debug
7/16/12 SKILL Language Programming 277
SKILL Language Programming 277
Cadence AEProgram
Run the SKILL use only: DoSKILL
from the not distribute
IDE
7/16/12 SKILL Language Programming 278
SKILL Language Programming 278
Cadence AE use
View the Results only:the
and Check DoVariables
not distribute
7/16/12 SKILL Language Programming 279
SKILL Language Programming 279
Cadence
Suspending AE use only:Your
and Resuming DoProgram
not distribute
Sometimes the bug you are investigating does not cause a SKILL error. When your
program runs to completion, you need to validate the output. Using the CIW, you
can interactively verify expressions from your program.
The SKILL expressions in your program typically depend upon function arguments
and local variables.
Before verifying the SKILL expressions in the CIW, you need to set the variables in
the expressions to appropriate values. But, doing so is time consuming and error
prone. It is better to run your program and suspend the execution at the expression
you want to evaluate.
To have SKILL suspend your program, you have three alternatives:
You can edit the source code for your program to call the break function.
SKILL suspends your program when your program calls the break function.
You can set a breakpoint at a function boundary. SKILL suspends your
program when the flow of control reaches the function boundary.
You can use the SKILL IDE to set breakpoints
After examining local variables and verifying expressions, you resume the execution
of your program.
7/16/12 SKILL Language Programming 280
A function boundary consists of four points. Each point is an event that occurs during a function
call. The order of events is call, entry, exit, and return. In the following table, the caller refers to
the code that contains the function call and the callee refers to the function itself:
You can set a breakpoint at all four points for any function you define while the SKILL Debugger
is installed.
For other SKILL functions, you can set a breakpoint at only the call point or the return point.
Point Description
Call In the caller, after SKILL evaluates the argument expressions
Entry In the callee, after binding the caller’s actual arguments to the
callee’s formal arguments
Exit In the callee, after computing the return result
Return In the caller, after running to the caller
SKILL Language Programming 280
Cadence AE use
Setting Breakpoints only:
Using theDo notIDEdistribute
SKILL
Example
Click in the left column to set the breakpoint on the TriShapeReport
function. A red-hand icon appears. To clear it click on it again.
7/16/12 SKILL Language Programming 281
SKILL Language Programming 281
Cadence AE usein only:
Hitting a Breakpoint DoIDE
the SKILL not distribute
1. Set a breakpoint
at the entry of the
TriShapeReport
function.
2. Call the
TrShapeReport
function.
3. The SKILL IDE
highlights the
source code line
and the CIW
notes the
breakpoint.
7/16/12 SKILL Language Programming 282
SKILL Language Programming 282
Cadence AE use
Tracing Variables only:
in the SKILLDo
IDEnot distribute
View the wid and thePort function arguments
7/16/12 SKILL Language Programming 283
SKILL Language Programming 283
Cadence AE
Step Through theuse
Codeonly: Do not distribute
You can single step through the code, go to the next
function, step out of the current function or continue
running the program.
7/16/12 SKILL Language Programming 284
SKILL Language Programming 284
Cadence AE use only: Do not distribute
Lab Exercises
Lab 14-1 Analyzing an Error
Lab 14-2 Running Debugger Sessions
7/16/12 SKILL Language Programming 285
SKILL Language Programming 285
Cadence
SKILL Lint AE use only: Do not distribute
SKILL Lint performs the following tasks:
Analyzes your source code for many common errors and inefficient
techniques.
Generates hints, suggestions, warnings, and errors.
Locates local variables that are never used.
Isolates globals that are never referenced.
Checks for globals without the designated prefixes (such as Tr).
Validates procedure calls for the correct number of arguments.
Checks for incorrect keyword arguments.
Checks for a return expression outside of a prog expression.
Advises the use of more efficient constructs.
Produces a summary score for your program.
You can read further about SKILL Lint in the SKILL User Guide.
7/16/12 SKILL Language Programming 286
You access SKILL Lint from the SKILL Development Toolbox.
SKILL Lint can analyze all the source code in a file or in a context.
You direct the SKILL Lint output to a file or to the [Link].
You can selectively disable SKILL Lint checks.
You need to identify package prefixes that your global variables use.
SKILL Language Programming 286
Cadence AE use only: Do not distribute
SKILL Lint Interface
7/16/12 SKILL Language Programming 287
SKILL Language Programming 287
Cadence AE use only: Do not distribute
SKILL Profiler
The SKILL Profiler tells you where your SKILL programs are taking the
most time and allocating the most memory. Specifically, it performs the
following tasks:
Measures the time spent in each function that executes longer than
1/60th of a second.
Shows how much SKILL memory is allocated in each function.
Displays a tree graph of all functions that your program executed, and
the time that those functions spent, or the memory that those functions
allocated.
You can measure performance without having to modify function
definitions.
You can read further about the SKILL Profiler in the SKILL User Guide.
7/16/12 SKILL Language Programming 288
SKILL Language Programming 288
Cadence AE
SKILL Profiler use only: Do not distribute
Interface
7/16/12 SKILL Language Programming 289
SKILL Language Programming 289
Cadence AE use only: Do not distribute
SKILL Surveyor
SKILL Surveyor is a process to determine what changes you need to make
to your code to assure compatibility with the current version of SKILL.
The process works like this:
Start the SKILL Tabulator to collect a list of SKILL function names used
in your code.
You send an e-mail with the list to Cadence Support.
Cadence Support conducts an analysis (called a survey) and mails the
results back to you.
You can run SKILL Surveyor from the DFII graphical interface if you have
product #900.
SKILL Surveyor is useful for migrating SKILL code from one release to the
next.
7/16/12 SKILL Language Programming 290
SKILL Language Programming 290
Cadence AE Code
Migrating SKILL use only: Do not distribute
Updates or Yes
Organize SKILL Files Change SKILL File
changes
required?
No
Test in Test in IC6.1.X
CDBA:
successful?
Yes
No
No
Make any required Works
changes to SKILL file Fix SKILL File
properly in
6.1.X?
No
Yes No
SKILL Lint
IC5.X:
successful? Passes
Run SKILL Lint
Yes SKILL Lint?
SKILL Survey
Yes
SKILL Surveyor Document changes and
archive working version
7/16/12 SKILL Language Programming 291
SKILL code migration is not a single step. It is a cycle that involves the running SKILL Lint,
conducting a survey, and verifying, validating, checking and rechecking the code. The phases of
the cycle are as follows:
1. Organize and categorize your SKILL files in the existing environment.
2. Validate the SKILL code in the existing environment by devising tests for the code. Fix
any problems prior to testing the code in the new environment.
3. Run SKILL Lint on the files prior to translation. Fix any globals, unused variables or
functions, or other mistakes. Run Lint iteratively until the file has no problems.
4. Perform a SKILL survey on the files using SKILL Surveyor. Study all results for possible
conversion issues.
5. Fix any issues found in the survey by modifying the SKILL file.
6. Test the function in the new environment. Test all branches and functions in the file.
7. If any fixes are required, make the changes.
8. After the file is working, run SKILL Lint for the new version on the file to make sure that
there are no globals or unused variables. Use Lint iteratively until the file is clean.
9. Document all changes and modifications. Make a backup of the new working file.
SKILL Language Programming 291
Cadence AE use
Accessing SKILL only: Do not distribute
Surveyor
7/16/12 SKILL Language Programming 292
First, select the SKILL Development toolbox from the CIW Tools menu. Then select SKILL
Surveyor from the SKILL Development form.
Previously you would go to the SourceLink website to download the SKILL Surveyor utility
(SKILL Tabulator). Now you can access it directly from the SKILL Development toolbox.
SKILL Language Programming 292
Cadence
Using SKILLAE use only: Do not distribute
Surveyor
Fill in the top of the SKILL
Tabulator form with the
location and suffixes of
your SKILL files.
The report file is sent to
Cadence and surveyed.
The results are returned
to you with any SKILL
function changes you
need to make to your
code.
7/16/12 SKILL Language Programming 293
*File or Directory Name(s): The SKILL files to be tabulated or directory names where the SKILL files to be tabulated are
located. By default this field shows the current directory where the application is launched. Note that this field is required in
order to successfully run the SKILL Tabulator.
*File Extensions: The extensions of the files to tabulate (default: il ile cdsinit). If you use extensions other than the usual il,
ile, or cdsinit, you need to modify this field. The SKILL Tabulator follows symbolic links and the extensions are checked
against the file linked to, rather than the link itself. This field is required to successfully run the SKILL Tabulator.
Recurse Directories: Whether the SKILL Tabulator should recursively search all the files hierarchically under the directory
paths given in the File or Directory Name(s) fields. This option is on by default.
Exclude Files or Directories: Specifies files or directories to be excluded from tabulation in the current directory level of
the directories specified in the File or Directory Name(s) field.
Recursively Excluded Files: Specifies files to be recursively excluded from tabulation in the current directory level as well
as all the sub-directories of the directories specified in the Directory Name(s) field.
*Report File: The output file (default: ./[Link]) that contains a list of Cadence and user-defined functions called and
defined and how many times they were called. This field is required in order to successfully run the SKILL Tabulator.
Create Info File: Specifies whether to create the info file that contains a list of files where Cadence and user-defined
functions were called. This option is on by default.
Info File: The information file (default: ./[Link]) that contains a list of files where Cadence and user-defined functions
were called. This field is grayed-out by default.
Create Defn File: Whether to create the definition file that contains a list of files where Cadence and user-defined functions
were defined. This option is on by default.
Defn File: The definition file (default: ./[Link]) that contains a list of files where Cadence and user-defined functions
were defined. This field is grayed-out by default.
Show Report: Specifies whether to display the report file in a viewfile window when tabulation is done. By default, this
option is switched on (the report file will be displayed).
Show User Defined: Whether to list the functions that are filtered by the local definition criterion in the output file. This
option is selected by default.
SKILL Language Programming 293
Cadence AEProcess
SKILL Surveyor use only: Do not distribute
SKILL Surveyor runs the SKILL Tabulator to create a nonproprietary snapshot of
your SKILL environment. It reports all the Cadence functions called in your SKILL
code. It allows you to ignore your custom functions to preserve confidentiality.
The results of a tabulation process are written to three files:
[Link] (list of functions defined and called and the number of times each is called)
[Link] (files where functions were called)
[Link] (files where functions were defined)
You can e-mail the [Link] file to Cadence Support for analysis. Cadence
Support will e-mail the analysis results back to you.
7/16/12 SKILL Language Programming 294
The analysis results include changes you need to make to your code to assure compatibility with
the current version of the SKILL language.
The analysis results provide
All undefined functions (misspelled or dependencies): for example, you called it, but neither
you nor we defined it.
All re-defined Cadence functions: for example, you defined it and we also defined it in our
code.
All changed functions (most are positive improvements): for example, you called it, yet we
changed it between releases.
All deleted functions (with replacements if available): for example, you called it, yet we
deleted it between releases.
All functions which are safely supported, for example: you called it, and we documented and
support it.
All functions which might be dangerous to use: for example: you called it, yet we don't
document or support it.
Advice on how to recover from any changes identified, for example: Cadence R&D-supplied
advice for your functions.
Exclusion of user-defined functions by turning off the checkbox for Show User Defined in
the tabulator form.
SKILL Language Programming 294
Cadence AE use
SKILL Conversion only: Do not distribute
Resources
Several SKILL programming resources are available for SKILL conversion.
Migration Documents
IC Migration Guide
[Link]
OpenAccess Installation and Configuration Guide
[Link]
SKILL Programming Resources
The SKILL Finder Tool: CIW–Tools–SKILL Development–Finder
The SKILL Quick Reference (by version)
SKILL Language User Guide
SKILL Language Reference Guide
SKILL Development Functions Reference
Cadence® Virtuoso® Design Environment SKILL Functions Reference
Individual tool SKILL reference manuals
7/16/12 SKILL Language Programming 295
All of the resources mentioned, except the SKILL Finder, can be found in the Cadence online
documentation. This can be started by setting your shell environment path to point to the Cadence
tools (as you would when starting the Cadence IC tools) and typing cdnshelp. You can also select
Help from any window in IC5.0.2 to open the documentation.
The SKILL Finder can be started three ways:
Typing startFinder( ) in the CIW input pane
Typing cdsFinder& in a shell window
Using the menu item in the CIW: Tools–SKILL Development–Finder.
You also have CIW command-line access to the SKILL Finder help files, as shown in the
following example:
> help help
help( [ S_name ] ) => t / nil
Retrieves and prints the cdsFinder documentation strings for the given
function name (a symbol). If the given name is a string, it is interpreted
as a regular expression, and the entire cdsFinder database is searched for
functions whose name or documentation string contains or matches the given
string. Help is an nlambda function.
t
>help "leLayer"
leLayerAnd, leLayerAndNot, leLayerOr, leLayerSize, leLayerXor
SKILL Language Programming 295
Cadence AE use only: Do not distribute
Lab Exercises
Lab 14-3 Using SKILL Lint
Lab 14-4 Surveying the SKILL Code
7/16/12 SKILL Language Programming 296
In lab 14-3, you use SKILL Lint to locate program problems.
In lab 14-4, you locate SKILL files and use SKILL Surveyor to run the tabulator. You see the
results of a SKILL code survey.
SKILL Language Programming 296
Cadence AE use only: Do not distribute
Module Summary
In this module, we covered
Matching SKILL development utilities with development tasks
The SKILL Debugger
SKILL Lint and the SKILL Profiler
SKILL Surveyor
7/16/12 SKILL Language Programming 297
SKILL Language Programming 297
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 298
SKILL Language Programming 298
Cadence AE use only: Do not distribute
Cellview Data Model
Module 15
July 16, 2012
SKILL Language Programming 299
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn how to
Describe database object concepts.
Describe Virtuoso® Design Environment on OpenAccess (OA).
Use the cellview data model documentation.
Open a cellview nongraphically.
Create geometry in a design.
Save and close a cellview.
Create geometries with relative object design (ROD).
Survey how the cellview data model represents
Geometry
Markers
Hierarchy
Connectivity
Vias
User-defined properties
Retrieve all attributes of a database object.
7/16/12 SKILL Language Programming 300
Terms and Definitions
OpenAccess Industry-standard database technology.
Library A collection of design objects that you refer to by a logical name, such as
cells, views, and cellviews.
Cell A component of a design: a collection of different representations of the
components implementation, such as its schematic, layout, or symbol.
Cellview A particular representation of a particular component, such as the layout of
a flip-flop or the schematic of a NAND gate.
View An occurrence of a particular view type identified by its user-defined
name, "XYZ". Each "XYZ" view has an associated viewType, such as
maskLayout, schematic, or symbolic.
Pin A physical implementation of a terminal.
Terminal A logical connection point of a component.
Rod Use a relative object design to create geometries in a layout cellview.
SKILL Language Programming 300
Cadence AE Review
Database Object use only: Do not distribute
In the “Database Queries” module, we covered
Database object concepts
Several specific object types
The cellview object type
The inst object type
The Shapes object types
The net object type
The geGetWindowCellView function
The geGetSelSet function
Using the ~> operator to retrieve attributes and user-defined
properties.
7/16/12 SKILL Language Programming 301
SKILL Language Programming 301
Cadence
OpenAccessAE use only: Do not distribute
Database
Cadence EDA Industry University
EDA Tools Tools Research
Standard API Floorplanning
Data Model Schematics
Reference Database Layout
A common database and API for next-generation integration of digital and
custom flow tools.
Enhanced and maintained by the industry-run OpenAccess Coalition under Si2
as open database for tool integration.
High-capacity connectivity-based database with structures to compactly handle
large designs.
7/16/12 SKILL Language Programming 302
Well-documented C++ based public API for easy integration of third-party tools.
Single database eliminates translation steps
Single data model eliminates loss of data
Correct representation is between each application and the database, not a function of
downstream tools
Name mapping in the API means each tool uses its own naming rules
All existing design data is available to any tool that decides to use it
Nonproprietary and uses OpenSource model for distribution and enhancement
Increased capacity for physical layout data
For documentation, OpenAccess uses a GNU Public License application product called Doxygen.
This provides the capability of producing documentation for all functions by extracting the
information from the comments in the source code.
SKILL Language Programming 302
Cadence
OpenAccessAE
and use only:
Virtuoso Do Environment
Design not distribute
OpenAccess (OA) refers to the public OpenAccess database technology
promoted and maintained by the Si2 organization. It includes the following:
A cellview data model
A C++ API (not covered in this course)
Cadence adds the SKILL® API and custom extensions on top of OA to
create the Virtuoso Design Environment.
The cellview data model expresses the following design data:
Geometry
Hierarchy
Connectivity
Applications programs can express user-defined data and relationships by
means of
User-defined properties
User-defined groups
7/16/12 SKILL Language Programming 303
OA and SKILL
Database access consists of procedural access layers on top of the OpenAccess database. SKILL
routines provide nearly complete access to all the data stored in the OA design database. You can
create, modify, save, retrieve, and maintain data in the OA database. SKILL functions are
available at the programming level and allow tight and complete control over database operations.
OpenAccess A public API and reference database to allow tool
interoperability.
Si2 Silicon Integration Initiative, Inc. — Organization
[Link] aimed at improving quality and reducing costs of
integrated silicon systems. This is the parent
organization of the OpenAccess coalition which will
control future development of the API.
SKILL Language Programming 303
Cadence AE use
Database-Centric only: Do not distribute
Flows
All tools communicate through the common API layer.
Multiple tool flows share data without the need for translation.
Data model continually improved to address new requirements.
7/16/12 SKILL Language Programming 304
When the data model is revised, then the new releases of the Cadence tools are updated to support
the new data model.
SKILL Language Programming 304
Cadence AE use
Database Access only:
SKILL Do not distribute
Documentation
The chapter “Database Access” in the Virtuoso Design Environment SKILL
Reference has sections on
Data stored as objects
Database access functions
Attribute retrieval and modification
See the Cadence online documentation to access this material by
Searching for specific functions, such as the dbOpenCellViewByType function.
Using the table of contents for this material.
When working with designs in CDBA and OpenAccess you can determine the
database type with
dbGetDatabaseType( ) => CDBA | OpenAccess
Note: This is important because there are additional database objects in
OpenAccess that were not present in CDBA. Your SKILL code could therefore need
to branch based on the database type in order to execute properly in both
environments.
7/16/12 SKILL Language Programming 305
SKILL Language Programming 305
Cadence AE
Description of use only:
Database Do not distribute
Objects
The section “Description of Database Objects” has a series of tables that
list the attributes for each object type. To locate the section, in Cadence
Help, search for “description of database objects.”
Each table consists of four columns:
The Attribute column lists the attribute name.
The Modify column lists whether you can use the ~> operator together
with the = operator to update the attribute value.
The Type column lists the constrained value of the attribute. The value
of an attribute is constrained to be one of these SKILL data types:
String
Integer
Float
Database object
List
Boolean (appears as a string, true or false)
The Description column summarizes the meaning of the attribute.
7/16/12 SKILL Language Programming 306
There are three types of attributes:
Attribute Description
Mandatory Must be specified at the time the database object is created.
These attributes are essential to the viability of the database object.
Optional Might or might not be present on a particular database object, in which
case its value is nil.
Derived Are computed dynamically from other attributes.
Consequently, you cannot change them.
SKILL Language Programming 306
Cadence AE use
Database Object only: Do not distribute
Classes
An object class is a data type abstraction that groups related object types
into a class. Examples of object types which have similar attributes are
All object types have an objType attribute.
The inst and mosaicInst object types both have a master attribute.
All shape object types and the inst object type have a bBox attribute.
All shape object types have a layerName attribute.
The stdVia and customVia object types have a route attribute.
All blockage objects have a type attribute.
7/16/12 SKILL Language Programming 307
An object class is a collection of object types with similar attributes.
Class Scope
Generic database object All database objects
figure Any selectable database object
anyInst The inst and mosaicInst database objects
shapes All shape database objects
via The stdVia and customVia objects and the
viaHeader class
blockage The layerBlockage and areaBlockage objects
and the halo class
SKILL Language Programming 307
Cadence AE
Cellview Data useRoad
Model only:
MapDo not distribute
In this module, diagrams such as this one summarize the cellview data model.
libName
cellName
cellView viewName
Shape cellView
shapes
objType objType
The diagrams use the following conventions:
An ellipse represents a class of object types that share attributes.
A rectangle represents an object type.
Attribute names are clustered around the ellipses or rectangles.
Arrows represent relationships between two object types or two object type
classes. Each arrow is labeled with an attribute name.
A single-headed, thin arrow represents a 1-to-1(0) relationship.
A double-headed, thin arrow represents a 1-to-many(0) relationship.
7/16/12 SKILL Language Programming 308
This table summarizes the example road map. The road map focuses on attributes that represent
relationships between object types.
Object type or class Attribute name Attribute value
Shape objType
Shape cellView one cellView object
cellView objType
cellView libName
cellView cellName
cellView viewName
cellView shapes zero or more Shape database objects
The ~/SKILL/CaseStudy/[Link] defines a function that builds the complete road map as a
layout cellview. See Lab -10, Building the Cellview Data Model Road Map, for further details.
SKILL Language Programming 308
Cadence AE
Cellview Data useSnapshot
Model only: Do not distribute
7/16/12 SKILL Language Programming 309
SKILL Language Programming 309
Cadence AE use only: Do not distribute
Opening Cellviews
The dbOpenCellViewByType function opens a cellview nongraphically.
If successful, it returns the database object of the cellview.
cv = dbOpenCellViewByType(
"master" ;; library name
"mux2“ ;; cell name
"schematic" ;; view name
"schematic“ ;; view type
"r" ;; access mode
;; "r" = read, "a" = append, "w" = overwrite
)
db:12345678
Use the dbOpenCellViewByType function to create a new cellview.
cv = dbOpenCellViewByType( "master" "new" "layout" "maskLayout" "w" )
=> db:37711916
7/16/12 SKILL Language Programming 310
The dbOpenCellViewByType Function
If the dbOpenCellViewByType function is unsuccessful, it returns nil.
cv = dbOpenCellViewByType( "master" "boxes" "layout" "maskLayout") )
*WARNING* failed to open cellview (boxes layout) from lib (master) in 'r„
mode because cellview does not exist.
nil
dbOpenCellviewByType Examples
If cell "cellA" with view "layout" exists in library "test," open the cellview for read.
cellview = dbOpenCellViewByType("test" "cellA" "layout")
Open cell "cellA" with view "layout" in library "test" for "append" mode. Create the cellview if it
does not exist.
cellview = dbOpenCellViewByType("test" "cellA" "layout" "maskLayout" "a")
Open cell "cellA" with view "layout" in library "test" for "append" mode only if the cellview
already exists.
cellview = dbOpenCellViewByType("test" "cellA" "layout" "" "a")
SKILL Language Programming 310
Cadence
Shapes AE use only: Do not distribute
layerPurposePairs
cellView
shapes
cellView
layerName shapes
layerNum Shape LP
lpp
layerName
layerNum
purpose
polygon rect line
nPoints nPoints
points points
Note: Not all shape object types are shown. is a kind of
7/16/12 SKILL Language Programming 311
Every cellView database object has a shapes attribute. The value of shapes is a list of all shapes in
the design. If you need to process all the shapes in a design by layer purpose pair, retrieve the
layerPurposePairs attribute, whose value is a list of LP database objects.
Each LP database object has
A shapes attribute, which is a list of all shapes that are on that layer purpose pair.
layerName and layerNum attributes, which identify the layer purpose pair.
Each Shape database object has
layerName and layerNum attributes, which identify the layer name and number of the layer
where the shape is.
An lpp attribute whose value is the list of layer name and layer purpose.
SKILL Language Programming 311
Cadence AE use only: Do not distribute
Creating Shapes
There are several SKILL functions that create database objects. These
functions
Begin with dbCreate.
Require a cellview database object and enough other arguments to
describe the object.
Return the new database object.
Use the dbCreateRect function to create a rectangle on a layer with a given
bounding box.
let( ( cv newRect )
cv = dbOpenCellViewByType( "master" "new"
"layout" "maskLayout" "w")
newRect = dbCreateRect(
cv ;;; cellView database object
"metal1" ;;; layer name
list( 0:0 .5:.5 ) ;;; bounding box
)
...
) ; let
7/16/12 SKILL Language Programming 312
The dbCreateRect Function
dbCreateRect( d_cellView tx_layer l_bBox ) => d_rect / nil
dbCreateRect( d_cellView (tx_layer [t_purpose] ) l_bBox ) => d_rect / nil
This function creates a rectangle.
Arguments Interpretation
d_cellView Specifies the cellview
tx_layer Specifies either the layer name or number
t_purpose Specifies purpose; defaults to drawing
l_bBox Defines the lower-left and upper-right corners of the bounding box
Returns the dbObject of the rectangle.
Returns nil if the rectangle is not created.
SKILL Language Programming 312
Cadence AE use only: Do not distribute
Updating Shapes
You can often use the ~> operator to update a shape.
Expression Action Example
~>bBox = Move a rectangle aRect~>bBox = newBBox
~>layerName = Change a shape’s layer aRect~>layerName = "thinox"
~>points = Change a path’s points aPath~>points = newPoints
~>width = Change a path’s width aPath~>width = 3.0
There are attributes you are not allowed to set.
aPath~>nPoints = 6
Message: *Error* setSGq: dbSetq:
Can not set attribute - nPoints
The geTransformUserBBox function transforms a bounding box according
to a displacement vector, a rotation, and a magnification.
newBBox = geTransformUserBBox( aRect~>bBox
list( 0:deltaY "R0" )
)
7/16/12 SKILL Language Programming 313
The geTransformUserPoint Function
The geTransformUserPoint function transforms a point by the displacement and rotation passed
in.
The geTransformUserBBox Function
The geTransformUserBBox function is similar to geTransformUserPoint, except that it expects a
bounding box. It returns the transformed bounding box in the standard format: the first point is the
lower-left corner and the second point is the upper-right corner of the bounding box.
Refer to the reference documentation for further information on these functions.
SKILL Language Programming 313
Cadence AE use
Saving and Closing only: Do not distribute
a Cellview
The dbSave function saves a modified cellview that has been opened in
write or append mode.
let( ( cv newRect )
cv = dbOpenCellViewByType(
"master" "new" "layout" "maskLayout" "w“
)
newRect = dbCreateRect(
cv ;;; cellView database object
"metal1" ;;; layer name
list( 0:0 .5:.5 ) ;;; bounding box
)
dbSave( cv )
...
) ; let
You cannot save or overwrite a cellview that is open in read mode.
However, can save a cellview modified in read mode to an entirely new
cellview.
7/16/12 SKILL Language Programming 314
The dbSave Function
See the Cadence® online documentation to read more about this function. For instance, you can
specify a different cellview to save the data to.
If you are editing a schematic cellview, you also need to do a schCheck prior to the dbSave
function. This corresponds to the Check and Save step that you perform interactively when editing
or expanding a schematic cellview.
SKILL Language Programming 314
Cadence
The dbCloseAE use only: Do not distribute
Function
Use the dbClose function when you no longer need a cellview in virtual
memory.
let( ( cv newRect )
cv = dbOpenCellViewByType("master" "new" "layout" "maskLayout" "w")
newRect = dbCreateRect(
cv ;;; cellView database object
"metal1" ;;; layer name
list( 0:0 .5:.5 ) ;;; bounding box
)
dbSave( cv )
dbClose( cv )
) ; let
Avoid accessing purged objects. The ~> operator cannot retrieve attributes
from a purged database object that has been removed from virtual memory.
In that case, the ~> operator issues a warning and returns nil.
cv~>cellName
dbGetq: Object is a purged/freed object. - db:37711916
nil
After closing a cellview, set all variables containing the database object to
nil.
7/16/12 SKILL Language Programming 315
To read more about the dbClose function, see the Cadence online documentation.
SKILL Language Programming 315
Cadence AE use
Creating Shapes Usingonly: Do not distribute
ROD Functions
Relative object design, or ROD, was developed to enhance the ability to
create layout cellviews by
Combining numerous and repetitive commands, such as creating
connectivity, into a single command.
Providing access to parts of a shape - edges, corners, etc. - without
the overhead of custom SKILL code.
Providing an option to name objects and the place them relative to one
another.
Maintaining the relationships of the ROD objects to one another when
the objects are edited interactively or with SKILL code.
ROD functions are often used in pcell development but are also useful in
general cell development.
7/16/12 SKILL Language Programming 316
As a caution, ROD objects add additional overhead to the system requirements.
SKILL Language Programming 316
Cadence AE
Multipart Path use only:
Example: Bus Do not distribute
Key:
metal1
subpaths
Master path
You can create a bus using the offsetSubPath option to rodCreatePath. As
you vary the geometry of the master path, the subpaths automatically
adjust accordingly.
The lower metal route is the master path, and the other routes are each an
offset subpath of the master path.
7/16/12 SKILL Language Programming 317
The code for the example shown here might look something like this:
routeWidth = routeSpacing = 1.0
rodCreatePath(
?layer “metal1”
?pts list(20:-20 40:-20 40:-30 80:-30) Master path
?width routeWidth
?justification "center "
?cvId geGetEditCellView()
?offsetSubPath
list(
list(
?layer “metal1”
?justification "left"
?sep routeSpacing First adjacent path
) ;end subpath1
list(
?layer “metal1” Next adjacent path
?justification "left”
?sep (routeSpacing * 2.0) + routeWidth
) ;end subpath2
...
) ; offsetSubPath
) ; rodCreatePath
SKILL Language Programming 317
Cadence AE use
Creating Objects only:Objects
from Other Do not distribute
Using the rodCreateRect, rodCreatePolygon, or rodCreatePath function, you can
create a new rectangle, polygon, or path from one or more existing ROD objects.
The existing objects are referred to as source objects, and the new object is
referred to as the generated object
You use the ?fromObj keyword argument to specify the source objects
You can specify a difference in the size between the generated object and the
source objects
You use the ?size keyword argument to specify the scaling factor for the new
object.
source object: diffusion region generated object: well
7/16/12 SKILL Language Programming 318
The code for the example shown here might look something like this:
cv = geGetEditCellView() ;; Get the current cellview ID
diffObj = rodCreateRect( ;; Create the P-diffusion rectangle
?cvId cv
?layer "pdiff"
?bBox list(1:1 6:4)
wellObj = rodCreateRect( ;; Create the N-well rectangle
?cvId cv
?layer "nwell"
?fromObj diffObj ;; P-diffusion rect is source object
?size 0.8 ;; N-well is 0.8 units larger than p-diff
SKILL Language Programming 318
Cadence AEtouse
Using rodAlign Alignonly: Do not distribute
ROD Objects
This function aligns a named object by a point handle on that object to a
specific point or to a point handle on a reference object.
rodAlign(
?alignObj d_alignObj ;; Object to be aligned
[?alignHandle t_alignHandle] ;; Point on object to align
[?refObj d_refObj] ;; Align to this object
[?refHandle t_refHandle] ;; Point to align to on ref obj
[?refPoint l_refPoint] ;; Fixed point to align to
[?maintain g_maintain] ;; Alignment persistent?
[?xSep txf_xSep] ;; Horizontal offset
[?ySep txf_ySep] ;; Vertical offset
upperLeft upperRight
System Handle
Examples
lowerLeft lowerRight
7/16/12 SKILL Language Programming 319
Examples
Assume a layout editor window is open and these commands have been executed:
smallRect = rodCreateRect(?cvId geGetEditCellView()
?layer “metal1” ?width 3 ?length 2)
bigRect = rodCreateRect(?cvId geGetEditCellView()
?layer “metal1” ?width 8 ?length 10)
1. Align the lower-left corner of bigRect to a fixed point:
rodAlign(
?alignObj bigRect
?alignHandle "lowerLeft"
?refPoint 2.5:4
)
2. Align the upper-left corner of smallRect to the upper-right corner of bigRect:
rodAlign(
?alignObj smallRect
?alignHandle "upperLeft"
?refObj bigRect
?refHandle "upperRight“ )
Note: The system maintains the handles such as lowerLeft, upperLeft and upperRight on all
ROD objects, so no calculations are required by your SKILL code to locate these.
SKILL Language Programming 319
Cadence AE use only: Do not distribute
Lab Exercises
Lab 15-1 Enhancing the Layer Shape Report SKILL Program
You develop a SKILL function that produces a report to count
the number of each kind of shape on each layer in a design.
Lab 15-2 Creating a Cellview
You create a cellview containing various shapes.
Lab 15-3 Aligning Rectangles
You develop a SKILL function to align the top sides of a set
of rectangles.
Lab 15-4 Aligning Rectangles Using ROD Functions
You modify the previous alignment program to use ROD.
7/16/12 SKILL Language Programming 320
SKILL Language Programming 320
Cadence
Markers AE use only: Do not distribute
Figure marker cellView
bBox objects
cellView points
objType msg
prop shortMsg
tool
isVisible
deleteWhen Figure
severity
A marker is an object that indicates violations between objects in the database.
Different types of markers exist for different types of violations.
The area of the marker is specified by a point array.
Markers are OA objects and can be used by other tools which access the
database.
The attributes which define the marker are defined in the OA specification so
that all tools will have a consistent interpretation of the marker objects.
7/16/12 SKILL Language Programming 321
SKILL Language Programming 321
Cadence AE use only:
The Marker deleteWhen Do not distribute
Attribute
The deleteWhen attribute is set so that the system knows when a marker
can be removed from the database. This is a string attribute.
deleteNever: Delete the marker only by explicit deletion.
deleteFirst: Delete the marker when ANY associated object is removed.
deleteLast: Delete the marker when ALL associated objects are
removed.
deleteModify: Delete the object when ANY associated object is modified.
7/16/12 SKILL Language Programming 322
SKILL Language Programming 322
Cadence AE use
The Marker severity only: Do not distribute
Attribute
The severity attribute indicates the servers of the violation shown by the marker. It
returns one of the predefined values or unsupported if the value is not valid.
acknowledgedWarning: The warning has been acknowledged by the designer.
annotation: User generated information.
criticalError: Tool generated error. Usually requires design review sign-off.
error: Tool generated error.
fatalError: Tool generated error. Cannot be signed off, as it will always result in a
non-functioning /nonmanufacturable design. Such errors are generated usually
from the process end (design rule) where the fab/foundry does not allow sign-
offs.
info: Tool generated information
signedOffCriticalError: The error has been reviewed by the design team and has
been signed off.
signedOffError: The error has been signed off
warning: Tool generated warning
unsupported: None of the above values
7/16/12 SKILL Language Programming 323
SKILL Language Programming 323
Cadence AE
Marker SKILL use only: Do not distribute
Examples
Set all the markers in a cellview to deleteNever status
cv = dbOpenCellViewByType( “master” “mux2” “layout” )
cv~>markers~>deleteWhen = “deleteNever”
Locate all of the markers with a deleteModify and warning status
setof( marker cv~>markers
marker~>deleteWhen == “deleteModify” ) &&
marker~>severity == “warning”
)
Count and create a report of all markers with the signedOffCriticalError
status
counter = 0
foreach( marker cv~>markers
when( marker~>severity == “signedOffCriticalError”
printf( “Signed Off Critical Error %d, Tool:%s, Msg:%s,
Points:%L\n” ++counter marker~>tool marker~>msg marker~>points ))
) ; foreach
printf( “%d TOTAL Signed Off Critical Errors for %s %s %s\n”
counter cv~>libName cv~>cellName cv~>viewName )
7/16/12 SKILL Language Programming 324
SKILL Language Programming 324
Cadence AE use only: Do not distribute
Creating Markers
dbCreateMarker( d_cellviewId t_msg t_tool l_points
[ ld_objects ]
[ g_isVisible ]
[ g_isClosed ]
[ t_severity ]
[ t_shortMsg ]
[ t_deleteWhen ]
) => d_markerId | nil
Create a 10x10u marker at location 0:0 with the message “Validated”
dbCreateMarker( geGetEditCellView() “Validated” “Tool-A” list( 0:0 0:10 10:10
10:0))
Create a marker with severity=”error” and deleteWhen=”deleteLast” for all
metal2 shapes. The marker will only be removed after all metal2 shapes
have been removed from the cellview.
m2shapes = setof( shape cv~>shapes shape~>layerName == “metal2” )
dbCreateMarker( cv “Remove metal2” “Tool-A” list(0:0 0:10 10:10 10:0)
m2shapes t t “error” ““ “deleteLast” )
7/16/12 SKILL Language Programming 325
SKILL Language Programming 325
Cadence AE use only: Do not distribute
Lab Exercises
Lab 15-5 Creating, Locating, and Deleting Markers
7/16/12 SKILL Language Programming 326
SKILL Language Programming 326
Cadence
Hierarchy AE use only: Do not distribute
Example: Instance I1 of master mux2 schematic
7/16/12 SKILL Language Programming 327
The following examples review ~> expressions:
The list of the instances in the design
mux2~>instances => ( db:39520396 db:39523572 db:39522480 .... )
I1 = dbFindAnyInstByName( mux2 "I1" ) => db:38127508
The list of master cell names
mux2~>instances~>cellName => ( "Inv" "nand2" "nand2" "nand2" )
The list of instance names
mux2~>instances~>name => ( "I6" "I9" "I8" "I3" "I1“ "I0" "I5" "I7" "I4" "I2" )
SKILL Language Programming 327
Cadence
The cellViewAE
and use only:Types
inst Object Do not distribute
instanceMasters
instRefs
instances master
cellView inst cellView
cellView name
libName libName libName
cellName cellName cellName
viewName viewName viewName
mux2 = dbOpenCellViewByType( "master" "mux2" "schematic" )
mux2~>cellName => "mux2"
nth( 3 mux2~>instances )~>cellName ==> "nand2”
7/16/12 SKILL Language Programming 328
The cellView Object Type
Each cellView database object has:
libName, cellName, and viewName attributes, whose values uniquely identify the design.
An instanceMasters attribute, whose value is a list of all cellView database objects
instantiated in this design.
An instRefs attribute, whose value is a list of all Instance database objects with this design as
master.
The inst Object Type
Each Instance database object has:
The objType attribute value equal to "inst" or "mosaicInst".
A name attribute whose value is the name of the instance.
The libName, cellName, and viewName attributes, whose values uniquely identify the master.
SKILL Language Programming 328
Cadence AE use Function
The TrFormatInstance only: Do not distribute
The TrFormatInstance function prints information about an instance.
procedure( TrFormatInstance( inst )
let( ( cv format )
cv = inst~>cellView
format = "%s %s %s %s %s\n" ;;; your choice
printf(
format
inst~>name
inst~>cellName ;; the master’s cellName
cv~>libName
cv~>cellName
cv~>viewName
)
) ; let
) ; procedure
Assuming that inst contains an instance database object,
The inst~>objType expression is either "inst" or "mosaicInst".
The inst~>cellView expression is the cellView containing the instance.
The inst~>master expression is the instance’s master database object.
The inst~>master~>objType expression is "cellView“.
7/16/12 SKILL Language Programming 329
Sample output from the [Link].
\i TrFormatInstance( car( geGetSelSet()))
\o I1 nand2 master mux2 schematic
\t t
\i TrFormatInstance( car( geGetSelSet()))
\o I6 Inv master mux2 schematic
\t t
Can you account for the return value t by studying the source code?
This more realistic format string prints the information in columns.
format =
"Instance: %-10s Master: %-10s within CellView: %-10s %-10s %-10s \n"
SKILL Language Programming 329
Cadence AE use
Creating Instances only:
Using Do not distribute
SKILL
You can create instances using SKILL to create hierarchy.
For nonparameterized cellviews, use
dbCreateInst( d_cellView
d_master
t_name
l_point
t_orient
[ x_numInst ]
[ b_physOnly]
)
=> d_inst / nil
Example
dbCreateInst(inCellView masterCV "inst1" list(0 0) "R0" 1)
7/16/12 SKILL Language Programming 330
SKILL Language Programming 330
Cadence AE use
Creating Instances only:Using
of Pcells Do not distribute
SKILL
For parameterized cellviews, use
dbCreateParamInstByMasterName(d_cellView
t_libName
t_cellName
t_viewName
t_name
l_origin
l_orient
[ x_numInst
[ l_params ]
) => d_inst / nil
Example
dbCreateParamInstByMasterName(inCellView
"basic" "nand" "symbol" "inst1" list(0 0) "R0" 1
list(list("w" "float" 2.0) list("l" "float" 5.0)))
7/16/12 SKILL Language Programming 331
Each parameter specified need the parameter name, parameter type and parameter value.
SKILL Language Programming 331
Cadence AE
A Hierarchical use only: Do not distribute
Design
Assume you have a hierarchical design and you need a list of masters that
are instantiated in the hierarchy. In this example, the list is ( A B C D ).
Top A C
Top
A B
A B C
C C D A C D
A A
D
A
7/16/12 SKILL Language Programming 332
SKILL Language Programming 332
Cadence
Traversing aAE use only:
Hierarchical DoDesign
Layout not distribute
procedure( TrHierarchyTraversal( cellView listSoFar )
foreach( master cellView~>instances~>master
let( ( nextCellView )
nextCellView = master
cond(
( !nextCellView nil )
( member( nextCellView listSoFar ) nil )
( t
listSoFar =
TrHierarchyTraversal(
nextCellView
cons( nextCellView listSoFar ))
)
) ; cond
) ; let
) ; foreach
listSoFar;;; return value
) ; procedure
The cellView parameter identifies the cellview to expand.
The listSoFar parameter identifies cellviews to avoid expanding.
7/16/12 SKILL Language Programming 333
The TrHierarchyTraversal function is recursive.
The cellView parameter identifies the cellview to expand. The listSoFar parameter identifies
cellviews to avoid expanding.
For each master at this level of the hierarchy, you compute the next cellview to expand recursively.
There are three outcomes:
There is no appropriate cellview. This can occur if the master is not in the library. You do
nothing.
The appropriate cellview has already expanded. You can tell by checking if it is an element of
the listSoFar. You do nothing with this master.
There is an appropriate cellview and you haven’t expanded it yet. You add it to listSoFar and
recursively expand it.
You accumulate all the expansions underneath each master in listSoFar and return listSoFar.
When calling TrHierarchyTraversal, pass nil for the listSoFar.
expansion = TrHierarchyTraversal( dbOpenCellViewByType( "master" "mux2" "layout" ) nil )
SKILL Language Programming 333
Cadence AE use only: Do
Using dbOpenCellViewByType not distribute
to Switch Views
You can pass a list of view names to the dbOpenCellViewByType function.
dbOpenCellViewByType(
"Example"
"nand2"
’( "silos" "schematic" )
)
db:12345678
In this example, the dbOpenCellViewByType function performs one of the
following tasks:
If a nand2 silos cellview exists in the Example library, then the function
opens the cellview and returns the database object.
If a nand2 schematic cellview exists in the Example library, then the
function opens the cellview and returns the database object.
Otherwise, the function returns nil.
7/16/12 SKILL Language Programming 334
SKILL Language Programming 334
Cadence AE use
A List of Schematic only: Do not distribute
Views
The TrSwitch function passes a switch list to the dbOpenCellViewByType
function. The TrSwitch function returns a schematic view if you pass a
symbol cellview to it.
procedure( TrSwitch( masterCellView )
if( !masterCellView
then nil
else
case( masterCellView~>cellViewType
( "schematicSymbol“ ;;; branch for schematics and symbols
dbOpenCellViewByType(
masterCellView~>libName
masterCellView~>cellName
'( "schematic" "[Link]" ) ;;; SWITCH LIST
)
)
( "maskLayout“ ;;; brach for layouts – no switch list
masterCellView )
( t nil )
) ; case
) ; if
) ; procedure
7/16/12 SKILL Language Programming 335
SKILL Language Programming 335
Cadence
Traversing aAE use only:
Hierarchical Do not
Schematic distribute
Design
procedure( TrHierarchyTraversal( cellView listSoFar )
foreach( master cellView~>instances~>master
let( ( nextCellView )
nextCellView = TrSwitch( master )
cond(
( !nextCellView nil )
( member( nextCellView listSoFar ) nil )
( t
listSoFar =
TrHierarchyTraversal(
nextCellView
cons( nextCellView listSoFar ))
)
) ; cond
) ; let
) ; foreach
listSoFar;;; return value
) ; procedure
The cellView parameter identifies the cellview to expand.
The listSoFar parameter identifies cellviews to avoid expanding.
7/16/12 SKILL Language Programming 336
SKILL Language Programming 336
Cadence AE use only: Do not distribute
Lab Exercises
Lab 15-6 Exploring Hierarchy
Lab 15-7 Traversing a Hierarchical Design
You run the TrHierarchyTraversal function on master mux2 layout
and turn on tracing to observe the recursion.
7/16/12 SKILL Language Programming 337
SKILL Language Programming 337
Cadence
ConnectivityAE use only: Do not distribute
Example Net SEL in master mux2 schematic
External nets connect a terminal with zero or more instance terminals.
Internal nets connect zero or more instance terminals.
Each instance terminal is on one instance.
7/16/12 SKILL Language Programming 338
SKILL Language Programming 338
Cadence AE
The term, net, anduse only:Object
instTerm Do not distribute
Types
name
direction
terminals
term
net
cellView
term
nets
net
instances name
instTerms
net
instTerms
Instance instTerm
inst
name name
7/16/12 SKILL Language Programming 339
Each cellView database object has
A terminals attribute, whose value is a list of all term database objects in this design.
A nets attribute, whose value is a list of all net database objects in this design.
A net runs between one or more internal instance terminals. Each instance terminal is on a unique
instance. In addition, a net can connect to the outside world by means of a terminal.
Each net database object has
A term attribute, whose value is the unique term database object for this net.
An instTerms attribute, whose value is a list of instTerm database objects.
Each instTerm object has an inst attribute, whose value indicates the instance.
SKILL Language Programming 339
Cadence
ConnectivityAE use Instances
Between only: Doand
not distribute
Masters
nets pins
cellView net
name
instances instTerms
net
instTerms
Instance instTerm
name inst name
master term
terminals
cellView term
7/16/12 SKILL Language Programming 340
SKILL Language Programming 340
Cadence
Figures and AE use only: Do not distribute
Terminals
name
direction fig
term pins pin Figure
term pin
net net
term
pins
net
name
For a schematic cellView, Figures associated with term objects are Instances
whose purpose attribute is "pin".
For a maskLayout cellView, Figures associated with term objects are Shapes or
Instances.
This example determines what type of figure is associated with the terminal pins.
cv~>terminals~>pins~>fig~>objType
7/16/12 SKILL Language Programming 341
Every Instance database object has a purpose attribute. This attribute helps you determine the role
of the instance in the design.
SKILL Language Programming 341
Cadence AE use only: Do not distribute
Lab Exercises
Lab 15-8 Developing a Net-based Netlister
You develop a simple net-based netlister.
Lab 15-9 Developing an Instance-based Netlister
You develop a simple instance-based netlister.
7/16/12 SKILL Language Programming 342
SKILL Language Programming 342
Cadence
Vias AE use only: Do not distribute
All vias are defined in the technology file.
Vias are database objects and are not instances.
Standard vias have all details described in the technology file:
Custom vias have a Pcell or fixed cellview associated with them:
7/16/12 SKILL Language Programming 343
In the prior database model (CDB), vias could be:
cellviews
placed as instances
were not required to be defined in the technology file
There were also many kinds of vias:
cdsVia
symbolic contacts
prRuleVias
The cdb2oa migration utility automatically converts you CDB vias to OA Technology File vias.
For Pcells with symContactDevices, the symbolic view of these vias can be retained by using the –
keepdevicemasters option. This option lets those Pcells work without additional SKILL code
changes to switch to standard vias.
SKILL Language Programming 343
Cadence AE useand
Comparing Standard only: Do Vias
Custom not distribute
Standard vias can be the source of a wide variety of via placement
topologies. Tools can place optimum arrays of vias for example because
the relationship of layers and rules is completely defined.
Custom vias are often fixed devices. The layers and rules for the via cannot
be known by the application placing the vias so making optimum via
placements is usually not possible. For each unique via variant, a unique
customViaDef must exist so the overhead of maintaining a set of custom
vias is higher than with standard vias.
7/16/12 SKILL Language Programming 344
SKILL Language Programming 344
Cadence AE
Locating Vias anduse only: Do not distribute
Via Parameters
Database Attributes Techfile Definition
via viaHeader viaDef
overrideParams params
Vias are defined in their respective technology files. After the technology
file is loaded or attached, it becomes part of the database.
Example
Print out all vias and their locations and parameters:
cv = geGetEditCellView()
foreach( via cv~>vias
printf( “Via: %s, Origin: %L\n” via~>name via~>origin )
foreach( paramlist via~>viaHeader~>overrideParams
printf( “Params: %L\n” paramlist)
)))
7/16/12 SKILL Language Programming 345
SKILL Language Programming 345
Cadence AE use only: Do not distribute
Creating Vias
dbCreateVia(
d_cellviewId
d_viaDefId
l_point
t_orient
[ l_paramList ] ]
)
=> d_viaId | nil
Get the technology file ID of the library that contains the via definition:
tfid=techGetTechFile(ddGetObj("gpdk090"))
Get the ID of the via you want to place:
viaid=techFindViaDefByName(tfid "M2_M1")
Get the cellview ID where you want to place the via:
layid =geGetEditCellView()
Place the via at the coordinate, and with orientation you want:
dbCreateVia(layid viaid list(0 0 ) "R0" )
7/16/12 SKILL Language Programming 346
You cannot use dbCreateInst to create a via in IC6.1.X. The command dbCreateInst will place an
instance.
For custom vias, l_paramList is a list of
l_param and l_param is list(t_propName t_propType g_value)
For standard vias, l_paramList is a list of lists, each of which is a name value pair.
The parameters are
t_cutLayerName n_cutWidth n_cutHeight x_cutRows x_cutColumns l_cutSpacing etc.
For more details, see the Cadence Help document Virtuoso Design Environment SKILL Functions
Reference.
SKILL Language Programming 346
Cadence AE use only: Do not distribute
Lab Exercises
Lab 15-10 Exploring Vias
7/16/12 SKILL Language Programming 347
SKILL Language Programming 347
Cadence AE
Properties on use only:
a Generic Do Object
Database not distribute
Every database object is a kind of generic database object. Each specific
database object has three attributes: objType, cellView, and prop.
cellView
Generic
Database Object cellView
objType
prop
object
name
prop value
valueType
Attribute Meaning
objType The specific object type: “net”, “line”, and so forth
cellView The cellView database object containing the database object
prop Zero, one, or more prop database objects
7/16/12 SKILL Language Programming 348
The value of the objType attribute is a text string that indicates the type of the database object.
The value of the prop attribute is a list, possibly nil, of prop database objects. Each such object
represents a user-defined property on the database object.
SKILL Language Programming 348
Cadence
User-DefinedAE use only: Do not distribute
Properties
Applications are responsible for creating, updating, and interpreting user-
defined properties.
CDBA represents a user-defined property by a database object with object
type prop.
Every database object, except prop objects themselves, can have zero or
more user-defined properties.
CDBA stores all the properties on an object as the value of the prop
attribute.
Example
Assume that window 5 is displaying master mux2 schematic.
cv = geGetWindowCellView( window(5)) => db:18253868
cv~>prop => (db:22856044 ... )
cv~>prop~>objType => ( "prop" ... )
7/16/12 SKILL Language Programming 349
The CDBA manages the prop attribute but does not manage any specific user-defined properties.
Applications are responsible for managing their own user-defined properties.
SKILL Language Programming 349
Cadence AE use only:
Examining User-Defined Do not distribute
Properties
Use the ~>prop syntax to retrieve a list of prop database objects.
Use the ~>prop~>name syntax to retrieve a list of property names.
Use the ~>prop~>value syntax to retrieve a list of property values.
Example
cv~>prop~>name => ("net#" ... )
cv~>prop~>value => (22 ... )
cv~>prop~>valueType => ( "int" ... )
Use the user-defined property name on the right side of the ~> operator to
retrieve a specific property value. The user-defined property name must
satisfy the syntax for a SKILL symbol. Include the name in quotes if the
name includes illegal characters.
cv~>"net#" => 22
Given the property name, use the dbFindProp name to retrieve the prop
database object.
dbFindProp( cv "net#" )~>valueType => "int”
7/16/12 SKILL Language Programming 350
Use a foreach mapcar expression to retrieve a list of property name and property value pairs.
foreach( mapcar prop cv~>prop
list( prop~>name prop~>value )
); foreach
=>
(("net#" 22)
("schGeometryLastRecorded" "Oct 2 [Link] 1995")
("lastSchematicExtraction" "Oct 2 [Link] 1995")
("schXtrVersion" "sch.10.0")
("instance#" 10)
("instancesLastChanged" "Oct 2 [Link] 1995")
("schGeometryVersion" "[Link].1.4")
)
SKILL Language Programming 350
Cadence AE use only:
Creating User-Defined Do not distribute
Properties
You can use the ~> operator to create a user-defined property. The
valueType is derived from the SKILL data type of the property value you
assign.
cv~>TrStringProp = "high"
dbFindProp( cv "TrStringProp")~>valueType => "string"
cv~>TrFloatProp = .5
dbFindProp( cv "TrFloatProp")~>valueType => "float"
cv~>TrILListProp = '(1 2)
dbFindProp( cv "TrILListProp")~>valueType => "ILList“
Use the appropriate dbCreate.*Prop SKILL function to
Specify a valueType as "time".
Create enumerated, range, or hierarchical user-defined properties.
7/16/12 SKILL Language Programming 351
For the list of allowed property valueTypes, see the Cadence online documentation. In the Design
Framework II SKILL Functions Reference Manual, Chapter 2, refer to the section “Description of
Database Objects.”
SKILL Language Programming 351
Cadence
Hierarchical AE use only:
User-Defined Do not distribute
Properties
Use a hierarchical property to represent structured data.
Use the dbCreateHierProp function to create a hierarchical property.
Use the ~> operator to create properties associated with the
hierarchical property. Each such associated property represents a slot
in the structured data.
The prop attribute of a hierarchical property is always nil. The value
attribute lists the property objects associated with a hierarchical property.
Example
hp = dbCreateHierProp( cv "TrHierProp" ) => db:39320456
hp~>a = 1
hp~>b = 2
hp~>value => (db:39320544 db:39320504)
hp~>value~>object => (db:39320456 db:39320456)
hp~>prop => nil
7/16/12 SKILL Language Programming 352
The dbCreateHierProp Function
See the Cadence online documentation to read more about this function.
The dbReplaceHierProp Function
See the Cadence online documentation to read more about this function.
SKILL Language Programming 352
Cadence
Other Kinds AE use only:Properties
of User-Defined Do not distribute
CDBA supports the following kinds of user-defined properties:
Enumerated user-defined properties
Range user-defined properties
7/16/12 SKILL Language Programming 353
To read more about the following functions, see the Cadence online documentation.
dbCreateEnumProp
dbReplaceEnumProp
dbCreateRangeProp
dbReplaceRangeProp
SKILL Language Programming 353
Cadence AE
Retrieving All use only:
Attributes Do not Object
of a Database distribute
The ~>? expression returns a list of all the attribute names of a database
object.
cv~>? =>
(cellView objType prop bBox cellName ... )
The ~>?? expression returns a list of attribute names and values.
cv~>?? =>
(db:18253868
cellView db:18253868
objType "cellView"
prop ( db:22972580 db:2297508 ... )
bBox ((-3.500000 -0.218750) (2.275000 0.337500))
... )
7/16/12 SKILL Language Programming 354
The ~>?? expression builds a list that starts with the database object in question, followed by
alternating name value pairs.
This list is an example of a disembodied property list. Such lists usually start with nil, but the list
you build with the ~>?? expression starts with the database object in question.
SKILL Language Programming 354
Cadence AE
The Show File use only: Do not distribute
Browser
Displays the attribute names and values for a database object in a Show
File window. You can perform the following tasks:
Browse any displayed database objects.
Select associated Figures in a design window.
Probe associated Nets in the design window.
Raise parent and children browsers.
7/16/12 SKILL Language Programming 355
SKILL Language Programming 355
Cadence AE Function
Example: SKILL use only: Do not distribute
TrShowFileBrowser( geGetWindowCellView() )
TrShowFileBrowser( car( geGetSelSet() )
The Show File Browser is available only as part of this course.
7/16/12 SKILL Language Programming 356
Here is the code to start the Show File Browser with a bindkey.
hiSetBindKey(
"Schematics" "Ctrl<Btn2Down>"
"{ mouseSingleSelectPt() TrBrowseObject() }" )
hiSetBindKey(
"Layout" "Ctrl<Btn2Down>"
"{ mouseSingleSelectPt() TrBrowseObject() }" )
procedure( TrBrowseObject( )
TrShowFileBrowser(
car( geGetSelSet( )) || geGetWindowCellView()
)
) ; procedure
Both geGetSelSet and geGetWindowCellView functions default to the current window. We assume
that the TrBrowseObject function is called with the bindkey mechanism, so that the design
window is the current window.
To browse any database object showing in a Browser window, such as "net12345678", do the
following:
Double-click over "net12345678" with the mouse.
Select the Browse Selection menu item.
SKILL Language Programming 356
Cadence AE use only: Do not distribute
Lab Exercises
Lab 15-11 Exploring User-Defined Properties
Lab 15-12 Locating Database Objects
7/16/12 SKILL Language Programming 357
SKILL Language Programming 357
Cadence AE use only: Do not distribute
Module Summary
In this module, we covered
A review of database object concepts
Opening a cellview into virtual memory
Creating shapes in a design
Surveying the cellview database model
Geometry
Hierarchy
Connectivity
User-defined properties
Traversing a hierarchical database
Retrieving all the attributes on a database object
7/16/12 SKILL Language Programming 358
SKILL Language Programming 358
Cadence AE use only: Do not distribute
User Interface
Module 16
July 16, 2012
SKILL Language Programming 359
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn about
Context-sensitive pop-up menus
Fixed menus
Dialog boxes
List boxes
Forms
Toolbars
7/16/12 SKILL Language Programming 360
SKILL Language Programming 360
Cadence AE use
Context-Sensitive only:
Pop-Up Do not distribute
Menus
The TrWindowsPopUp function creates and displays a pop-up menu that lists the
Design Framework II windows currently on the desktop. The menu choice becomes
the top window.
procedure( TrWindowsPopUp()
hiDisplayMenu(
hiCreateSimpleMenu(
’TrWindowsPopUpMenu
"Windows"
foreach( mapcar wid hiGetWindowList()
hiGetWindowName( wid )
) ; foreach
foreach( mapcar wid hiGetWindowList()
sprintf(
nil
"hiRaiseWindow( window( %d ))"
wid->windowNum
)
) ; foreach
) ; hiCreateSimpleMenu
) ; hiDisplayMenu
) ; procedure
hiSetBindKey( "Command Interpreter"
"<Key>F6" "TrWindowsPopUp()" )
7/16/12 SKILL Language Programming 361
You can create menus dynamically at the time you invoke the hiDisplayMenu function. Such
menus can be context-sensitive. The callback for each menu item can refer to
Literal data
Global variables
hiDisplayMenu( hiCreateSimpleMenu( ... ))
The sprintf Function
Use the sprintf function to dynamically create the callback for each menu item.
The sort Function
You can use the sort function to sort the window list. Use TrGetSortedWindowList in place of
hiGetWindowList in the TrWindowPopUp function declaration.
procedure( TrCompareWindowTitles( w1 w2 )
alphalessp( hiGetWindowName(w1) hiGetWindowName(w2))
) ; procedure
procedure( TrGetSortedWindowList()
sort( hiGetWindowList() ’TrCompareWindowTitles )
) ; procedure
SKILL Language Programming 361
Cadence
Fixed MenusAE use only: Do not distribute
Fixed menus have the following characteristics:
Typically occupy the entire top or side of the screen
Include a two dimensional array of menu items
Include Done as the last menu item
Clicking a menu item in a fixed menu does not set the current window.
7/16/12 SKILL Language Programming 362
SKILL Language Programming 362
Cadence AEMenus
Creating Fixed use only: Do not distribute
Create the menu items using the hiCreateMenuItem function.
TrMenuItem1 = hiCreateMenuItem(
?name ’TrMenuItem1
?itemText "One"
?callback "println( \"One\" )"
)
TrMenuItem2 = hiCreateMenuItem(
?name ’TrMenuItem2
?itemText "Two"
?callback "println( \"Two\" )“
)
Use the hiCreateVerticalFixedMenu or hiCreateHorizontalFixedMenu
functions to create a fixed menu.
hiCreateVerticalFixedMenu(
’TrExampleVerticalFixedMenu
list( TrMenuItem1 TrMenuItem2 )
2 ;;; number of rows
1 ;;; number of columns
)
7/16/12 SKILL Language Programming 363
SKILL Language Programming 363
Cadence AE use
Displaying Fixed only: Do not distribute
Menus
Use the hiDisplayFixedMenu function to display a fixed menu.
hiDisplayFixedMenu(
TrExampleVerticalFixedMenu
"top" ;;; one of "top", "bottom", "right", or "left"
)
You can use the hiFixedMenuDown function to remove a fixed menu from
the screen.
hiFixedMenuDown( TrExampleVerticalFixedMenu )
7/16/12 SKILL Language Programming 364
SKILL Language Programming 364
Cadence AEMenus
Attaching Fixed use only: Do not distribute
to Windows
You can attach a vertical fixed menu to these types of windows:
Text windows
Form windows
To attach your vertical fixed menu, use the
hiCreateVerticalFixedMenu function to create your menu.
hiAddFixedMenu function to attach a fixed menu to a window.
It replaces any attached fixed menu.
hiAddFixedMenu(
?fixedMenu TrExampleVerticalFixedMenu
?window window( 4 )
)
By default, the menu appears on the left side of the application window.
The Done menu item does not appear. Clicking a menu item sets the current
window.
Note: You cannot attach fixed menus to graphics windows. Use toolbars instead.
7/16/12 SKILL Language Programming 365
Cadence® applications attach fixed menus that usually consist of icon items.
On the User Preferences form, the Show Fixed Menu Names field controls whether the itemText
for an item is dynamically displayed. You can also use the SKILL® command.
hiGetCIWindow()->showFixedMenuLabels => t
Several functions manipulate attached, fixed menus.
The hiAddFixedMenu Function
The hiGetWindowFixedMenu Function
Use the hiGetWindowFixedMenu function to retrieve an attached, fixed menu.
Do not confuse the hiGetWindowFixedMenu function with either the hiGetWindowMenu function
or the hiGetBannerMenus function.
wid = geOpen(
?lib "master" ?cell "nand2" ?view "layout"
?mode "r")
attachedMenu = hiGetWindowFixedMenu( wid )
type( attachedMenu ) => hiFixMenu
The hiRemoveFixedMenu Function
Use the hiRemoveFixedMenu function to remove an attached, fixed menu.
hiRemoveFixedMenu( wid ) => t
SKILL Language Programming 365
Cadence AE use only: Do not distribute
Lab Exercises
Lab 16-1 Exploring Fixed Menus
Create a vertical fixed menu.
Attach the menu to an application window.
7/16/12 SKILL Language Programming 366
SKILL Language Programming 366
Cadence
Dialog BoxesAE use only: Do not distribute
Reminder
Status Report
Yes No Help
Clicking Yes.
Displays Status Report completed in the CIW
Removes the dialog box
7/16/12 SKILL Language Programming 367
Dialog boxes are pop-up windows that display a message for the user.
Use dialog boxes to
Ask for confirmation from the user.
Display status messages bundled with an associated follow-up callback that the user can
select.
There are three kinds of dialog boxes.
System Blocks any further action in any application until
modal response. Use for confirmation.
Modal Blocks any further action in the Virtuoso Design
Environment until response. Use for confirmation.
Modeless Nonblocking. Useful for status messages or reminders.
Each dialog box has two or three buttons to let the user confirm an action or status and dismiss or
close the dialog box.
SKILL Language Programming 367
Cadence AE use only:
The hiDisplayAppDBox Do not distribute
Function
The hiDisplayAppDBox function creates and displays a dialog box.
hiDisplayAppDBox(
?name gensym( ’TrReminderDialogBox ) Create variable
?dboxBanner "Reminder"
?dboxText "Status Report"
?callback "TrReminderCB(\"Status Report\")"
?dialogType hicWarningDialog Modeless to allow
?dialogStyle ’modeless independent work
?buttonLayout ’YesNo
)
procedure( TrReminderCB( reminderText )
printf( "%s completed" reminderText ) The callback
) ; procedure
The ?name argument must be a unique global variable. The hiDisplayAppDBox
function stores the data structure of the dialog box in this variable.
Use the gensym function to create a new global variable.
The ?callback argument is a text string that contains the entire function call you
want Design Framework II to execute when the user clicks OK or Yes.
7/16/12 SKILL Language Programming 368
The hiDisplayAppDBox function creates and displays a dialog box.
The dialog box is destroyed when it is removed from the screen.
Keyword argument Meaning
?name The dboxHandle symbol is bound to the data structure of the
dialog box and then reset to nil when box is dismissed.
?dboxBanner Text that appears within the window manager banner text of the
dialog box.
?dboxText Message that appears in the dialog box.
?callback Callback that executes whenever the user selects OK or Yes.
?dialogType hicWarningDialog, hicErrorDialog and so on.
See User Interface SKILL Functions Reference Manual.
?dialogStyle Blocking behavior of this dialog box. Acceptable choices are
’systemModal, ’modal, or ’modeless.
?buttonLayout ’OKCancel, ’YesNo, ’YesNoCancel, and so on.
See User Interface SKILL Functions Reference Manual.
?location See User Interface SKILL Functions Reference Manual.
SKILL Language Programming 368
Cadence AEBlocking
The Dialog Box use only: Do not distribute
Behavior
You specify the blocking behavior with the ?dialogStyle argument. The
three choices are listed in this table.
Dialog style Blocking behavior hiDisplayAppDBox
returns
modeless Does not block any Immediately
application
modal Blocks Virtuoso® After box is dismissed.
Design Environment
applications.
systemModal Blocks all applications After box is dismissed.
in the system until the
user responds to the
dialog box.
7/16/12 SKILL Language Programming 369
SKILL Language Programming 369
Cadence AECallback
The Dialog Box use only: Do not
and Button distribute
Layout
You specify the button layout with the ?buttonLayout argument.
You specify a SKILL expression with the ?callback argument.
Represent the SKILL expression as a text string. It is the entire
function call, just like callbacks for menu items and bindkeys.
The following buttons trigger the callback.
Button Layout Argument Button That Triggers Callback
OKCancel OK
YesNo Yes
YesNoCancel Yes
CloseHelp
Close
7/16/12 SKILL Language Programming 370
The following program displays modeless dialog boxes to verify the circumstances under which
the system triggers the callback. The source code is in the ~/SKILL/DialogBoxes/[Link]
file.
TrButtonLayouts =
’( OKCancel YesNo YesNoCancel CloseHelp Close )
procedure( TrDialogBoxes( )
foreach( buttonLayout TrButtonLayouts
hiDisplayAppDBox(
?name gensym( ’TrDialogBox )
?dboxBanner "Test"
?dboxText get_pname( buttonLayout )
?buttonLayout buttonLayout
?dialogType hicInformationDialog
?dialogStyle ’modeless
?callback
sprintf( nil "TrDialogBoxCB( ’%L )" buttonLayout )
)
) ; foreach
) ; procedure
procedure( TrDialogBoxCB( arg )
printf( "TrDialogBoxCB called: %L\n" arg )
) ; procedure
SKILL Language Programming 370
Cadence AE use only: Do not distribute
Lab Exercises
Lab 16-2 Exploring Dialog Boxes
7/16/12 SKILL Language Programming 371
SKILL Language Programming 371
Cadence
List Boxes AE use only: Do not distribute
mux2
OK Cancel Apply
SEL
A
Y
Use a list box to display choices to the user.
List boxes display a list of user-defined strings in a scrollable window.
The window has a vertical and horizontal scrollbar and the size of the window
is constant. You can select a string (or strings) using the left mouse button.
The application can use the strings that you select after the window is
dismissed.
Both the Cancel and OK buttons remove the window from the screen;
however, using the Cancel button ignores your selections.
List boxes do not block the user.
7/16/12 SKILL Language Programming 372
You can provide the list of choices explicitly or using a data query such as cv~>nets~>name.
SKILL Language Programming 372
Cadence AE use
The hiShowListBox only: Do not distribute
Function
The hiShowListBox function creates and displays a list box:
procedure( TrShowListBox( aList listBoxTitle )
hiShowListBox(
?name gensym( ’TrExampleListBox )
?choices aList
?callback 'TrExampleListBoxCB
?title listBoxTitle
?multipleSelect t
?applyButton t
)
) ; procedure
procedure( TrExampleListBoxCB( ok theListBox )
if( ok then
printf( "You choose:\n" )
foreach( choice theListBox->value
printf( "%15s\n" choice )
) ; foreach
else printf( "You clicked Cancel.\n" )
) ; if
) ; procedure
cv = geGetEditCellView()
TrShowListBox( cv~>nets~>name cv~>cellName )
7/16/12 SKILL Language Programming 373
The hiShowListBox function creates and displays a list box containing a group of text strings.
Key argument Meaning
?name A global variable in which SKILL stores data structure.
?title The title.
?choices List of text string choices.
?callback Function called when the user clicks OK, Cancel, or Apply.
?multipleSelect Controls single item selection or multiple item selection.
?applyButton t => provides Apply button.
The hiDisplayListBox function is obsolete and will be removed in a future release.
Avoid using it.
SKILL Language Programming 373
Cadence
The List BoxAE use only: Do not distribute
Callback
Write your callback function so that it accepts two arguments.
procedure( TrExampleListBoxCB( ok theListBox )
...
) ; procedure
Design Framework II triggers the callback function when the user clicks
OK, Cancel, or Apply.
Design Framework II supplies two arguments.
User Callback arguments hiShowListBox List box screen
action return value behavior
OK t t Disappears
the list box data structure
Apply t Remains on screen
the list box data structure
Cancel nil nil Disappears
nil
7/16/12 SKILL Language Programming 374
The callback can use the SKILL expressions in this table.
Expression Meaning
theListBox->value Retrieves the list of selected items.
theListBox->choices Retrieves the list of items that the user can select.
theListBox->choices = ’(…) Changes the list of items that the user can select.
While the box is displayed, other SKILL functions can similarly manipulate the list box data
structure through a global variable.
SKILL Language Programming 374
Cadence AE use only: Do not distribute
Lab Exercises
Lab 16-3 Exploring List Boxes
7/16/12 SKILL Language Programming 375
SKILL Language Programming 375
Cadence AE use only: Do not distribute
Standard Forms
Standard forms solicit data from the user to complete a command.
Forms contain a window banner with generic command buttons: OK,
Cancel, Defaults, Apply, and Help.
You can define other fields and command buttons specific to your
application.
The user interacts with a form by mouse and keyboard.
Open File
Forms provide these
OK Cancel Defaults Help generic command
buttons automatically.
Library Name master Cell Names
Cell Name mux2 mux2
mux2_connect
View Name layout Inv
Inv_save You define the fields
nand2 and buttons specific
Mode edit read scratch to your application.
test
Library path file
7/16/12 SKILL Language Programming 376
Standard forms solicit data from the user.
You create each standard form with a banner containing the name of the form and any of the
following buttons:
Button Function
OK Completes the command and removes the form from the screen.
Cancel Cancels any changes or selections made to the form and removes
the form from the screen.
Defaults Sets all values in the form to their default values.
Apply Completes the command and leaves the form on the screen.
Help Displays a document containing additional information.
SKILL Language Programming 376
Cadence AE use only: Do not distribute
Analyzing a Command
The table describes how Virtuoso® Design Environment and SKILL
respond to the user during a typical command that displays a form.
User Virtuoso Design Environment SKILL
Chooses Invokes menu item callback Menu item callback displays
menu item the form.
Fills in data Invokes field callbacks Field callbacks provide
feedback and set other field
values.
Clicks Invokes callback Form callback completes
OK/Apply the command.
7/16/12 SKILL Language Programming 377
SKILL Language Programming 377
Cadence
Creating andAE use only:
Displaying Do not distribute
a Form
hiDisplayForm( ... )
hiCreateAppForm( ... ) or
hiCreateStringField( ... ) hiOpenWindow( ... )
Create forms from the bottom up
Follow these steps to create and display a form:
1. Use the hiCreate* functions to create the fields.
2. Use the hiCreateAppForm function to create the form.
3. Use the hiDisplayForm function to display the form or
use the hiOpenWindow function to install the form in a window.
7/16/12 SKILL Language Programming 378
SKILL Language Programming 378
Cadence
Example FileAE use only: Do not distribute
Form
This example shows a form with a single string field.
File Form
OK Cancel Defaults Apply Help
File Name .cshrc
The user specifies a file name in the File Name field.
The form callback checks whether the file exists. If the file exists, the
form callback displays it in a Show File window.
7/16/12 SKILL Language Programming 379
SKILL Language Programming 379
Cadence
Creating the AE use only:
File Name Field Do not distribute
Pass the data structure of the File Form to the validation routine of the File
Name field. Thus, the validation routine can access other fields in the form.
Use the hiGetCurrentForm function to retrieve the data structure of the File
Form.
TrFileNameField = hiCreateStringField(
TrFileNameField
?name ‟TrFileNameField
?prompt "File Name"
?defValue ".cshrc"
?callback "TrDoFieldCheckCB( hiGetCurrentForm() )"
?editable t
)
procedure( TrDoFieldCheckCB( theForm ) TrFileNameField
if( isFile( theForm->TrFileNameField->value )
...
) ; procedure
7/16/12 SKILL Language Programming 380
The hiCreateStringField Function
Creates a string field entry for a form.
Keyword argument Meaning
?name Symbolic name of this field.
?prompt Field prompt.
?value Initial value.
?help See User Interface SKILL Functions Reference Manual.
?defValue Default value.
?font See User Interface SKILL Functions Reference Manual.
?callback The function calls to execute when the user clicks into another
field.
?format See User Interface SKILL Functions Reference Manual.
?editable nil => read-only.
t => user can edit this field.
SKILL Language Programming 380
Cadence AE
Validating the Fileuse only:
Name Field Do not distribute
The TrDoFieldCheckCB function returns t if the file exists and returns nil
otherwise.
The theForm argument is the data structure that the hiGetCurrentForm
function returns.
TrFileNameField is the symbol you passed to the hiCreateStringField
function.
procedure( TrDoFieldCheckCB( theForm )
if( isFile( theForm->TrFileNameField->value ) then
println("File exists")
t
else
println("File Does Not Exist--Try Again")
nil
) ;if
) ; procedure
7/16/12 SKILL Language Programming 381
User actions trigger the execution of the field validation routines. They execute after the field and
form creation routines have returned.
Do not rely on passing local variables to either of the following:
Your form field checking routines
Your form callback routine
However, you can use global variables to communicate with the field checking routines as
well as with the form callback routine.
SKILL Language Programming 381
Cadence
Creating the AE use only: Do not distribute
File Form
Use the hiCreateAppForm function to create a form data structure.
TrFileForm = hiCreateAppForm(
?name ‟TrFileForm
?formTitle "File Form"
?callback ‟TrFileFormCB
?fields list( TrFileNameField )
?help ""
?unmapAfterCB t
)
Make the ?name argument be a global variable. This variable plays these
two roles:
The form data structure contains a reference to the ?name parameter.
The hiCreateAppForm function stores the data structure as the value
of the ?name parameter.
7/16/12 SKILL Language Programming 382
The hiCreateAppForm Function
Returns the SKILL data structure of a form with the specified field entries.
Keyword argument Meaning
?name A global variable; SKILL stores the form’s data structure in this variable.
?fields A list of field data structures.
?fromTitle The form name, which appears in the form’s window banner.
?callback The function or functions to be called when the user selects
OK, Apply, or Cancel in a form. Can also be a list containing ‘(g_okAction
g_cancelAction). Can be strings or symbols.
?ummapAfterCB If t, SKILL removes the form after the callback returns. Otherwise, the form is
removed when the user clicks OK. See User Interface SKILL Functions Reference
Manual.
?formType See User Interface SKILL Functions Reference Manual.
?dialogStyle See User Interface SKILL Functions Reference Manual.
?buttonLayout See User Interface SKILL Functions Reference Manual.
?initialSize See User Interface SKILL Functions Reference Manual.
SKILL Language Programming 382
Cadence AE
The File Form use only:
OK/Apply Do not distribute
Callback
Make sure that the form callback does the following:
Performs all the field checks again.
Continues the command.
procedure( TrFileFormCB( theForm )
if( TrDoFieldCheckCB( theForm )then Validate field
hiSetCallbackStatus( theForm t ) Clear unmap veto
hiHighlightField(
theForm Form data structure
‟TrFileNameField Field symbol
‟background ) Highlight type
view(
theForm->TrFileNameField->value )
else
hiSetCallbackStatus( theForm nil ) Veto form unmap
hiHighlightField(
theForm ‟TrFileNameField ‟error )
) ; if
) ; procedure
7/16/12 SKILL Language Programming 383
To facilitate a user-friendly interface, make your callback validate the fields before continuing the
command.
If there are any fields with errors, then
Highlight the fields with errors.
Prevent the removal of the form from the screen.
Do not continue the command.
If all fields contain valid data, then
Remove any field highlighting.
Continue the command.
The ?unmapAfterCB Argument
If you create the form with ?unmapAfterCB set to t, the form stays on the screen until the form
callback returns.
The hiSetCallbackStatus Function
When you set the callback status to nil, the form stays on the screen. To permit the form to be
removed later, set the callback status to t.
SKILL Language Programming 383
Cadence AEFileuse
Displaying the only: Do not distribute
Form
Button Callback hiDisplayForm Form removed
evaluated return value from screen
OK Yes t Yes
Apply Yes does not return No
Cancel No nil Yes
Use the hiDisplayForm function to display a form you create with the
hiCreateAppForm function.
By default, the hiDisplayForm function does not return until the user clicks
OK or clicks Cancel.
7/16/12 SKILL Language Programming 384
The hiDisplayForm Function
By default, the hiDisplayForm function does not return until the user clicks OK or clicks Cancel.
The ?dontBlock Argument
If you pass ?dontBlock t when you create a form, then the hiDisplayForm function returns
immediately.
SKILL Language Programming 384
Cadence AE useArgument
The ?unmapAfterCB only: Do not distribute
The ?unmapAfterCB argument governs when the X Window System
removes the form from the screen.
You have two opportunities for the X Window System to remove the form:
While SKILL evaluates the callback
After SKILL evaluates the callback
SKILL evaluates callback
Form removed Form removed
during callback after callback
TIME
User Clicks OK
7/16/12 SKILL Language Programming 385
SKILL Language Programming 385
Cadence AECursor
Controlling the use only:
Icon Do not distribute
You can control the cursor icon that appears to let the user know the state
of the process that is running. For example, if you change the cursor to an
hourglass icon this will let the user know to wait for the process to
complete.
Get the cursor icon value
hiGetCursor() => integer ID of the cursor type in the current window
Set the cursor icon value
hiSetCursor(wid x_cursor ) => t if the cursor was set, nil if it
was not set
Example
hiSetCursor( hiGetCurrentWindow() hicHourglass)
7/16/12 SKILL Language Programming 386
x_cursor constant X windows equivalent
hicArrow XC_left_ptr
hicCross XC_cross
hicHand XC_hand2
hicHelp XC_question_arrow
hicIbeam XC_xterm
hicNo XC_pirate
hicSizeAll XC_fleur
hicSizeNESW —
hicSizeNS XC_sb_v_double_arrow
hicSizeNWSE —
hicSizeWE XC_sb_h_double_arrow
hicUpArrow XC_sb_up_arrow
hicWait XC_watch
hicArrowHourglass —
hicHourglass —
hicNoCursor —
SKILL Language Programming 386
Cadence AE use
Frequently Asked only: Do not distribute
Questions
What role do the f1, f2, f3, fields, form, and ExampleForm variables play?
Which of these variables must be global?
Which can be local?
let( ( f1 f2 f3 fields form ) Field data structure
f1 = hiCreateStringField( Symbolic field name
?name ‟field1
...
) Field data structure
f2 = hiCreateStringField(
Symbolic field name
?name ‟field2
...
)
...
fields = list( f1 f2 f3 ) Form data structure
form = hiCreateAppForm( Must be global
?name ‟ExampleForm
?fields fields
...
) Form data structure
hiDisplayForm( form )
) ; let
7/16/12 SKILL Language Programming 387
This table explains the role and the scope of each variable in the overhead example.
Variables Role Scope (local or global)
f1, f2, f3 Each value is a field data structure. Make these variables local.
field1, field2, field3 Each is the symbolic name of a The scope is irrelevant,
field. Each value is irrelevant. because the variable name,
instead of the value, is used
fields The value is a list of the field data Make this variable local.
structures.
form The value is a form data structure. Make this variable local.
ExampleForm The symbolic name of the form. Make this variable local.
The value is a form data structure.
SKILL Language Programming 387
Cadence
Form Fields AE use only: Do not distribute
All field creation routines share similar arguments and return the field
structure.
Field category Field type Creation function
Type-in single-line string hiCreateStringField
multi-line string hiCreateMLTextField
integer numeric hiCreateIntField
floating point numeric hiCreateFloatField
list hiCreateListField
2-D point hiCreatePointField
bounding box hiCreateBBoxField
2-D point list hiCreatePointListField
bounding box hiCreateBBoxField
combo field hiCreateComboField
Enumerated choice toggle hiCreateToggleField
boolean hiCreateBooleanButton
radio hiCreateRadioField
list box hiCreateListBoxField
cyclic hiCreateCyclicField
layer cyclic hiCreateLayerCyclicField
scale hiCreateScaleField
numeric hiCreateSpinBox
Information text hiCreateOutputStringField
Command button hiCreateButton
button box hiCreateButtonBoxField
7/16/12 SKILL Language Programming 388
Use the Cadence Finder to list all the functions whose name starts with hiCreate and end with
Field.
Aesthetically you can use the following to organize the form:
hiCreateFrameField
hiCreateSeparatorField
hiCreateScrollRegion
hiCreateLabel.
SKILL Language Programming 388
Cadence AE use
Some Additional Typesonly: Do not distribute
of Fields
Tab field: hiCreateTabField
Divide a form using horizontal tabs
Scrollbars automatically added if tabs exceed window width
Report field: hiCreateReportField
Table data with automatic re-sort by clicking on a column header
Interactively resize columns
Tree field: hiCreateTreeTable
An expandable tree to organize data
Hypertext field: hiCreateHyperTextField
Hypertext links to web information
Two options: simple and advanced
7/16/12 SKILL Language Programming 389
Tab Field Example: Tree Field Example:
tabField = hiCreateTabField( treeF=hiCreateTreeTable(
?name 'pcellTabField ?name 'treeField
?fields fieldList ?title "Tree Table -- View 1"
?tabs tabNames ?selectMode 'extended
?tabPlacement 'top ?titleAlignment 'center
) ?callback "treeCB" ?expandCallback
"expandCB" ?collapseCallback "collapseCB"
Report Field Example: ?headers '(
f3 = hiCreateReportField( ("Folder" 120 'left)
?name 'TrHierCellList ("Comment" 150 'left)
?title "Master Cells in Hierarchy" ("Misc" 80 'right 'float))
?titleAlignment 'center ?choice rootTree )
?choices list('("NONE" "NONE" "NONE"))
?headers list( Hypertext Field Examples:
'( "Library" 150 'center 'string t ) f1 = hiCreateSimpleHypertextField(
'( "Cell" 150 'center 'string t ) 'TrHt1
'( "View" 150 'center 'string t ) "Download Cadence Software"
) "[Link]
?callback "TrGetViews(hiGetCurrentForm())" )
) ; f3 f2 = hiCreateHypertextField(
?name 'TrHt2
?value
"<A name=slink
href=[Link] SourceLink
DFII FAQ</A>"
)
SKILL Language Programming 389
Cadence AE use only: Do not distribute
Lab Exercises
Lab 16-4 Exploring Forms
Lab 16-5 Writing a Form Application
You create a form capable of changing the name and size of
an associated window.
This lab has several optional sections for advanced students.
7/16/12 SKILL Language Programming 390
SKILL Language Programming 390
Cadence AE use only: Do not distribute
Toolbar Customization
Toolbars provide consistent icon menus across windows and applications.
They are available for all applications. Some examples are
File Edit
Schematic
Layout
You can customize the toolbars by modifying a definition file. The default
toolbar definition file is located at
<installdir>/share/cdssetup/dfII/toolbars/byApplication/[Link]
Here is an example from the [Link] file:
( ( nil
name leFileToolbar
text “File”
items (
( *** item1 definition***)
( *** item2 definition***)
)) ...
7/16/12 SKILL Language Programming 391
SKILL Language Programming 391
Cadence AE use
Example: Toolbar only: Do not distribute
Customization
The toolbar name (such as leFileToolbar) must be unique across all applications.
The text the program uses for the toolbar title and tooltip text (such as File) need not
be unique.
(( nil
name leFileToolbar
text "File"
items (
(
nil
type action
name leFileToolbarOpen
text "Open"
iconFile "[Link]"
callback "deFileOpen()"
disabled t
)
(
nil
type action
name leFileToolbarSave
text "Save"
iconFile "[Link]"
callback "geSave()"
enableCondition modified
))...
7/16/12 SKILL Language Programming 392
SKILL Language Programming 392
Cadence AE use only:
Toolbar Customization Do not distribute
File Definition
Main Toolbar
Mandatory fields: name, text, items
Optional fields: Invisible, toolButtonStyle (textOnly, iconOnly, textBesideIcon,
textUnderIcon)
Item type action
Mandatory fields: type (action), name, text, callback, iconFile (.png format)
Optional fields: subAction, disabled, checkable, checked
Item type comboBox
Mandatory fields: type (comboBox), name, toolTip, items, callback, width
Optional field: disabled
Item type typein
Mandatory fields: type (typein), name, toolTip, callback, value, width
Optional field: disabled
Item type separator
Mandatory fields: type (separator), name
Item type inheritToolbarsFrom
Mandatory fields: inheritToolbarsFrom (application)
7/16/12 SKILL Language Programming 393
You can create your own icons using an image editor like GIMP. You need to be able to save the
icon file in the PNG format. Be sure to set the pixel size to 24x24 so they will display correctly in
the toolbar. You can also locate free icons on the internet.
Note
The iconFile is looked up in the standard [Link] locations prefixed by the path icons/24x24. The
standard locations include
<installdir>/share/cdssetup
./.cadence
~/.cadence
A complete explanation of each field can be found in the Virtuoso Design Environment User
Guide. See “Customizing Toolbars” in the “Customizing Your Design Environment” section.
SKILL Language Programming 393
Cadence AE use
Creating a Toolbar withonly:
SKILLDo not distribute
Code
hiCreateToolbar
Creates a toolbar that you can add to windows and session windows. A
toolbar is a container object that can contain combo boxes, type-in items,
actions, and separators.
hiCreateToolbar(
?name <toolbar_name>
?title “Toolbar Title”
?toolButtonStyle <style>
SKILL function Toolbar feature
hiCreateToolbarComboBox Cyclic plus type-in menu item
hiCreateToolbarTypein Type only menu item
hiCreateAction Icon with optional text to execute a
SKILL command
hiCreateToolbarSeparator Line to separate items in the toolbar
7/16/12 SKILL Language Programming 394
hiCreateToolbar(
?name s_name
[?title t_title]
[?toolButtonStyle s_buttonStyle]
[?toolTip t_toolTip]
[?items l_toolbarItems]
[?invisible g_invisible]
)
s_buttonStyle
One of the following symbols specifying the style of the toolbar buttons: 'textOnly, 'iconOnly,
'textBesideIcon, or 'textUnderIcon.
Default value: 'iconOnly
t_toolTip
The tooltip that will be displayed whenever the cursor hovers over the toolbar.
g_invisible
t or nil. Specify t if you want the toolbar to be invisible initially; specify nil if you want it to
be displayed. The default value is nil.
You can modify the value of this argument after the toolbar is created with the invisible
property, as in this example:
windowId->hiToolbars->toolbarName->invisible = nil
SKILL Language Programming 394
Cadence AE use
Creating a Toolbar withonly:
SKILLDo not
Code distribute
Example
Create the toolbar
toolbar1 = hiCreateToolbar(
?name „ExampleToolbar1
?title “Example”
?toolButtonStyle „textUnderIcon )
Create the toolbar item (icon with action)
exampleAction = hiCreateAction(
?name „ExampleIconItem
?callback “view(\”.cdsinit\”)”
?icon “[Link]”
?iconText “view .cdsinit” )
Add the item to the toolbar
hiAddToolbarItem( toolbar1 exampleAction )
Place the toolbar in a session window
hiPlaceToolbar( hiGetSessionWindow(1) toolbar1 )
7/16/12 SKILL Language Programming 395
?icon
The icon that is displayed for the action. After the toolbar is created, you can change the icon
with the hiIcon property.
For example: windowID->hiToolbars->toolbarName->actionName->hiIcon = “[Link]”
Specifying Icons for hi Functions
All hi functions that take icons as arguments (such as hiCreateButton, hiCreateLabel,
hiCreateTreeItem, and hiCreateMenuItem) accept icons in any of the following formats:
t_fileName
list(t_fileName x_width x_height)
list(x_iconHandle x_width x_height)
where x_iconHandle is the handle of the icon, x_width is the desired width of the icon, and
x_height is the desired height of the icon. This list, which was the only format accepted in releases
prior to IC 6.1.2, can be obtained through the hiStringToIcon, hiLoadIconData, hiLoadIconFile,
geCellViewToDlist, and dlDlistToIcon functions.
t_fileName: If t_fileName in any of the above options is an absolute path (starting with /), the file
is loaded directly. If t_fileName is a relative path, the Cadence Search File mechanism (CSF) is
used to search for the icon file. For each location in your [Link] file, the following
subdirectories are searched. The names of these subdirectories represent the resolution of the
image files in them: icons/16x16, icons/24x24, icons/32x32, icons/48x48. The first file found for
each resolution is loaded into the icon. When the icon is used, the appropriate resolution is used.
SKILL Language Programming 395
Cadence AE use only: Do not distribute
Lab Exercises
Lab 16-6 Modifying a Toolbar Menu
Lab 16-7 Creating a Toolbar Using SKILL Code
7/16/12 SKILL Language Programming 396
SKILL Language Programming 396
Cadence AE use only: Do not distribute
Module Summary
In this module, we covered
Context-sensitive pop-up menus
Fixed menus
Dialog boxes
List boxes
Forms
Toolbars
7/16/12 SKILL Language Programming 397
Category Functions
Fixed menus hiCreateVerticalFixedMenu
hiCreateHorizontalFixedMenu
hiDisplayFixedMenu
hiGetWindowFixedMenu
hiRemoveFixedMenu
hiAddFixedMenu
Dialog boxes hiDisplayAppDBox
List boxes hiShowListBox
Forms hiCreateStringField
hiCreateAppForm
hiDisplayForm
hiSetCallbackStatus
hiHighlightField
SKILL Language Programming 397
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 398
SKILL Language Programming 398
Cadence AE use only: Do not distribute
Advanced Customization
Module 17
July 16, 2012
SKILL Language Programming 399
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn how to
Customize the Virtuoso® Schematic Editor and the Virtuoso Layout
Editor software.
Add a menu item to a pull-down menu.
Insert a menu item in a pull-down menu.
Delete a menu item from a pull-down menu.
Add a pull-down menu to the menu banner.
Reorganize the menus in the menu banner.
Customize form field default values.
Manage the Layer Selection Window
7/16/12 SKILL Language Programming 400
SKILL Language Programming 400
Cadence AE use only: Do not distribute
Module Scope
This module covers the following topics:
Customizing Virtuoso Schematic Editor, Virtuoso Layout Editor, and
other Design Editor applications
Customizing the default value and initial value of a statically defined
field in a SKILL® form
You need different techniques to customize the CIW, Layer Selection
Window (LSW), and Library Manager.
7/16/12 SKILL Language Programming 401
This module focuses on one of several approaches to customizing certain Virtuoso® Design
Environment applications, such as the Virtuoso Schematic Editor and the Virtuoso Layout Editor
applications.
SKILL Language Programming 401
Cadence AE
Design Editor use only: Do not distribute
Applications
The Design Editor is a software interface that associates application
software with view types. The Design Editor is not itself a tool.
The Virtuoso Schematic Editor and Virtuoso Layout Editor software are
Design Editor applications.
All Design Editor applications register certain of their SKILL functions
with the Design Editor. These application SKILL functions are known
as Design Editor trigger functions.
The Design Editor calls these registered SKILL functions to configure the
design window when the user does any of the following tasks:
Opens a cellview
Descends the design hierarchy into a cellview
Ascends the design hierarchy into a cellview
7/16/12 SKILL Language Programming 402
The view type of the cellview determines which trigger functions the Design Editor invokes.
Cadence® supplies the basic set of Design Editor trigger functions for each supported view type.
You can define several user trigger functions for each supported view type.
The deGetAllViewTypes Function
The deGetAllViewTypes function returns a list of all registered Design Editor view types.
deGetAllViewTypes() => ("graphic" "maskLayout" "schematic"
"schematicSymbol" ... )
The deGetAppInfo Function
The deGetAppInfo function returns the information associated with the application registered for a
viewType. You can extract specific trigger information with the -> operator.
deGetAppInfo( "schematic" )->menuTrigger => schMenuTrigger
SKILL Language Programming 402
Cadence AE
Design Editor use
User only:
Trigger Do not distribute
Functions
This course presents two user-trigger functions:
user postinstall trigger function — modifies existing menus or sets
variables
user menu trigger function — adds new menus
The phrase user trigger function implies the following:
You define the user trigger function.
Cadence does not define it.
The Design Editor invokes your function after it configures a design
window.
To define a user trigger function in your .cdsinit file, do the following:
Declare the user trigger function.
Register your trigger function with the Design Editor.
You can register multiple-user trigger functions for a view type. If there is a
user trigger function already present, the new one will be added to the list.
7/16/12 SKILL Language Programming 403
SKILL Language Programming 403
Cadence AE use
The Design Editor Useronly: Do not distribute
Triggers
Declare a user postinstall trigger function to accept ONE argument as in
this example.
procedure( TrUserPostInstallTrigger( args )
...
) ; procedure
Declare a user menu trigger function to accept ONE argument as in this
example.
procedure( TrUserMenuTrigger( args )
...
) ; procedure
The single argument to any Design Editor trigger function is a disembodied
property list that includes the following fields:
args->window
args->libId
args->libName
args->cellName
args->viewName
args->accessMode
args->action
You must use the -> operator to access the fields. Do not use the ~>
operator.
7/16/12 SKILL Language Programming 404
SKILL Language Programming 404
Cadence
Registering aAE use
User only: Do
Postinstall notFunction
Trigger distribute
Use the deRegUserTriggers function to register your user postinstall trigger
as in this example.
deRegUserTriggers( "schematic"
nil ;;; no user application trigger
’TrUserMenuTrigger
’TrUserPostInstallTrigger
)
The first argument is the view type associated with the application.
Virtuoso Schematic Editor = "schematic“
Virtuoso Layout Editor = "maskLayout"
Pass nil for any unused trigger, in this case the second argument.
The third argument is the function that you want for the user menu
trigger. Use the single quote syntax.
The fourth argument is the function that you want for the user
postinstall trigger. Use the single quote syntax.
7/16/12 SKILL Language Programming 405
The deRegUserTriggers Function
See the Cadence online documentation to read more about this function.
Virtuoso XL viewtypes
schematic: schSynthesisXL
layout: maskLayoutXL
SKILL Language Programming 405
Cadence
Developing aAE use
User only:
Trigger Do not distribute
Function
Develop a user trigger function the same way you develop any SKILL
function.
Be aware that the Design Editor traps any SKILL errors that a user
postinstall trigger function causes.
If you are using the SKILL Debugger, configure it to display a stack trace
automatically.
7/16/12 SKILL Language Programming 406
SKILL Language Programming 406
Cadence
Debugging aAE
Useruse only:
Trigger Do not distribute
Function
After you have declared and registered a user trigger function, you can test
and debug it.
To test your user trigger function, follow these steps:
1. Open an application window.
2. Determine if there are any errors or warnings in the CIW.
3. Determine if the windows menu banner or pull-down menu has
been appropriately customized.
7/16/12 SKILL Language Programming 407
SKILL Language Programming 407
Cadence
Redefining aAE
Useruse only: Trigger
Postinstall Do notFunction
distribute
When you determine the cause of an error, follow these steps:
1. Edit the source of your user postinstall trigger function.
2. Redefine the user postinstall trigger function. You do not have to
register it again when you redefine it.
3. Open another application window. Determine if it has been
appropriately customized.
7/16/12 SKILL Language Programming 408
SKILL Language Programming 408
Cadence AE
What You Put use
in the only:File
.cdsinit Do not distribute
After you have tested your user postinstall trigger function, declare it and
register it in your .cdsinit file.
Example
procedure( TrUserPostInstallTrigger( args )
...
) ; procedure
deRegUserTriggers( "schematic"
nil
nil
’TrUserPostInstallTrigger
)
7/16/12 SKILL Language Programming 409
SKILL Language Programming 409
Cadence AE use only:
Three User Postinstall TriggerDo not distribute
Examples
On the next several slides, there are three examples that implement the
following customizations:
Customization Trigger
Adding a menu item to the Edit menu User postinstall trigger
in the schematic editor window
Adding a pull-down menu to a User menu trigger
schematic editor window
Reordering the Virtuoso Layout Editor User postinstall trigger
pull-down menus
7/16/12 SKILL Language Programming 410
SKILL Language Programming 410
Cadence AEItem
Adding a Menu usetoonly: Do notEdit
the Schematic distribute
Menu
In your .cdsinit file, declare your user postinstall trigger function and register it with
the Design Editor.
procedure( TrUserPostInstallTrigger( args )
...
) ; procedure
deRegUserTriggers( "schematic"
nil
nil
’TrUserPostInstallTrigger
)
Make the TrUserPostInstallTrigger function do these tasks:
1. Build your menu item if it is not already built.
2. Add your menu item to the Edit menu if it is not already in the Edit menu.
hiAddMenuItem( schEditMenu TrMenuItem )
The schEditMenu global variable contains the data structure of the Edit pull-
down menu in Virtuoso Schematic Editor.
7/16/12 SKILL Language Programming 411
The hiAddMenuItem Function
Use the hiAddMenuItem function to add a menu item to a menu. Pass data structures for both the
menu and the menu item.
The hiInsertMenuItem Function
Use the hiInsertMenuItem function to insert a menu item in a menu. Pass data structures for both
the menu and the menu item. The third parameter is the position of the menu item in the menu.
hiInsertMenuItem( schEditMenu TrMenuItem 0 )
Locating the Menu Items with the Menu Data Structure
Use the hiGetMenuItems function to get the menu items for a specific menu data structure.
This example lists all the menus and their menu items for the current window:
foreach( item hiGetBannerMenus( hiGetCurrentWindow()
printf( “%L : %L\n” item hiGetMenuItems( eval( item ) ) )
SKILL Language Programming 411
Cadence AE Menu
Finding the Edit use Data
only:Structure
Do not distribute
The schEditMenu global variable contains the data structure of the Edit
pull-down menu in Virtuoso Schematic Editor.
Follow these steps to verify this fact by inspection.
1. Open a Virtuoso Schematic Editor design window.
2. Make it the current window.
3. Call the hiGetBannerMenus function.
hiGetBannerMenus( hiGetCurrentWindow()) =>
( schematicTools schFileMenu4 schWindowMenu
schEditMenu schAddMenu schCheckMenu schSheetMenu )
Each variable in the return result holds the data structure of the
corresponding pull-down menu.
Specifically, the schEditMenu variable contains the data structure
for the Edit menu in Virtuoso Schematic Editor.
7/16/12 SKILL Language Programming 412
The hiGetBannerMenus Function
See the Cadence online documentation to read more about this function.
The TrGetMenuWithTitle Function
You can use the TrGetMenuWithTitle function to determine the data structure of the menu in the
window banner with the given title.
procedure( TrGetMenuWithTitle( wid title )
let( ( menus menuVariable )
menus = hiGetBannerMenus( wid )
menuVariable =
car(
exists( var menus
symeval(var)->_menuTitle == title
)
)
when( menuVariable symeval( menuVariable ))
) ; let
The exists Function
See the Cadence online documentation to read more about this function.
The symeval Function
See the Cadence online documentation to read more about this function.
SKILL Language Programming 412
Cadence AE and
Avoiding Errors useWarnings
only: Do not distribute
Make sure that your user postinstall function verifies the following
conditions:
Before building your menu item, verify that it does not already exist.
Consider this example.
unless( boundp( ’TrMenuItem )
TrMenuItem = hiCreateMenuItem(
...
)
) ; unless
Before attempting to modify the menu, verify that the menu data
structure is in memory and that the menu item is not present in the
menu, as in this example.
boundp( ’schEditMenu ) && !schEditMenu->TrMenuItem
7/16/12 SKILL Language Programming 413
Analyzing the Menu Data Structure
Let M be a variable whose value is a menu data structure.
Let TrMenuItem be the symbolic name of a menu item.
Then M->TrMenuItem is non-nil when the item is in the menu, and nil otherwise.
The boundp Function
See the Cadence online documentation to read more about this function.
Use the boundp function to determine whether a variable is bound.
The boundp function returns t, if the variable is bound to a value.
It returns nil, if it is not bound to a value.
SKILL Language Programming 413
Cadence AE
What You Put use
in the only:File
.cdsinit Do not distribute
To make the Edit menu in Virtuoso Schematic Editor have the Example
menu item, include the following code in your .cdsinit file:
procedure( TrUserPostInstallTrigger( args )
unless( boundp( ’TrMenuItem ) Check #1
TrMenuItem = hiCreateMenuItem(
?name ’TrMenuItem
?itemText "Example"
?callback "println( ’Example )"
)
) ; unless
when(
boundp( ’schEditMenu ) &&
!schEditMenu->TrMenuItem Check #1
hiAddMenuItem( schEditMenu TrMenuItem )
) ; when
) ; procedure
deRegUserTriggers( "schematic"
nil
nil
’TrUserPostInstallTrigger
)
7/16/12 SKILL Language Programming 414
Check #1
Check #1 determines whether the menu item exists.
Check #2
Check #2 determines whether the menu exists without the menu item present.
SKILL Language Programming 414
Cadence AE use
Adding a Pull-Down only:
Menu Do not distribute
to Schematic Windows
Use the same approach as in the first example.
In this example, make the TrUserMenuTrigger function do these tasks:
1. Build your pull-down menu, if it is not already in memory.
2. Return the list of menus to add.
Test your menu function to add the pull-down menu to the window banner:
hiInsertBannerMenu( windowID TrUserMenuTrigger() 0)
7/16/12 SKILL Language Programming 415
Building Your Pull-Down Menu
The Design Editor calls your trigger function each time the user opens a Virtuoso Schematic
Editor window. To avoid building your menu repeatedly, the following code checks whether the
menu already exists.
procedure( TrUserMenuTrigger()
if( boundp( ’TrSchematicPulldownMenu )
then list( TrSchematicPulldownMenu )
else
list(hiCreatePulldownMenu( ’TrSchematicPulldownMenu ... ))
) ; if
) ; procedure
SKILL Language Programming 415
Cadence AE
What You Put intouse only: Do
the .cdsinit File not distribute
To make every Virtuoso Schematic Editor window have your pull-down
menu on the far right, include the following code in your .cdsinit file:
procedure( TrUserMenuTrigger( args ) See below
...
) Returns the menu list
) ; procedure
deRegUserTriggers( "schematic" View type
nil No user application trigger
’TrUserMenuTrigger User menu trigger
7/16/12 SKILL Language Programming 416
The TrUserMenuTrigger Function
procedure( TrUserMenuTrigger()
if( boundp( ’TrSchematicPulldownMenu ) then
list( TrSchematicPulldownMenu )
else
list( hiCreatePulldownMenu(
’TrSchematicPulldownMenu
"Example Menu"
list(
hiCreateMenuItem( ;list of menu items
?name ’One
?itemText "One"
?callback "println( ’One )"
)
hiCreateMenuItem(
?name ’Two
?itemText "Two"
?callback "println( ’Two )"
)
) ; list
) ; hiCreatePulldownMenu
) ; list
) ; if
) ; procedure
SKILL Language Programming 416
Cadence AE use
Reordering Layout only:
Editor Do not
Pull-Down distribute
Menus
In your .cdsinit file, include source code to declare the
TrUserPostInstallTrigger function and register it as Design Editor user
postinstall trigger function.
procedure( TrUserPostInstallTrigger( args )
...
) ; procedure
deRegUserTriggers( "maskLayout"
nil
nil
’TrUserPostInstallTrigger
)
In this example, make the TrUserPostInstallTrigger function do these tasks:
1. Retrieve the list of pull-down menus already in the banner.
2. Remove them all.
3. Insert them one by one at position 0.
7/16/12 SKILL Language Programming 417
Use the same approach as the first and second examples.
SKILL Language Programming 417
Cadence AE
What You Put intouse only: Do
the .cdsinit File not distribute
To make every layout editor window appear with the pull-down menus in reverse
order, include the following code in your .cdsinit file:
procedure( TrReverseBannerMenus( wid )
let( ( theBannerMenuList )
theBannerMenuList =
hiGetBannerMenus( wid ) Save menus
hiDeleteBannerMenus( wid ) Remove all menus
foreach( menuSymbol theBannerMenuList
hiInsertBannerMenu( wid menuSymbol 0 ) Reinsert menus
) ; foreach
) ; let
) ; procedure
procedure( TrUserPostInstallTrigger( args )
TrReverseBannerMenus( args->window )
)
deRegUserTriggers( "maskLayout" View type
nil No user application trigger
nil No user menu trigger
’TrUserPostInstallTrigger User postinstall menu trigger
)
7/16/12 SKILL Language Programming 418
See the Cadence online documentation to read more about these functions:
The hiGetBannerMenus function
The hiDeleteBannerMenus function
The TrReverseBannerMenus function
SKILL Language Programming 418
Cadence
CustomizingAE use only: Do not distribute
Forms
Assume your goal is to customize the default value or initial value of a form
field.
To use the SKILL language to customize a form, follow these steps:
1. Declare a function that customizes a form field’s default value.
2. Use the defUserInitProc function to register your function as a user
init proc with SKILL.
3. When the SKILL Evaluator brings this form into memory, it calls
your function.
The next slides explain these steps in greater detail.
7/16/12 SKILL Language Programming 419
Certain applications use an ASCII text file to control the default values for their forms.
The defUserInitProc function causes your function to be loaded immediately after the context you
have chosen.
You can also set form defaults from the .cdsenv file. When forms appear, the default values are
already set. Some buttons are already turned on, some fields already contain text, and some other
choices are already set.
Cadence supplies an initial set of defaults in a sample file located at
<your_install_dir>/tools/dfII/samples/.cdsenv
Your system administrator customizes this file for your site and puts it in the local environment
file at
<your_install_dir>/tools/dfII/local/.cdsenv
You can override these site-specific settings by creating another .cdsenv file in your home or
workarea directory. When the Cadence software loads, it reads your .cdsenv file after the site-
specific file, so the settings in your file override the settings in files loaded earlier. These overrides
apply to your system only.
SKILL Language Programming 419
Cadence
CustomizingAE use only:
the Default ValueDo
of anot
Formdistribute
Field
For each field in a form built with SKILL, there is a corresponding SKILL
expression that sets the field value. Whenever the user sets a field value in
a form, the corresponding SKILL expression executes.
You can observe this SKILL expression in the ~/[Link] file.
A similar SKILL expression sets the default value.
Example
Consider the File Form discussed in the User Interface module. Follow
these steps:
1. Set the File Name field to the /tmp/[Link] value.
2. Observe the resulting SKILL expression in the CIW.
TrFileForm->TrFileNameField->value = "/tmp/[Link]"
A similar expression sets the default value. Use defValue instead of value.
TrFileForm->TrFileNameField->defValue = "/tmp/[Link]
7/16/12 SKILL Language Programming 420
SKILL Language Programming 420
Cadence AE useInitialization
Design Environment only: Do Sequence
not distribute
Cadence® partitions applications into one or more SKILL contexts. A SKILL
context is a binary file containing compiled SKILL code and SKILL data
structures.
When you start the Virtuoso Design Environment, it loads these items:
1. Loads one or more SKILL contexts (pre-loaded sets of functions).
2. Loads all .cdsenv files (environment variables for applications).
3. Loads the .cdsinit customization file.
However, a .cdsinit can load other .cdsinit files.
4. Responds to user activity by loading other SKILL contexts. For
example when the user opens a schematic for the first time.
virtuoso & Timeline
1 1 1 1 2 3 4
geView menuBuilder schView selectSv .cdsenv .cdsinit schematic
7/16/12 SKILL Language Programming 421
The search order for the .cdsinit file is /tools/dfII/local, the current directory, and the home directory. When the
environment finds a .cdsinit file, the search stops.
The context files are in the <install_dir>/[Link]/etc/context directory.
Each executable (ex. Schematic, Layout, etc. ) loads different contexts.
Study the log file to determine the contexts that your executable loads prior to the .cdsinit file.
The virtuoso executable loads these contexts, as the following excerpt for the [Link] indicates.
Loading [Link]
Loading [Link]
Loading [Link]
Loading [Link]
Study the log file to determine the contexts that your executable loads prior to the .cdsinit file.
The context files are in the <install_dir>/etc/context directory.
A priority for the Design Framework II environment is to minimize startup time for application. For large
applications, loading a SKILL context is faster than loading the original SKILL source code.
When Cadence builds a context, Cadence specifies a context initialization function to create data structures that
are not appropriate to save in the context, such as ports, database objects, and window IDs.
After the Design Framework II environment loads a context upon demand, it calls the Cadence context
initialization function. However, if you load a context with the loadContext function, you must use the
callInitProc function to invoke the initialization function.
Some applications build forms dynamically. Customizing these forms is beyond the scope of this course
SKILL Language Programming 421
Cadence AE useFunction
The defUserInitProc only: Do not distribute
You can supply a user initialization SKILL function for any Cadence
context.
Immediately after the Virtuoso Design Environment loads a context into
memory, Virtuoso Design Environment calls these functions:
The initialization SKILL function that Cadence supplies.
The user initialization SKILL function that you supply for that context.
Your user initialization S KILL function can customize the menus and forms
that are defined in a context.
Example
procedure( TrCustomizeContext()
...
) ; procedure
defUserInitProc( "schView" ’TrCustomizeContext )
Context User initialization
function
7/16/12 SKILL Language Programming 422
See the Cadence online documentation to read more about this function.
The first argument to the defUserInitProc function is the name of a context. The second argument
denotes the SKILL function that you want the Design Framework II environment to call when it
loads the context.
SKILL Language Programming 422
Cadence AE use
Manage the Layer only:Window
Selection Do not distribute
(LSW)
Remove the LSW from the screen
leUnmapLSW()
Restore the LSW to the screen
leRemapLSW()
The LSW is only present with the layout tools. By default, after the LSW is
displayed for a layout window, it is not removed from the screen, and there
is no close option on the window itself. The SKILL commands listed here
are the only way remove and restore the window.
7/16/12 SKILL Language Programming 423
Historically this window could not be removed because it was always a reference to the layers in
the current window. If you remove the LSW with leUnmapLSW, you need to restore it if you
require it for another layout window. The system will not restore the LSW when a new layout
window is opened. You need to use leRemapLSW.
SKILL Language Programming 423
Cadence AE
Modifying the use
Layer only: Do
Selection not distribute
Window
You can modify the LSW using functions that match the string:
^le.*LSW and ^leSet.*Layer
For example to set layer metal1 to be visible use:
leSetLayerVisible( (“metal1” “drawing”) t )
Another example is to set the LSW to show only the layers in the current
window in the LSW. This involves looking through the layer purpose pairs
(LPPs) list in the current cellview and using that to set the validity, visibility
and selectability of the layers.
leSetAllLayerValid( nil ) ;;; turn validity of all layers off
leSetAllLayerVisible( nil ) ;;turn visibility of all layers off
leSetLayerSelectable( nil ) ; turn selectability of all layers off
foreach( lpp geGetEditCellView()~>lpps ; go through each lpp and set it
leSetLayerValid( list( lpp~>layerName lpp~>layerPurpose ) t )
leSetLayerVisible( list( lpp~>layerName lpp~>layerPurpose ) t )
leSetLayerSelectable( list( lpp~>layerName lpp~>layerPurpose ) t )
7/16/12 SKILL Language Programming 424
You can control the length of the purpose abbreviation in the LSW to two or three characters by
setting the variable lwLPIconPurposeLength in the .cdsenv file. This variable is only looked at
startup of the layout tool and cannot be reset during the session envSetVal, envLoadFile or
leSetEnv functions.
SKILL Language Programming 424
Cadence AE use only: Do not distribute
Lab Exercises
Lab 17-1 Adding a Menu Item to the Schematic Edit Window
You study and run the lecture example.
Lab 17-2 Adding a Pull-Down Menu to a Schematic Editor Window
You study and run the lecture example.
Lab 17-3 Reversing the Layout Editor Pull-Down Menus
You study and run the lecture example.
Lab 17-4 Customizing the Initial Window Placement
You customize the Layout Editor to initially place all of its
design windows in a given location.
7/16/12 SKILL Language Programming 425
SKILL Language Programming 425
Cadence AE use only: Do not distribute
Module Summary
In this module, we discussed
Customizing the Virtuoso Schematic Editor software and the Virtuoso
Layout Editor
Customizing form field default values
7/16/12 SKILL Language Programming 426
SKILL Language Programming 426
Cadence AE use only: Do not distribute
Data Structures
Module 18
July 16, 2012
SKILL Language Programming 427
Cadence AE use only: Do not distribute
Module Objectives
In this module, you learn how to
Implement records in the SKILL® language
Disembodied property lists
SKILL structures
Use Arrays
Use associative data structures
Association tables
Association lists
7/16/12 SKILL Language Programming 428
SKILL Language Programming 428
Cadence
DisembodiedAE use only:
Property Lists Do not distribute
A disembodied property list is logically equivalent to a record. New fields
can be dynamically added or removed.
A disembodied property list is a list that starts with any value, typically nil,
followed by alternating name/value pairs.
aCard = ’( nil rank "ace" suit "spades" )
Name Value
rank “ace”
suit “spades”
Use the -> operator to retrieve a value for a given name.
aCard->rank => "ace"
aCard->suit => "spades"
Use the -> operator together with the = operator to update or add a field.
aCard->faceUp = t
faceup t
7/16/12 SKILL Language Programming 429
Disembodied Property Lists
The first element of the disembodied list does not have to be nil. It can be any SKILL data object.
The access operation ignores the first element.
You can use a disembodied property list to consolidate several arguments into a single argument.
Similarly, you can use a disembodied property list to consolidate several global variables into a
single global data structure.
When you apply the ~>?? operator to a database object, this operator builds a disembodied
property list. This list consists of the attributes and values of the database object.
The get and getq Functions
The -> operator is implemented by the getq function. Its second argument is not evaluated. That
is, it is implicitly quoted as in this example.
getq( aCard rank ) => "ace"
The get function is a generalized version of the getq function. Both of its arguments are evaluated.
SKILL Language Programming 429
Cadence AE use only: Do not distribute
SKILL Structures
A SKILL structure is also logically equivalent to a record. The defstruct
function declares a template. It automatically defines a SKILL creation
function with the slot names as keyword parameters.
Example
1. Define a card structure and allocate an instance of card.
defstruct( card rank suit faceUp ) => t
2. Allocate an instance of card and store a reference to it in aCard.
aCard = make_card( ?rank "ace" ?suit "spades" )=> card@0xa8e8378
Card structure Card instance Value
rank rank “ace”
suit suit “spades”
faceup faceup nil
3. Use the type function to determine the structure name.
type( aCard ) => card
7/16/12 SKILL Language Programming 430
The defstruct Function
The defstruct function declares a creation function, which you use to make instances of the
structure. SKILL bases the name of the creation function on the name of the structure.
The printstruct Function
The printstruct function dumps out a structure instance. It recursively dumps out any slot value
that is also a structure instance.
Comparing SKILL Structures and Disembodied Property Lists
A structure is more efficient than a disembodied property list, when you know the slots in
advance, and you specify them when you declare the structure.
A structure instance requires less space than a disembodied property list and slot access is
faster.
SKILL Language Programming 430
Cadence AEUpdating
Accessing and use only: Do not distribute
Structures
The -> operator provides slot access.
aCard->rank => "ace"
aCard->rank = 8 => 8
Use ->? to get a list of the slot names.
aCard->? => ( faceUp suit rank )
Use ->?? to get a list of slot names and values.
aCard->?? => ( faceUp nil suit "spades" rank "ace" )
You can create slots dynamically for a specific instance by simply
referencing them with the -> operator.
aCard->marked = t => t
aCard->?? => (faceUp nil suit "spades" rank "ace"
marked t )
7/16/12 SKILL Language Programming 431
SKILL Language Programming 431
Cadence
Arrays AE use only: Do not distribute
SKILL provides arrays.
Elements of an array can be any datatype.
SKILL provides run-time array bounds checking.
Use the declare function to allocate an array of a given size.
Example
declare( week[7] ) => array[7]:9780700
week => array[7]:9780700
type( week ) => array
arrayp( week ) => t
days = ’(monday tuesday wednesday thursday friday Saturday sunday)
dayNum = 0
foreach( day days
week[dayNum++] = day )
week array
0 1 2 3 4 5 6
monday tuesday wednesday thursday friday saturday sunday
7/16/12 SKILL Language Programming 432
The declare function returns the reference to the array storage and stores it as the value of week.
The type function returns the symbol array.
The arrayp function returns t.
Arrays are one dimensional. You can implement higher dimensional arrays using single
dimensional arrays.
SKILL checks the array bounds each time you access the array during runtime. Accessing an array
outside the array bounds causes an error.
Arrays and Structures
Structure instances are arrays. The first element of the array holds the type, and the last element is
reserved for a disembodied property list to hold dynamically added slots.
SKILL Language Programming 432
Cadence AE use
Two-Dimensional only: Do not distribute
Arrays
You can implement a two-dimensional array as an array of row arrays.
TrTimesTable = Tr2DArray( 7 7 ) ;;; see notes page
for( i 0 6
for( j 0 6
TrTimesTable[i][j] = i*j
) ; for
) ; for
[i][j] 0 1 2 3 4 5 6
0 0 0 0 0 0 0 0
1 0 1 2 3 4 5 6
2 0 2 4 6 8 10 12
3 0 3 6 9 12 15 18
4 0 4 8 12 16 20 24
5 0 5 10 15 20 25 30
6 0 6 12 18 24 30 36
7/16/12 SKILL Language Programming 433
procedure( Tr2DArray( nRows mCols)
let( ( rowArray row )
declare( rowArray[ nRows ] )
for( i 0 nRows-1
declare( row[ mCols ] )
rowArray[ i ] = row
) ; for
rowArray
) ; let
) ; procedure
SKILL Language Programming 433
Cadence
Association AE use only: Do not distribute
Tables
An association table is a collection of key-value pairs.
You can use these SKILL data types as keys in a table:
integer
string
list
symbol
database object
Use the syntax for array access to store and retrieve entries in a table.
The makeTable function defines and initializes the association table.
The arguments include:
The table name (required).
The default entry (optional).
The default of the default is the unbound symbol.
7/16/12 SKILL Language Programming 434
An association table is implemented as a hash table.
Association table access uses the equal function to compare keys.
Several list-oriented functions also work on tables, including iteration. Use these functions to
manipulate tables:
The foreach function executes a collection of SKILL expressions for each key in a table.
The setof function returns a list of keys in a given table that satisfies a given criterion.
The length function returns the number of keys in a table.
The remove function removes a key from a table.
Use the tablep function to test whether a data value is a table.
SKILL Language Programming 434
Cadence AE use
Using Association only:
Tables Do notArrays
as Dynamic distribute
You can easily use an association table for a one-dimensional array. Use
integers as the keys.
Use an association table in situations where it is obviously wasteful or
impossible to allocate the entire array as in these data structures:
A sparse array, most of whose entries are unused
Multidimensional arrays
To implement a two-dimensional array, use keys that are lists of index
pairs.
procedure( Tr2D_DynamicArray()
makeTable( ’TrSparseArray )
) ; procedure
TrTimesTable = Tr2D_DynamicArray( )
for( i 0 6
for( j 0 6
TrTimesTable[ list( i j ) ] = i*j
) ; for
) ; for
7/16/12 SKILL Language Programming 435
SKILL Language Programming 435
Cadence
Associating AE usewith
Shapes only:
LayerDo not distribute
Purpose Pairs
You can use an association table to associate a shape with a layer purpose
pair as follows:
Use a list composed of the layer name and the purpose as a key to
access the table.
The value for the key is the list of shapes on the layer purpose pair.
Making the Table
cv = geGetWindowCellView( )
tableName = sprintf( nil "%s %s %s"
cv~>libName cv~>cellName cv~>viewName )
shapeTable = makeTable( tableName nil )
=> table:master mux2 layout
shapeTable master mux2 layout
7/16/12 SKILL Language Programming 436
The sprintf function creates a string using the formatting standards of the printf command and
assigns it to a variable.
SKILL Language Programming 436
Cadence AETable
Populating the usewith
only: Do not distribute
Shapes
foreach( shape cv~>shapes
layerPurpose = shape~>lpp
shapeTable[ layerPurpose ] =
cons(
shape
shapeTable[ layerPurpose ]
)
) ; foreach
shapeTable master mux2 layout
key = shape~>lpp Value = shape object list
(“metal1” “drawing”) (shape1, shape3, shape7)
(“metal2” “drawing”) (shape2)
(“poly” drawing”) (shape4 shape5)
(“cont” “drawing”) (shape6 shape8)
(“via1” “drawing”) (shape9)
7/16/12 SKILL Language Programming 437
The shapes Attribute
Every cellView database object has a shapes attribute, whose value is a list of all shapes in the
design.
The layerPurposePairs Attribute
In practice, if you need to process all the shapes in a design by layer purpose pair, retrieve the
layerPurposePairs attribute, whose value is a list of LP database objects. Each LP database object
has these attributes:
a shapes attribute, which is a list of all Shapes that are on that layer purpose pair.
layerName and layerNum attributes, which identify the layer purpose pair.
SKILL Language Programming 437
Cadence AE use only:
Traversing Association TablesDo not distribute
Use the foreach function to visit every key in an association table.
The following code displays each key/value pair in the CIW.
foreach( key shapeTable
println(
list( key shapeTable[ key ] )
)
)
The following functions also work with tables:
The forall function
The exists function
The setof function
7/16/12 SKILL Language Programming 438
The readTable and writeTable Functions
Use these functions to read a table from a file and to write a table to a file.
SKILL Language Programming 438
Cadence
Association AE
Listsuse only: Do not distribute
A list of key-value pairs is a natural means to record associations.
An association list is a list of lists. The first element of each list is the key.
assocList = ’( ( "A" 1 ) ( "B" 2 ) ( "C" 3 ) )
The assoc function retrieves the list given the index.
assoc( "B" assocList ) => ( "B" 2 )
assoc( "D" assocList ) => nil
The rplaca function updates the first element of a list. Use the rplaca
function to replace the car of the cdr of the association list entry as shown
here.
rplaca( cdr( assoc( "B" assocList ) ) "two" )
=> ( "two" )
assocList => (( "A" 1 ) ( "B" "two" ) ( "C" 3 ))
Key Value
A 1
B 2
C 3
7/16/12 SKILL Language Programming 439
The tableToList Function
You can also convert an association table to an association list. Use the tableToList function to
build an association list from an association table.
The append Function
The append function appends data from disembodied property lists or association lists to an
association table.
For the first argument, you specify the association table.
For the second argument, you specify the disembodied property list, association list, or other
association table whose data is to be appended to the first association table.
SKILL Language Programming 439
Cadence AE use only: Do not distribute
Lab Exercises
Lab 18-1 Exploring Associative Tables
Lab 18-2 Exploring Association Lists
Lab 18-3 Exploring Disembodied Property Lists
Extend the Layer Shape Report to maintain a separate count
for each type of shapes in a design. Eliminate the
miscellaneous count.
Three versions
o Use an association table
o Use an association list
o Use a disembodied property list.
7/16/12 SKILL Language Programming 440
SKILL Language Programming 440
Cadence AE use only: Do not distribute
Module Summary
In this module, we covered
Implementing records in the SKILL language with
Disembodied property lists
SKILL structures
SKILL arrays
Association lists
Association tables
7/16/12 SKILL Language Programming 441
SKILL Language Programming 441
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 442
SKILL Language Programming 442
Cadence AE use only: Do not distribute
01 March 2011
Introduction to SKILL++
Module 19
July 16, 2012
SKILL Language Programming 443
Cadence AE use
Module Objectives only: Do not distribute
01 March 2011
In this module, you learn how to
Understand how SKILL and SKILL++ work together
Create and load SKILL++ files
Understand expression evaluation in the SKILL® and SKILL++
environments
Know the evaluation environment of a function
Understand the affects on variable definitions
7/16/12 SKILL Language Programming 444
SKILL Language Programming 444
Cadence AE use only: Do not distribute
What Is SKILL++?
SKILL++ is one of the advanced features of the SKILL language which
include:
SKILL++
Lexical scoping
Symbols and Quoting
Treating the language as data
Macros
Code that writes code
Object System
Very powerful classes and methods
This module will focus on the lexical scoping capabilities.
The remainder are covered in the Advanced SKILL class.
7/16/12 SKILL Language Programming 445
SKILL Language Programming 445
Cadence AE use
SKILL and SKILL++ only: Do not distribute
01 March 2011
SKILL and SKILL++ are the same language.
SKILL++ is an extension of the SKILL language.
Support for lexical scoping
Private functions and data
Object system
SKILL and SKILL++ functions can call each other
SKILL Language
Source code file suffix: .il
Execution environment: SKILL
SKILL++
Source code file suffix: .ils
Execution environment: SKILL++
7/16/12 SKILL Language Programming 446
SKILL++ was developed as an extension of the SKILL® language that supplies critical support
for the advanced features required to solve complex problems and create code that is easier to
reuse and maintain. The improvements include lexically scoped variables and the creation of
private functions as well as a greatly enhanced object system.
SKILL and SKILL++ are the same language that execute in different environments. SKILL and
SKILL++ function calls can be mixed in the same procedure. The function definition determines
which environment the function will execute. By default, if the function is defined in a file with a
.ils suffix, it will be defined in the SKILL++ environment. If the file suffix is anything else,
including .il, the function will be defined in the SKILL environment.
SKILL Language Programming 446
Cadence AE use only:
The Execution Environment Do not distribute
01 March 2011
SKILL and SKILL++ execute in different runtime environments.
Different variable scoping
SKILL uses dynamic scoping
SKILL++ uses lexical scoping
Different symbol usage
SKILL symbol slots
value
function
property list
SKILL++
Supports closures
Functions are bound to the function slot of the symbol
SKILL and SKILL++ share functions transparently
SKILL global variables must be imported into the SKILL++ environment
7/16/12 SKILL Language Programming 447
The execution environment determines whether the function is run as in SKILL or SKILL++. This
determines such things as scoping of variables, definitions of local functions and symbol usage.
Global functions are shared between the environments and SKILL global variables can be
imported into the SKILL environment.
SKILL Language Programming 447
Cadence AEEnvironment
The Execution use only:Interactive
Do not distribute
Virtuoso starts in the SKILL environment.
Finding the current environment interactively.
theEnvironment()
SKILL – Returns nil
SKILL has only one environment
SKILL++ - Returns the environment ID
SKILL++ can support multiple environments
Interactive Environment Creation
toplevel( „ils ) – Starts a new SKILL++ environment
toplevel(„il) – Suspends the SKILL++ environment and returns to
the original SKILL environment
resume() – Closes the interactive environment
7/16/12 SKILL Language Programming 448
SKILL Language Programming 448
The Execution Environment
Cadence AE use only: Do not distribute
01 March 2011
Defining Functions in SKILL and SKILL++
Functions are defined the same in both environments.
procedure( functionName( argument list ) …body… )
defun functionName ( argument list ) …body…)
defun and procedure are the same command with different syntax
Both define functions.
Either can be used in the SKILL or SKILL++ language.
They can be used interchangeably.
Lisp users use defun.
C style programmers use procedure.
lambda creates unnamed functions.
7/16/12 SKILL Language Programming 449
Functions are defined in files using commands like procedure or defun. These are both the same
command using different syntax and can be used interchangeably in either SKILL or SKILL++.
There are other function creation methods such as lambda that creates an unnamed function,
defglobalfun for creating global functions in closures, flet for creating functions local to another
function. We will explore some of these in this class.
SKILL Language Programming 449
The Execution Environment
Cadence
Defining Functions in SKILL & SKILL++ distribute
AE use only: Do not
01 March 2011
The source file suffix determines the execution environment
.il – Functions defined in SKILL environment
.ils – Functions defined in SKILL++ environment
SKILL
Loading the source file
load( “[Link]” )
Executing a function
mySKILLfunction( “This is an argument string” 8)
SKILL++
Loading the source file
load( “[Link]” )
Executing a function
myAdvSKILLfunction( “Another string” ?keyedArgument 12 )
7/16/12 SKILL Language Programming 450
The suffix of the source file containing the function definition determines the function execution
environment. When the source file is loaded, the execution is the same between SKILL and
SKILL++, the procedure name followed by the values for the arguments, the required arguments
and the optional or keyed arguments.
Functions defined in a file with a .ils extension will be defined in the SKILL++ environment,
functions in any file with a different extension are loaded in SKILL by default.
SKILL Language Programming 450
The Execution Environment
Cadence AE use only:
Function Definitions Do not distribute
01 March 2011
A SKILL function cannot have the same name as a SKILL++ function
Visa-versa
SKILL and SKILL++ share the same function name table
If a SKILL and SKILL++ function of the same name are defined, the
last one defined wins
Copy and Paste from an Editor
The default toplevel is SKILL
Function may be re-defined in the incorrect argument
Change the top level
toplevel(„ils / ‟il)
7/16/12 SKILL Language Programming 451
Since SKILL and SKILL++ functions share the same space, two functions cannot have the same
name even if they are defined in different environments. If there are multiple definitions of the
same function, the last one defined is the one accessible by the user.
A common technique for debugging functions and methods is to copy and paste from an editor
into the CIW. This may be a problem because the function may be re-defined in the wrong
environment. The command toplevel changes the environment between SKILL and SKILL++.
Note that if you paste code in the CIW while another function is executing, the environment will
be determined by the executing function.
SKILL Language Programming 451
The Execution Environment
Cadence
Switching between SKILL and SKILL++ distribute
AE use only: Do not
01 March 2011
Use interactively or in a file to switch environments
inScheme( …body…)
Executes the body in the SKILL++ environment
Usually executed from the SKILL environment
In .il SKILL source files to switch environment for some function definitions.
inSKILL( …body… )
Executes the body in the SKILL environment
Usually executed in the SKILL++ environment
In .ils SKILL++ source files to switch environment for some function
definitions.
7/16/12 SKILL Language Programming 452
You can execute or define functions in a different environment than the one defined by the source
file suffix using the functions inSKILL and inScheme.
In a SKILL++ source file (.ils), the block defined in the inSKILL statement will be executed in the
SKILL environment. Global variables and function definitions will be defined in the SKILL
environment with its dynamic scoping. In a SKILL source file (.il), the block defined within the
inScheme statement will be executed in the SKILL++ environment. These commands allow you
to mix SKILL and SKILL++ function definitions in the same source file.
SKILL Language Programming 452
The Execution Environment
Cadence AE use only:
SKILL++ Environments Do not distribute
01 March 2011
Can have multiple environments
let(…) statement
Creates a new SKILL++ environment
Sets the lexical scope of the environment
Variables and functions are defined within the environment
Bound variables are not available to different environments
Bound variables are accessible by functions defined in the environment
Variables and functions defined in the same environment implement a Closure
defglobalfun defined functions are public
lambda functions are private
Variables defined in the let statement are private
7/16/12 SKILL Language Programming 453
SKILL++ supports multiple environments, each let statement creates a new environment that sets
the lexical scope of variables and functions defined within that environment. The variables and
functions defined within an environment implement a closure, the variables, some procedures and
lambda functions are private, functions defined by defglobalfun are public but can access the
values in the closure variables.
SKILL Language Programming 453
The Execution Environment
Cadence AE use only:
Global Variables Do not distribute
01 March 2011
Created at the top level of the environment
Can be accessed by all procedures defined in that environment
SKILL Globals SKILL++ Globals
defvar( globalVariable define( quasiGlobalVar
valueExpresssion ) valueExpression )
Evaluates the expression Evaluates the expression
Creates a variable in the dynamic Creates a variable in the current
SKILL environment SKILL++ environment
Sets the value of the variable Sets the value of the variable
SKILL global variables are global to SKILL++ variables are private to the
the SKILL environment SKILL++ environment in which they
are defined
7/16/12 SKILL Language Programming 454
SKILL and SKILL++ can define global variables.
• The function defvar is often used to define global SKILL variables, this is equivalent to using
equals ( = ) .
• In SKILL++, global variables are created using define.
• SKILL++ global variables only have values within the current SKILL++ environment, they
are not accessible to SKILL or other SKILL++ environments.
SKILL Language Programming 454
Cadence
The Execution Environment Functions distribute
AE use only: Do not
01 March 2011
Let
Global variables lexical
scoped
env
Functions F
SKILL SKILL++
Environment Environment
A D
dynamically
C lexical
scoped lexical scoped
variables B env Key
dynamically
scoped
scoped env
variables Environment
C Function
7/16/12 SKILL Language Programming 455
In both the SKILL and SKILL++ environments, named functions are available for general use,
even functions declared within a SKILL++ lexical scope.
• The SKILL functions A and B are defined in the global function space.
• The SKILL++ functions C and D are defined in the global function space because they are
not defined within a lexical scope.
• The function F is declared within the lexical scope of the let. It is only available in the global
function space if it is defined with defglobalfun or globalProc.
SKILL Language Programming 455
Cadence
The Execution Environment Variables distribute
AE use only: Do not
01 March 2011
importSkillVar
let
SKILL lexical
global variables scoped
env
F
SKILL SKILL++
Environment Environment
A D
dynamically
C lexical
scoped
scoped lexical
variables B env Key
dynamically
scoped
scoped env
variables Environment
C Function
7/16/12 SKILL Language Programming 456
Global variables are available within SKILL and can be imported into the SKILL++ environment.
• Global variables in SKILL++ are available to any SKILL++ function.
• SKILL global variables can be imported into SKILL++ environments using the
importSkillVar function.
• The variable imported into the lexical scope is only available within that scope.
Variables declared within a SKILL function are available to all functions evaluated by the original
function, they are dynamically scoped.
• If the function A calls the function B, the variables declared within SKILL function A are
accessible within SKILL function B.
• If the function C calls the function D, the variables in C are not accessible by the function D.
• If a SKILL function calls a SKILL++ function, the SKILL function’s variables are not
accessible in the SKILL++ function and visa-versa.
The function F can access any variables scoped within its environment.
SKILL Language Programming 456
The Execution Environment
Cadence
Sharing between SKILL and SKILL++ distribute
AE use only: Do not
01 March 2011
SKILL++ environments cannot see SKILL globals
SKILL++ environments cannot see variables from other SKILL++
environments
Variables can be accessed from containing environments
Share a SKILL global variable with the current SKILL++ environment
importSkillVar( SKILLVariableName )
Informs the environment that the variable name is treated as a SKILL global
in the SKILL++ environment
Will have no affect if the variable is already defined in the SKILL++
environment
Local variables take precedence
Does not follow the dynamic scope rule in SKILL++ code
7/16/12 SKILL Language Programming 457
This is how you would import SKILL variables into SKILL++.
An experiment for you to try:
1. Create a SKILL function that declares and sets the value of a variable. The variable
should be defined in the let statement.
2. Call a SKILL++ function from inside the SKILL function.
The SKILL++ function should import the variable from the SKILL function.
The SKILL++ function should change the value of the variable.
What should happen when the SKILL++ function terminates?
SKILL Language Programming 457
Cadence AE use
Advanced SKILL only: Do not distribute
Summary
SKILL and SKILL++ complement each other
Share functions
SKILL++ can access SKILL global variables
Use toplevel to change environments
SKILL and SKILL++ procedure definitions
Same procedure declaration
.il source file for SKILL
.ils source file for SKILL++
SKILL++ creates toplevel environments
Lexical scope set by let statement
Support for private data and private functions
7/16/12 SKILL Language Programming 458
SKILL Language Programming 458
Cadence AE use only: Do not distribute
Lab Exercises
Lab 19-1 Implementing a Simple Counter Data Type in the SKILL
Language
In this lab, you implement a Counter data type in SKILL by
declaring four SKILL
functions to allocate a counter and manipulate the counter.
Lab 19-2 Implementing a SKILL ++ Counter Data Type
In this lab, you re-implement the allocator function as a
SKILL++ function.
Lab 19-3 Re-implementing the Counter Data Type (Optional)
In this lab, you re-implement the remaining functions of the
Counter data type.
7/16/12 SKILL Language Programming 459
SKILL Language Programming 459
Cadence AE use only: Do not distribute
7/16/12 SKILL Language Programming 460
SKILL Language Programming 460
Cadence AE use only: Do not distribute
Next Steps
Module 20
July 16, 2012
SKILL Language Programming 461
Cadence AEPostcourse
Completing the use only:Assessment
Do not distribute
1. In a web browser, enter: [Link]
2. Log in to the exam server:
a. In the Name field, enter your complete email address, such as
joe@[Link].
b. In the Group field, enter your company’s email suffix, such as [Link].
3. Select the postcourse assessment:
ES SKILL Language Programming IC 6.1.5 POST
4. Complete the assessment. Try to answer every question.
5. Click Submit at the bottom of the assessment.
You receive a score and see the answers.
7/16/12 SKILL Language Programming 462
SKILL Language Programming 462
Cadence AE use only: Do not distribute
Proof of Attendance
You can receive proof of attendance after taking a Cadence® instructor-led
course (public, standard onsite, or virtual). Please contact your local
customer training office to request a Certificate of Attendance. Be sure to
include your name and course title.
For local customer training contact information, refer to
[Link]
7/16/12 SKILL Language Programming 463
SKILL Language Programming 463
Cadence
Certificate ofAE useCompletion
Course only: Do(Optional)
not distribute
To receive a Certificate of Completion, you must complete an online exam
with a score of 75% or more.
The benefits of receiving a certificate include:
A confirmation of your knowledge and understanding
An acknowledgement of course mastery so that you can update your
resume with new skills and make yourself more marketable
Peer recognition
Detailed instructions for obtaining a Certificate of Completion are provided
on the next page.
7/16/12 SKILL Language Programming 464
SKILL Language Programming 464
Cadence AE use only:
Obtaining a Certificate Do not distribute
of Completion
Instructor-Led or Virtual Course iLS Course
1. Log in to [Link] using your 1. Log in to [Link] using your
user name and password. user name and password.
If you have problems logging in, email If you have problems logging in, email
training_enroll@[Link]. training_enroll@[Link].
2. Choose Catalog – Advanced Catalog Search 2. Find the course in your learning plan. (If necessary,
from the pull-down menus. Enter the course title in choose Learning – Learning Plan from the pull-
the Title field and click Search. down menus.)
3. Locate the item with Exam in the title. 3. Click Go to Content.
4. Click Request Approval. On the new page that 4. Locate the item with Exam in the title. Click the link
appears, click Submit. to launch the exam.
5. After receiving approval via email from Cadence 5. Complete the exam. After completion, your score
Training, again search for the course and then click will be displayed. A passing score is 75%.
Go to Content. The exam launches. 6. If you passed, download the Certificate of
6. Complete the exam. After completion, your score Completion. Under the Learning tab, click
will be displayed. A passing score is 75%. Learning History, find the course, and click Print
Completion Certificate.
7. If you passed, download the Certificate of
Completion. Under the Learning tab, click If you did not pass, you have the option of taking
Learning History, find the course, and click Print the exam again.
Completion Certificate.
If you did not pass, you have the option of taking
the exam again.
7/16/12 SKILL Language Programming 465
SKILL Language Programming 465
Cadence
Thank You AE use only: Do not distribute
Completing the Classroom Course Evaluation
1. Go to [Link]
2. Choose your region and click Go.
3. Locate your course title.
4. Click on the pencil icon to open the form.
5. Complete the course evaluation and click Submit.
Viewing Course Catalogs Scott Hargraves
Director of Education Services
1. Go to [Link].
2. Select Support & Training – Training Course Evaluation
Catalogs.
Submitting Questions and Comments
1. Email training_enroll@[Link].
7/16/12 SKILL Language Programming 466
SKILL Language Programming 466
Cadence AE use only: Do not distribute
Interprocess Communication
Appendix A
July 16, 2012
SKILL Language Programming 467
Cadence AE use only: Do not distribute
Appendix Objectives
In this appendix, you learn how to
Describe the scope of SKILL® IPC.
Describe an example C program.
Spawn the C program as a separate UNIX child process.
Communicate synchronously with the child process.
Communicate asynchronously with the child process.
7/16/2012 SKILL Language Programming 468
Terms and Definitions
Blocking read The parent process, the Virtuoso® Design Environment, is suspended
until the data is available from a child process. During a blocking
read, the parent’s user interface and graphics freeze.
Deadly embrace Two processes enter a dead lock if both wait for resources held by the
other before releasing resources. A blocking read with a timeout limit
avoids the possibility of a deadly embrace.
Kill command The UNIX kill command sends a signal to a UNIX process. The kill
command requires a UNIX process ID. The SKILL process ID is
different from the UNIX process ID.
SKILL Language Programming 468
Cadence
The Scope ofAE useIPConly: Do not distribute
SKILL
With SKILL IPC, an application can
Launch a C executable or shell command as a separate UNIX process.
Write text strings to the child’s stdin channel.
Read text strings from the child’s stout and stderr channels.
Suspend, resume, interrupt, and terminate the child process.
The example child program reads a text string from its stdin and writes the
text string containing upper case characters to its stdout.
this is a string stdin
THIS IS A STRING
stdout
stderr
Child process
7/16/2012 SKILL Language Programming 469
SKILL Language Programming 469
Cadence AE use
The toUpperCase.c only:Code
Source Do not distribute
#include <stdio.h>
#include <ctype.h>
#define TRUE 1
#define MAXLEN 100
main()
{
int c;
char s[MAXLEN],*p;
while( TRUE ) { Forever
p = s;
fgets(p, MAXLEN, stdin); Read stdin
while ( *p )
{
if (islower(*p))
*p = toupper(*p); Force case
p++;
}
printf("%s", s); Write stdout
fflush(stdout);
}
7/16/2012 SKILL Language Programming 470
The toUpperCase.c program
Reads a line from stdin using the gets function
Converts lowercase characters to uppercase characters
Uses the printf statement to write to stdout
SKILL Language Programming 470
Cadence AETwo
Comparing the use only: Do not
Communication distribute
Styles
Synchronous communication features a single flow of control.
Your user is not free to run other Virtuoso® Design Environment
commands until synchronous communication with the child is
complete.
When you call the TrUpperCase function, the user cannot run another
Virtuoso Design Environment command until the TrUpperCase function
returns.
Asynchronous communication does not grab your application’s flow of
control.
Your user is free to run other Virtuoso Design Environment commands.
Asynchronous communication with the child occurs between Virtuoso
Design Environment commands.
7/16/2012 SKILL Language Programming 471
SKILL Language Programming 471
Cadence AE use
Spawning a Child only: Do not distribute
Process
Use the ipcBeginProcess function to launch a child process.
The ipcBeginProcess function returns an integer that identifies the child
process. This ID is not the same ID used by the UNIX environment.
The newly initiated child process communicates with its parent process
using the standard descriptors: stdin, stdout, and stderr.
ipcWriteProcess
stdin
SKILL
program ipcReadProcess
stdout
stderr
Virtuoso Design Environment Child process
7/16/2012 SKILL Language Programming 472
The ipcBeginProcess Function
Use the ipcBeginProcess function to spawn a UNIX process to execute a command or sequence of
commands. The ipcBeginProcess function returns an integer process ID.
Argument Required? Type Meaning
command Required Text Spawns a UNIX process to execute
command on hostname.
hostname Optional Text The child process executes locally unless
a network node is specified for
hostname.
ioHandler Optional Text or function System invokes ioHandler when child
symbol data on stdout is available.
errHandler Optional Text or quoted System invokes errHandler when child
function symbol error on stderr is available.
postFunc Optional Text or quoted System invokes postFunc
function symbol when child terminates.
SKILL Language Programming 472
Cadence AEwith
Synchronizing usetheonly: Do not distribute
Child Process
You can synchronize a SKILL program with either of these two events in
the child process:
The child has been launched and can now accept data through its
stdin.
The child has terminated.
Whenever a SKILL program synchronizes with either of the above events,
the SKILL program suspends itself and the Virtuoso Design Environment
user interface freezes until the event happens.
Use the ipcWaitForProcess function to synchronize with the child launch
and the ipcWait function to synchronize with the child termination.
7/16/2012 SKILL Language Programming 473
The ipcWaitForProcess Function
Call the ipcWaitForProcess function before you send any data to the child process.
The ipcWait Function
Call the ipcWait function if you want to prevent the user from doing anything until the child
process terminates.
For example, the child process might create a file that is required for further steps the user
might take.
Both the ipcWaitForProcess function and the ipcWait function freeze the Virtuoso Design
Environment user interface until they return. Although the Virtuoso Design Environment user
interface is frozen, the SKILL Evaluator is available to invoke the data handler or error handler of
a child process.
SKILL Language Programming 473
Cadence AE with
Communicating usethe
only:
ChildDo not distribute
Process
The child process communicates through its stdin, stdout, and stderr with
the Virtuoso Design Environment.
ipcWriteProcess
stdin
SKILL
program ipcReadProcess
stdout
stderr
Virtuoso Design Environment Child process
You can use either synchronous or asynchronous techniques to
communicate with the child process.
7/16/2012 SKILL Language Programming 474
SKILL Language Programming 474
Cadence AE
Synchronous use only: Do not distribute
Communication
Task Synchronous Communications
Processing child data ipcReadProcess
Processing child data ipcReadProcess
Determining exit status ipcGetExitStatus
Detecting child termination ipclsAliveProcess
7/16/2012 SKILL Language Programming 475
The ipcIsAliveProcess Function
If the child process is alive, the ipcIsAliveProcess function returns t. If the child process has
terminated, the ipcIsAliveProcess returns nil.
The ipcReadProcess Function
The ipcReadProcess function reads data from the child function.
The second argument to ipcReadProcess specifies a timeout limit. This limit is the maximum time
in seconds to wait before giving up the attempt to read.
If the ipcReadProcess function times out before data is available from the child, the
ipcReadProcess function returns an empty string.
If 0 is given for the timeout value, the ipcReadProcess function only reads what is currently
available.
SKILL Language Programming 475
Cadence AE
Synchronous use only: Do
Communication not distribute
Example
procedure( TrUpperCaseList( aList )
let( ( childPID result )
childPID = ipcBeginProcess( Spawn child
simplifyFilename(
Full path
"./IPC/[Link]" )
)
ipcWaitForProcess( childPID ) Synchronize
result = foreach( mapcar element aList
ipcWriteProcess( Write to child
childPID
strcat( element "\n" )
)
ipcReadProcess( childPID 10 ) Read from child
) ; foreach
ipcKillProcess( childPID )) Terminate the child
result
) ; let
) ; procedure
TrUpperCaseList( ’( "a" "bc" "def" )) Call function
=> ("A\n" "BC\n" "DEF\n“)
7/16/2012 SKILL Language Programming 476
The TrUpperCaseList Function
The TrUpperCaseList function does the following:
Accepts a list of text strings as its single argument
Returns the list of text strings that the child sends back
Uses the functions in this table
Function Purpose
ipcBeginProcess Launch a child process to execute the compiled
UpperCase.c program.
simplifyFilename Determine the full path name to the executable.
ipcWaitForProcess Synchronously wait for the child to launch.
ipcWriteProcess Write each text string in a list to the child process.
ipcReadProcess Synchronously wait for the child to send back data.
ipcKillProcess Terminate the child process.
SKILL Language Programming 476
Cadence AECommunication
Asynchronous use only: Do not distribute
Task Asynchronous Communications
Processing child data Data handler Specify to ipcReadProcess
Processing child data Error handler Specify to ipcReadProcess
Determining exit status Postfunction Specify to ipcGetExitStatus
Detecting child termination Postfunction Specify to ipclsAliveProcess
Three SKILL functions govern asynchronous communication with the child
process. The Virtuoso Design Environment calls the following functions:
The data handler when it receives data from the child’s stdout channel.
The error handler when it receives an error from the child’s stderr
channel.
The postfunction when UNIX reports that the child has terminated.
7/16/2012 SKILL Language Programming 477
The SKILL Evaluator executes calls to data handlers, calls to postfunctions, and user input in the
order they are queued.
The dataHandler Function
You must declare the data handler to accept two arguments: o_childId and t_data. A single
data handler can service multiple child processes because the process ID of the child is a
parameter.
The child sends data to the Virtuoso Design Environment process after each newline
character or when the buffer fills or is flushed. If the data handler does not have time to read
the data before the child process writes again, the data is not lost. The data handler is only
called if data is available and the Virtuoso Design Environment is idle.
The errHandler Function
You must declare your error handler function to accept two arguments: o_childId and t_data.
The postFunc Function
You must declare your postfunction to accept two parameters: o_childId and x_exitStatus.
SKILL Language Programming 477
Cadence AECommunication:
Asynchronous use only: DoExample
not distribute
The following pages show you how to do these tasks:
Communicate asynchronously with a child process.
Re-implement the previous synchronous communication example
using asynchronous communication.
The new implementation requires a collection of functions to communicate
through global variables.
7/16/2012 SKILL Language Programming 478
SKILL Language Programming 478
Cadence AEChild
Launching the useProcess
only: Do not distribute
The TrUpperCase_Launch function launches the child and sends the first string in
the list to the child process.
procedure( TrUpperCase_Launch( aList )
let( ( childPID result )
childPID = ipcBeginProcess( Spawn child
simplifyFilename( Determine full path
"./IPC/[Link]"
)
""
’TrUpperCase_DataHandler
nil
’TrUpperCase_PostFunction
)
ipcWaitForProcess( childPID ) Synchronize
TrList = aList Initialize globals
TrResult = nil
TrUpperCase_Write( childPID ) First write to child
printf( "Launched child %d\n" childPID )
) ; let
) ; procedure
TrUpperCase_Launch( ’( "a" "bc" "def" ))
7/16/2012 SKILL Language Programming 479
The TrUpperCase_Launch Function
The TrUpperCase_Launch function accepts a list of text strings as its single argument.
It returns t.
The TrUpperCase_Launch function uses the functions in this table.
Function Purpose
ipcBeginProcess Launch a child process to execute the compiled
UpperCase.c program.
simplifyFilename Determine the full path name to the executable.
ipcWaitForProcess Synchronously wait for the child to launch.
TrUpperCase_Write Write a text string to the child process.
SKILL Language Programming 479
Cadence
Writing DataAE use
to the only: Do not distribute
Child
The several functions in the example communicate through two global
variables.
The TrList global variable contains the strings to be sent to the child
process.
The TrResult global variable contains the strings that the child process
has returned.
The TrUpperCase_Write function does the following:
Writes the first element in TrList to the child.
Sets the TrList to be the remainder of the list.
procedure( TrUpperCase_Write( pid )
ipcWriteProcess(
pid
strcat( car( TrList ) "\n" ) Access global
)
Update global
TrList = cdr( TrList )
) ; procedure
7/16/2012 SKILL Language Programming 480
SKILL Language Programming 480
Cadence AEfrom
Receiving Data usetheonly:
ChildDo not distribute
Process
Make your data handler accept these two arguments:
pid – argument identifies the child process.
data – argument is the text string that the child sent to the Virtuoso
Design Environment.
Example TrUpperCase_DataHandler function
procedure( TrUpperCase_DataHandler( pid data )
Update global
TrResult = append( TrResult list( data ))
Access global
if( TrList then
TrUpperCase_Write( pid )
else ipcKillProcess( pid )
) ; if
) ; procedure
This function appends the child data to the list in the global variable
TrResult and checks the global variable TrList to decide whether to
Send the next string to the child.
Terminate the child.
7/16/2012 SKILL Language Programming 481
The TrUpperCase_DataHandler Function
The Virtuoso Design Environment queues a call to the data handler when it receives data from the
child’s stdout channel.
The data handler executes when the SKILL Evaluator is idle.
SKILL Language Programming 481
Cadence AE use only: DoFunction
The TrUpperCase_PostFunction not distribute
Make your postfunction accept two arguments:
pid – argument identifies the child process.
status – argument is the UNIX exit status of the terminated child
process.
Use global variables to communicate with the rest of your application.
The return value of the postfunction is irrelevant.
Example of TrUpperCase_PostFunction
procedure( TrUpperCase_PostFunction( pid status )
printf( "Child %d result: %L\n" pid TrResult )
) ; procedure
7/16/2012 SKILL Language Programming 482
When a child process terminates, the Virtuoso Design Environment queues a call to the child’s
postfunction, if one exists.
The call to the postfunction executes when the SKILL Evaluator is idle.
SKILL Language Programming 482
Cadence AEChild
Controlling the useProcess
only: Do not distribute
Function Argument Action
ipcStopProcess child ID Suspends the child process
ipcContProcess child ID Resumes the child process
ipcKillProcess child ID Terminates the child process
ipcKillAllProcesses none Terminates all child processes
ipcSoftInterrupt child ID Sends a kill -2 to the child process
7/16/2012 SKILL Language Programming 483
SKILL Language Programming 483
Cadence AE use only: Do not distribute
Lab Exercises
Lab A-1 Compiling a C Program
Lab A-2 Exploring Synchronous Communication
Lab A-3 Exploring Asynchronous Communication
7/16/2012 SKILL Language Programming 484
SKILL Language Programming 484
Cadence AE use only: Do not distribute
Appendix Summary
This appendix covered
Launching a child process with the ipcBeginProcess function
Synchronizing the child process with the ipcWaitForProcess function
Waiting for the child to terminate with the ipcWait function
Writing text strings to the child’s stdin using the ipcWriteProcess
function
Reading text strings from the child’s stout using the ipcReadProcess
function
Launching a child process with a data handler and a postfunction
7/16/2012 SKILL Language Programming 485
Category Functions
Launching a child process pcBatchProcess
ipcBeginProcess
Synchronizing with a ipcWaitForProcess
child process ipcWait
Controlling a child ipcStopProcess
process ipcContProcess
ipcSoftInterrupt
ipcKillProcess
ipcKillAllProcesses
Data communication ipcReadProcess
ipcWriteProcess
data handlers
postfunctions
SKILL Language Programming 485
Cadence AE use only: Do not distribute
7/16/2012 SKILL Language Programming 486
SKILL Language Programming 486
Cadence AE use only: Do not distribute
SKILL Debugger
Appendix B
July 16, 2012
SKILL Language Programming 487
Cadence AE use only: Do not distribute
Appendix Objectives
In this appendix, you learn how to describe the most useful facilities of the
command-line SKILL® debugger, including:
Single-step tracing
Function tracing
Trapping SKILL errors
Setting and clearing breakpoints
Single-step execution
7/16/2012 SKILL Language Programming 488
SKILL Language Programming 488
Cadence AE useEnvironment
SKILL Development only: Do not distribute
The SKILL Development Environment is a separate product from the
Design Framework II environment. It contains several utilities to help you
perform a variety of SKILL development tasks.
Utility Task
SKILL Debugger Trap errors.
Suspend execution.
Monitor execution.
SKILL Lint Identify potential errors, oversights, and inefficient constructs.
SKILL Profiler Measure performance and memory usage.
SKILL Surveyor Survey SKILL code to determine what changes are needed to
migrate to a new version of Cadence software.
7/16/2012 SKILL Language Programming 489
The SKILL Development Environment tools help you to
Reduce the time it takes to develop or migrate your SKILL program.
Improve the quality and efficiency of your SKILL program.
SKILL Language Programming 489
Cadence AE useWindow
SKILL Development only: Do not distribute
You can access all of the capabilities of the SKILL Development
Environment through SKILL functions. Alternatively, the SKILL
Development window is an interface to many of the facilities of the SKILL
Development Environment.
In the CIW, the Open – SKILL Development command opens the SKILL
Development window.
Control a debugging session
Analyze common source code for errors
Measure CPU time and memory usage per function
Display a tree of function calls within a requested function
Trace values of functions, variables or properties
Locate Cadence functions providing syntax and synopsis
Scan code to identify functions that changed between revisions
7/16/2012 SKILL Language Programming 490
SKILL Language Programming 490
Cadence AE Toolbox
SKILL Debugger use only: Do not distribute
The SKILL Debugger button in the SKILL Development window opens the
SKILL Debugger Toolbox.
The SKILL Debugger Toolbox provides a command button interface to most
of the SKILL Debugger commands.
7/16/2012 SKILL Language Programming 491
In your .cdsinit file, you can define a bindkey for the F4 key to open the SKILL Debugger
Toolbox.
hiSetBindKey( "Command Interpreter"
"<Key>F4" "ilDebugToolBox()" )
SKILL Language Programming 491
Cadence AE use
Using Single-Step only:
Tracing Do notandistribute
to Analyze Error
When your program causes a SKILL error, the following happens:
Your program aborts before completing.
The CIW displays an error message.
Often, single-step tracing provides enough information for you to determine
the cause of the error.
To use single step tracing follow these steps:
1. In the CIW, turn on single-step tracing.
tracef( t )
2. Run your application.
The SKILL Debugger displays the arguments and the return value of each
function [Link]
Evaluator displays an error message.
3. In the CIW, turn off single-step tracing.
untrace()
7/16/2012 SKILL Language Programming 492
Single-step tracing can be very effective, but it has the following drawbacks:
Single-step tracing produces a lot of output. If the SKILL error does not occur early in the
run, you can easily get confused or lost looking at the output.
The output shows each function call with evaluated arguments. It can be hard to correlate the
output with your source code.
The Tracing Form
The Tracing command is in both the SKILL Debugger Toolbox and the SKILL Development
Toolbox. It brings up the Tracing form. You can use this form to control tracing instead of using
the tracef and untrace functions.
SKILL Language Programming 492
Cadence AE
A Single-Step useExample
Trace only: Do not distribute
Examine the lines preceding the error message for evidence.
\i TrShapeReport( window(3))
\o |window(3)
\o |window --> window:3
\o |TrShapeReport(window:3)
\o ||outfile("/tmp/[Link]")
\o ||outfile --> port:"/tmp/[Link]"
\o ||TriShapeReport(window:3 port:"/tmp/[Link]")
\o |||(window:3~>libName)
\o |||getSGq --> nil
\o |||(window:3~>cellName)
\o |||getSGq --> nil
\o |||(window:3~>viewName)
\o |||getSGq --> nil
\o |||fprintf(port:"/tmp/[Link]" "%s %s %s contains:" nil nil nil)
\e *Error* fprintf/sprintf: format spec. incompatible with data – nil
Can you spot what causes the fprintf/sprintf error?
7/16/2012 SKILL Language Programming 493
In this example, the trace output indicates that the code expects a cellview database object but is
dealing with a window ID.
SKILL Language Programming 493
Cadence AE useTrace
Another Single-Step only: Do not distribute
Example
Can you determine the cause of the error from the following trace?
\i TrShapeReport( window( 4 ))
\o |window(4)
\o |window --> window:4
\o |TrShapeReport(window:4)
\o ||outfile("/tmp/[Link]")
\o ||outfile --> port:"/tmp/[Link]"
\o ||TriShapeReport(window:4 port:"/tmp/[Link]")
\o |||geGetWindowCellView(window:4)
\o |||geGetWindowCellView --> db:41474092
\o |||(db:41474092~>libName)
\o |||getSGq --> "master"
\o |||(db:41474092~>cellName)
\o |||getSGq --> "mux2"
\o |||(db:41474092~>viewName)
\o |||getSGq --> "layout"
\o |||fprintf(port:"/tmp/[Link]"
"%s %s %s contains:" "master" "mux2" "layout")
\o |||fprintf --> t
\o |||(db:41474092~>shapes)
\o |||getSGq --> (db:41517992 db:41517736 db:41517480 db:41517224 db:41528864 ... )
\o |||(db:41517992~>objType)
\o |||getSGq --> "textDisplay"
\e *Error* postincrement: can't handle add1(nil)
Sometimes trace output yields no evidence.
How can you find out more about this error?
7/16/2012 SKILL Language Programming 494
procedure( TrShapeReport( wid )
let( ( thePort )
thePort = outfile( "/tmp/[Link]" )
when( thePort
TriShapeReport( wid thePort )
close( thePort )
) ; when
view( "/tmp/[Link]" TrReportBBox "Shape Report" )
) ; let
) ; procedure
procedure( TriShapeReport( wid outport )
let( ( rectCount polygonCount pathCount miscCount )
cv = geGetWindowCellView( wid )
fprintf( outport "%s %s %s contains:"
cv~>libName cv~>cellName cv~>viewName )
foreach( shape cv~>shapes
case( shape~>objType
( "rect" rectCount++ )
( "polygon" polygonCount++ )
( "path" pathCount++ )
( t miscCount++ )
) ; case
) ; foreach
fprintf( outport "\n%-10s %-10d" "Rectangles" rectCount )
fprintf( outport "\n%-10s %-10d" "Polygons" polygonCount )
fprintf( outport "\n%-10s %-10d" "Paths" pathCount )
fprintf( outport "\n%-10s %-10d" "Misc" miscCount )
list( cv~>libName cv~>cellName cv~>viewName )
) ; let
) ; procedure
SKILL Language Programming 494
Cadence AE Debugger
Using the SKILL use only:
to Do
Trapnot distribute
an Error
Normally, when your program causes a SKILL error, your program is aborted.
SKILL discards the knowledge about the program state at the time of the error. This
knowledge includes the following:
The values of local variables
The sequence of function calls under evaluation at the time of the SKILL
error
This information can help you determine the cause of the error. To examine this
information before SKILL discards it, you must trap the error:
1. Install the SKILL Debugger.
2. This enables the SKILL Debugger to trap any untrapped error.
3. Run your application to reproduce the error.
4. The SKILL Debugger traps the error.
5. Display the SKILL stack and dump the local variables.
6. Analyze the flow of control.
The following slides cover more details of this debugging approach.
7/16/2012 SKILL Language Programming 495
SKILL Language Programming 495
Cadence
Installing theAE use
SKILL only: Do not distribute
Debugger
There are two ways to install the SKILL Debugger:
Use the installDebugger function in your .cdsinit file to install the SKILL
Debugger at your session’s startup.
Use the SKILL Debugger Toolbox to install the debugger.
Open the SKILL Debugger
Toolbox to install the debugger.
When you install the SKILL Debugger, the prompt in the lower left corner of the CIW
changes from > to 1>. The prompt in the [Link] file also changes from > to 1>.
7/16/2012 SKILL Language Programming 496
The installDebugger Function
You can use the installDebugger function in your .cdsinit file to install the SKILL Debugger. The
installDebugger function does the following tasks:
Installs the SKILL Debugger as the default error handler.
Turns on the debugMode switch to clear the write protection on all functions. While the
SKILL Debugger is installed, you can redefine any SKILL function.
The uninstallDebugger Function
The uninstallDebugger function does the following tasks:
Restores the normal system error handler.
Turns off the debugMode switch to restore the write protection on all functions.
SKILL Language Programming 496
Cadence AESKILL
Displaying the useStack
only: Do not distribute
To display the SKILL stack, use one of these two alternatives:
Use the Stacktrace command on the SKILL Debugger Toolbox.
Use the stacktrace function.
7/16/2012 SKILL Language Programming 497
The Dump Command
Prints the current value of all the local variables on the stack.
The Stacktrace Command
Prints the functions on the stack and their arguments.
The Where Command
This command displays the SKILL stack and the values of all the local variables that you can
reference.
SKILL Language Programming 497
Cadence AE
Analyzing the useStack
SKILL only: Do not distribute
A SKILL stack trace displays the sequence of function calls under evaluation, using
one line per function call. For the most recent function call, it displays all the
expressions under evaluation.
\p Debug 2>
\i stacktrace()
\e <<< Stack Trace >>>
\e errorHandler("postincrement" 0 t ... )
\e (miscCount = miscCount)
\e miscCount++
\e case((shape~>objType) ("rect" rectCount++) ("polygon“ polygonCount++) ... )
\e foreach(shape (cv~>shapes) case((shape~>objType) ("rect" &) ("polygon" &) ... ))
\e let((rectCount polygonCount pathCount ... ) (rectCount = (polygonCount = &))
(cv = geGetWindowCellView(wid)) ... )
\e TriShapeReport(wid thePort)
\e TrShapeReport(window(4))
\t 8
\p Debug 2>
\i miscCount
\t nil
\p Debug 2>
SKILL abbreviates each line with these notations:
( ... ) indicates arguments that have been clipped.
( & ) indicates function invocations that have been clipped.
You control the clipping with the tracelevel and tracelength variables.
7/16/2012 SKILL Language Programming 498
tracelevel
This environment variable controls the depth of elements in a list that are printed during tracing.
tracelength
This environment variable controls the number of elements in a list that are printed during tracing.
SKILL Language Programming 498
Cadence AE use only: Do not distribute
Debugging Example
The following slides show an excerpt from the ~/[Link] file. This slide
shows the following steps:
Installing the SKILL Debugger
Running your program
The SKILL Debugger traps the error.
\p >
\i installDebugger()
\t t
\p 1>
\i TrShapeReport( window( 4 ))
\o *** Error in routine postincrement:
\o Message: *Error* postincrement: can't handle add1(nil)
\o SKILL Debugger: run GUI-based tools/bin/cdsFinder
on search string `debug' for a list of commands or debugQuit to leave.
\p Debug 2>
7/16/2012 SKILL Language Programming 499
SKILL Language Programming 499
Cadence AE use only: Do not distribute
Debugging Example (continued)
This excerpt from the ~/[Link] shows these next two steps:
Dumping the SKILL stack at the time of the error.
Examining the value of the miscCount variable.
\p Debug 2>
\i stacktrace()
\e <<< Stack Trace >>>
\e errorHandler("postincrement" 0 t ... )
\e (miscCount = miscCount)
\e miscCount++
\e case((shape~>objType) ("rect" rectCount++) ("polygon“ polygonCount++) ... )
\e foreach(shape (cv~>shapes) case((shape~>objType) ("rect" &) ("polygon" &) ... ))
\e let((rectCount polygonCount pathCount ... ) (rectCount = (polygonCount = &))
(cv = geGetWindowCellView(wid)) ... )
\e TriShapeReport(wid thePort)
\e TrShapeReport(window(4))
\t 8
\p Debug 2>
\i miscCount
\t nil
\p Debug 2>
What caused the error?
How can you fix the error?
7/16/2012 SKILL Language Programming 500
SKILL Language Programming 500
Cadence
Suspending AE use only:Your
and Resuming DoProgram
not distribute
Sometimes the bug you are investigating does not cause a SKILL error.
When your program runs to completion, you need to validate the output.
Using the CIW, you can interactively verify expressions from your program.
The SKILL expressions in your program typically depend upon function
arguments and local variables.
Before verifying the SKILL expressions in the CIW, you need to set the
variables in the expressions to appropriate values. But, doing so is time
consuming and error prone. It is better to run your program and suspend
the execution at the expression you want to evaluate.
To have SKILL suspend your program, you have two alternatives:
You can edit the source code for your program to call the break
function. SKILL suspends your program when your program calls the
break function.
You can set a breakpoint at a function boundary. SKILL suspends your
program when the flow of control reaches the function boundary.
After examining local variables and verifying expressions, you resume the
execution of your program.
7/16/2012 SKILL Language Programming 501
A function boundary consists of four points. Each point is an event that occurs during a function
call. The order of events is call, entry, exit, and return. In the following table, the caller refers to
the code that contains the function call and the callee refers to the function itself:
Point Description
Call In the caller, after SKILL evaluates the argument expressions
Entry In the callee, after binding the caller’s actual arguments to the
callee’s formal arguments
Exit In the callee, after computing the return result
Return In the caller, after running to the caller
You can set a breakpoint at all four points for any function you define while the SKILL Debugger
is installed.
For other SKILL functions, you can set a breakpoint at only the call point or the return point.
SKILL Language Programming 501
Cadence AE use only: Do not distribute
Setting Breakpoints
To set a breakpoint at a function, use one of these two alternatives:
Use the Set Breakpoints command available on the SKILL Debugger
Toolbox. This command lets you
Set a conditional breakpoint at the entry point of a function.
Set a conditional breakpoint at the exit point of a function.
Clear all breakpoints that are currently set.
This command does not let you set more than one breakpoint on a
function at a time.
Use the breakpt function.
Example
If you want to set a breakpoint both at the entry point and at the exit point of
a function, you must use the breakpt function.
The following example sets an unconditional breakpoint at the entry and at
the exit of the TriShapeReport function.
breakpt( TrShapeReport ( ( entry t ) ( exit t ) ))
7/16/2012 SKILL Language Programming 502
The breakpt Function
breakpt( [s_function [break_condition]])=> g_result
This function sets breakpoints on one or more functions. The SKILL debugger is the default break
handler and is entered automatically when a breakpoint is encountered. The functions breakpt and
unbreakpt set and clear breakpoints on the functions given.
If no break_conditions are given, the breakpoint is called "unconditional." The behavior of an
unconditional breakpoint is as follows:
if the function is read-protected or not yet defined under debugMode, the breakpoint is
assumed to be set at the "call" point.
Otherwise, it is assumed to be set at the "entry" point of the function.
Value returned:
List of functions whose breakpoints have been set.
SKILL Language Programming 502
Cadence AE use only: Do not distribute
Clearing Breakpoints
To clear one or more breakpoints, use one of these two alternatives:
Use the Set Breakpoints command available on the SKILL Debugger
Toolbox. This command allows you to
Clear a breakpoint at a function.
Clear all breakpoints that are currently set.
Use the unbreakpt function.
7/16/2012 SKILL Language Programming 503
The unbreakpt Function
unbreakpt( [s_function... | t] ) => g_result
Clears breakpoints for the functions listed. The return value is the names of the functions for
which the breakpoints were removed.
SKILL Language Programming 503
Cadence AE use only: Do not distribute
Hitting a Breakpoint
The following excerpt from the ~/[Link] shows these steps:
1. Setting a breakpoint at the entry of the TriShapeReport function.
2. Calling the TrShapeReport function.
3. Displaying the stack at the breakpoint.
4. Examining the wid and thePort function arguments.
\i breakpt TriShapeReport
\t (TriShapeReport)
\p 1>
\i TrShapeReport( window( 4 ))
\o <<< Break >>> on entering TriShapeReport
\o SKILL Debugger: ...
\p Debug 2>
\i stacktrace
\e <<< Stack Trace >>>
\e breakHandler(nil)
\e entry of TriShapeReport
\e TriShapeReport(wid thePort)
\e TrShapeReport(window(4))
\t 3
\p Debug 2>
\i wid
\t window:4
\p Debug 2>
\i thePort
\t port:"/tmp/[Link]"
\p Debug 2>
7/16/2012 SKILL Language Programming 504
SKILL Language Programming 504
Cadence AEProgram
Resuming Your use only: Do not distribute
To resume your suspended program from a breakpoint, you have these options:
Use the Continue command on the SKILL Debugger Toolbox.
Use the continue function.
Your program continues to execute. If the flow of control reaches another
breakpoint, your program suspends execution again.
7/16/2012 SKILL Language Programming 505
The Continue Command
Continues execution from a breakpoint.
The Continue Function
cont( )
continue( )
Continues execution from a breakpoint. The cont and continue functions are identical.
cont( ) => exits the break handler
SKILL Language Programming 505
Cadence
The continueAE use only: Do not distribute
Function
Use the continue function to resume your program from a breakpoint.
Example
\i breakpt( outfile TriShapeReport TrShapeReport )
\t (TrShapeReport TriShapeReport outfile)
\p 1>
\i TrShapeReport( window( 4 ))
\o <<< Break >>> on entering TrShapeReport
\o SKILL Debugger: ...
\p Debug 2>
\i continue
\o <<< Break >>> on calling outfile with args
("/tmp/[Link]")
\o SKILL Debugger: ...
\p Debug 2>
\i continue
\o <<< Break >>> on entering TriShapeReport
\o SKILL Debugger: ...
\p Debug 2>
\i stacktrace
\e <<< Stack Trace >>>
\e breakHandler(nil)
\e entry of TriShapeReport
\e TriShapeReport(wid thePort)
\e TrShapeReport(window(4))
\t 3
\p Debug 2>
7/16/2012 SKILL Language Programming 506
The excerpt from the ~/[Link] shows these steps:
Setting a breakpoint at the entry of the outfile, TriShapeReport, and TrShapeReport functions.
Calling the TrShapeReport function.
Continuing from the breakpoint at the entry of the TrShapeReport function.
Continuing from the breakpoint at the call to the outfile function.
Displaying the stack.
SKILL Language Programming 506
Cadence AE Your
Single-Stepping use Program
only: Do not distribute
From a breakpoint, you can execute your program one function call at a
time. To run your program in single-step mode, you have the following
options:
Use the Step command on the SKILL Debugger Toolbox.
Use the step function.
SKILL suspends your program after executing the current function call.
7/16/2012 SKILL Language Programming 507
This example shows single-stepping from a breakpoint at the TrShapeReport function.
\i breakpt TrShapeReport
\t (TrShapeReport)
\p 1>
\i TrShapeReport( window( 4 ))
\o <<< Break >>> on entering TrShapeReport
\o SKILL Debugger: ...
\p Debug 2>
\i step
\o stopped before evaluating let((thePort)
(thePort = outfile("/tmp/[Link]")) ... )
\p Debug 2>
\i step
\o stopped before evaluating (thePort = outfile("/tmp/[Link]"))
\p Debug 2>
\i step
\o stopped before evaluating outfile("/tmp/[Link]")
\p Debug 2>
\i step
\o stopped before evaluating when(thePort TriShapeReport(wid thePort) ... )
\p Debug 2>
\i step
\o stopped before evaluating TriShapeReport(wid thePort)
\p Debug 2>
\i step
\o <<< Entering TriShapeReport >>>
\o stopped before evaluating let((rectCount polygonCount pathCount ... ) ...
\p Debug 2>
SKILL Language Programming 507
Cadence AE Sessions
SKILL Debugger use only: Do not distribute
When the SKILL Debugger suspends your program because of a
breakpoint or an error trap, it creates a debugger session.
In a debugger session, you can examine the program state as follows:
Use the CIW to examine local variables or evaluate an expression that
refers to local variables.
Display the stack to clarify the flow of control.
Breakpoint
If the program is suspended due to a breakpoint, you have these choices:
Resume the program.
Abort the program by quitting the debugger session.
Error Trap
If the program is suspended due to an error trap, you can only abort the
program.
7/16/2012 SKILL Language Programming 508
After you have fixed a problem, make sure that you abort the program before rerunning it.
SKILL Language Programming 508
Cadence AE useSession
Quitting a Debugger only: Do not distribute
When you are at a breakpoint, you can abort your program by quitting the debugger
session.
When the SKILL Debugger traps an error, you cannot resume your program. After
examining local variables and displaying the stack, you need to quit the debugger
session.
You can choose either of these ways to quit a debugger session:
Use the Terminate Debugging and Quit Debugger command in the SKILL
Debugger Toolbox.
Use the debugQuit function.
In fact, the SKILL Debugger does not restrict your access to other activities in the
Virtuoso Design Environment. It is a good idea to exit the debugger session as soon
as you have finished your investigation of the program state.
7/16/2012 SKILL Language Programming 509
SKILL Language Programming 509
Cadence AEDebugger
Nesting SKILL use only: Do not distribute
Sessions
The SKILL Debugger nests debugger sessions. The prompt in the CIW
indicates a number that is one higher than the number of nested SKILL
Debugger sessions.
Error or breakpoint Error or breakpoint
1> Debug 2> Debug 3>
Quit Debugger Quit Debugger
Why does the SKILL Debugger nest debugger sessions?
7/16/2012 SKILL Language Programming 510
The SKILL Debugger does not restrict your access to the Design Framework II environment.
During a debugger session, you can still do the following through the user interface:
Trigger the evaluation of other SKILL expressions.
Use the CIW to evaluate a SKILL expression.
One of these SKILL expressions can generate an error or call a function.
To exit all nested debugger sessions without quitting the debugger, type reset in the CIW.
SKILL Language Programming 510
Cadence AE Summary
SKILL Debugger use only: Do not distribute
To set an error trap, install the SKILL Debugger. This error trap only traps
errors that are not otherwise trapped.
You do not have to install the SKILL Debugger if you just want to set
breakpoints.
It is a good idea to install the SKILL Debugger and define several aliases in
your .cdsinit file. Include the following lines in your .cdsinit file:
installDebugger()
alias( q debugQuit )
alias( c continue )
7/16/2012 SKILL Language Programming 511
SKILL Language Programming 511
Cadence
Other SKILLAE use only:
Debugger Do not distribute
Benefits
While the SKILL Debugger is installed, you have the following advantages:
You can redefine any SKILL function.
When you call the edit function, you can specify just the function name,
as in this example:
edit( TrShowFileBrowser t )
You can call the whereIs function to display information about a
function’s source code file as in this example.
whereIs( TrShowFileBrowser )
TrShowFileBrowser is defined in file
"/usr1/mnt/skilldev/SKILL/CaseStudy/[Link]"
at line 492.
7/16/2012 SKILL Language Programming 512
While the SKILL Debugger is installed, the load function associates the file being loaded with
each function that the file declares.
SKILL Language Programming 512
Cadence AE use only: Do not distribute
Lab Exercises
Lab B-1 Analyzing the Error
Lab B-2 Running Debugger Sessions
7/16/2012 SKILL Language Programming 513
SKILL Language Programming 513
Cadence AE use only: Do not distribute
Appendix Summary
This appendix covered
The command-line SKILL Debugger
7/16/2012 SKILL Language Programming 514
SKILL Language Programming 514
Cadence AE use only: Do not distribute
SKILL Examples
Appendix C
July 16, 2012
SKILL Language Programming 515
Cadence AE use only: Do not distribute
Appendix Overview
In this appendix, the SKILL examples include:
CCSraiseWindow (Solution #11637206) – user interface
CCSslotMetal (Solution #11252132) – database update
CCSaddProp (Solution #11138234) – foreach cell in a library
Stroke Editor (Solution #11618300) – mouse stroke user interface
7/16/2012 SKILL Language Programming 516
Iteration To repeatedly run a collection of SKILL® expressions.
SKILL Language Programming 516
Cadence AE use
CCSraiseWindow only:
SKILL Do not distribute
Example
Problem
You have many design windows open. Some of the windows might be
iconified, and some might be under other windows.
Is there a way to list the windows and select one to be on the top?
Solution: (11637206) See Cadence Online Support for details.
1. Create a menu using hiCreateSimpleMenu.
2. For the list of choices, convert the window IDs to window names using:
foreach(mapcar win hiGetWindowList()
winName = hiGetWindowName(win)…
3. For the callbacks for each choice, convert the list of window IDs to the
SKILL commands needed to deiconify and raise the window.
foreach(mapcar win hiGetWindowList()
sprintf(nil strcat("hiDeiconifyWindow(window(%d)) &&
"hiRaiseWindow(window(%d))") win->windowNum win->windowNum))
7/16/2012 SKILL Language Programming 517
procedure(CCSraiseWindow()
let( (winName)
;; create and display a simple pop-up menu containing a list
;; of windows that currently exist for the session
hiDisplayMenu(
hiCreateSimpleMenu('CCSschWinList
"Window List"
;; build a list of window name references
foreach(mapcar win hiGetWindowList()
winName = hiGetWindowName(win)
;; if the window name contains a ':' then use the part of
;; the name after the ':', otherwise just use the whole
;; window name - this is to remove a prefix like
;; "Virtuoso Schematic Editor L Reading"
if(index(winName ":")
substring(index(winName ":") 2)
winName
)
); foreach
;; build a list of callbacks, each one will deiconify and/or
;; raise a specific window using the window number
foreach(mapcar win hiGetWindowList()
sprintf(nil strcat("hiDeiconifyWindow(window(%d)) &&
"hiRaiseWindow(window(%d))") win->windowNum win->windowNum)
); foreach
); hiCreateSimpleMenu
); hiDisplayMenu
); let
); procedure CCSraiseWindow
hiSetBindKey("Command Interpreter" "Ctrl<Key>w" "CCSraiseWindow()")
SKILL Language Programming 517
Cadence AE
CCSslotMetal useExample
SKILL only: Do not distribute
Problem
Is there a way to automatically create slotted metal paths for wide path
wires?
Our process rules require slotting in metal that is a certain width or
wider. What is the easiest way to create such paths?
Solution: (11252132) See Cadence Online Support for details.
1. You can create a slotted metal structure by using the Virtuoso Create –
Multipart Path menu and then by saving it as a template.
2. In addition, you can further simplify and automate the process by using
the SKILL code, [Link], that is attached to the solution. The code
uses an enterPath function to gather the points and provide visual
feedback for the outline of the path; the function provides a command
options form to control the path layer, width, and entry snap mode. The
digitized points are passed to a procedure that calls the
rodCreatePath() function to make the Multipart Path (MPP).
7/16/2012 SKILL Language Programming 518
You can download the example from Cadence® Online Support.
SKILL Language Programming 518
Cadence
CCSaddPropAE use
SKILL only: Do not distribute
Example
Problem
Is there a SKILL routine that adds the prCellType property to all the
cells in the library?
Solution (11138234): See Cadence Online Support for details.
1. Locate the library:
libId = ddGetObj( lib_name )
2. Loop through all cells in the library:
foreach( cell libId~>cells~>name
cellId = ddGetObj( lib_name cell )…
3. Check to see if it is a layout cellview:
if( member( "layout" cellId~>views~>name )…
4. Open the cellview and replace the property:
viewId = dbOpenCellViewByType( lib_name cell "layout“ "" "a")
dbReplaceProp( viewId "prCellType" "string" "standard")
7/16/2012 SKILL Language Programming 519
procedure(CCSaddProp( lib_name )
let( ( libId cellId viewId)
unless( libId = ddGetObj( lib_name )
error( "Could not get library %s." lib_name )
)
foreach( cell libId~>cells~>name
cellId = ddGetObj( lib_name cell )
if( member( "layout" cellId~>views~>name )
then
if(ddIsObjWritable(ddGetObj(lib_name cell "layout"))
then
viewId = dbOpenCellViewByType( lib_name cell "layout"
"" "a")
dbReplaceProp( viewId "prCellType" "string" "standard")
dbSave( viewId )
dbClose( viewId )
else
printf( "CCSaddProp: can't edit %s.\n" cell)
) ; end of if
) ; end of if
) ; end of foreach
) ; end of let
) ; end of procedure
In CIW:
load("[Link]")
CCSaddProp("dp_lib")
SKILL Language Programming 519
Cadence
Stroke EditorAE use only: Do not distribute
Example
Problem
How can I use the mouse to perform actions like pan, zoom in, zoom
out, copy, delete etc.?
In other words, I would like to use mouse gestures or "strokes" to
perform some action when a shape is drawn with the mouse.
Solution (11618300) See Cadence Online Support for details.
The software has a capability called “strokes,” and it can be set up by
loading a few files as shown here:
setSkillPath( append( list(prependInstallPath("etc/sted")) getSkillPath()))
load("[Link]")
load("[Link]")
hiLoadStrokeFile("[Link]" "Layout")
This file, [Link] contains the stroke definitions. The strokes can be viewed or
saved to another file using the stroke_editor executable in the tools/bin directory of
your tool installation. In addition to the "Layout" shown above, you can load strokes
for "Schematics" or "Symbol" among some of the tool choices.
7/16/2012 SKILL Language Programming 520
You can draw with the right mouse button depressed to make stroke shapes or mouse gestures
in the graphical window. For example, a straight line left, down, up or right pans the view. A "w"
shape performs a "window fit" operation, a "c" shape performs copy, and so on.
A brief summary is shown here:
Shape | Action Comment
-----------------+--------------------------------------------------------------------------------------------
alpha | Delete (lower-case Greek alpha/aleph, fish-like shape, α)
C | Copy (selected set, or object under stroke with infix=t)
M | Move (selected set, or object under stroke with infix=t)
P | Query Properties (selected set, or object under stroke with infix=t)
S | Stretch (selected set, or object under stroke with infix=t)
u | Undo ("U" with a tail)
W | Fit Window (lower-case Greek omega or jagged W will work)
Z | Zoom in
\ | Zoom out
| | Pan Up/Down (depending in which direction is drawn)
- | Pan Left/Right (depending in which direction is drawn)
Often the stroke action is in proportion to the size of the stroke. A "z“ zooms into the area that the
z was drawn over. If "infix" is turned on, then actions such as copy, delete or move apply to the
object the stroke was drawn over, if nothing is previously selected.
SKILL Language Programming 520
Cadence AE use only: Do not distribute
Updating SKILL Code for New Objects
Appendix D
July 16, 2012
SKILL Language Programming 521
Cadence AE use only: Do not distribute
Appendix Objectives
In this appendix, you learn how to:
Create and find new objects in the database
Update their SKILL® code to replace CDB data conventions to new
objects
Understand and fix some of the major changes to their SKILL, such as
timeStamps
Find and fix any form problems
Relevant Documentation
Virtuoso Design Environment Adoption Guide
Cadence® User Interface on QT Compatibility Guide
Virtuoso® Design Environment SKILL: What's New?
Virtuoso User Interface SKILL: What's New?
7/16/2012 SKILL Language Programming 522
SKILL Language Programming 522
Cadence
How Do NewAE useAffect
Objects only:Your
DoCode?
not distribute
New objects replace data conventions in CDB.
Boundaries, blockages, rows, and sites
CDB – shapes on special LPPs
OA – new objects for interoperability
Interconnect was created through paths and instances.
Update your code to create and access the new objects.
Functions need to look for pathSegs as well as paths.
Create/search for native objects instead of shapes on special LPPs.
In general:
In SKILL code, find CDB data conventions and replace with new objects.
A V T V
7/16/2012 SKILL Language Programming 523
Throughout this discussion, we’ll keep returning to this theme: Why do we want to access these new
objects through SKILL at all? Many Cadence customers have a significant investment in SKILL, and
there’s a good chance that this SKILL accesses, creates, or modifies objects that behave similarly to these
new DFII objects. That’s why it’s important to understand these new objects in a fundamental, deep-down
sense.
In your old SKILL code, you might find that you were creating these exact objects, only in the form of
shapes on a specific layer-purpose pair (LPP). For example, a rectangle (which is a unique database object)
on the layer metal1 with a purpose blockage might serve by the tool as a blockage for metal1, preventing
any metal1 routing from taking place where that shape lies. The problem with this approach is that now,
every tool in the design flow must understand that a shape on that layer/purpose serves as a blockage. It’s
what we call a data convention.
In OpenAccess 2.2, many objects that were represented with data conventions (shapes on special LPP’s)
have a new, unique representation directly in the database. We’ll address this more in coming slides, but the
short version is: All tools will see these new objects in exactly the same way, with no interpretation
necessary.
The challenge comes in repairing SKILL code that looks for these data conventions, or creates objects that
use them. In general, use the knowledge that you obtain in this chapter about how these objects work and
are used in order to best predict where (in your SKILL code) you will need to make modifications. Look for
those special layer names or purposes, especially if they are unique to your design process.
It’s important to know how these objects are accessed and created through the SKILL language if your
applications will be used with OpenAccess 2.2 data. This appendix makes the process of updating your
code much easier.
SKILL Language Programming 523
Cadence
New Object: AE
Viasuse only: Do not distribute
A via is a design object.
It is defined in the technology file.
stdViaDef
customViaDef
Vias are placed as vias and not as
instances.
A via is added directly to a net.
Virtual memory savings
leHiCreateVia
leHiCreateWire
7/16/2012 SKILL Language Programming 524
Vias are a design object from the technology file. The standardViaDef is most often used in
custom design, the customViaDef is used by place and route tools. The vias are placed as shapes,
not instances and are added directly to the net.. This creates a significant savings in virtual
memory for the millions of vias in a design.
SKILL Language Programming 524
Cadence AE use
SKILL-level Access only: Do not distribute
to Vias
CDB Equivalent Finding
dbCreateInst or dbCreateParamInst cv = geGetEditCellView()
db:0x0448ff9b
viaList = cvId~>vias
Creating
(db:0x04483121 db:0x0448f19a ...
viaDefId = techFindViaDefByName(
techId viaHeaders = cvId~>viaHeaders
viaDefName )
(db:0x04478321 db:0x0449f13b ...
dbCreateVia(
Attributes
d_cellviewId
d_viaDefId via~>?
l_point (cellView objType prop purpose viaHeader route routeStatus
t_orient direction topology origin orient bBox net pin connRoutes
[ l_paramList ]
) => d_viaId figGroup markers groupMembers parent children
)
When a via is placed using SKILL,
you must find and assign all
design rule values.
7/16/2012 SKILL Language Programming 525
This is an example of how you explore the different objects, listing the CDB equivalent, the
SKILL creation command for the new object, how to find the new object in the cellview, and the
attributes for the new object.
SKILL Language Programming 525
Cadence AE use only: Do not distribute
How Vias Work
When a via is defined in the technology
file, a via header is defined. It has all
default parameter values defined from
the techfile.
When a via is placed, a subHeader is Via Header
created in VM. cutRows = 1
Has all changed parameters. Listed
as “overrideParams” attribute on subHeader subHeader
via subHeader cutRows = 4 cutRows = 3
Unchanged parameters are
accessed from the Via Header
Placement Placement
Each variant has a subHeader
cutRows = 4 cutRows = 3
A subHeader can have many
variants (all with exact same param
values)
The Header and subHeaders are all
viaHeader objects on the cellView.
7/16/2012 SKILL Language Programming 526
Much like pcells, via placements refer to a viaHeader. The viaHeader contains the parameter
values instead of those values being assigned to each instance. This is a significant memory
savings. If the via parameter value is the same as the default on the custom via master or
stdViaDef, the value is not assigned to the viaHeader.
SKILL Language Programming 526
Cadence
New Object: AE use only: Do not distribute
pathSegs
Defined as a single two point
segment on a single layer
Can be orthogonal (90°) or
diagonal (45°) only
All endpoints and boundary
vertices are automatically on-
grid.
Octagonal End
Points for 45-degree Path segs
segments
Not the same as a path object!
7/16/2012 SKILL Language Programming 527
In the past, interconnect was created using chains of paths and special instances that provided
connection between metal layers. Paths, of course, are an important aspect of custom layout, being
very flexible in the angles, end styles, and other features that are possible with paths.
Unfortunately, this same flexibility makes it difficult for Place and Route software to make sense
of paths that have edges that are off-grid, have odd angles, or have different end styles.
To solve the problem of interconnect, OpenAccess 2.2 introduces a new object, the path segment.
In OpenAccess 2.2, this is referred to as an oaPathSeg, or a pathSeg for short. pathSegs are much
simpler than paths, in that they:
Can only have two points: a beginning point and an end point. If a connection requires more
points, a chain of pathSegs will be needed.
Must be either orthogonal or diagonal. The diagonal path segments have octagonal end-
styles, each vertex of which can easily be placed on-grid.
Can easily be forced on-grid.
Paths continue to exist in the database in the exact same manner as they have in the past. We
simply have added a new, simpler, interoperable object that can readily be interpreted by P&R
applications as interconnect.
PathSegs created by the Virtuoso applications comply with the DEF specification of pathSegs,
which specifies the algorithm used to create the octagonal edge-points. This is compatible with
the DEF 5.7 syntax.
SKILL Language Programming 527
Cadence
New Object: AE use only: Do not distribute
pathSegs (continued)
Why use pathSegs?
Virtuoso® software keeps endpoints of pathSegs and vias attached.
DEF Equivalent: Recognized by other tools as routing objects.
Any segment can have its width changed.
45 degree segments have all points, centerline, and boundary on grid.
When should I not use pathSegs?
PathSegs are used for interconnect.
PathSegs are limited to 0, 90 and 45 degree angles.
Paths can be created at any angle.
Paths are used for guard rings and other non-connectivity design
objects.
7/16/2012 SKILL Language Programming 528
SKILL Language Programming 528
Cadence
SKILL-Level AE usetoonly:
Access Do not distribute
Path Segs
CDB Equivalent Finding
cv = geGetEditCellView()
None
db:0x0448ff9b
psList = setof(shape cv~>shapes
Creating shape~>objType == "pathSeg")
dbCreatePathSeg(
(db:0x0448f119 db:0x0448f11a ...
d_cellviewId
tx_layer
l_beginPt
l_endPt Attributes
n_width
t_beginStyle pathSeg~>?
t_endStyle (cellView objType prop bBox children groupMembers
[ l_extValue ] isAnyInst isShape matchPoints net parent pin purpose
) => d_pathSegId textDisplays assocTextDisplays markers figGroup
layerName layerNum lpp connRoutes routeStatus width
beginExt endExt beginPt endPt boundary beginStyle
endStyle topology isOrthogonal route
)
7/16/2012 SKILL Language Programming 529
This is the example of the creation, search and attributes of the pathSeg object.
SKILL Language Programming 529
Cadence AE use
How Do pathSegs only:
Affect Do
SKILL not distribute
Programming?
There is full access to pathSegs through the SKILL language programming.
Creation
Search
objType
Writing a SKILL processing function to convert paths to pathSegs
There is no way to automatically translate paths into pathSegments
outside of custom SKILL
User requirements for path intersections will vary
Exact algorithm is highly user-dependent
Editing pathsegs to change endpoints to fit your own algorithm
PathSegs created by Cadence® applications are DEF-compliant.
A V T V
7/16/2012 SKILL Language Programming 530
Why would anybody want SKILL access to pathSegs? One of the of most common questions we
get in other migration training classes is “how do I convert my existing interconnect (which uses
paths) into pathSegs? The cdb2oa translator, which translates design data into OpenAccess 2.2,
does not perform this conversion, and with good reason; There are many ways in which a given
path could be converted into pathSegs with different results. For example, given a path with a 90-
degree turn, when this turn is broken into two pathSegs, there are many ways that the intersection
can be constructed; Both pathSegs overlap each other completely, one abuts the other but does not
overlap, one overlaps slightly, etc. The addition of 45-degree segments complicates this even
more. The only reliable way for a Cadence® customer to obtain satisfactory results is to perform
this conversion themselves.
In addition, it might make sense that a user might want custom, non-default end-points. These can
also be customized using SKILL code.
SKILL Language Programming 530
Cadence AE Code
Migrating SKILL use Related
only: Do not distribute
to PathSegs
Detecting pathSeg problems in your CDB SKILL:
You probably will not have problems related to pathSegs when running your
CDB SKILL code
pathSegs are a new addition to OpenAccess, but are an enhancement rather
than a requirement
Your design flow will determine whether you need pathSegs or not
Code that creates paths will still work perfectly in OA2.2 running your CDB
SKILL code
If interoperability is a concern, you may want to consider pathSegs for
conveying connectivity to other tools
How to update your SKILL code to create pathSegs:
Replace dbCreatePath… commands with dbCreatePathSeg… commands
As pathSegs only create two-point segments, your code will be creating more
db objects than it used to if you make it build pathSegs instead of paths
7/16/2012 SKILL Language Programming 531
You probably will not have any issues with pathSegs in your old code, because pathSegs did not
exist before the OpenAccess 2.2-based releases. Furthermore, there’s no real requirement by any
single application that you use pathSegs. However, interoperability concerns might be a strong
motivator for changing to pathSegs.
Note also that nothing has changed with respect to regular paths in DFII. You can still use them in
exactly the same way as in previous versions, and your SKILL code will work perfectly without
modification with respect to paths.
However, in order to ensure interoperability, you might want to convert paths in your existing
designs into pathSegs. Be aware that because pathSegs can only represent a single, two-point
segment, if you replace a single path that contained several points, you will now have many
pathSegs in place of the single path. Note that pathSegs are fairly efficient, streamlined objects in
the OpenAccess 2.2 database, and there’s really not much of a performance penalty for using
pathSegs vs. paths.
To update your code, you’ll use the dbCreatePathSeg command instead of dbCreatePath. The
next slide shows an example of how this could be done.
SKILL Language Programming 531
Cadence AE use only: Do not distribute
Code Example
Replace: With:
… …
dbCreatePath( foreach((nextPoint currPoint)
cadr(points) points
cvId
dbCreatePathSeg(
“metal2”
Three separate cvId
ptList
“metal2”
0.2 pathSegs! currPoint
)
nextPoint
0.2
“extend” “extend”
);dbCreatePathSeg
);foreach
Single Object Multiple Objects
7/16/2012 SKILL Language Programming 532
In our example, we have some SKILL code that is creating a path from a point list. This list might
contain only two points, or most likely many more points. In the illustration at the bottom, the
path contains four points.
To replace this code, you need to iterate through the list of points, collecting the points into pairs.
When you have a pair of points, you can easily call dbCreatePathSeg, and pass the two points.
This will iterate over the list of points, creating a new pathSeg for each subsequent point after the
first pair.
The result is a chain of pathSegs that basically represent the original path. Note that you’ll need to
check the endstyles, and based on your particular choice of how the pathSegs will overlap (if at
all), you’ll need to customize your code to make this occur.
SKILL Language Programming 532
Cadence AE use
Why Be Concerned only:
with Do not distribute
New Objects?
There are several new and changed objects in the DFII database
Common definitions of design objects
Understood by more than the Virtuoso® platform
Support interoperability
Code that accesses objects in the database needs to be updated
Functions that count or tabulate objects in the database
Functions that search for new/changed objects (boundaries,
blockages, rows, sites, vias, etc.)
Let’s look at an example…
7/16/2012 SKILL Language Programming 533
We’ll take a step back from new database objects for a moment to discuss migrating SKILL code
in the general sense. We’ve learned about pathSegs in the database, and we can see that there are
most likely not any places where you can run SKILL and it will cause an error message because
you are not creating a pathSeg. pathSegs are additions to the database, and as such, are optional in
your code, not required. However, this will not be the case for other new objects, such as
boundaries, blockages, rows, and sites.
There is, however, a concern about functions that look for objects in cellview databases. Functions
that tabulate shapes in a design, functions that trace connectivity through shapes, and functions
that look for specific objects (namely, the ones mentioned in the training class) will need to be
updated to look for these new objects, and to look for them in the correct manner. We’ll see many
examples of this during the remainder of this appendix.
SKILL Language Programming 533
Cadence AE use only:
Example of Reporting Do
Objects notDB
in the distribute
Replace: With:
foreach(shape cv~>shapes foreach(shape cv~>shapes
case(shape~>objType case(shape~>objType
(“rect” … (“rect” …
(“polygon” … (“polygon” …
(“path”… (“path”…
(“arc” … (“pathSeg” …
(“arc” …
What can you grep for?
Use grep to find these strings:
objType
path
A V T V
7/16/2012 SKILL Language Programming 534
This code sample shows a shape tabulator. Note that we are iterating through the shapes in the
design, querying the object type of each object. Of course, if this code were used on an
OpenAccess 2.2 database, it would still function, albeit incorrectly. It would miss out on all of the
pathSegs that are in the database. In order to update our code, we’ll have to add some lines to
accommodate new objects.
On the right side of the slide, we’ve added a new option to the “Case” statement. We will now
have a branch for each pathseg.
In each of the examples that we will show in the slide, we’ll take a second to examine what strings
we could “grep” for in our SKILL files in order to locate potentially problematic SKILL. So, in
this slide, what could we “grep” for in order to locate this potential problem, specifically with
respect to pathSegs?
In this case, we’d be concerned any time we’re checking a shape’s objType. In many cases, this
will not locate problematic SKILL, as there are many reasons that one might access the objType,
for example, when looking for other objects. However, it might turn up potential problems as in
the example above. We can also grep for “path” in our code. This is a better search string, as it
will find references to paths in our SKILL code as well as in the comment blocks in our SKILL
files. Anywhere we are looking for, manipulating, or creating paths, we might want to be aware
that pathSegs might be in the design serving a similar functions as paths. This code will most
likely need to be updated.
SKILL Language Programming 534
Cadence AE use
New OA Objects: Rowsonly: Do not distribute
and Sites
Site
When placing instances in digital
designs, locations where the
instances go are determined first.
Site: A location where a standard
Site
Site
Site
Site
cell, macro, or device is to be
placed.
A site must be the same height as
the instance master.
Site can be flipped or mirrored to Row
provide desired cell orientation
compared to rails.
Sites are defined in the techfile.
Inst Site
Generally, one site exists for each
unique standard cell master height. Sites are defined in the techfile.
Row Rows (of those sites) are
A repetition of the site element in a created in the cellview.
given direction
7/16/2012 SKILL Language Programming 535
Our next new objects in DFII are rows and sites. Rows and sites are common constructs in the
place-and-route environment, but are unfamiliar objects to many custom designers.
A Site is a location where a standard cell will be placed in a design. Generally, sites are arrayed
into a long row called (surprise!) a Row. Standard cells are generally an even multiple of the
width of a site, but are always the exact height of a site, to ensure that the power and ground
connections line up properly with the power and ground rails that run along the top and bottom of
the row.
Sites are defined in the techfile, and a site definition exists for each cell height.
In the design, a row is first created, and the site locations are determined by the row as evenly
spaced snap-points in the row.
SKILL Language Programming 535
Cadence AE use only: Do not distribute
Creating Sites
Sites must be defined in the techfile, either:
Through SKILL or manually in the techfile
techCreateScalarSiteDef(
d_techfileID
t_siteDefName
t_siteDefType
n_width
n_height
[g_symmetricInX = t|nil]
[g_symmetricInY = t|nil]
[g_symmetricInR90 = t|nil]
) It doesn’t matter how you create
the site definitions! Either
method achieves the same
result.
A V T V
7/16/2012 SKILL Language Programming 536
There are two ways to create a site definition on the techfile; One is interactively in SKILL, using
the techCreateScalarSiteDef( ) function, which can be done in the CIW. You’ll need to provide a
name for the site definition, generally “core” or “pad” to describe the function of the site. Of
course, width and height are required as well.
You can also create site definitions in the techfile by loading an ASCII techfile and compiling it.
This is generally how sites are created.
A third way to obtain site definitions in the techfile is to import a technology LEF that creates
them. This process is discussed more in the translator user guide for LEF/DEF.
SKILL Language Programming 536
Cadence AE use only: Do not distribute
Creating Rows
1. Obtain the cellview ID
cv = geGetEditCellView()
2. Obtain the techDB ID
tf = techGetTechFile(cv)
3. Obtain the site def
sd = techFindSiteDefByName(tf
“gpdk090site")
Row
dbCreateRow(
cv
sd
“Row1" 4. Create
0:0 the row
20
)
Sites
7/16/2012 SKILL Language Programming 537
As we mentioned, sites are defined (and exist) only in the techfile, but rows exist in the cellview.
To create a row, the User Interface can (of course) be used, but in order to create a row in SKILL,
we’ll use the dbCreateRow function. First, you must obtain the cellview ID, and once we have
that we can obtain the techfile that is currently being referenced by it. We then locate the site def
in that techfile, and once we have the cellview ID and the site def ID we can use dbCreateRow to
create our row.
The image in the lower right of the screen shows a row that was created in a cellview. By
changing the display options to display site locations and row names, we can see what a row looks
like in the cellview.
SKILL Language Programming 537
Cadence AERelated
Migrating Code use only: Doand
to Rows notSites
distribute
Sites and SiteDefs
siteDefs have not changed at all since CDB.
Same techfile definition
Same SKILL API
7/16/2012 SKILL Language Programming 538
Sites and Sitedefs have not changed at all since CDB, which includes the definition in the
technology file and the SKILL API. In this respect, your old code will work fine! What’s new,
however, is the ability to place sites in your design in the form of rows, so the new functionality
(which we’ve already covered) will need to be added if you will be using rows and sites.
SKILL Language Programming 538
Cadence
Boundaries AE use only: Do not distribute
Boundaries are special database
objects (rectangular or polygonal)
that enclose objects: instances,
shapes, wire elements, etc.
Types
PRBoundary: A boundary to
surround placement and wiring of a
block
snapBoundary: A boundary to be
snapped to a site in a cell row if the
prBoundary is not a rectangle
clusterBoundary: A boundary
around a cluster of cells
areaBoundary: An area designated
for a special purpose
Example: High voltage area of a
design that requires special design
rules
7/16/2012 SKILL Language Programming 539
Boundaries are a familiar concept in Virtuoso, but are new objects in OA2.2. In CDB, they are
rectangles or polygons that are on a special layer/purpose pair, which identify them as those
special objects. The most familiar boundary is the PR Boundary, which is used in Virtuoso XL,
and in OpenAccess, the PR Boundary is still present. In fact, there are also three other types of
boundaries; Snap Boundaries, which are used for snapping an instance to a site in a row; Cluster
Boundaries, which are used to locate cells in a cluster, and Area Boundaries, which are used to
designate a special area of a design for applying special design rules to an area of the design or to
specify a special area for some other purpose. We’ll learn more about boundaries on the coming
slides.
SKILL Language Programming 539
Cadence AE use only: Do not distribute
Accessing Boundaries
Automatic boundary generation routines (for establishing special design
areas, etc.)
Shape summary report programs
Converting shapes on special (non-standard) layers into OAboundaries
Creating Boundaries
The dbCreate*Boundary functions are very simple
Three or four arguments, including:
The destination cellview ID
The list of points for the boundary object ( not a bounding box )
An optional list of edge names
A name (for cluster boundaries)
Boundaries are stored directly on the cellview, not as shapes!
7/16/2012 SKILL Language Programming 540
One question that arises is: Why access boundaries through SKILL? There are many areas where
you might already be accessing boundaries through SKILL, and it’s important to make sure that
these applications are updated to use the new code constructs. You might have shape report
programs that count figures in the design, and they might include the PR Boundary or other
boundaries in the summaries. You might have SKILL that actually creates boundaries, either PR
Boundaries or area boundaries. In light of the new of data types of boundaries, you might choose
to write custom SKILL code to convert your old methodology (which was most likely LPP-based)
into the new format for representing boundaries. Regardless, there are many reasons why you
might choose to utilize this new SKILL API to create boundary objects.
The functions that create boundaries are fairly simple; They accept three or four arguments, which
include:
The destination cellview ID
The list of points for the boundary object, either a bounding box or a list of points for a
polygonal boundary
An optional list of edge names
And for cluster boundaries, a name of the cluster which is contained by the boundary.
Let’s look at some examples of how these functions work.
SKILL Language Programming 540
Cadence
SKILL-Level AE usetoonly:
Access Do not distribute
Boundaries
CDB Equivalent Finding Boundaries
prBoundary – Shape on layer cv~>prBoundary
"prBoundary" purpose "drawing" or db:0x04480f92
"boundary" cv~>?
snapBoundary - NONE (cellView objType prop bBox lib libName
cellName cell cellViewType […] prBoundary
snapBoundary viaHeaders routes steiners
blockages vias guides sitePattern
Creating Boundaries areaBoundaries figGroups)
dbCreatePRBoundary(
d_cellViewId
l_points Boundary Attributes
[ lt_edgeNames ]
cv~>snapBoundary~>?
) => d_boundaryId | nil
(cellView objType prop bBox children
groupMembers parent textDisplays
dbCreateSnapBoundary( assocTextDisplays figGroup markers
d_cellViewId numEdges points edgeNames area)
l_points
[ lt_edgeNames ]
) => d_boundaryId | nil
… A V T V
7/16/2012 SKILL Language Programming 541
As with other objects, there are db functions to create boundaries. Each type of boundary has its
own function create that type of boundary. Two examples are shows on this slide:
dbCreatePRBoundary and dbCreateSnapBoundary. dbCreatePRBoundary accepts very simple
arguments: The cellview in which the PR Boundary will be created, and the list of points that
make it up. Note that it can be polygonal in shape, but it will not be a polygon – it will be a PR
Boundary object. dbCreateSnapBoundary works similarly, except that it also can accept a list of
edge names. We’ll see more about the list of points that these functions accept on the next slide.
There can only be one PR Boundary in a cellview in OpenAccess.. To locate the PR Boundary in a
cellview, you can query it directly from the cellview database object. In fact, you can see all of the
boundaries in a cellview directly from the cellview object, by using the ~>? Operator as you can
see on this slide. Note that these objects are distinct objects in the database, and are not shapes.
To edit the attributes of a boundary, you can store the boundary in a variable, and query the
attribute as you would any ordinary database object. You can locate information that is generic to
any database object, or information specific to a boundary, such as numEdges, points, edgeNames,
etc.
SKILL Language Programming 541
Cadence AE use only: Do not distribute
Creating Boundaries
All dbCreate*Boundary functions accept a list of points.
PR Boundaries, Cluster Boundaries, and Area Boundaries can accept
polygonal point lists.
Must be a list of 3 or more points
Bounding box is not sufficient!
Snap Boundary must be a rectangular list of four points
List of points must form a rectangle
dbCreatePRBoundary( dbCreatePRBoundary(
d_cellViewId cv
l_points list(0:0 0:4 4:4 4:0)
[ lt_edgeNames ] ) => db:0x04cf34a4
) => d_boundaryId | nil
7/16/2012 SKILL Language Programming 542
All of the dbCreate functions that create boundaries accept a list of points. PR Boundaries, cluster
boundaries, and Area Boundaries can accept a polygonal list of points. These lists must have at
least three valid points that result in a non-zero area. A bounding box is not sufficient!
The Snap Boundary is the only boundary that must be rectangular in shape. Despite this, it accepts
a list of four points, not a bounding box. So make sure that you check your list of points, and
make sure that the list contains four points, and is polygonal.
SKILL Language Programming 542
Cadence AERelated
Migrating Code use only: Do not distribute
to Boundaries
Locating errors related to boundaries:
Boundaries were created using shapes on specific LPPs in CDB.
Creating CDstyle boundaries does not generate errors.
Your boundary shapes are not interoperable!
You’ll need to convert them from shapes to boundaries
Seek out areas of your code where you create boundaries
cdb2oa looks for “standard” layer names for boundary objects.
The oaToolkit will help you find SKILL that creates boundaries.
But only if you use the standard prBoundary layer name (for example)
If you use nonstandard layer names, you must convert your boundaries.
“grep” for your boundary LPP in your SKILL code
“grep” for “boundary” in your comment blocks
Search for shapes in your designs on your special boundary LPP
A V T V
7/16/2012 SKILL Language Programming 543
To locate SKILL that contains boundaries, we must search for shapes that are being created or
referenced on a certain layer-purpose pair. Shapes on special LPPs were a data convention used in
CDB. You might not get an error if you perform a function in SKILL that creates a shape on the
special Layer-Purpose pair that is reserved for displaying boundaries, but the resulting shape will
not function as a boundary object. They will be treated as shapes, and nothing more. So part of
our SKILL migration related to boundaries will be modifying our old code to create native
boundary objects instead of shapes on the boundary LPP.
To find this code, check for the name of your boundary LPPs in the SKILL code. You can easily
“grep” for these LPPs. You can also grep for the word “boundary” in your code, although this
might be misleading as boundary can be used in many different contexts. Note that the cdb2oa
translator does convert the shapes in your existing designs, so these shapes will be converted into
the correct type of boundary object. But your SKILL must be fixed or it will still create these old
constructs instead of the native OA objects.
SKILL Language Programming 543
Cadence AE Migration
SKILL Boundary use only: Do not distribute
Example
Replace: With:
… …
PRbnd = rodCreatePolygon( PRbnd = dbCreatePRBoundary(
?cvId cvId
cvId
?layer “prBoundary”
ptlist
?pts ptList
) )
when(length(ptList) != 4
;Create the Snap Boundary snbPts = BBoxToPoints(PRbnd)
;overlapping the PR Boundary: snpBnd = dbCreateSnapBoundary
when(length(ptList) != 4
cvId
snpBnd = rodCreateRect(
snbPts
?cvId cvId
)
?layer “SPB”
?fromObj PRbnd );when
) …
);when
…
Note: Need new function to
compute snap boundary points!
What can you grep for in this example? A V T V
7/16/2012 SKILL Language Programming 544
In this slide, we can see an example of migrating SKILL that creates a PR Boundary.
There are two problematic areas of this code: One where we are creating a PR Boundary, and then
one where we are creating a snap boundary if it’s needed. Note that we are using
dbCreatePolygon and dbCreateRect to perform both of these actions.
Instead of rodCreatePolygon, we will substitute dbCreatePRBoundary. In place of rodCreateRect
for the SnapBoundary, we’ll use dbCreateSnapBoundary.
What can we grep for in this example?
Of course, our Boundary layers that we used in CDB would be the first things we could search for.
In our case, we have two layers that we can grep for, prBoundary and, the layer we use for the
snap boundary SPB. In addition, searching for the word boundary would have led us to the
comment block in this section. Note that simply searching for the word “Boundary” in this code
would have been hit-and-miss. We’re lucky that this code is well-commented, but if it were not,
our search would have to be more sophisticated, searching for LPP names instead.
Also note that we will need some new code in addition to our previous code. rodCreateRect
accepted a bounding box, and we now need a list that contains four points that form a rectangle.
We’ll need to add that code for our function to operate properly.
SKILL Language Programming 544
Cadence AE use
New IC 6.1 Objects: only: Do not distribute
Blockages
Blockages are polygonal
database objects designed to Blockages
protect areas of design
Placement blockages
Routing blockages (Interoperable)
Pin blockages
Slot blockages
Fill blockages
Feedthrough blockages
Screen blockages
7/16/2012 SKILL Language Programming 545
Another new object in OpenAccess 2.2 and in IC 6.1 is a blockage. A blockage is a polygonal
object that looks very much like a shape, but has rather the opposite effect: It prevents an object
from being placed in a design in a manner that overlaps the blockage. There are many different
types of blockages that can be placed in a design. Placement blockages prevent instances from
being placed, routing blockages prevent any type of routing on a certain layer, pin blockages
prevent the creation of pins in an area, slot blockages prevent metal slotting from being performed
on an area of metal, and fill blockages prevent fill patterns from being placed. Feedthrough
blockages prevent signal from being passed through a particular pin on a device, and screen
blockages prevent metal screening over the area covered by the blockage.
There is a note on this slide next to Routing Blockages that says “interoperable”. OpenAccess
itself supports two other types of blockages: via blockages, which prevent a via from being placed
in an area, and metal blockages, which prevent certain metals from being placed in an area. Note
that a routing blockage can very easily fill both of these needs. All the designer needs to do is
create a routing blockage on the metal layer or via layer in order to accomplish this.
A blockage is not a shape! It’s a distinct database object, separate from rectangles, paths, or
polygons.
One confusing aspect of blockages is that while they are associated with a layer or layer/purpose,
they do not themselves have a layer. For example, a Metal1 blockage is designed to block metal1
from being placed in a design. However, if I turn off blockages, but turn on Metal1 for display, I
won’t see my blockage.
SKILL Language Programming 545
Cadence
SKILL-Level AE usetoonly:
Access Do not distribute
Blockages
CDB Equivalents Finding Blockages
Shapes on purpose "blockage" block = car(cv~>blockages)
Keepouts in VCAR db:0x07821b92
Creating Blockages Blockage Attributes
dbCreateLayerBlockage( block~>?
d_cellviewId Creates routing,
tx_layer Pin, slot, fill, (cellView objType prop bBox children
t_type groupMembers parent textDisplays
l_points feedthrough, and
assocTextDisplays figGroup area
[ d_owner ] screen blockages
) isOrthogonal isRectangle isPushedDown
type owner density layer layerHeader
=> d_layerBlockageId | nil
effectiveWidth nPoints points)
dbCreateAreaBlockage( Creates
d_cellviewId
l_points
placement
[ d_owner ] blockages
)
=> d_areaBlockageId | nil A V T V
7/16/2012 SKILL Language Programming 546
SKILL access to blockages is through the familiar db access functions for creating them. Locating
and editing blockages is done through the familiar cellview data access interface. Let’s see how
we do this:
To create blockages, we have two functions:
dbCreateLayerBlockage - This function creates routing, pin, slot, fill, feedthrough, and screen
blockages, and you must tell it which of these types you want as the type argument.
Placement blockages, on the other hand, are intended to prevent instances from being placed in
the cellview, and therefore do not have an associated layer. The function dbCreateAreaBlockage is
designed to create placement blockages.
Note that this function does not accept a layer, but does accept a list of points which can be
polygonal.
To locate the blockages in the design, you can query them directly from the cellview object. Once
you have a blockage stored in a variable, you can query it directly using the ~> operator like any
other database objects.
SKILL Language Programming 546
Cadence AERelated
Migrating Code use only: Do not distribute
to Blockages
Locating Errors Related to Blockages
Blockages are mainly used by autoplacers and autorouters to prevent
placement or routing over a certain area.
“Keepouts” in VCAR, blockages in SOC Encounter
In DFII, blockages were implemented as LPP conventions.
Regular shape (rectangle, polygon) on a blockage layer/purpose
Same process as for boundaries!
Look for code that creates shapes on your special blockage LPPs.
grep for the purpose name of "blockage: or the purpose you used
grep for the string “keepout”
A V T V
7/16/2012 SKILL Language Programming 547
To locate errors related to blockages, we should look at applications in our current design flow
that create shapes that operate as blockages. They are primarily used by auto-placers and routers
in order to prevent the placement of instances and routing objects in the design. They are also
placed in the design prior to metal fill, area fill, and screen placements, typically at the end of the
design cycle. Any application or utility that creates, modifies, or looks for these blockages will
need to be updated to use the new objects instead of shapes on a specific layer or purpose.
Recall that in CDB, these objects were on special LPPS. Typically, the layer would be the layer to
be blocked, and the purpose was “blockage”, or something more specific such as
“routeBlockage”. We’ll want to look for these layer/purposes in our custom SKILL code to locate
these constructs, and replace them with the native object API.
Note that this is very much the same process that we used for boundaries, and the same rules
apply in searching for these objects. We’ll see an example on the next slide.
SKILL Language Programming 547
Cadence AE Migration
SKILL Blockage use only: Do not distribute
Example
Replace: With:
…
…
;Generate the instance name and
;Generate the instance name and
; create the instance ; create the instance
iName = sprintf(nil “mycell %s” n) iName = sprintf(nil “mycell %s” n)
inst = dbCreateInst(cvId master iName inst = dbCreateInst(cvId master iName
currLoc “R0”)
currLoc “R0”)
;Create a blockage over the ;instance: ;Create a blockage over the ;instance:
blk = dbCreateAreaBlockage(
blk = dbCreateRect(
cvId
cvId
BBoxToPoints(inst~>bBox)
list(“instance” "instBlock”)
)
inst~>bBox
…
)
…
A V T V
What can you grep for in this Note: Need new function to compute
example? polygon points from a bbox.
7/16/2012 SKILL Language Programming 548
In this example code, we are placing an instance, and then it appears that we are creating a
blockage that overlaps the instance. The blockage overlaps the instance, but is created using
dbCreateRect.
To fix this, we will want to replace the call to dbCreateRect, with code that creates a blockage.
Instead, we will include a call to dbCreateAreaBlockage, because we want to prevent the
placement of instances overlapping our instance, The function to use for placement blockages is
dbCreateAreaBlockage.
To locate problematic code in our SKILL directories, we can grep for the word blockage, but a
better search string would be our purpose, in this case, DKblk. This is our own, privately defined
blockage layer that we have created and used in our PDK.
Finally, it’s note worth that like boundaries, both of the blockage creation functions accept a list of
points in polygon fashion, and not a bounding box. We’ll need to use the same function that we
used in the past to convert a bbox into a list of four points that constructs the same rectangle.
SKILL Language Programming 548
Cadence AEReporting
Code Example: use only: Do not
Objects in thedistribute
DB
Replace: With:
foreach(shape cv~>shapes foreach(shape cv~>shapes
case(shape~>objType case(shape~>objType
(“rect” (“rect”…
case(shape~>purpose (“polygon”…
(“boundary” …
(“path”…
(“BLK” …
(“pathSeg” …
(t …
(“arc” …
)
(“polygon” );case
case(shape~>purpose …
("boundary” … );foreach
(“BLK” … prBoundary = cv~>prBoundary
(t …
…
)
blockages = cv~>blockages
(“path”…
(“arc” … …
A V T V
7/16/2012 SKILL Language Programming 549
We can now look at a more comprehensive example of SKILL function migration. In our previous
environment, we used a SKILL function that summarized the various shapes in our design, and
specifically counted boundaries and blockages. On the code on the left, we can see that we were
specifically looking for a purpose name of BDY or BLK, and since these shapes could be
polygons or rectangles, we must search for both. To migrate this code correctly, we must instead
look for the new objects.
In this case, we can dispense with the case statement entirely, because boundaries and blockages
will no longer be stored in the database as rectangles or polygons. Our code can simply iterate
through these shapes and perform whatever action we would if it were not a boundary or
blockage.
We can then simply query the boundaries directly from the cellview itself (using the ~> operator).
Note that boundaries are stored separately on the cellview: The PR Boundary is distinct, as is the
snap boundary (if applicable) and any area boundaries or cluster boundaries.
We can do the same with blockages, except that all blockages are stored under the attribute
“blockages” in the cellview. All blockages, be they placement, routing, fill, or other blockages are
stored under cv~>blockages.
SKILL Language Programming 549
Cadence AE use
Changed Objects: Netsonly: Do not distribute
and Terminals
It is now possible to have several terminals per net.
SKILL code that accesses nets and terminals must now net
allow for this possibility.
If you are querying the database, then be prepared term term
to look for more than one terminal on a given net.
If you are creating terminals/nets, then be aware of the new
functionality in the SKILL API to allow you to create these objects.
7/16/2012 SKILL Language Programming 550
The first case we’ll examine is multiple terminals per net. Often, this problem manifests itself in
that code that previously was comprehensive in its treatment of terminals might not be fully
operating as it should. For example, we can envision some SKILL that accesses a terminal on a
net, adds a property, and renames the terminal. On OpenAccess there are potentially many
terminals per net, and as we’ll see, the single terminal that gets returned from the database query
might or might not be the terminal that is expected. Furthermore, the property is only being
applied to one terminal, so our code must be aware of that when retrieving the information from
the property. In general, your code should be aware of the fact that where in the past there was one
object, now there are many.
SKILL Language Programming 550
Cadence AE use Support
Backward-Compatible only: Do notAttributes
of db distribute
Both nets and pins have been improved for backward-compatible support:
Nets
Support both the “term” and “terms” attributes
net~>term returns the first element of the list stored in net~>terms
Pins
Support both the “fig” and “figs” attributes
pin~>fig returns the first element of the list stored in pin~>figs
Migrating your SKILL is probably optional
If you are accessing terms or figs from nets or pins, you’ll want to check to
make sure that you’re getting the correct term or fig, as there is now a
1:many relationship
The exact term or fig you get from the db object is arbitrary
7/16/2012 SKILL Language Programming 551
Much effort has been put into ensuring backward compatibility for your SKILL whenever
possible. In this course, we’ve seen many instances where changes are required, and many where
backward compatibility is 100%. Pins and Nets both support the previous method of querying
figures and terminals, respectively. Because there are now many terminals on a net, instead of the
“term” attribute on a net, we would expect to see “terms”. What we see, in fact, is both attributes;
“terms” returns a list of the terminals on the net, and “term” returns a single terminal that is the
first element of the list. Thus, your old SKILL code will work with the new release, but be aware
that one of the terminals is being retrieved from the list, and you might or might not receive the
terminal that you are looking for. As was mentioned previously, make sure that your code accesses
the attribute that returns the list of objects (“terms” instead of “terms”, and “figs” instead of
“fig”). Furthermore, you should write your SKILL so that it locates the terminal (or figure) that it
needs, or store that information on the net (or pin).
SKILL Language Programming 551
Cadence AE use only: Do not distribute
Accessing Terminals
CDB Equivalent Locating terminals
One terminal per net dbFindTermByName( d_cellView t_name )
=> d_term / nil
dbGetNetTerms( d_net )
=> d_term / nil
Creating terminals Accessing terminals
dbCreateTerm( term = car(cv~>terminals)
d_net db:0x06441792
t_name term~>?
t_direction
(cellView objType prop direction groupMembers
[ b_physOnly ]
) => d_term / nil name net numBits pins routeMethod
connRoutes textDisplays assocTextDisplays pinCount
Creates a terminal for a net.
markers mustJoinTerms position physOnly )
Each terminal must have a
net~>terms
unique name
(db:0x06441792 db:0x06441798)
One terminal must have the
same name as the Verilog Port net~>term
or symbol terminal db:0x06441792
7/16/2012 SKILL Language Programming 552
Accessing terminals through SKILL is done in much the same manner that it was in previous
versions. Terminals can be created using dbCreateTerm as in the past. Now, however, more than
one terminal can be created on a given net.
Locating terminals is done using functions like dbFindTermByName or dbGetNetTerms. Little has
changed with respect to locating terminals.
Most SKILL code, however, accesses terminals not through SKILL functions but directly through
the database object queries.
We can easily retrieve the list of terminals directly from a net by querying a new attribute, terms.
We can also query term, and retrieve one of the terminals. As you can see, both attributes have
been implemented as we discussed on the previous slide.
SKILL Language Programming 552
Cadence AEand
Migrating Nets use only: Do not distribute
Terminals
Replace With
;Obtain the net ;Obtain the net
net = dbFindNetByName(“In1”) net = dbFindNetByName(“In1”)
;Get the terminal from the net ;Get the terminal from the net
term = net~>term term = car(exists(term
;Set the terminal direction net~>terms
term~>direction = “input” term~>prop~>name ==
;Assign our property to the “routePriority”)
; terminal as an integer ;Set the terminal direction
dbReplaceProp(term term~>direction = “input”
“routePriority” “int” 3) ;Assign our property to the
; terminal as an integer
dbCreateProp(term “routePriority”
Grep for these in “int” 3)
your SKILL code!
7/16/2012 SKILL Language Programming 553
Migrating your nets and terminals means making your code aware of the fact that there is a one-
to-many relationship between nets and terminals. In this example, we have a section of SKILL
that queries the terminal of a net, sets the direction to be “input”, and then replaces a property
(that we assume exists on the terminal already). As we now know, our old SKILL code might fail
if there is now more than one terminal on the net, and the terminal to be returned was not the
correct terminal. Either our code would fail reassigning the property, or later on when we went to
query the property from the terminal, we might find either no value or the incorrect value on the
terminal that was returned.
To properly repair the code, we must first understand that when either assigning our property
querying our property on the terminal, we must be deliberate in locating the correct terminal on
the net. In this example, we are first searching for a terminal on the net that that already contains
our property, and then reassigning that particular terminal’s value.
Note that we have modified our code from looking for a single object to expecting a list of
terminal objects. We now use the terms attribute instead of term.
It bears mentioning that in the general case, to locate code that uses the older SKILL constructs
we can simply grep for “term”, or even better, grep for term with the ~> operator in front of it.
This will locate areas in our code where we access the terminals on a net. We can also grep for
comments that might indicate terminal/net relationships.
SKILL Language Programming 553
Cadence AE use
Changed Objects: only:
Figures andDo not distribute
Pins
It is now possible to have several figures per pin.
pin
SKILL that accesses figures and pins must now allow for
this possibility.
If you are querying the database, be prepared to look fig fig
for more than one figure on a given pin.
If you are creating figures/pins, be aware of the new functionality in the
SKILL API to allow you to create these objects
Where to look for changes:
In SKILL code that is used for abutment (more will be said on this later)
In SKILL code that traverses connective shapes on a net
In SKILL code that summarizes shapes based on nets
7/16/2012 SKILL Language Programming 554
In much the same manner as terminals and nets, we can now have multiple figures per pin. And
our SKILL must similarly anticipate that where a single object was returned in the past, we should
now be looking for a list of objects. In reality, while our old SKILL will still be supported, we
should consider updating the SKILL so that it correctly expects a list of figures on a pin, and
searches through those figures for the one in question.
Where should we look for SKILL to update?
This is a big topic, and one that will be covered in detail later on, as most of the changes we’ll see
will be in custom Pcell abutment code. This will be covered in detail in later phases of this course.
Other areas of SKILL that might be of concern would be connectivity transversal applications. For
example, a user might create a function that highlights specific shapes on a given net, and create a
halo shape, boundary, blockage, or similar operation. In the process, it’s necessary to find out all
of the shapes on the net, and this might be done through pins as well as through nets. In this case,
we should be aware of many shapes on a given pin, although it’s a much safer bet to obtain the
shapes directly from the net. Regardless, you’ll no doubt be familiar with code you’ve written,
and you can easily search for this type of operation in your SKILL.
SKILL Language Programming 554
Cadence AE use only: Do not distribute
Accessing Figures
CDB Equivalent Locating figures
One figure for each pin pin~>fig
OA uses multiple figures pre pin to db:0x0448d61c
create the strongly connected pin
model pin~>figs
Creating figures (db:0x0448d61c db:0x0448d61b)
Creating figures is the same as
creating them in CDB Manipulating figures
dbCreateRect(… pin = fig~>pin
dbCreatePolygon(… db:0x06441822
dbCreatePath(…
dbAddFigToPin(pin fig2)
dbSubFigFromPin(…
With an addition:
dbCreatePathSeg(…
7/16/2012 SKILL Language Programming 555
There’s no difference creating figures through SKILL, with the exception that we have a new
function for creating path segments (which we’ve already covered).
As we’ve discussed, locating figures is where we see significant changes. Our old SKILL is still
supported, in that there is backward support for querying the “fig” attribute of a pin using the ~>
operator. However, as you can see in this example, the figure returned by querying the “fig”
attribute might be just one of many figures on the pin, and there is no way to ensure which figure
gets returned.
The only safe way to perform this query is to query the “figs” attribute instead. This returns the
full list of figures attached to the pin, and it’s up to me in my SKILL code to locate the correct
figure and then use that figure.
Manipulating figures is now a more complex process, as we can (and in some cases, need to) add
or subtract figures from pins. To do this, we have two new functions: dbAddFigToPin and
dbSubFigFromPin. Both of these functions are available and can be used in your SKILL code to
create a figure and then add it to the correct pin.
SKILL Language Programming 555
Cadence AEand
Migrating Pins use only: Do not distribute
Figures
The migration of pins and figures is a similar process to the migration of
nets and terminals. In fact, the issues and relationships are the same.
Make your code expect a list instead of a single figure.
Make your code search for the correct figure instead of relying on
having the first figure returned.
What should we grep for?
“pin” or "pins"
"pin~>”
"~>pin"
7/16/2012 SKILL Language Programming 556
We will be exploring the pin connectivity model in another chapter. When searching for pins, you
must be update your code to look at the pin figures instead of relying on a single pin and figure as
in CDB. The pin~>command will return the first database id in the figure list, this may not be the
figure your are looking for.
Finally, what should we grep for? Not surprisingly, we should grep for the word pin, ~>pin or
pin~>
SKILL Language Programming 556
Cadence AE use
Changed Objects: only: Do not distribute
Markers
Markers
Distinct objects in IC 6.1: oaMarker
No longer a shape on a specific marker LPP!
Persistent objects in the database
If you save and re-open, the markers will remain in the cellview
Not a construct of the tool
All tools use same representation for markers
Different levels of severity: annotation, info, acknowledgedWarning,
warning, signedOffError, error, signedOffCriticalError, criticalError,
fatalError, unsupported
Same SKILL API
Same functions create markers, accept same arguments as previous
versions
7/16/2012 SKILL Language Programming 557
Markers are also first-class objects in IC 6.1, as opposed to rectangles or polygons on a marker
layer in previous versions. They are also pervasive objects in the database, not an artifact of the
tool. That means that they are saved to the database when the design is saved. This is important as
in OpenAccess 2.2 all tools use the same representation for markers, and a tool can now
understand and manipulate markers created by another tool.
A marker has a severity attribute, which can vary in severity from annotation or information to
fatalError or unsupported. The user or tool is responsible for setting the severity of the marker.
SKILL Language Programming 557
Cadence AE use only: Do not distribute
Accessing Markers
Markers are helpful for a wide variety of applications.
Team applications that perform custom verification
Annotating designs in certain areas
Markers can be associated with objects.
Does not mean that the marker overlaps the object, or is connected to it
Any real meaningful connection is application dependent
This is a useful capability for user applications that can be easily accessed
through the SKILL language.
7/16/2012 SKILL Language Programming 558
SKILL Language Programming 558
Cadence AE use only: Do not distribute
Using Markers
CDB Equivalent Finding Markers
;Obtain all markers in the cv:
Markers where shapes on the
cv~>markers
layer error and warning
purposes in CDB. db:0x10355912
Same API creates marker ;Find markers in a specific area:
objects mlist = dbMarkerQuery(cv list( 2:2
3:3))
Creating Markers (db:0x10355912)
dbCreateMarker(
d_cellviewId
Editing Markers
t_msg
t_tool marker~>msg
l_points "Error: Msg."
[ ld_objects ]
marker~>severity
[ g_isVisible ]
[ g_isClosed ] "annotation"
[ t_severity ] dbAddObjectsToMarker(marker list(rect))
[ t_shortMsg ]
t
[ t_deleteWhen ]
) => d_markerId | nil
A V T V
7/16/2012 SKILL Language Programming 559
Markers, in practice, behave exactly like they used to in previous versions. In fact, no migration is
necessary for SKILL API functions that created markers. They accept the same arguments as
before, return the same values, etc., but now they create OpenAccess 2.2. marker objects, and not
rectangles on the marker layer.
The function dbCreateMarker has been enhanced but is 100% backward compatible with IC
5.1.41 CDB SKILL. There’s really no need to change your SKILL functions at all.
In contrast to creating markers, locating markers has changed significantly since IC 5.1.41.
Whereas in the past, markers were regular shapes on a specific Layer-Purpose pair, markers are
distinct objects in the database, stored directly on a cellview. To access markers, we use the ~>
query operator
SKILL Language Programming 559
Cadence AE for
New SKILL APIs use only:
New Do not distribute
Objects
There are three new concepts in the IC 6.1 Release that are important for users:
FigGroups
Clusters
Steiners
All have SKILL APIs that are user accessible.
All have access through the OA22 database in DFII.
All are new in IC 6.1, and have never been supported by previous releases of DFII.
Users were not using these features in previous releases.
SKILL support issues are extremely unlikely.
SKILL migration issues are extremely unlikely.
But, we’ll present the SKILL APIs anyway…
7/16/2012 SKILL Language Programming 560
There are two new SKILL APIs for new objects in IC 6.1 that are noteworthy: FigGroups and
Clusters. Both have SKILL APIs for creating and manipulating these objects that are documented,
and both are accessible objects through the database in OpenAccess 2.2. This means that we can
access both objects through ~> access in a cellview, and there are attributes and properties that are
accessible as well.
It bears mentioning that because both of these new objects are brand new, it’s unlikely that there
will be any SKILL migration issues. But because SKILL these new features are present, we’ll
present the SKILL APIs for your use.
SKILL Language Programming 560
Cadence
FigGroups AE use only: Do not distribute
FigGroups, or groups of figures, allow figures to be treated as a single
grouping rather than individual objects
A “virtual hierarchy” that allows for grouping of separate figures
All figures in a group exist at the current level of hierarchy, but act as if they
were in an instance
FigGroup can be copied, rotated, mirrored, moved, etc. just as an
instance
But it’s not an instance; They are still individual objects in the database at
the current level of hierarchy
Figures can be grouped, ungrouped, and regrouped
Supported through a SKILL API as well as through all menu
commands
7/16/2012 SKILL Language Programming 561
FigGroups are a new construct in DFII. A figGroup, or figure group, is a method of grouping
figures to create a virtual level of hierarchy in a cellview. Several figures (this includes shapes,
instances, boundaries, blockages, vias, and other objects) can be added to a figGroup, and once
this is done, they are now associated together. Actions can no longer be performed on the figure;
rather, any action that is performed on a shape that is part of a figGroup is now performed on the
entire figGroup. For example, moving, rotating, flipping, or other edits performed on the shape
will affect the entire figGroup.
Note that while it may appear, for all intents and purposes, that this figGroup is an instance, there
is no additional level of hierarchy created. All figures, as well as the figGroup, exist at the current
level of hierarchy. Figures can be grouped, ungrouped, and regrouped.
There is extensive support of figGroups through the SKILL API, as well as through all menu
commands. A figGroup is a native object in the OA2.2 database, and thus is fully accessible
through regular database access. FigGroups are stored on the cellview.
SKILL Language Programming 561
Cadence AE use only: Do not distribute
Using FigGroups
Creating FigGroups Finding FigGroups
cv = geGetEditCellView()
dbCreateFigGroup(
db:0x046bff9e
d_cellView
cv~>figGroups
t_name
(db:0x10355a12)
g_ordered
fig = car(geGetSelSet()
l_origin
fig~>figGroup
t_orient db:0x10355a12
) => d_figGroup | nil
Editing FigGroups
dbAddFigToFigGroup(
dbGetFigGroupByName(cv
d_figGroupId
"myGroup")
d_figId
db:0x10355a12
)
=> t | nil
A V T V
7/16/2012 SKILL Language Programming 562
The first step in using a figGroup in SKILL programming is to create one using the
dbCreateFigGroup function. The cellview, a unique name, a boolean to determine if the objects
contained in the list are specifically ordered, the origin and orientation are all required for creating
a figGroup. Once the figGroup is created, it must be populated with figures in the database. This
is done using the dbAddfigToFigGroup function.
Note that a figGroup is a logical object, in that it exists in parallel to the figures in the database.
Creating a figGroup, or more to the point, adding a figure to a figGroup does not delete the figure,
nor does removing a figure from a figGroup add a figure to the database. When a figure is added
to a figGroup, it is now a member of that figGroup, but both the figure and the figGroup exist in
parallel.
To find the figGroups in a cellview, you can query the cellview directly. The figGroups attribute
of a cellview returns the list of figGroup database objects for that cellview.
SKILL Language Programming 562
Cadence
Clusters AE use only: Do not distribute
Clusters group instances into the same placement group.
Placement is within cluster boundaries.
Used primarily in digital design.
Cluster support is supported in floorplanning tools.
OA tools recognize clustered instances if they can deal with clusters
Instances can be added to and removed from clusters
Example
We want to group all instances associated with an area of logic together in
a specific area.
Each instance is assigned to be a member of the cluster by the user or
a placement planning application.
Placement tool automatically locates instances on the cluster and
places them a cluster boundary
7/16/2012 SKILL Language Programming 563
Clusters are another way of grouping instances together for placement purposes.
The clusters themselves do not create any particular orientation. Rather, a cluster is a container
object that contains several instances in a design. The classic example is that a cluster is
associated with a particular piece of logic in a standard cell digital design. Each instance is
assigned to the cluster, and during placement, the placer recognizes the cluster and plans the
instance placement appropriately.
Clusters are supported primarily by floorplanning tools. Since they are used to guide placement,
they may not be required for your custom design flow. Instances can be freely added to and
removed from clusters using the User Interface, but no SKILL access is provided for these actions.
More functions related to clusters will be supported in future releases.
SKILL Language Programming 563
Cadence AE use only: Do not distribute
Using Clusters
Creating Clusters Finding Clusters
dbCreateCluster( cv~>clusters
(db:0x10355892)
d_cellViewId
c = dbFindClusterByName( cv
t_clusterName "myCluster")
t_clusterType db:0x10355892
) => d_clusterId | nil c~>??
(db:0x10355892 cellView
dbCreateCluster(cv "myCluster" db:0x046bff9e objType "cluster"
"inclusive") prop nil name "myCluster"
clusterType "inclusive"
db:0x10355892 groupMembers nil parent nil
subClusters nil instances nil
boundaries nil isParent nil
markers nil blockages nil)
A V T V
7/16/2012 SKILL Language Programming 564
Cluster support in SKILL programming is limited to the ability to create a cluster using
dbCreateCluster and the ability to locate a cluster using dbFindClusterByName. Clusters can be
queried, and information about them can be obtained, but at this time, there are few ways that
clusters can be used and supported in IC 6.1.
SKILL Language Programming 564
Cadence
Steiners AE use only: Do not distribute
A logical point representing a
branch point in a given route or
routes
Used to minimize net length in
branching of wires/routes
In OA2.2, wires must connect to
pins, vias, or Steiners
Must have a location, but not
Steiners
necessarily a layer assigned
7/16/2012 SKILL Language Programming 565
Steiners are a logical concept in the database to indicate a branching point in interconnect. They
are usually generated in P&R tools either automatically or by designers, and are used to minimize
the length of a net when there are many branches of wires in the net. They are useful for assigning
an intermediate connection point on the route, from which it may branch outward. In OpenAccess,
elements of wires (which includes paths, pathSegs and vias) must connect to pins, vias, or
steiners. Steiners must have a location, but since they are logical constructs, they need not have a
layer. There is no “steiner” object in CDB, and thus, there are no migration challenges associated
with converting your code to use steiners. It is strictly an optional feature in your SKILL code, but
it is being presented as Steiners are new objects and have a SKILL interface.
We’ll see how we access Steiners through SKILL on the next slide.
SKILL Language Programming 565
Cadence AE use only: Do not distribute
Using Steiners
Creating Steiners Finding Steiners
dbCreateSteiner( cv = geGetEditCellView()
d_cellViewId db:0x046bff9e
l_bBox cv~>steiners
[tx_layer]
Editing Steiners
) => d_steinerId | nil
steiner = car(cv~>steiners)
A V T V
7/16/2012 SKILL Language Programming 566
Steiners can be accessed in the cellview much like the other new objects. You can create a Steiner
using dbCreateSteiner, and the two required arguments are a cellview in which the Steiner is
created, and a list of two points which is a bounding box location of the Steiner. You can
optionally specify a layer to associate with the Steiner.
To locate the steiners in your design, you can query them directly from the cellview using the ~>
operator. They are stored directly on the cellview.
SKILL Language Programming 566
Cadence AE use only: Do not distribute
Other SKILL Changes
Appendix E
July 16, 2012
SKILL Language Programming 567
Cadence
Time Stamp AE use only: Do not distribute
Differences
Time stamps on cellViews were used to track the changes in CDB.
Extracting system time is slow.
Time stamps have a resolution of 1 second.
Many changes can happen in 1 second.
Editing time stamps are replaced with OpenAccess (OA) counters.
Other timestamps (tool or system based) are retained.
CDB OA
Editing lastInstancesChanged OA counter
Tool lastSchematicExtraction lastSchematicExtraction
System File Time Stamp File Time Stamp
7/16/2012 SKILL Language Programming 568
Time stamps have changed significantly from CDB to OpenAccess (OA). Rather than using a
time stamp (which has a resolution of one second of time), OpenAccess uses integer counters to
track the version of a database object. These integer counters are implemented as properties on a
cellview that get incremented each time a save occurs or an edit takes place.
The advantage in doing this is that two events could conceivably occur in the space of a second,
especially when dealing with the faster tools in OpenAccess.
SKILL Language Programming 568
Cadence
Time Stamp AE use only: Do not distribute
Differences (continued)
What Are OA Counters?
cv = dbOpenCellViewByType( libName cellName
A counter is an attribute that has viewName )
an integer value. printf("Netlisting for cellview: %s %s %s
\n" libName cellName viewName)
Incremented when data is printf(“ %s \n" cv~>instancesLastChanged)
changed when( cv
TriNetlist( cv )
Much faster than finding the
dbClose( cv )
system time
) ; when
Expects a string
Have finer resolution than
time stamps
They are used to track:
The currency of cellview Sample timestamp:
connectivity
“Jul 11 [Link] 2005”
The currency of instances and
masters
Other timing-related information
7/16/2012 SKILL Language Programming 569
Time stamps are one of the few topics where SKILL® migration may require more effort on the
part of the migrating user. The main change is in the instancesLastChanged time stamp, this has
been eliminated. If you use this to check the connectivity, you can now use isConnCurrent.
SKILL Language Programming 569
Cadence
Time Stamp AE use only: Do not distribute
Differences (continued)
CDB Timestamp errors often show up as print errors:
instancesLastChanged is a > TrNetlist("amsPLL" "pll" "schematic")
timestamp.
> Netlisting for cellview: amsPLL pll schematic
No longer supported in IC 6.1 > *Error* fprintf/sprintf: format spec. incompatible with data - nil
IC 6.1
fileTimeStamp: time format (ex:
"Jul 11 [Link] 2005" ) cv = dbOpenCellViewByType( libName cellName
modifiedCounter: counter format viewName )
printf("Netlisting for cellview: %s %s %s \n"
Tools must be changed to libName cellName viewName)
accept this method of printf(“ %n \n" cv~>modifiedCounter)
tracking changes.
when( cv
lastSchematicExtraction: Tool TriNetlist( cv )
created property that contains a dbClose( cv )
timestamp
) ; when
Fix by replacing attribute and
A V T V format string.
7/16/2012 SKILL Language Programming 570
File time stamps and tool created properties such as lastSchematicExtraction are still available to
the users.
SKILL Language Programming 570
Cadence
Time Stamp AE use only:
Replacement Do not distribute
Functions
New Counter Functions
dbDisableCellViewCounter
dbEnableCellViewCounter
dbGetCellViewCounter
dbSetInstHeadersCounter
New Connectivity Check Functions (Available in IC 5.1.41 as well)
Use these commands to check/set the connectivity status of a schematic
dbIsConnCurrent
dbSetConnCurrent
File Time Stamp Function (Available in IC 5.1.41 as well)
dbGetFileTimeStamp
File time stamps are created by the system and are still available.
7/16/2012 SKILL Language Programming 571
SKILL Language Programming 571
Cadence AE use only:
Database Differences: Do not distribute
OA Objects
Modifying Objects
In CDB, converting a shape to another shape type retains the same db identifier.
In OpenAccess, it can return a different value.
Examples
Convert path to polygon
dbSetLabelType also returns a dbId. (CDB returned a boolean.)
Changing the Name of an Object
In CDB, an object name was an attribute, and could be changed freely.
In OpenAccess, a name can hold logical value.
Changing an instance name to that of another instance causes a warning
Ex: inst~>name => “I4” (Scalar Instance)
inst~>name = “I<0:4>” (Arrayed instance – different OA object type!)
7/16/2012 SKILL Language Programming 572
When converting an object in CDB from one data type to another, DFII always returns the same
database object identifier. This may not be the same in OpenAccess. To avoid problems when
using a SKILL function to change an object’s data type, the return value of the function should be
stored in a variable for later use, rather than relying on the variable that contained the original
object.
Similarly, care must be taken when changing the name of an object in OpenAccess. Because an
object’s name can hold logical value (such as the name of an instance in an arrayed instance),
changing that value may cause warnings.
For example, a common shortcut in CDB for obtaining an instance from the database is to do the
following:
inst~>name = “I<0:4>” (Arrayed instance – different OA object type!)
In OpenAccess, you might inadvertently reassign the object type of the object. Instead of this
code, consider using the following instead:
newId = dbFindInstByName(“I<0:4>”)
SKILL Language Programming 572
Cadence AE Differences:
Database Object use only: Do not distribute
Shapes
Objects with Points
Coincident and collinear points are not supported by IC 6.1 (Removed, shape gets
created)
OpenAccess does not allow the retracing of segments in polygons (=ERROR)
OpenAccess does not allow the existence of zero-area rectangles (=ERROR)
OpenAccess does not allow self-intersecting polygons, lines, or paths (=ERROR)
1 2
4
Coincident/Collinear 6
points removed
5
vdd!
Line segment illegal
Illegal self-intersection of path
7/16/2012 SKILL Language Programming 573
The OpenAccess database is a very efficient, compact database which is always optimized for
capacity. To accomplish this, all data that is created in the database is optimized to use as little
space as possible, and to be represented as efficiently as possible.
To accomplish this, the functions that create objects such as rectangles, polygons, lines, paths, and
other shapes will automatically check shapes when they are created to make certain that collinear
points, coincident points, zero-area polygons, and zero-area rectangles do not exist.
Cellviews which contain these shapes will either be corrected during translation (in the case of
collinear or coincident points) or can result in errors during translation (in the case of polygons
with retraced segments or zero-area shapes). It is always a good idea to check for these shapes in
cellviews prior to translation.
Pcells that create these illegal shapes will not function in DFII on OpenAccess. An error will
result and a “Pcell Eval Failed” message will result. To prevent this, fix the SKILL function that
creates the illegal shape.
SKILL Language Programming 573
Cadence AE use
Creating Shapes, only:
Lines, Do not distribute
and Dots
Zero Area shapes are not permitted in the OpenAccess database.
Creating a line or a dot as a polygon is not allowed.
But, you can still create the elements you need
Lines dbCreateLine()
Dots dbCreateDot()
To create the vdd! pin symbol on the previous slide, create the triangle as a
polygon and join a line to it.
Tools are available in the OAtoolKit to find these objects and correct
them by creating the new object.
7/16/2012 SKILL Language Programming 574
Database Objects Code Example
\i dbCreateRect(geGetEditCellView() list("Metal1" "drawing") list(0:0 0:0))
\w *WARNING* dbCreateRect: Invalid bounding-box for a rectangle
\t nil
\i polygon = dbCreatePolygon(geGetEditCellView() list("Metal1" "drawing")
\i '((-7.53 3.81)
\i (-7.435 3.81)
\i (-7.435 3.97)
\i (-7.34 3.97)
\i (-7.34 4.07)
\i (-7.3 4.07) Note redundant collinear point!!
\i (-7.26 4.07)
\i (-7.26 3.735)
\i (-7.53 3.735) ))
\t db:0xb4d125a0
\p >
\i polygon~>points
\t ((-7.53 3.81)
\t (-7.435 3.81)
\t (-7.435 3.97)
\t (-7.34 3.97)
\t (-7.34 4.07)
\t (-7.26 4.07) Redundant point removed, but shape gets created!
\t (-7.26 3.735)
\t (-7.53 3.735) )
SKILL Language Programming 574
Cadence
SKILL ObjectAE use only:
Differences: Do dd
db and not distribute
Database Objects (dbObject)
These are the database files that store the design data.
Cellviews and everything used to construct them
[Link], [Link], [Link], [Link]
Design Data Objects (ddObject)
All of your noncellview design data and properties
Also managed by OA, but not design data files
The OA API organizes them using the oaDMFileSys
7/16/2012 SKILL Language Programming 575
SKILL Language Programming 575
Cadence
SKILL ObjectAE use only:
Differences: Do not
Property distribute
Bags
Setting Properties on DM System (dd) Objects
Editing properties on a cellview object (dbObject) modifies the cellview
database, not the property bag ([Link])
Editing properties on a DMFileSys object (ddObject) modifies the
property bag ([Link], separate from the cellview)
CDB: Some SKILL® functions such as dbReplaceProp on a ddObject
automatically opened the property bag.
IC [Link] use dbOpenBag, dbSaveBag, and dbCloseBag explicitly.
If you use a function without first opening the bag, the function issues a
warning message
A V T V
7/16/2012 SKILL Language Programming 576
SKILL Language Programming 576
Cadence AEFunctions:
Modified SKILL use only: Do not
[Link] distribute
Support
The following SKILL functions have changed to support the new [Link] file
infrastructure:
All still work as before, but have added functionality
ddGetObj
ddCreateLib
ddDeleteObj
ddUpdateLibList
ddGetUpdatedLib
Example
ddCreateLib now updates [Link] in addition to updating [Link] file
Refer to DFII on OpenAccess Adoption Guide for more on what
changes have been implemented.
7/16/2012 SKILL Language Programming 577
SKILL Language Programming 577
Cadence AE use
Database Changes: only: Doand
layerHeader notlppHeader
distribute
Example
lppHeader layerHeader = car(cv~>layerHeaders)
The familiar ―lpp‖ object that SKILL Object Type
references all shapes on a layerHeader~>objType => "layerHeader"
layer/purpose pair
SKILL ~> Access
Available in CDB and previous OA- layerHeader~>layer => ―Metal3‖
®
based Virtuoso releases layerHeader~>steinerBBox => l_bBox / nil
layerHeader~>guideBBox => l_bBox / nil
New object: layerHeader layerHeader~>blockageBBox => l_bBox / nil
Used to access Steiners, blockages, layerHeader~>steiners => l_steinerId / nil
and guides that don’t have a layerHeader~>guides => l_guides / nil
purpose layerHeader~>blockages => l_blockageId / nil
Can access the bounding box layerHeader~>lpps => l_lpps / nil
information for above objects cv~>layerHeaders => l_layerHeaderIds / nil
lpp~>layerHeader => d_layerHeaderId / nil
Retrieve complete list of all of above
objects by layer
7/16/2012 SKILL Language Programming 578
SKILL Language Programming 578
Cadence AE Differences
Database Object use only: Do not distribute
Order of Generating Objects
The order in which data is stored in the CDB database will probably differ
from the order in which they are stored in OpenAccess.
OpenAccess is more consistent in the order in which objects are stored.
Note: Relying on the order in which objects return is generally a bad idea.
Always use the SKILL language to sort objects based on usage
criteria.
7/16/2012 SKILL Language Programming 579
When a group of objects (say, an array of Vias) is generated in OpenAccess, the order in which
they are generated initially differs from the order in which they will be stored. When the objects
are subsequently queried, the order in which they are returned will be more consistent than it was
in CDB.
As a general rule, it is not a good idea to rely on the order in which objects are returned in SKILL.
Data should be sorted if the order is important.
SKILL Language Programming 579
Cadence
SKILL ObjectAE use only:
Differences: TheDo not distribute
~> Operator
Querying the Layer Attribute for a Layer-Purpose ID
CDB: Query the layer attribute for an lpp:
lpp~>techLayer => db:34567890
OA: Information now stored as layer instead of techLayer
lpp~>techLayer => nil
lpp~>layer =>db:0x3456e789
Querying an Instance
When querying an instance used as a pin:
This is done mostly in Composer, where pins are instances
CDB: Can set the instance attribute. Ex: pin~>purpose = “cell”
OpenAccess: Cannot set the instance attribute — Returns a SKILL error.
7/16/2012 SKILL Language Programming 580
A few small differences exist with regard to the ~> operator:
1. The ~> operator cannot be used to set an instance pin attribute
2. When querying the layer of a layer-purpose pair object, it is stored as “layer” instead of
“techLayer”. This is a change of an attribute name. Most users will not be impacted, as
most users obtain the layer object (not the LPP object), and obtain the layer name from it.
SKILL Language Programming 580
Cadence AE use
SKILL Differences: only: Do not distribute
DBUperUU
DBUperUU Access
OpenAccess stores DBUperUU in only one location: the techDB
Previous methods for setting were set on the library.
Ex: lib~>DBUPerUU~>maskLayout = 1000
New functions: techGetDBUPerUU, techSetDBUPerUU, techGetUserUnit,
techSetUserUnit
DBUperUU and Scaling a Design Library
Just using techSetDBUPerUU is not sufficient.
You must scale your libraries using Xscale.
More to come …
7/16/2012 SKILL Language Programming 581
A few function changes have taken place from CDB. Make sure to check the IC 6.1 Adoption
Guide for a complete list of all changes.
One large change: DBUperUU Access
DBUperUU is now stored only in the techDB. In the past, DBUperUU was stored in the techDB,
on a library, or even on cellviews. Now, there is only one storage location for DBUperUU.
SKILL Language Programming 581
Cadence AE Differences:
Database Object use only: Do
Arcsnot distribute
Bounding Box of an Arc
The dbCreateArc function accepts two bounding boxes:
The bounding box that defines an ellipse (of which the arc is a part)
Another bounding box that intersects the ellipse somewhere. This can be
bigger than the minimum bbox that defines the arc.
Specified BBox
Minimum BBox
Arc BBox
IC 6.1: arc~>bbox always returns the minimum bbox.
CDB: arc~>bbox returns the specified bbox.
7/16/2012 SKILL Language Programming 582
In CDB, the original bounding box provided by the user to define the arc was stored in the
database, regardless of how closely it fit the resulting arc.
OpenAccess automatically calculates the minimum bounding box for an arc when it is created and
stores that information in the database. This model approximates more closely the use model that
one would expect from the arc bounding box.
This will not impact most users. Users who use conics (microwave designers, optoelectronics
designers, etc.) might be impacted by this change.
SKILL Language Programming 582
Cadence AE Differences:
Database Object use only: Do
Arcsnot distribute
Start and Stop Angles for Arc
CDB
Start and stop angles:
Range from -π to π
Stored in floating point precision
IC 6.1
Start and stop angles:
Range from 0 to 2 π
Stored in double precision
dbObjects store angles as OA, not CDB
Selecting an Arc
When selecting an arc, the arc itself (not the bounding box) must overlap
the selection bbox.
7/16/2012 SKILL Language Programming 583
Database Object Differences: Arcs
Arcs are stored differently in the OpenAccess database than they were in CDB. Rather than
storing angle values from -PI to PI (as in CDB), OpenAccess stores values from 0 to 2PI,.
However, to maintain consistency across tool versions, the functions dbGetArcAngle and
dbGetArcRec both return values ranging from -PI to PI. If your code requires these values, rather
than querying the database for this information, use these functions instead.
This will not impact most users. Users who use conics (microwave designers, optoelectronics
designers, etc.) might be impacted by this change.
SKILL Language Programming 583
Cadence AE use
SKILL Differences: only:Functions
Dropped Do not distribute
Functions Related to Contacts
Contacts no longer exist. Use vias instead.
leIsContactMaster, leIsAnyContactMaster,leSetContactParam,
leGetContactParam, leGetContactDefaultParam,
leGetContactRule
instPin Functions
instPins were intermediate pins which could be used to hold extracted R/C
data
dbCreateInstPin, dbCreateInstPinByName both dropped
But instances can still be used as pins
Pins can still be created, specifying an instance as a figure
A complete list of discontinued functions is provided in the DFII on OpenAccess
Adoption Guide.
7/16/2012 SKILL Language Programming 584
Be sure to check the IC 6.1 Adoption Guide for the latest list of dropped, technology, and other
functions that have been dropped from the release.
SKILL Language Programming 584
Cadence AE use
SKILL Differences: only:Functions
Dropped Do not distribute (continued)
dbTech Functions
Most dropped functions were held over for backward compatibility with
version IC 4.3.x. These functions are no longer supported in IC 6.1.
All have replacement functions that work in IC 6.1 or they are obsolete.
Examples include: dbCloseTech, dbCreateLayer,
dbDeleteLayer, dbDeletePurposeByName
techObj Functions
They are private to the techfile and redundant
They all begin with techObj.
Examples: techObjOpenTechFile, techObjCreateLP
7/16/2012 SKILL Language Programming 585
SKILL Language Programming 585
Cadence AE (HI)
Human Interface useDifferences
only: Do not distribute
Cadence now uses QT for the graphical interface.
SKILL users that intend to add fields to existing forms should expect
changes.
When adding fields, the form size will need to change.
formId~>initialSize = bigger value
When a field is added to the form the 6.1 hi layer expands the existing table
field so it overlaps the new fields.
If I first get the location of the table field before I add fields I can reset the
fields back to their original location after inserting the new fields
(hiGetFieldInfo(form 'field))
Reset with hiResizeField(form 'field list(width height [promptbox])
When it is resized, the field no longer overlaps even after resizing the form.
7/16/2012 SKILL Language Programming 586
SKILL Language Programming 586
Cadence AE use only: Do not distribute
Form Migration
QT replaces Motif for form creation.
Form OK/Apply/Cancel buttons now on bottom of form
formButtonLocation in .cdsenv is no longer used
HI commands are still used in SKILL language.
New field types are implemented in HI
systemModal not supported in forms or dialog boxes.
Changed to application blocking only
Field drawing order changes affect field obscuring.
2-D form can be malformed if the field height is incorrectly specified.
Use hiShowFieldBorders( t ) to turn on field borders to detect
overlapping fields.
7/16/2012 SKILL Language Programming 587
SKILL Language Programming 587
Cadence AE Field
Form Migration: use Drawing
only: Do not distribute
Order
New field placed to obscure existing fields
Order dependent
Last field drawn on top
QT does not draw in the same order as Motif
Wrong field may be displayed
In IC 6.1, hide the fields by assigning the invisible attribute.
unless( isNotOa
formId->hiddenField->invisible = t
) ; unless isNotOA
Works on your forms and Cadence forms
Hidden fields are not editable
Set invisible to nil to view field
formId->hiddenField->invisible = nil
7/16/2012 SKILL Language Programming 588
SKILL Language Programming 588
Cadence AE Malformed
Form Migration: use only:Fields
Do not distribute
Bug in HI fixed for proper form spacing
hiCreateAppForm(?name 'ACLC_checkLayoutForm
?formTitle "Layout Cells Check"
?fields list( list(libName 0:5 300:0 100)
list(libBrowser 0:35 300:30 100)
list(allCellsB 0:90 300:0 100) Illegal
list(cellList 0:100 300:0 100) Field
Height = 0
list(doWhat 0:160 300:0 100)
)
?callback list('ALCcheckLayoutFormPR)
?buttonLayout 'ApplyCancelDef )
Result:
Malformed
Fields
7/16/2012 SKILL Language Programming 589
SKILL Language Programming 589
Cadence AE Malformed
Form Migration: use only:Fields
Do not distribute
Updated
hiCreateAppForm(?name 'ACLC_checkLayoutForm Legal
?formTitle "Layout Cells Check" field
?fields list( list(libName 0:5 300:30 100)
height
list(libBrowser 0:35 300:30 100)
list(allCellsB 0:90 300:30 120)
list(cellList 0:120 300:30 100) Larger
label
list(doWhat 0:160 300:30 120)
space
)
?callback list('ALCcheckLayoutFormPR)
Updated
?buttonLayout 'ApplyCancelDef )
field spacing
7/16/2012 SKILL Language Programming 590
SKILL Language Programming 590
Cadence AE Malformed
Form Migration: use only:Fields
Do not distribute
and Lint
Find possible form problems with additional SKILL Lint rule found in the OA
toolkit.
OAtoolkit/sklint/rules
[Link]
Move to <cdsInstDir>/tools/local/sklint/rules for automatic loading
Checks form and field creation commands for height of field values
Outputs
Info – If the field height is set by a variable, an info statement is issued.
INFO (hiCreateField): [Link], line 112 (ADCcheckLayoutCellForm)
: hiCreateToggleField has a variable for the field height. If the value
is 0, the form in IC 6.1 will be distorted
Error – If the field height is set to 0, an error statement is issued.
ERROR (hiCreateAppForm): [Link], line 47
(ADCcheckLayoutCellForm) : A field in this form has a height of 0. The
form in IC 6.1 will be distorted.
7/16/2012 SKILL Language Programming 591
SKILL Language Programming 591
Cadence AE use Access
Database Information only: Do not distribute
Is there a SKILL function that reports the database type?
dbGetDatabaseType() => “OpenAccess” or "CDBA"
Is there a SKILL function that returns the full version of the Cadence tools?
getVersion()
=> “@(#)$CDS: [Link] version 6.1 09/13/2006 ...”
getVersion(“<any string>”)
ex: getVersion(“a”) => “sub-version IC 6.1.0EA.162.20”
Is there a function to return the OpenAccess database version?
dbGetBuildInfo() – returns the OA release number, tar kit revision number,
and date of the build
Is there a function to check the database type to make sure it’s using the correct
plugin?
ddLibIs5X(ddLibId) – returns t/nil if the library is/is not a 5x library
7/16/2012 SKILL Language Programming 592
SKILL Language Programming 592
Cadence
ITKdb AE use only: Do not distribute
What do I need to do with my ITK code?
There are function additions, changes, and deletions corresponding to the equivalent
SKILL functions. These are documented in the DFII Adoption Guide
New MAKE files (see itkDB sample directory)
CDB “Records” are an emulated data structure on OA. It is a lot more efficient, if you need a
single attribute to directly use the get API for it (if available) than to build the full record.
Non editable strings returned by the DB (for example viewName is an instance record dbInstRec)
used to be a char * type. They are now const char *
After modifying your code to reflect these changes as necessary, simply recompile your
code using the C libraries in the IC 6.1 build.
How do I integrate my native OA code with Virtuoso Design Environment?
You must add in the required Virtuoso Design Environment extension data, including
LPP’s to be able to use the native OA data in Virtuoso Design Environment applications.
You can do this using ITK or SKILL
If you use ITK, your native OA code and ITK code can coexist in the same file.
Run time license check
Access to “111” is required to run itk executable (but not checked out).
7/16/2012 SKILL Language Programming 593
SKILL Language Programming 593
Cadence AE Summary
SKILL Adoption use only: Do not distribute
New objects require changes in SKILL language which creates or edits the
CDB LPP data conventions
SKILL Lint will find many of the required changes.
Use grep to find hidden SKILL changes.
Take advantage of new objects by adding IC 6.1 only SKILL
Check closely any place you use timeStamps because some have been
replaced by OA counters.
Self overlap and redundant points are not allowed in OA.
Some shapes may not be migrated.
Check all user created forms.
Fields might overlap due to malformed field specifications.
Obscured fields can be drawn in the wrong order.
7/16/2012 SKILL Language Programming 594
SKILL Language Programming 594
Cadence AE use only: Do not distribute
Using the OpenAccess Toolbox
Appendix F
July 16, 2012
SKILL Language Programming 595
Cadence AE use only:
What Is the OpenAccess Do not distribute
Toolbox?
Checkers – SKILL® scripts that help you check an existing CDB library prior to
translation
Fixers – SKILL scripts that help you fix specific cdb2oa errors that occur frequently
Scripts – Shell scripts that help you filter out warnings and errors that are not
relevant, and that help you locate potentially problematic SKILL code.
SKILL – SKILL examples of Open Access (OA) constructs and many useful utilities
Spreadsheets – Sample planning spreadsheets for your migration project
Testdata – Test files to allow you to quickly run any of these scripts to see how well
they work
7/16/2012 SKILL Language Programming 596
SKILL Language Programming 596
Cadence
Notes AboutAE useToolkit
the OA only: Do not distribute
The OA toolkit is made by AEs.
It’s not tested by R&D, and not provided with any guarantees of
functionality.
Use it at your own risk.
That said…
It’s useful.
Most users find that it meets their needs and runs safely.
Therefore,
Read each file carefully and understand each line of the SKILL code or
shell script.
Test the function on a “safe” library first.
ALWAYS Make a backup.
7/16/2012 SKILL Language Programming 597
SKILL Language Programming 597
Cadence AE use only: Do not distribute
Checkers Command
Example checker: [Link] Example of one type of check: prBoundary
Includes a number of checks: procedure( CDB_dataCheck_prBoundary( cv )
let(( out lpps numShapes shapeList)
prBoundaries out = ""
numShapes = 0
Magnification
lpps = setof( lpp cv~>lpps
viewTypes lpp~>layerName == "prBoundary" )
foreach( lpp lpps
Point and shape data foreach( shape lpp~>shapes
numShapes++
Mosaics shapeList = cons( sprintf( nil
"%s on %s %s bbox: %L\n"
Names shape~>objType lpp~>layerName
lpp~>purpose shape~>bBox ) shapeList
Instance Terms )
) ; ** foreach shape **
You can customize it to include your own ) ; ** foreach lpp **
checks.
when( numShapes > 1
foreach( shape shapeList
It’s easy to customize and enhance
sprintf( out "%s%s" out shape )
) ; ** foreach shape **
It’s easy to use
) ; ** when numShapes **
Works on a whole library or a out
cellview ) ; ** let **
) ; ** procedure CDB_dataCheck_prBoundary **
7/16/2012 SKILL Language Programming 598
SKILL Language Programming 598
Cadence AE use only: Do not distribute
Fixers Command
Functions to fix bugs automatically
procedure(OAfixNetNames(libraryName_t searchString_t replacement_t
Several are based on cdb2oa error @optional cellNames_l)
numbers. Just untar and use the SKILL let((libId cvId nets terms)
included ; find the target library
Operate on a cellview or entire library …
foreach(cell cellNames_l || libId~>cells~>name
Examples:
foreach(viewName list("schematic" "layout")
[Link] cvId = dbOpenCellView(libId cell viewName)
[Link] ; look for searchString_t in net names
when(cvId
[Link] && (nets = setof(net cvId~>nets rexMatchp(searchString_t
net~>name)))
Make sure you understand what a fixer does
|| (terms = setof(term cvId~>terminals rexMatchp(searchString_t
before using it! term~>name)))
Many scripts modify your cellviews dbReopen(cvId "a")
nets && OAreplaceString(cvId nets searchString_t replacement_t)
Back up your data prior to using a fixer!
terms && OAreplaceTerms(cvId terms searchString_t
Read the SKILL function and test it on replacement_t)
a test database first dbSave(cvId)
if(viewName == "schematic" then
schCheck(cvId)
7/16/2012 SKILL Language Programming 599
SKILL Language Programming 599
Cadence AE use only: Do not distribute
Scripts Command
Shell (mostly c-shell) scripts to quickly locate
set HOSTTYPE = `uname`
errors
if( $HOSTTYPE == 'SunOS' ) then
Faster than SKILL, easier to use than C set grep_exec = "/usr/xpg4/bin/grep -n"
else
Customizable and extendable
set grep_exec = "/usr/bin/env egrep -n"
Example: [Link] endif
Looks through SKILL files and “grep”s for set LOG = /usr/tmp/OAskillCheckerLog.$$
problematic items set SPACER = "\
************************************************************************\
Names of files that have changed
############################# File Name Changes
Opening a cellview in scratch mode $grep_exec -E "\.cdb|techfile\.cds|prop\.xx" $argv >& $LOG
Instance magnification if($status == 0) then
cat <<fileNameChangesMsg
Complex mosaics $SPACER
Many of these flag potential errors File name changes:
[Link] changed to [Link]
Might get false positives
[Link] changed to [Link]
Useful for locating comments and strings [Link] changed to [Link]
that contain problematic names [Link] changed to [Link]
[Link] changed to [Link]
[Link] changed to [Link]
7/16/2012 SKILL Language Programming 600
SKILL Language Programming 600
Cadence AE use only: Do not distribute
SKILL Command
“Potpourri” of SKILL files and
utilities
Examples of how to create
OA22 connectivity model,
proper ways to create
boundaries, etc.
;; Only one prBoundary allowed. Delete any existing ones.
Functions to do it the “OA when( cvId~>prBoundary
way” dbDeleteObject( cvId~>prBoundary )
) ; ** when cvId **
Function to write out [Link] points = dbCompressPointArray( points )
if( isBBox( points ) then
files from cellview hierarchy firstPt = car( points )
secondPt = cadr( points )
;; Create the prBoundary
prb = dbCreatePRBoundary( cvId
list( firstPt
xCoord( firstPt ) : yCoord( secondPt )
secondPt
xCoord( secondPt ) : yCoord( firstPt )
7/16/2012 SKILL Language Programming 601
SKILL Language Programming 601
Cadence
SpreadsheetAE use only: Do not distribute
Command
Currently, only one spreadsheet
Several tabs to help organize
data during migration project
People, Pre-assessment, flow
data, libraries to convert, SKILL
Use one sheet per process
Customize it for your
requirements
Organization is a key part of the
AVTV process
Spreadsheets are populated
during Assessment, and used
during V,T, and V.
7/16/2012 SKILL Language Programming 602
SKILL Language Programming 602
Cadence AE use only: Do not distribute
Testdata Command
How do you know if the OAtoolkit
viaBlk
works?
230
Need a “test” file that shows 231
classic errors 232
233
The Testdata directory of the
prBoundary
OAtoolkit contains sample files that
dbRefreshCellView(cv)
have error examples in it
dbReopen(cv "r")
Nonfunctional file, might just
contain a bunch of strings or cv = geOpen(?lib "lib" ?cell "cell" ?view "view" ?version nil ?mode "a")
lines with text
Might contain real SKILL or unless(windowId = getCurrentWindow()
error("Where's the current window\n")
shell script expressions
)
Use this file to test existing code, cv = geChangeCellView(windowId ?lib "lib" ?cell "cell" ?view "view" "a")
and maintain test files for your own
code! layerList = leGetValidLayerList(cv~>lib)
You won’t know if it works until layer = leGetEntryLayer(cv~>lib)
you test your function, so use
ours or make your own. printf("layerList is %L\nlayer is %L\n" layerList layer)
7/16/2012 SKILL Language Programming 603
SKILL Language Programming 603
Cadence AE use only: Do not distribute
7/16/2012 SKILL Language Programming 604
SKILL Language Programming 604