Pages

2012-10-03

OCEAN Script - Simulated

As an OCEAN script for a simulation progresses, it loosely contains of three command groups, as follows:
  1. Simulation setup commands which are used to specify
    • location of schematic/netlist of the circuit to be evaluated;
    • type of simulation;
    • type of simulator;
    • options for simulator;
    • devices' models;
    • nets(voltages) or currents to be saved...
  1. Simulation run command.
  2. Simulation data access commands which would
    • perform calculation(s) on saved results;
    • print or plot out saved/calculated data.

In this post, we’ll create a as-simple-as-possible script for our simulation. The script will only feature commands from the first two groups listed above.

For the said purpose, let's assume that you have design an operation amplifier - opamp for short; I believe any Analog IC Designer has to design an opamp in his career. Furthermore, you have an evaluation setup for the opamp in "schematic" view of cell named "Opamp_tb" located in library "OceanScriptLib".

Let's write our first Ocean Script so once runs, it would perform a AC simulation on this evaluation circuit. The AC simulation is the most commonly used simulation type for opamp circuit.

Please read through the script for the Opamp_tb.ocn below. Explanations for it are in the comments.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
; This is a comment line. The comment starts from ";" character and ends at the end of the line

; Begin of simulation setup
; Set the simulator as "spectre"
simulator( 'spectre ) 

; Location of circuit to be simulated based on library name, cell name, and view name 
design( "OceanScriptLib" "Opamp_tb" "schematic" )

; Set up model information based on full path of the model file and corner name
; As an example, below command apply for model file “~/model.scs” and “TYP” - name for typical corner
modelFile( '("~/model.scs" "TYP") )

; AC simulation, from frequency of 1mHz to 1GHz
analysis(' ac ?start "1e-3" ?stop "1e9" ) 
; End of simulation setup

; Run the simulation 
run()

Let's save the script as Opamp_tb.ocn at home directory ~/, then head to CIW window to test the script in the same way described in Hello World post.

Please read the log which is posted in CIW window as the script runs. You'll find that the script indeed executes the simulation, but nothing else shows up once it finishes. This is because our script lacks of any data saving and accessing commands. We will add that as our script extends in future posts.

No comments:

Post a Comment