0% found this document useful (0 votes)
25 views

SKILL Programming - Introduction - Ver1.0

Uploaded by

amritakavin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

SKILL Programming - Introduction - Ver1.0

Uploaded by

amritakavin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 94

SKILL Programming -

Introduction
By Rakesh M Sawant
Agenda

• Locating SKILL Information


• SKILL Programming Fundamentals
• Working With Lists
• Windows and Bindkeys
• Database Queries
• Menus and Toolbars
• Customization
• SKILL Functions
• SKILL Integrated Environment (IDE)
• Flow of Control

2
Locating SKILL Information

• Locate SKILL Information, solutions and examples using


• Candence Help (cdnshelp) online documentation system
• Candence Online Support Product Manuals Page
• Candence Online Support SKILL Information Page
• Cadence IC Community Blogs and Forums
• Cadence CDNLive Evenets and Proceedings
• SKILL API Finder search assistant in the SKILL IDE
• Virtuoso Search assistant

3
Locating SKILL Information

• 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

4
Locating SKILL Information

• SKILL Documentation Quick Reference


• These manuals cover the SKILL language independent of the design environment
• Cadence SKILL Language Reference
• Candence SKILL Language User Guide
• Candence SKILL Development Reference
• These manuals cover SKILL interfaces to the Virtuoso Design Environment
• Cadence User Interface SKILL Reference
• Virtuoso Design Environment SKILL Reference
• Vituoso Layout Suite SKILL Reference

Note: You can locate these product manuals in Cadence Help and on http://support.cadence.com under the Resources tab

5
Locating SKILL Information

• These manuals cover additional related features


• Virtuoso Relative Object Design(ROD) User Guide
• Virtuoso Parametrized Cell(Pcell) Reference
• Virtuoso Parametrized Cell(Pcell) SKILL Reference
• Cadence SKILL IDE User Guide
• Virtuoso I 6.1.8: What’s New

6
Locating SKILL Information

• Click on Help – Virtuoso Documentation Library in the upper right corner of a Virtuoso windo or
enter cdnshelp in an xterm window to launch Cadence Help
• Cadence Help has the SKILL related manuals containing syntax and examples needed to write SKILL
programs

7
Locating SKILL Information

• SKILL API Finder More Info Option

8
Locating SKILL Information

• Look up SKILL Examples on Cadence Online Support


• In Cadence Online Support (support.cadence.com) go to Resources – SKILL Information to locate, filer and
search for SKILL code examples

9
Locating SKILL Information

• SKILL Examples in the Custom IC Design SKILL Code Library


• When you locate a SKILL program you want to use click on the link to download that example
• To download the entire library of examples, select the Get all files shown below link to download a zip archive

10
Locating SKILL Information

• SKILL Examples in SKILL Information Troubleshooting Info


• You can filter the SKILL Information section to just the Troubeshooting Information document type using the
left hand column. You can also search for keywords to refine the results further. Selecting a specific SKILL
solution will allow you to download the SKILL code example.

11
Locating SKILL Information

• The Cadence IC Community – Goto: www.cadence.com/community


• At the Cadence Community site you can access
• Blogs to read about current IC related topics
• Forums to ask and answer specific design and product questions

12
Locating SKILL Information

• Locate Information on CDNLive Events and Proceedings


• Goto: www.cadence.com/cdnlive to view the previous and upcoming conferences.
• The CDNLive user group conferences provide opportunities to present papers and interact with Cadence customers across the world.
The proceedings offer insight into the flows and methods that Cadence users are applying to solve challenging problems

13
SKILL Programming Fundamentals

• Terms and Definitions

14
SKILL Programming Fundamentals

• Starting the Virtuoso Design Environment

• You can choose from three types of sessions:


• Graphic: Launches the Virtuoso environment and displays the CIW.
• Nongraphic: Virtuoso is started in a command prompt mode where non-graphical SKILL commands and
programs can be run.
• Replay: Launches the Virtuoso environment and a log file is used to replay commands from a prior session.

15
SKILL Programming Fundamentals

• What Is the Virtuoso Design Environment Initialization Process?


• During startup, the Virtuoso Design Environment initialization process searches
for and loads a .cdsinit file to initialize your virtuoso session.

• Virtuoso searches the following directories for a .cdsinit file:


• /tools/dfII/local
• The current directory “.”
• The home directory

• Typically, the .cdsinit file is used to define application bindkeys and load customer
specific SKILL utilities

16
SKILL Programming Fundamentals

• CIW: Command Interpreter Window


• The Command Interpreter Window or CIW launches automatically when Virtuoso starts.

17
SKILL Programming Fundamentals

• CIW: Color-Coded SKILL Syntax


• SKILL language keyword are highlighted in blue and strings in green
• The current incomplete line is noted in yellow background:

• Completed lines show matching parenthesis and a white background:

• Extra parenthesis in a line are shown in red with a yellow background:

• Completed procedures show matching parenthesis and a gray background

18
SKILL Programming Fundamentals

• Setting the Log Filter to Filter Output Pane Data


• Set the log filter using either: CIW – Options – Log Filter or using the SKILL Command hiSetFilterOptions( … )
• From the CIW, choose Options – Log Filter to display the Set Log File Display Filter form and check the boxes for the items
to display

• Use the hiSetFilterOptions function in your .cdsinit file.


• hiSetFilterOptions( t t t t t t t )

19
SKILL Programming Fundamentals

• Example CDS.log File Filtered by the Log Filter


• The Virtuoso Design Environment software transcribes the session in a file called ~/CDS.log.
• The log file adds a two-character tag that identifies the line.
• The following text illustrated an example transcript file:

20
SKILL Programming Fundamentals

• SKILL Syntax Summary

21
SKILL Programming Fundamentals

• What Are SKILL Data Types?


• 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.

22
SKILL Programming Fundamentals

• What Are SKILL Variables?


• SKILL Variables store data for use in SKILL commands,
function calls and programs.
• Variable names can contain:
• Alphanumeric characters
• Underscores ( _ )
• Question marks

• The first character of a variable cannot be a digit or


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

23
SKILL Programming Fundamentals

• What Is a SKILL Function Call?


• A SKILL Function Call invokes a Cadence or user-defined SKILL Function with zero or more arguments.
• SKILL syntax accepts function calls in three ways:
• State the function name first, followed by the arguments in a pair of matching parenthesis. No spaces are allowed between the function name and the left
parenthesis.

• Alternatively, you can place the left parenthesis to the left of the function name

• For SKILL function calls that are not subexpression, you can omit the outermost levels of parenthesis.

24
SKILL Programming Fundamentals

• SKILL Function Call Multiple Lines


• You can span multiple lines in either the CIW or a source code file.

• Several function calls can be on a single line. Use spaces to separate them.

• 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

25
SKILL Programming Fundamentals

• SKILL Function Arguments


• Each argument tells you:
• The expected data type of the argument
• Whether the argument is required, optional, or a keyword argument.

• SKILL function can 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 the arglist function:

26
SKILL Programming Fundamentals

• SKILL Function Argument 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.

• 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.

27
SKILL Programming Fundamentals

• Displaying Data in the CIW with print and println

• Every SKILL data type has a default display format that is called the
print representation.
• The SKILL Evaluator displays a return value with its print
representation.
• SKILL functions often display data before they return a value.
• Both the print and println functions use the print representation to
display data in the CIW output pane. The println function sends a
newline character.
• Both print and println allow for output to a file with the optional
second outputPort argument.

28
SKILL Programming Fundamentals

• Displaying Data Using printf with Format Control

• The printf functions writes formatted output to the CIW. The formatString allows for inserting values in the arguments
that follow into the resulting string.
• The first argument is a conversion control string (formatString) containing directives.

29
SKILL Programming Fundamentals

• printf Examples
• The printf function: If the conversion control directive is inappropriate for the data item, printf gives you an error
message.

• The %L Directive: The %L directive specifies the print representation. This directive is very convenient way to intersperse
application specific formats with default formats. Remember that printf return t.

30
SKILL Programming Fundamentals

• Using sprintf to Create Strings


• The sprintf has the same formatting controls as printf but assigns the results to a variable which is the first argument to
sprintf. The resulting string is also the return value of sprintf.

31
Working with Lists

• Build litsts
• Retrieve list elements
• Use lists to represent points and bounding boxes

32
Working with Lists

• What is a SKILL List?


• A SLILL 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

33
Working with Lists

• How the SKILL Evaluator Displays a List?


• To display a list, the SKILL Evaluator surrounds the elements of the list with parenthesis

• 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 function to display a list. SKILL displays the output on a single line.

34
Working with Lists

• Creating New Lists with the ’ operator and the list Function

• Specify all the elements literally. Apply operator ’ to the list.


Quoting is used to prevent expressions from being evaluated
• Make a list by computing each element from an expression. Pass
the expressions to the list function.

35
Working with Lists

• Adding Elements to an Existing List Using cons and


append

• Use the cons function to add an element to an existing


list.

• Use the append function to merge two lists together.

36
Working with Lists

37
Working with Lists

• Working with Existing Lists SKILL Functions Quick Reference

38
Working with Lists

• Traversing a List with the car and cdr Functions

• 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.

39
Working with Lists

• What Is a Two-Dimensional Point?


• 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

• The xCoord and yCoord functions access the x-coordinate and the y-coordinate.

40
Working with Lists

• Computing Points
• The : operator combines naturally with arithmetic operators. It has a lower precedence than the + or the * operator.

• Computing a point from another point is easy. For example, given a point P, apply an offset dx and dy in both
directions.

41
Working with Lists

• What Is a Bounding Box?


• 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.

• This is returned to you by the system as ( ( 300 400 ) ( 500 450 ) )

42
Working with Lists

• Creating a Bounding Box and Retrieving Elements Example


• Use the list function to create a bounding box. Specify the points by variables or by using the : operator.

• Use the lowerLeft and upperRight functions to retrieve the lower-left corner and the upper-right corner points of a
bounding box.

• These functions assume that the order of the elements is correct. Use the xCoord and yCoord functions to retrieve
the coordinates of these corners.

43
Working with Lists

• Bounding Box Manipulation Examples – Offset a bounding box

44
Working with Lists

• Bounding Box Manipulation Examples – The Smallest Bounding Box Enclosing Two Bounding
Boxes

45
Working with Lists

• Bounding Box Manipulation Examples – Finding the Intersection of Two Bounding Boxes

46
Working with Lists

• Bounding Box Combinations of car and cdr Functions

47
Windows and Bindkeys

• DEMO

48
Database Queries

• What are Database Objects?


• The SKILL Evaluator organizes design data in virtual memory in terms of database objects.
• Use SKILL language to access schematic, symbol and mask layout design data. This includes:
• Physical information (rectangles, lines and paths)
• Logical Information (nets and terminals)
• Some object types and their attributes:

• Each database object can also have one or more user-defined properties.

• The complete list of database object types and attributes is described in the Virtuoso Design Environment SKILL
Functions Reference manual.

49
Database Queries

• Querying a Design Using geGetWindowCellView and ~> operator


• When the design is in a graphic window, use the geGetWindowCellView function
to retrieve the database object for the design as shown in above example

• Next, use the operator to access the attributes of a database object.

50
Database Queries

• Examples of Querying Designs with the ~> operator

51
Database Queries

• What Are Instances?


• The inst object type represents an instance of a master cellview that is placed in the current cellview.
• Example: Instance I1 of master mux2 schematic

52
Database Queries

• What Are Nets?


• Nets are a connection between instances (through instTerms) and also a connection to terminals in the cellview.
• Example: net SEL in master mux2 schematic

53
Database Queries

• What Are Instance Terminals?


• Instance terminals provide an interface between instances 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 terminals on the I1 instance.

54
Database Queries

• What Are Terminals?


• A terminal provides a way to connect to a net within the design. Internal nets do not have terminals.
• Example: Terminal SEL in cellview master mux2 schematic.

55
Database Queries

• What Are Figures and Shapes?


• Figures are anything the user can select with the mouse. Every figure is either an instance or database object such as
a shape or via. Every figure has bBox attribute that describes its bounding box.
• Shapes in addition have a layerName attribute and an objType attribute describes the type of shape such as rect,
polygon, path or line.
• Example: master mux2 layout with an instance, path and via selected

56
Database Queries

• What Are Vias?


• Vias are layout database objects that provide connectivity between interconnected layers.
• In addition to this Standard Via, a Custom Via is allowed but it is stored as a cellview in the database and is not a Via
database object.

57
Menus and Toolbars

• 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 using the Toolbar Manager.

58
Menus and Toolbars

• Create a Pop-Up Menu with hiCreateSimpleMenu

• Use the hiCreateSimpleMenu function to build a menu with choices.


• Example above creates a pop-up menu with Example Menu as the title.
• Use the hiDisplayMenu function to display the menu.

59
Menus and Toolbars

• How to Display a Pop-Up Menu


• Use the hiDisplayMenu function to display a pop-up menu.
• Pass the menu data structure to the hiDisplayMenu function.

• Once you create a simple menu you can set a bindkey to display it for the user.

60
Menus and Toolbars

• How to Display a Pop-Up Menu


• Use the hiDisplayMenu function to display a pop-up menu.
• Pass the menu data structure to the hiDisplayMenu function.

• Once you create a simple menu you can set a bindkey to display it for the user.

61
Menus and Toolbars

• Creating a Pull-Down Menu Using


hiCreateMenuItem and
hiCreatePulldownMenu
• 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.

62
Menus and Toolbars

• Inserting a Pull-down Menu Into a Window Banner

• Assume that a single window is already open and use the


hiInsertBannerMenu function to insert a pull-down menu in
the window menu banner.
• The following command inserts a pull-down menu in the
leftmost position (0) of the CIW (window #1):

63
Menus and Toolbars

• How to Display a Pop-Up Menu

• 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
• 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.

64
Menus and Toolbars

• What Is a Toolbar?

• Toolbars provide consistent icon menus across windows and applications. They are available for all applications.
• The icons in the toolbars have SKILL callbacks associated with them to complete an action.
• You can customize the toolbars using several approaches:

65
Menus and Toolbars

• Toolbar Customization with an ASCII File


• 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/appName.toolbars
• Layout.toolbars file:

• Modify your local copy at .cadence/dfII/toolbars/byApplication/Layout.toolbars and restart Virtuoso. Hover the
mouse over the icon to see the changes to the icon text.

66
Menus and Toolbars

• Toolbar Customization with SKILL Commands


• This example uses the deFindToolbar, hiCreateAction, hiDeleteToolbarItem and hiAddToolbarItem functions.
• Open a Layout Window and load the SKILL code. Hover the mouse over the icon to see the changes to the icon text.

67
Menus and Toolbars

• How to Customize a Toolbar Using the Toolbar Manager


• The Toolbar Manager provides a user interface to manage items in toolbars.

68
Customization

• DEMO

69
SKILL Functions

• Grouping SKILL Expressions Together with Curly Braces

• 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.

70
SKILL Functions

• Two Common let Errors


• Including whitespaces after let.
• The error message depends on whether the return value of the let is assigned
to a variable.

• Omitting the list of local variables


• The error message vary and can be obscure and hard to decipher.
• Even if you have no local variables, you must provide an empty list format.

71
SKILL Functions

• Defining SKILL Functions Using the Procedure Function

• 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

72
SKILL Functions

• Three Common procedure Errors


• Including whitespace after the procedure function:

• Including whitespace after your function name:

• Omitting the argument list:

• The arguments to procedure are the function name, the argument list of the function, and the expression composing
the body of the function

73
SKILL Functions

• Defining Required Function Parameters


• 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
Make bBox a required parameter

To execute your function, you must


provide a value for the bBox parameter

74
SKILL Functions

• Defining Optional Function Parameters


• Include @optional before any optional function parameters
• Use paranthesis to designate a default value for an optional parameter

• To call the TrOffsetBBox function, specify the required and the optional arguments as follows:

75
SKILL Functions

• Defining Optional Function Parameters


• Include @optional before any optional function parameters
• Use parenthesis to designate a default value for an optional parameter

• To call the TrOffsetBBox function, specify the required and the optional arguments as follows:

76
SKILL Functions

• Collecting Function Parameters Into 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

• The TrCreatePath function simply prints a message about the list contained in points. To call the TrCreatePath
function, specify any number of points.

77
SKILL Functions

• SKILL Development Cycle


• 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.

• Traditionally, SKILL code was developed with an


external text editor and then the cut/pasted or
loaded into the CIW and a command line
debugger was used.

• Now the SKILL IDE offers a much-improved


interactive Development and Debug Environment
that may also be used in SKILL code development.

78
SKILL Functions

• Loading SKILL Source Code Using the load Command

• 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

• When you pass a relative pathname to the load function, the


load function resolves it in terms of a list of directories call the
SKILL path.

• You usually establish the SKILL path in your .cdsinit file by using
the setSkillPath or getSkillPath functions.

79
SKILL Functions

• How to Copy and Paste SKILL Source Code Into the CIW
• Use the mouse in your editor to select the source code.
• Move the cursor over the CIW input pane.
• Click the middle mouse button. Your selection is displayed in
the CIW input pane.
• Press return – Your entire selection is evaluated and displayed
in the CIW output pane.

80
SKILL Integrated Development Environment (IDE)

• Demo

81
Flow of Control

• SKILL Relational Operators


• SKILL Logical Operators
• Branching Statements
• Several methods of iteration to process data

82
Flow of Control

• SKILL Logical Operators


• The SKILL Evaluator considers nil as FALSE and any other value as TRUE
• The && and || operators only evaluate their second arguments if they must to determine the return result
• The && and || operators return the value last computed

83
Flow of Control

• SKILL Branching Statements

84
Flow of Control

• 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 the shapeType is rect the return value in the value of rectCount


• If the shapeType is not rect the return value in the value of miscCount

85
Flow of Control

• Two common if Errors


• Including whitespaces after if

• Including a right parenthesis after the conditional expression

86
Flow of Control

• Nested if-then-else Expressions


• Be careful with matching parenthesis correctly
• Comment the closing parenthesis and indent consistently as in below example

87
Flow of Control

• The when and unless Functions


• Use the when function whenever you have only then expression

• Use the unless function to avoid negating a condition

88
Flow of Control

• 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

89
Flow of Control

• The case Function

• Use the cond function when your logic involves multiway


branching.

• It 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
• It returns the last value computed in the arm it executes

• The cond function is equivalent to the if-then-else nested


expression shown here →

90
Flow of Control

• SKILL Interation

91
Flow of Control

• The for Function

• 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 expression
• 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 pranthesis: for( … )
• To avoid putting whitespaces immediately after the for syntax function

92
Flow of Control

• The foreach Function


• Use the foreach function to evaluate one or more expressions for each
element in a list of values

• 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.

93
Flow of Control

• The prog and return Function

• If you need to exit a collection of SKILL statements conditionally, use the prog function
• 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.

94

You might also like