Pages

2012-09-29

OCEAN Script - Hello World

OCEAN script is a Cadence's proprietary scripting language for simulation automation. For analog designer, OCEAN script is quite useful for collection of simulation data which can be used to determine circuit's performance with variations in environment or fabrication process. Furthermore, it is also handy when you try to optimize the design's performance by varying a set of design parameters.

Before we take on serious scripts which can run dozens or even hundreds of simulations automatically, let's start small with below script. Please save it as "helloWorld.ocn" in your home directory "~/".


1
2
3
4
5
6
7
; This is a comment line.
; The comment starts from character ";" and ends at the end of the line.

; Output file definition.
out = outfile("~/helloWorld.txt" "w")   
fprintf(out, "Hello World\n")
close(out)

I think the code is fairly self-explanatory and you may find that it would do nothing except creating a file in your home directory "~/" named "helloWorld.txt" whose content is just a string of "Hello World".

The next step is to run just created script to see if it does as intended. To do this, go to the Command Interpreter Window (CIW), it's the very first window shows up once you launch Cadence design tool. Then, type in a run command of


load "~/helloWorld.ocn"

and hit "Enter".


Command Interpreter Windows and the console for Ocean Script run command.Modified from source.
Go to your home directory "~/" to check whether file "helloWorld.txt" is created with content of "Hello World" string. If so, congratulations on your first Ocean Script success!

More to come.

PS: File access ability is quite important in OCEAN script. This is due to the fact that, for each simulation, we would usually calculate specifications of the evaluated circuit and print them into a text file for the record, instead of to plot all the resulted curves of each specification.
Assessment based on text data is just much easier, that's all.

No comments:

Post a Comment