Skip to main content

Updated 10 min readSKILL Scripting

Cadence SKILL language tutorial + examples

Learn the Cadence SKILL language with runnable Virtuoso examples: syntax, lists, procedures, dbCreateRect, PCells, CDF callbacks, forms and CIW debugging.

By the SkyCadEda engineering teamHow these notes are written

  • SKILL Scripting
  • Cadence Virtuoso
  • IC Design

ShareLinkedInX

On this page

Cadence SKILL is the Lisp-based scripting language built into Virtuoso. Anything you can do with the mouse in the layout editor, schematic editor or ADE you can also do from SKILL, and SKILL is the only way to write PCells, CDF callbacks and native Virtuoso forms. This guide covers the syntax, five working examples you can paste into the CIW, and how SKILL fits next to Tcl and Python.

What is Cadence SKILL?

SKILL is a dialect of Lisp developed by Cadence for controlling and extending its custom IC tools. The name comes from SCIL (Silicon Compiler Interface Language), pronounced "skill". It has been the scripting layer of the Virtuoso platform for more than three decades. SKILL code runs inside the Virtuoso process, so it reads and edits the open design database directly, creates menus and forms, and reacts to user actions. SKILL++ is the same language with Scheme-style lexical scoping, selected by the .ils file extension.

Everything is an S-expression, but SKILL also accepts C-style calls, so (printf "Hello, %s\n" name) and printf("Hello, %s\n" name) are the same thing. Conditionals use if, when, unless and cond; loops use for, foreach and while.

The functions you will call most fall into a few families: db* for the design database (cells, instances, shapes, nets, terminals), ge* and le* for the graphics and layout editor, hi* for forms, menus and bindkeys, cdf* for component parameters, and dd* for libraries and cells on disk.

SKILL syntax basics

The snippet below covers most of what you need to read other people's SKILL: variables, lists, local scope with let, procedures, and the two loop styles.

; Variables and lists
x = 3                          ; assignment, x is now 3
pts = list(0:0 2.0:1.0)        ; list of two points (x:y pairs)
car(pts)                       ; => (0 0)       first element
cadr(pts)                      ; => (2.0 1.0)   second element
length(pts)                    ; => 2
append1(pts 4:4)               ; returns a new list with 4:4 added at the end

; A procedure with local variables
procedure(SkArea(w h)
    let((area)
        area = w * h
        printf("area = %g\n" area)
        area                   ; last expression is the return value
    )
)

; Conditionals
cond(
    ((x > 5)  println("big"))
    ((x > 0)  println("small"))
    (t        println("zero or negative"))
)

; Loops
for(i 1 3 printf("i=%d\n" i))
foreach(p pts printf("point %L\n" p))

Two habits save time early on. Declare every variable inside let (or prog) so procedures do not leak globals into the session. And prefix your own function names (for example Sk), because SKILL has one global function namespace and Cadence reserves lower-case prefixes for its own functions.

Why SKILL matters for IC design

Custom and analog layout is still largely drawn by people, so layout productivity sets a large part of the schedule. SKILL runs inside the layout tool, which makes it the most direct way to remove repetitive editing.

A typical example: a layout engineer needs 200 identical capacitor instances in a matched array. By hand that means placing, aligning and routing each one and checking the matching pattern. A SKILL script takes rows, columns, pitch and the pattern as input and builds the array in seconds, the same way every time. The same approach applies to guard rings, pin and label placement, routing of repeated structures and layout migration.

Outside layout, the ADE simulation environment is scripted through OCEAN, which is SKILL with simulation functions (simulator, design, analysis, run). CDF callbacks, written in SKILL, control what happens when a designer edits a device parameter in the schematic.

SKILL use cases in production design

Parameterized cells (PCells)

A PCell is a layout cell whose geometry is generated by a SKILL function from its parameters. A MOSFET PCell takes width, length, finger count, contact style and well options and draws the matching layout. One device with a wide range of widths, lengths, finger counts and guard ring options has thousands of valid configurations; the PCell draws whichever one is requested.

Production PCells have to handle the corner cases (fingers so narrow that contacts no longer fit), produce DRC- and LVS-clean results for every legal parameter set, and validate their inputs. A minimal definition looks like this:

; Minimal PCell: a metal1 rectangle sized by two parameters.
; Load in the CIW with the target library writable.
pcDefinePCell(
    list(ddGetObj("myPcellLib") "sk_rect" "layout")
    (
        (width  float 1.0)
        (length float 2.0)
    )
    let((cv)
        cv = pcCellView
        dbCreateRect(cv list("metal1" "drawing") list(0:0 width:length))
    )
)

For stretch handles, Express PCells and more complex generators, see PCell development in Virtuoso.

Layout automation tools

Beyond PCells, SKILL is used for guard ring generators, routing helpers for differential pairs and current mirrors, placement scripts that respect spacing rules, metal fill generation and batch edits that update properties on hundreds of instances at once. Longer worked examples are in Virtuoso layout automation with SKILL.

Custom GUIs and interactive tools

The hi* functions build forms inside Virtuoso: fields, cyclic (drop-down) fields, toggles and buttons with callbacks. A form lets engineers who do not write SKILL run a generator with the right defaults and input checks. The form example further down shows the pattern.

CDF callbacks and schematic automation

The Component Description Format (CDF) defines a device's parameters and how they behave in the schematic and in the Edit Properties form. Each parameter can name a SKILL callback that runs when the value changes. Inside the callback, cdfgData refers to the CDF data of the instance being edited.

; CDF callback for parameter "w": clamp to a minimum width.
; Set the parameter's callback field to "SkWidthCB()".
procedure(SkWidthCB()
    let((w)
        w = cdfParseFloatString(cdfgData->w->value)
        when(w && w < 0.4e-6
            cdfgData->w->value = "400n"
            printf("w raised to the 400n minimum\n")
        )
    )
)

A resistor callback works the same way: compute segment count from the requested resistance and sheet resistance, update the derived parameters, and refuse values the geometry cannot reach.

Bindkeys and command extensions

Binding a function to a key is the smallest useful piece of automation. Put lines like this in your .cdsinit:

hiSetBindKey("Layout" "Shift<Key>r" "SkLayerReport()")
hiSetBindKey("Layout" "Ctrl<Key>F5" "SkListShapes()")

Cadence SKILL code examples

The snippets below can be typed into the Virtuoso CIW (Command Interpreter Window) or saved to a file and loaded with load(). Each one shows a pattern that larger scripts build on: walking the database, creating geometry, building a form and generating a report. Open a layout cellview first; the examples that create shapes need it open in edit mode.

Iterating shapes in a cellview with dbGetq

This walks every shape in the current cellview and prints its object type and layer-purpose pair to the CIW. The ~> operator is shorthand for dbGetq, the database attribute accessor used throughout SKILL layout code.

; List every shape in the current cellview with its layer
procedure(SkListShapes()
    let((cv)
        cv = geGetEditCellView()
        unless(cv error("Open a cellview first\n"))
        foreach(shape dbGetq(cv shapes)
            printf("%s on layer %L\n" shape~>objType shape~>lpp)
        )
        t
    )
)

Creating a rectangle with dbCreateRect

Creating geometry is the basis of every PCell and layout generator. This draws a 2.0 by 1.0 micron rectangle on metal1 drawing at the origin of the cellview being edited. Coordinates are written as x:y pairs and a bounding box is a list of two points. The interactive counterpart, leHiCreateRect(), starts the Create Rectangle command and lets the user click the corners.

; Create a 2.0um x 1.0um rectangle on metal1 drawing
procedure(SkDrawRect()
    let((cv rect)
        cv = geGetEditCellView()
        unless(cv error("Open a layout cellview in edit mode first\n"))
        rect = dbCreateRect(cv list("metal1" "drawing") list(0.0:0.0 2.0:1.0))
        when(rect
            printf("Created rectangle with bBox %L\n" rect~>bBox)
        )
        t
    )
)

A simple dialog with hiCreateAppForm

This builds a form with one float field and a callback that echoes the value to the CIW. The same pattern scales to generator front-ends with cyclic fields, toggles and validation.

; Minimal form: ask for a device width and echo it to the CIW
procedure(SkWidthFormCB(form)
    printf("Width entered: %g um\n" form->widthField->value)
)

procedure(SkShowWidthForm()
    let((field form)
        field = hiCreateFloatField(
            ?name 'widthField
            ?prompt "Device width (um)"
            ?value 1.0
        )
        form = hiCreateAppForm(
            ?name 'SkWidthForm
            ?formTitle "Set Device Width"
            ?fields list(field)
            ?callback 'SkWidthFormCB
        )
        hiDisplayForm(form)
    )
)

A layer-usage report loop

This tallies the shapes on each layer of the current cellview in an association table created with makeTable, then prints a summary. The same loop is the starting point for density checks and layout audits.

; Count shapes per layer and print a usage report
procedure(SkLayerReport()
    let((cv counts)
        cv = geGetEditCellView()
        unless(cv error("Open a cellview first\n"))
        counts = makeTable("layerCounts" 0)
        foreach(shape dbGetq(cv shapes)
            counts[shape~>layerName] = counts[shape~>layerName] + 1
        )
        printf("Layer usage for %s/%s:\n" cv~>libName cv~>cellName)
        foreach(layer counts
            printf("  %s: %d shapes\n" layer counts[layer])
        )
        t
    )
)

SKILL vs Tcl vs Python: choosing the right language

LanguageWhere it is nativeUse it for
SKILL / SKILL++Cadence Virtuoso, ADE (via OCEAN)PCells, CDF callbacks, forms, bindkeys, in-session database edits
TclSynopsys ICC2, PrimeTime, Custom Compiler; Cadence Innovus and Tempus; Calibre TVFTool control in those shells, flow scripts, report parsing
PythonOutside the tools (and some newer tool APIs)Orchestration, log and report parsing, dashboards, glue between tools

SKILL: the Virtuoso native language

If the work happens inside Virtuoso, write it in SKILL. PCells, CDF callbacks, forms, bindkeys and direct database edits all require it.

Tcl/Tk: the Synopsys and verification standard

Tcl is the command language of the Synopsys implementation and signoff tools (ICC2, PrimeTime, Custom Compiler) and of Cadence's digital tools (Innovus, Tempus). Calibre's rule language is SVRF; TVF, the Tcl layer that generates SVRF, and the Calibre RVE and query interfaces are Tcl-based. In mixed flows, Tcl or shell scripts often drive the tools while SKILL handles the Virtuoso steps. See Tcl scripting for EDA automation.

Python: the integration layer

Python is the best fit for cross-tool work: parsing logs and reports, comparing runs, generating HTML or CSV summaries and launching jobs. It can talk to a live Virtuoso session through a SKILL bridge, but the code that edits the database still executes as SKILL. More in Python for EDA automation.

The practical answer: use all three

Production flows mix them: SKILL for Virtuoso, Tcl for the tools that speak it, Python for data and orchestration, shell for environment setup and job submission. A Python wrapper can launch Virtuoso in batch (virtuoso -nograph -replay script.il) and collect the results.

Getting started with SKILL scripting

The reference documents are the Cadence SKILL Language Reference and the Virtuoso SKILL function references, both in the Cadence Help system shipped with the tools (cdnshelp). The SKILL API Finder searches function names and shows their arguments.

Start with a task you repeat every day. A bindkey that toggles a display setting or jumps to a cell is a good first script. Then move to reading the database: iterate over instances, print properties, change them. Once that is comfortable, write a small PCell.

SKILL scripting tutorial: getting started

This walks through the full cycle of a first script: write it, load it, run it, and find the output.

  1. Write the script. Create a plain text file named hello.il in the directory where you start Virtuoso. The .il extension is the convention for SKILL source files. Put this in the file:
    ; hello.il -- a first SKILL script
    procedure(SkHello()
        printf("Hello from SKILL!\n")
        printf("Running inside: %s\n" getVersion())
        t
    )
  2. Load it in the CIW with load(). In the Command Interpreter Window, type load("hello.il") and press Enter. If the file lives elsewhere, pass the full path, for example load("/home/user/skill/hello.il"). A successful load returns t; a syntax error prints a message pointing at the offending line.
  3. Run it and print to the CIW with printf. Type SkHello() in the CIW input line. Both printf calls write to the CIW output pane, the usual destination for status messages and debug traces.
  4. Find the Virtuoso log. Everything printed to the CIW is also written to the session log, normally CDS.log in the home directory (earlier sessions rotate to CDS.log.1 and so on). The log is where you recover output from long batch runs.
  5. Iterate. Edit the file, run load("hello.il") again and re-run the function. Reloading redefines the procedure in place, so there is no restart. To load your utilities in every session, add the load() calls to .cdsinit.

If you need PCells, CDF callbacks or layout utilities written and maintained for your team, see our Cadence SKILL scripting services.

Frequently asked questions

What is Cadence SKILL programming?

Cadence SKILL is a Lisp-based scripting language embedded in Cadence Virtuoso and the other Cadence custom IC tools. It gives programmatic access to the design database, the user interface and every Virtuoso command. Engineers use it to write parameterized cells (PCells), CDF callbacks, layout utilities, custom forms and bindkeys. SKILL++ is the variant with Scheme-style lexical scoping.

Is SKILL hard to learn compared to Python?

The parentheses and prefix notation look unfamiliar at first, but SKILL also accepts C-like calls such as printf("%d" x), and the core constructs (procedure, let, if, foreach, cond) are small. Engineers who already program usually become productive within a few weeks. Most of the learning is the Virtuoso database model (cellviews, shapes, instances, terminals), not the language itself.

Can Python replace SKILL for Cadence Virtuoso automation?

Partly. Python is good for batch jobs, report parsing and tying Virtuoso to other tools, and it can drive a running Virtuoso session through a SKILL bridge such as the open-source skillbridge package. PCells, CDF callbacks, forms, bindkeys and in-session database edits still run as SKILL, so most production flows use both.

What are PCells in Cadence SKILL?

PCells (parameterized cells) are layout cells whose geometry is generated by code from parameters instead of drawn by hand. In SKILL a PCell is defined with pcDefinePCell: a list of parameters with defaults, and a body that creates shapes in pcCellView. A MOSFET PCell takes width, length and finger count and draws the matching DRC-clean layout for every combination.

Does SkyCadEda provide SKILL scripting services?

Yes. SkyCadEda provides Cadence SKILL scripting services: PCell development, layout automation tools, custom forms, CDF callbacks, bindkeys, batch processing scripts and modernization of legacy SKILL code. We work with foundries, IDMs, fabless semiconductor companies and IP providers worldwide.

More engineering notes

Working through a problem like this?

Tell us about your flow: the tools, the PDK, what is failing and when it needs to be clean.