M. T. Homer Reid MIT Home Page
Physics Problems Research teaching My Music About Me Miscellany

Console-Based Circuit Simulation
in CADENCE Analog Artist:
A Tutorial Introduction to ocean


Lesson 1:
Simple Console Simulations

Lesson 2:
More Advanced Console Simulations

Lesson 3:
Simple Scripting Examples

Lesson 4:
Anatomy of a VCO, Part 1

Introduction and Setup

Perhaps you, like me, are among the dwindling number of IC designers who remember fondly the day when simulating a circuit meant typing text commands into a text window and reading the results as text output. Perhaps your nostalgia for that day, like mine, is based not solely on wistful longing for younger days but on the conviction that working this way is just plain faster than navigating the windows and menus of modern GUI-based circuit simulators. If so, then you, like me, felt somewhat put out when the world chose to abandon text-based programs like Spice and and switch to GUI environments like Cadence's Analog Artist. You went through the obligatory motions of learning to simulate with windows and menus, but all along you were wishing you could just open a console and type in your simulation commands.

Or perhaps you're a native Cadence user, fully at home with windows and menus, but you need a more powerful interface into the simulator to run more thorough simulations and extract more complicated information. You want to simulate your circuit under different process conditions without having to pull down a menu for each one. You want to run your simulation and then do some number crunching on the output data to arrive at the result you're really seeking. You want to set up a long sequence of simulations, each of which depends on the results of the last, and then fire it off before going home for the weekend.

Either way, there's something you're looking for in ocean. While not perfect, the tool provides a much-needed console-based interface into Spectre for those of us who need text to simulate circuits, and a scripting interface into the simulator for those who need to run more complicated simulations.

In this tutorial, I'll try to address both constituencies. The tutorial will be organized into several lessons, broadly divided into two groups. The first few lessons will discuss how to start the console-based ocean interface into Spectre and carry out some basic analyses. In these lessons I have in mind the reader fitting the profile of the first paragraph above--the one who, like me, wants to run Spectre from a text console just like Spice. In the following lessons I'll cover more advanced scripting techniques, which will be more of interest to the designer profiled in the second paragraph above. But designers in this camp might also profit from following through the first few lessons as well, just to get a sense of what console-based circuit simulation is really like.

A Preliminary Word: Using hofe

The ocean program provided in the Analog Artist suite is really more like a back-end than a front-end processor. It goes as far as presenting a prompt on the console and allowing the user to type in commands--but no farther. In particular, it has no command-line editing, no facility for paging its text output in a sensible way, and no error-checking to catch typos that can hang the internal command parser.

For that reason, I recommend that students of this tutorial first download my hofe program, which is a wrapper utility for the ocean interface that provides a slightly higher level of user-friendliness than ocean itself. Specifically, hofe provides command-line editing and history, a paging feature to prevent the simulator's output from scrolling off the top of the screen, a syntax-checking mechanism to prevent you from accidentally entering commands that could hang the ocean parser, some command aliases to shortcut long commands, and more. Getting set up with hofe now will undoubtedly save you many headaches as you proceed through this tutorial.

Having said that, none of what I cover in this tutorial requires the use of hofe. Every command in this tutorial works just as well at the ocean console as at the hofe console, although from time to time I will include boxes like this with hints specially intended for hofe users.

Tutorial Example: A Fully Differential CMOS OpAmp

For the purposes of this tutorial I've created a CMOS op amp circuit and a test bench for it. The circuits are not necessary for the tutorial, but for a hands-on learning experience you might want to download the schematic files and play along in an ocean session on your own machine. If nothing else, seeing the PDF versions of the schematics will make it easier to follow some of the commands in the next few lessons.

Download circuit files:

Opamp Schematic (PDF) fdopamp.pdf
Test Bench Schematic (PDF) tfdopamp.pdf
Cadence Library fdopamp.tar.gz

Getting Set Up: Creating a Netlist

Before we can get into the details of ocean circuit simulation in Lesson One, we need to netlist our circuit. When doing this it's nice to give the Cadence Composer some guidance on where to write the files, as otherwise they tend to get written to obscure subdirectories of your root directory.

So let's suppose we've just finished editing our test bench schematic in Cadence Composer, and now we want to netlist it and read it into ocean. To do this, we first open the Analog Artist window. (In my version this is done by choosing "Analog Environment" from the "Tools" menu at the top of the schematic editor window.) Open the "Setup" menu from the tool bar at the top of the Analog Artist window and choose "Simulator/Directory/Host." In the "Project Directory" text box, enter the directory from which you intend to invoke ocean. Personally, I like to create a new directory called spectre for this purpose--for example, in this case, the full path to my target directory is /home/homer/circuits/emerald/spectre. So in my case the screen would look like this:

Specifying Project Directory in Analog Artist

Choose "OK" to confirm the new project directory. Then, back in the Analog Artist window, open the "Simulation" menu from the tool bar and choose "Netlist-->Create." If your circuit contains no errors, a window containing the text of the netlist will pop up; you can close this window, unless you want to read through the netlist.

Note: The above procedure for setting the netlist directory can be obviated by including the line
 asimenv.startup projectDir string "./spectre" 
in the .cdsenv file in your home directory. With this line, the netlist directory hierarchy will be written to the spectre subdirectory of the directory from which you started icfb. (You can, of course, replace "./spectre" in the above line with any other directory you like).

After this step, the directory you specified as the Project Directory should have a new subdirectory called tfdopamp (or whatever your circuit was named). Looking into this subdirectory reveals an extensive hierarchy of files and further subdirectories. The actual netlist that describes your circuit is written to a file called netlist in subdirectory spectre/schematic/netlist. So, for example, in my case the full path to the file would be


If you have successfully created this file, let's proceed on to Lesson One!

Lesson 1: Basic Analysis Commands

Homer Reid's Ocean Tutorial, by Homer Reid
Last Modified: 11/16/16