Cadence SKILL
Encyclopedia
SKILL is a Lisp dialect used as a scripting language
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

 and PCell
PCell
PCell stands for parameterized cell, a concept used widely in the automated design of analog electronic circuits. A PCell is a cell which is automatically generated by electronic design automation software based on the value of its governing parameters...

 (parameterized cells) description language used in many EDA
Electronic design automation
Electronic design automation is a category of software tools for designing electronic systems such as printed circuit boards and integrated circuits...

 software suites by Cadence Design Systems
Cadence Design Systems
Cadence Design Systems, Inc is an electronic design automation software and engineering services company, founded in 1988 by the merger of SDA Systems and ECAD, Inc...

 (e.g. Cadence Allegro and Cadence Virtuoso). It was originally put forth in an IEEE
Institute of Electrical and Electronics Engineers
The Institute of Electrical and Electronics Engineers is a non-profit professional association headquartered in New York City that is dedicated to advancing technological innovation and excellence...

 paper in 1990.

History

SKILL was originally based on a flavor of Lisp called “Franz Lisp
Franz Lisp
In computer programming, Franz Lisp was a Lisp system written at UC Berkeley by the students of Professor Richard J. Fateman, based largely on Maclisp and distributed with the Berkeley Software Distribution for the Digital Equipment Corp VAX...

” created at UC Berkeley
University of California, Berkeley
The University of California, Berkeley , is a teaching and research university established in 1868 and located in Berkeley, California, USA...

 by the students of Professor Richard J. Fateman
Richard Fateman
Richard J. Fateman is a professor emeritus of computer science at the University of California, Berkeley.He received a BS in Physics and Mathematics from Union College in 1966, and a Ph.D. in Applied Mathematics from Harvard University in 1971. He was a major contributor to the Macsyma computer...

. SKILL is not an acronym, it is a name. For trademark reasons Cadence prefers it be capitalized.

Franz Lisp
Franz Lisp
In computer programming, Franz Lisp was a Lisp system written at UC Berkeley by the students of Professor Richard J. Fateman, based largely on Maclisp and distributed with the Berkeley Software Distribution for the Digital Equipment Corp VAX...

 and all other flavors of LISP
Lisp
A lisp is a speech impediment, historically also known as sigmatism. Stereotypically, people with a lisp are unable to pronounce sibilants , and replace them with interdentals , though there are actually several kinds of lisp...

 were eventually superseded by an ANSI
Ansi
Ansi is a village in Kaarma Parish, Saare County, on the island of Saaremaa, Estonia....

 standard for Lisp called "Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in ANSI standard document ANSI INCITS 226-1994 , . From the ANSI Common Lisp standard the Common Lisp HyperSpec has been derived for use with web browsers...

." Historically, SKILL was known as IL. SKILL was a library of IL functions. The name was originally an initialism for Silicon Compiler Interface Language (SCIL), pronounced "SKIL," which then morphed into "SKILL," a plain English word that was easier for everyone to remember.'

"IL" was just Interface Language. Whilst SKILL was used initially to describe the API rather than the language, the snappier name stuck. The name "IL" remains a common file extension used for SKILL
Skill
A skill is the learned capacity to carry out pre-determined results often with the minimum outlay of time, energy, or both. Skills can often be divided into domain-general and domain-specific skills...

 code ".il" designating that the code contained in the file have lisp-2 semantics. Another possible file extension is ".ils" designating that the content have lisp-1 semantics.

Comments

Comments are delimited by either the traditional Lisp semicolon

(car mylist) ; Comment from semicolon to end of the line

or C-style comments

/* Comment */ car(mylist) /* Another comment */

Function call

SKILL programmers have a choice of expression syntaxes. Traditional Lisp syntax such as
(car mylist)
can be mixed with C-like syntax such as
car(mylist)
White space between the function name and the opening parenthesis, as in
car (mylist)
is also allowed but has a different meaning. For example
(list car (mylist))
or equivalently
list(car mylist)
has the traditional lisp meaning of a call to the list function with two operands car and (mylist), the first of which is a variable reference, and the second a call to the mylist function. Usually this is not what the beginner programmer intended. Thus, SKILL novices usually incorrectly think of car (mylist) as a syntax error.

Certain arithmetic operations can be also called using an infix notation
Infix notation
Infix notation is the common arithmetic and logical formula notation, in which operators are written infix-style between the operands they act on . It is not as simple to parse by computers as prefix notation or postfix notation Infix notation is the common arithmetic and logical formula notation,...

. Thus each of the following is recognized and in fact are represented the same internally

(plus 1 2 3 4 5 6 7)
plus(1 2 3 4 5 6 7)
1+2+3+4+5+6+7


Functions may be called using several different indirect second order functions.


(inSkill (apply 'plus '(1 2 3 4 5 6 7)))
(inScheme (apply plus '(1 2 3 4 5 6 7)))
(inSkill (apply 'plus 1 2 3 '(4 5 6 7)))
(inScheme (apply plus 1 2 3 '(4 5 6 7)))
(inSkill (funcall 'plus 1 2 3 4 5 6 7)))
(inScheme (funcall plus 1 2 3 4 5 6 7)))

Function definition

This infix notation was introduced to make it easier for programmers familiar with C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 and other procedural languages to understand and write SKILL code.

SKILL indeed internally represents the language as traditional Lisp S-expression
S-expression
S-expressions or sexps are list-based data structures that represent semi-structured data. An S-expression may be a nested list of smaller S-expressions. S-expressions are probably best known for their use in the Lisp family of programming languages...

, the surface syntax loosens this restriction compared to other lisps. More elaborate examples look quite different to their Lisp equivalents. For example, the factorial function in SKILL may be represented several different ways which are all compiled to the identical internal representation.

C styl

procedure( factorial(n)
if( n<=1 then
1
else
n * factorial(n-1)
)
)


lisp styl

(procedure (factorial n)
(if (leqp n 1)
then 1
else (times n (factorial (difference n 1)))))


hybrid styl

(procedure (factorial n)
(if n<=1
then 1
else n * (factorial n-1)))

Objects and types

The SKILL language supports several built-in object types.
  • symbol --

  • list

  • fixnum

  • flonum

  • string

  • port

  • assocTable

  • array

  • funobj

  • envobj

  • stdobj

Functions

The SKILL language supports both dynamic (sometimes referred to as special) and lexical variables
Variable (programming)
In computer programming, a variable is a symbolic name given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents...

. However, a single function is limited to interpret its variables homogeneously. There are several ways of syntactically indicating whether a function be interpreted lexically or dynamically. One of which are to use (inSkill ..) and (inScheme ...) forms indicating dynamic and lexical scoping respectively.

(inSkill (lambda (A B) (A B)))


In the inSkill example A and B are dynamic variables in the parameter list of the lambda (the lambda list), and (A B) within the body of the function is interpreted as a call to the globally defined function A passing the value of the local dynamic variable B.

(inScheme (lambda (A B) (A B)))


In the inScheme example A and B are lexical variables in both the lambda list, and also (A B) within the body of the function which is interpreted as a call to the function A which has been passed and a parameter the value of the local lexical variable B.

inSkill and inScheme forms may be mixed within a single function with some degree of flexibility.

(inScheme (lambda (A B) (A (inSkill B) B)))


In this example a lexical 2-ary function is created which calls A, a function passed as its first argument, passing two parameters: the value of the dynamic variable B and also the value of the local lexical variable B.
SKILL supports several kinds of functions. In addition to the functions and special forms built into the language, users can create functions in their own applications of several varieties.

Anonymous functions including lexical closures
Closure (computer science)
In computer science, a closure is a function together with a referencing environment for the non-local variables of that function. A closure allows a function to access variables outside its typical scope. Such a function is said to be "closed over" its free variables...

.


(lambda (A)
(lambda (B)
(plus A B)))


Lambda functions which evaluate their arguments using normal
Evaluation strategy
In computer science, an evaluation strategy is a set of rules for evaluating expressions in a programming language. Emphasis is typically placed on functions or operators: an evaluation strategy defines when and in what order the arguments to a function are evaluated, when they are substituted...

 left-to-right evaluation rules.


(defun (A B)
(list A A B B))


Nlambda functions which do not evaluate their arguments, but pass their operands unevaluated at run time.


(nprocedure (A)
(when (listp A)
(eval A)))


Macros which are evaluated by expanding at load/compile time. The sexpressions a macro returns (evaluates to) become input for the compiler, and is thus evaluated at run time.


(defmacro nif (num if_plus if_zero if_minus)
(let ((var (gensym)))
`(let
(cond ((plusp ,var) ,if_plus)
((zerop ,var) ,if_zero)
(t ,if_minus)))))


SKILL supports CLOS-like generic functions which are allowed to have an optional default implementation.


(defgeneric generic_add (a b c))


SKILL supports CLOS-like methods which specialize on all their required arguments. (Older versions of SKILL only support specialization of the first argument.)


(defmethod generic_add ((a fixnum) (b number) (c list))
(apply plus a b c))


Local functions of two sorts are supported with flet and labels. If local functions are defined with flet such as inner1 and inner2 below, neither one can see the other's definition.


(defun outer
(flet ((inner1
(printf "hello"))
(inner2
(printf "world")))
(inner)
(printf " ")
(world)
(newline)))


If local functions are defined with labels such as inner1 and inner2 below, all of them see the other's definition. Local function are only supported in lexical mode.


(defun outer
(labels ((inner1
(printf "hello"))
(inner2
(inner1)
(printf " world\n")))
(inner2)))

Additional Commands

Additional commands are added to the language for functions specific to a certain tool. For example, functions specific to the PCB Editor have the prefix “axl” (e.g. axlDBGetDesign), and commands specific to the Design Entry tool have the prefix “cn” (e.g. cnGetDwgInfo).

Examples

Here are some examples of SKILL.

First, a basic “Hello world
Hello world program
A "Hello world" program is a computer program that outputs "Hello world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to...

”:

println("Hello, world!")


SKILL supports tail call optimization, if it is explicitly enabled. Here is a tail recursive
Tail call
In computer science, a tail call is a subroutine call that happens inside another procedure and that produces a return value, which is then immediately returned by the calling procedure. The call site is then said to be in tail position, i.e. at the end of the calling procedure. If a subroutine...

 version of factorial which requires no stack space for the recursion if optimizeTailCall is enabled.


(sstatus optimizeTailCall t)

(defun factorial (n)
(flet ((repeat (n factorial)
(if (plusp n)
(repeat (sub1 n)
n * factorial))
factorial)))
(repeat n 1)))


The following definition is a more idiomatic iterative definition.


(defun factorial (n)
(let ((answer 1))
(for i 2 n
answer = answer * i)
answer)))


This example shows how variables are assigned and scoped, using = and let, respectively:

procedure( swap
let( ((a 1) (b 2))
c = a
a = b
b = c
printf("%d %d %d\n" a b c)
)
)


The variables a and b are scoped within the let function, but variable c is not. As a result, c becomes a global variable that can be accessed without the scope of the swap function. Here is what happens when swap is executed and a, b and c are then printed:

> swap
2 1 1
t
> a
  • Error* toplevel: undefined variable - a

> b
  • Error* toplevel: undefined variable - b

> c
1

User Groups

  • A SKILL users' group
    Users' group
    A users' group is a type of club focused on the use of a particular technology, usually computer-related....

     is currently hosted on Yahoo! Groups
    Yahoo! Groups
    Yahoo! Groups is one of the world’s largest collections of online discussion boards. The term Groups refers to Internet communication which is a hybrid between an electronic mailing list and a threaded Internet forum, in other words, Group messages can be read and posted by e-mail or on the Group's...

     under the name "skill_school" (link).
  • Cadence also hosts two SKILL users' group forums on their Cadence Community website. One is dedicated to Allegro PCB SKILL (PCB SKILL), and the other is dedicated to IC
    Integrated circuit
    An integrated circuit or monolithic integrated circuit is an electronic circuit manufactured by the patterned diffusion of trace elements into the surface of a thin substrate of semiconductor material...

    SKILL (Custom IC SKILL).
  • No known users' group currently exists for Cadence Concept SKILL scripting (as of May 2010).


Note: due to Wikipedia's copyright policy, direct links to all three SKILL users' groups cannot be given here. Visit Yahoo! Groups or the Cadence Community website and search by the exact users' group name.

More SKILL Programming Examples:
http://www.cadence.com/community/forums/T/10274.aspx

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK