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

HOFE: Homer's OCEAN Front End

A Front-End Processor for ocean with Command Line Editing, Command Line History, Error Checking, Console Text Scrolling, and Command Shortcuts

Broadly speaking, the world is divided into two factions: those who prefer controlling their IC simulator through graphical windows and menus, and those who cling staunchly to the old-fashioned method of typing simulator commands one-by-one into a console text window. As is clear to anyone familiar with the Cadence toolset, the Cadence developers' feet are planted squarely within the menus-and-windows contingent, and, inasmuch as much of the IC design world is migrating toward the Cadence platform, this bodes ill for those of us who like consoles and text. However, in a begrudging nod to dinosaurs like myself, Cadence has provided the ocean scripting interface to their Analog Artist simulator, which can help smooth the path for would-be converts from Celerity to Spectre.

Perhaps as an indication of their disdain for text-based tools, however, the Cadence people have put only the bare minimum of effort into the standalone ocean interface. No, let me rephrase that: the Cadence people seem purposefully to have made the ocean console hard to use. One problem is the absence of a text-scrolling mechanism, which means that all but the last 20 or so lines of the simulator's output scroll off the top of the screen, leaving no way to retrieve them. Another flaw is that small typos on the command line--forgetting to close a double quote or a parentheses, for example--can hang the entire program. Certainly the most deplorable omission is that of command-line editing, which we text hounds understand to be the sine qua non of console-based tools.

To remedy these oversights, I've created a front-end processor for the standalone ocean interface. This program, run from the UNIX command line, gives an environment indistinguishable from the ocean environment, except for reasonable output scrolling, command-line editing (and command-line history), error-checking to catch typos that would otherwise hang the program, and some shortcut commands I've put in to avoid excessive wear-and-tear on the fingers caused by repeatedly typing long and arcane LISP commands.

Update History

DateDescription
8/2/2002 Added .case command to allow easy switching among process files. Syntax example: .case c1. This is like the .lib command in Celerity, but in Ocean it's better because you don't have to go subsequently through the time-consuming step of rereading the netlist file.
8/1/2002 Added command line redirection. Now you can use the | or > characters at the end of a command line to direct the output from that command to a program or file. See below for examples.
7/30/2002 Fixed a...well, not exactly a bug, but an undesirable performance aspect. In versions heretofore, invoking top after starting a long simulation from hofe would reveal that the hofe process was taking up as large a chunk of system resources as the ocean process, even though hofe was just waiting for ocean to finish. This is now corrected.
7/18/2002 Added .cl command (thanks to feedback from Scott Dickinson). Added rudimentary signal handling: CNTRL-C keystrokes are passed on to the ocean process, while CNTRL-Z forces the appearance of the hofe> prompt.
7/6/2002 Added some new translation commands: .di, .op.
6/30/2002 Fixed several bugs involving unwanted core dumps (as opposed to wanted core dumps?) and added some new translation commands: .dwa, .dan, .rep, .buf.
4/1/2002 Initial Release

Installation

Getting started with this thing is simple. First, download it:

Solaris Binary: hofe
Source archive: hofe.tar.gz
Source files in HTML format with syntax highlighting: hofe.c.shtml
hofetran.c.shtml
hofesyn.c.shtml

To build the tool, download and unpack the above source archive. In the makefile you will need to edit the -I option in CFLAGS, and the -L option in LDFLAGS, to point to the correct locations of the the GNU readline and history libraries and their include files. (Note added 11/19/2003: You will also need to modify the OCEAN_PATH constant in hofe.h to point to the correct location of the ocean executable on your system. Thanks to Zhongda Wang for pointing this out.) If you don't have these libraries on your system, you can get them both (in the same package) from ftp.gnu.org. Once you've installed or compiled the binary, put it somewhere within your PATH, and make sure libreadline.so and libhistory.so are somewhere within your LD_LIBRARY_PATH.

Usage

At the UNIX command prompt, type hofe. What you see should be identical to what you would normally see after typing ocean, except that the command prompt is now hofe> instead of ocean>. From here on you can proceed just as if you were at the ocean> prompt.

Command Line Editing and History

The command line editing and history functionality defaults to emacs style. Those who prefer vi style will want to create a file named .inputrc in their home directories and include therein the line

set editing-mode vi

There are actually many more commands you can put in the .inputrc file. For a synopsys, see the GNU readline on-line documentation.

Text Scrolling

The text scrolling functionality is self-explanatory. When the simulator's output all fits on one screen, there is no scrolling, and otherwise the more program is invoked to request your approval before scrolling each screenful of text off the top of the screen. You can turn this feature on and off with the commands .buf on and .buf off. It's turned off by default.

To test this out, do a .buf on and then try the command ocnHelp(). This command produces much more output than can fit on one screen, and in the normal ocean console the great majority of it is lost off the top of the screen. Makes you wonder why they bothered to put in the command in the first place....

Command Line Output Redirection

The text scrolling functionality is what you want in some cases, but in other cases you'd like to redirect the simulator's output to a file, or to an external shell program like awk or sort. For these purposes hofe provides the standard | and > operators. Some examples:

The first of these searches for occurrences of the word "Plot" in the on-line help, and the second writes the contents of the on-line help to file helpfile.

Command Line Error Checking

If you enter a command line with any unpaired parentheses or double quotes, or with a backslash not enclosed within double quotes, hofe will give you an error message and will not pass your command on to OCEAN. For example, suppose we had forgotten to type the closing parenthesis in the previous command:

hofe> ocnHelp(

**
** HOFE error: This command line contains inequal
** numbers of open and closed parentheses!
** The OCEAN parser is not sufficiently intelligent
** to handle such advanced syntax.
**

hofe> 

If you had entered the same command into the ocean console, the program would hang: the prompt would disappear, no simulator output would be generated to the screen, and you would eventually have to kill the process and start over.

Of course, these syntax-checking hooks have the drawback that you can't type in complex multi-line ocean constructs at the command line. I don't know if you can do that in standalone ocean, but even assuming you can, why would you want to? You'd have to get every character exactly right or risk hanging the simulator and having to cntrl-c your way out of it. The better solution is to edit your complex commands in a text editor and then read in the file with a load() command on the hofe command line.

Command Shortcuts

In addition to the absence of command-line editing and the less-than-robust command parser, a further dead giveaway of the Cadence developers' contempt for console-based simulation is the highly keystroke-inefficient command syntax they've cooked up for ocean. Let's face it: some of these commands are just way too long to type in repeatedly during the course of a simulation. Of course, once you've typed in a long command once, you can use hofe's command-line history and editing features to pull up that command again and modify it as necessary, but it would be even more convenient if you didn't have to type the long commands in at all. With that in mind, hofe recognizes and translates some built-in command shortcuts, as detailed in the table below.

Note that all of these shortcuts begin with a period ("."). The raw ocean parser seems to choke on such commands, so if you type in a command starting with a period that hofe fails to recognize as one of its shortcuts, hofe will complain and will not pass the command on to ocean.

Command Template Description Translation
.buf on | off Enable/disable HOFE internal scroll buffering --
.case arg Select which simulation process file to use modelFile(list("$ICDS_CKT_SIM_SW/lib/$ICDS_TECH
/sim/spc/$ICDS_SIM_DATECODE/$ICDS_TECH.scs" "arg"))
.cl Clear console terminal --
.dan Delete Analysis Queue delete('analysis)
.dc op DC analysis delete('analysis)
analysis('dc ?saveOppoint t ?oppoint "rawfile")
run
selectResults('dc)
.di arg1 ... argN Instance Parameter Report selectResults('instance)
report(?name "arg1")
report(?name "arg2")
...
report(?name "argN")
.dwa Clear All Waveforms deleteWaveform("all")
.dw arg1 ... argN Clear Specified Waveforms deleteWaveform(arg1)
...
deleteWaveform(argN)
.op dev [parm] DC Operating Point Report selectResults('dcOpInfo)
report(?name "arg" [?param "parm"])
.rep arg Operating Point Parameter Report selectResults('dcOpInfo)
report(?param "arg")
.sr arg Select Results selectResults('arg)


hofe: Homer's Ocean Front End, by Homer Reid
Last Modified: 11/16/16