SKILL Programming - Introduction - Ver1.0
SKILL Programming - Introduction - Ver1.0
Introduction
By Rakesh M Sawant
Agenda
2
Locating SKILL Information
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
Note: You can locate these product manuals in Cadence Help and on http://support.cadence.com under the Resources tab
5
Locating SKILL Information
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
8
Locating SKILL Information
9
Locating SKILL Information
10
Locating SKILL Information
11
Locating SKILL Information
12
Locating SKILL Information
13
SKILL Programming Fundamentals
14
SKILL Programming Fundamentals
15
SKILL Programming Fundamentals
• Typically, the .cdsinit file is used to define application bindkeys and load customer
specific SKILL utilities
16
SKILL Programming Fundamentals
17
SKILL Programming Fundamentals
18
SKILL Programming Fundamentals
19
SKILL Programming Fundamentals
20
SKILL Programming Fundamentals
21
SKILL Programming Fundamentals
• 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
23
SKILL Programming Fundamentals
• 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
• 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
• 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
• 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
• 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
• 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
31
Working with Lists
• Build litsts
• Retrieve list elements
• Use lists to represent points and bounding boxes
32
Working with Lists
33
Working with Lists
• 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
35
Working with Lists
36
Working with Lists
37
Working with Lists
38
Working with Lists
• 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
• 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
42
Working with Lists
• 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
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
47
Windows and Bindkeys
• DEMO
48
Database Queries
• 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
50
Database Queries
51
Database Queries
52
Database Queries
53
Database Queries
54
Database Queries
55
Database Queries
56
Database Queries
57
Menus and Toolbars
58
Menus and Toolbars
59
Menus and Toolbars
• Once you create a simple menu you can set a bindkey to display it for the user.
60
Menus and Toolbars
• Once you create a simple menu you can set a bindkey to display it for the user.
61
Menus and Toolbars
62
Menus and Toolbars
63
Menus and Toolbars
• 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
• 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
67
Menus and Toolbars
68
Customization
• DEMO
69
SKILL Functions
• 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
71
SKILL Functions
72
SKILL Functions
• 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
74
SKILL Functions
• To call the TrOffsetBBox function, specify the required and the optional arguments as follows:
75
SKILL Functions
• To call the TrOffsetBBox function, specify the required and the optional arguments as follows:
76
SKILL Functions
• 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
78
SKILL Functions
• 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
82
Flow of Control
83
Flow of Control
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
85
Flow of Control
86
Flow of Control
87
Flow of Control
88
Flow of Control
89
Flow of Control
90
Flow of Control
• SKILL Interation
91
Flow of Control
• 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
93
Flow of Control
• 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