• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Blogs
  2. Analog/Custom Design
  3. SKILL for the Skilled: Introduction to Classes -- Part …
Team SKILL
Team SKILL

Community Member

Blog Activity
Options
  • Subscribe by email
  • More
  • Cancel
CDNS - RequestDemo

Have a question? Need more information?

Contact Us
Sodoku
Team SKILL
programming
classes
object orientation
Virtuoso
object system
Lisp
Custom IC Design
SKILL++
SKILL
Allegro

SKILL for the Skilled: Introduction to Classes -- Part 1

15 Aug 2011 • 3 minute read

In the previous couple of SKILL for the Skilled postings, we looked at some of the features of SKILL++. In fact, we saw local functions, higher-order functions, and lexical scoping. Still another set of features of SKILL++ is called the SKILL++ Object System. This system provides a standardized way of implementing object oriented SKILL applications.

Object Orientation

An Object System is a programming language feature which allows the programmer to control the characteristics and behavior of groups of objects in an organized and coherent way -- in effect making certain types of problems easier to solve.

If you are familiar with C++, Java, or similar programming languages, you might think that Object Orientation is that thing which C++/Java does. I would suggest to abandon that restrictive misconception. One of the first languages to introduce the concepts of object orientation was lisp during the 1970s, long before C++ or Java existed. The SKILL++ object system is based on this lisp approach. I hope the upcoming series of articles begins to peek your interest in this powerful and elegant subset of the SKILL language.

The SKILL++ Object System

SKILL++ strives to make the object system dynamic and reflective. This means you can create classes, and methods on the fly, inspect and debug them, and edit and redefine them in the same VM image. As you learn more about SKILL++ you should be pleasantly surprised at the power of a dynamic object oriented language.

In a nutshell the SKILL++ Object System allows the SKILL programmer to define classes of objects which share (some) structure definition and have similar behavior. Classes define how instances are structured. On the other hand methods on generic functions define how those instances of those classes behave and interact.

The SKILL++ object system provides the capabilities of classes and methods in such a way that they can be used independently or together as the programmer chooses. The means you don't need to understand generic functions and methods to understand classes and instances. In the upcoming series of articles we will look at classes as a tool for solving the Sudoku puzzle.

The Sudoku puzzle

First, what is a Sudoku puzzle? The Sudoku puzzle is a grid divided into nine horizontal rows, nine vertical columns, and nine so-called 3x3 blocks. To solve a sudoku puzzle, you must fill in each blank entry with an appropriately chosen digit from the set {1, 2, 3, 4, 5, 6, 7, 8, 9} such that the rows, columns, and 3x3 blocks each contain all of the numbers from 1 through 9. An implication of this requirement is that each digit must appear exactly once in each row, exactly once in each column, and exactly once in each 3x3 block.

Sudoku in SKILL++

I'd like to implement a SKILL function, SkuSolve, which will work like the following example. The actual example comes from the Sudoku Wikipedia entry.

After we have implemented SkuSolve and its support functions, we should be able to solve any valid Sudoku puzzle as follows.

(SkuSolve '((5 3 ?   ? 7 ?   ? ? ?)
(6 ? ? 1 9 5 ? ? ?)
(? 9 8 ? ? ? ? 6 ?)

(8 ? ? ? 6 ? ? ? 3)
(4 ? ? 8 ? 3 ? ? 1)
(7 ? ? ? 2 ? ? ? 6)

(? 6 ? ? ? ? 2 8 ?)
(? ? ? 4 1 9 ? ? 5)
(? ? ? ? 8 ? ? 7 9)))
This call should print something like the following:

 

starting with: 
+-----+-----+-----+
|5|3| | |7| | | | |
|6| | |1|9|5| | | |
| |9|8| | | | |6| |
|8| | | |6| | | |3|
|4| | |8| |3| | |1|
|7| | | |2| | | |6|
| |6| | | | |2|8| |
| | | |4|1|9| | |5|
| | | | |8| | |7|9|
+-----+-----+-----+

found solution:
+-----+-----+-----+
|5|3|4|6|7|8|9|1|2|
|6|7|2|1|9|5|3|4|8|
|1|9|8|3|4|2|5|6|7|
|8|5|9|7|6|1|4|2|3|
|4|2|6|8|5|3|7|9|1|
|7|1|3|9|2|4|8|5|6|
|9|6|1|5|3|7|2|8|4|
|2|8|7|4|1|9|6|3|5|
|3|4|5|2|8|6|1|7|9|
+-----+-----+-----+

Preview

In the upcoming series we'll look at the following:

  • Defining a class including with inheritance
  • Constructing instances of a class
  • Manipulating instances at run-time
  • Examining the content of an instance

Stay tuned for more to come. Please send submit your questions or comments in the comment section below.

Jim Newton

See Also:
  • Object-oriented programming
  • Common Lisp Object System
  • Sudoku

CDNS - RequestDemo

Try Cadence Software for your next design!

Free Trials

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information