Automatic Simulation with Ocean Script
This articles covers:
- The SKILL language basics
- Use of Ocean script for complicated parameter sweep
- Use of Python for parallel simulation
Basic
Running Ocean Script
To use Ocean interactively
- In a UNIX Shell, type in
ocean
- In the CIW, type in Ocean commands directly
To run a written Ocean script
- In the interactive mode, type in
load( "oceanScript.ocn" )
- In a UNIX Shell, type in
ocean < oceanScript.ocn >> oceanLog.log
Ocean Use Model
It would be the best to copy the auto-generated "netlist" folder to avoid file missing. For successful Ocean simulation, the following netlist files are indispensable:
netlist
1
2
3
4
5
6// attenuator
PORT0 (INPUT 0) port r=50 num=1 type=sine
PORT1 (OUTPUT 0) port r=50 num=2 type=sine
R0 (INPUT OUTPUT) resistor r=rt
R1 (INPUT 0) resistor r=rb
R2 (OUTPUT 0) resistor r=rbnetlistHeader
1
2simulator lang=spectre
global 0netlistFooter (empty file)
Besides, it is highly likely that map files are required for result browsing. Otherwise, a error "In Save statement: None of the nets/terminals got successfully mapped." may occur.
The Ocean script is used to control the simulation. To do this
1 | ; set the simulation engine |
Browse Results
After the simulation, the results can be browsed independently.
1 | openResults( "./result" ) |
Types of Simulation
DC
In the Ocean script
1 | ; specify the analysis |
TRAN
In the netlist, specify the ports
1 | // piecewise-linear voltage source |
In the Ocean script
1 | ; specify the analysis |
AC
In the netlist, specify the ports
1 | PORT0 (INPUT 0) port r=50 num=1 mag=1 |
In the Ocean script
1 | ; specify the analysis |
SP
In the netlist, specify the ports
1 | PORT0 (INPUT 0) port r=50 num=1 type=sine |
In the Ocean script
1 | ; specify the analysis |
HB
In the netlist, specify the ports
1 | PORT0 (INPUT 0) port r=50 num=1 type=sine freq=fin dbm=pin \ |
In the Ocean Script
1 | ; specify the analysis |
The SKILL® Language
Skill is a programming language integrated into the Virtuoso environment to extend its capabilities. Its grammar is similar to Lisp, with supplemented useful features.
Operators
1 | + ;plus |
Syntax
1 | \ ;Escape for special characters |
Calling a function
1 | plus(2,3) ;C style |
Defining a variable
1 | a = 2 ;C style |
Defining a list
1 | a = '(3 3.14 "abc") ;use a ' to avoid evaluation |
Declaring a function
1 | procedure( add( x y ) |
Loop and branch
1 | ;if |
Datatype
1 | nil ;atom, ogical false or empty list |
Useful Functions
1 | ; calculate stability factor mu |
Multi-Thread Simulation
Spectre® engine itself does not support multi-thread simulation. To leverage the potential of multi-core processors, we can perform several Spectre simulation at the same time manually or automatically. One method to implement automatic parallel simulation is to use Threading module in Python to open up several threads. To achieve this
Preparation
The files should be arranged as follows
1 | - autoOceanSim.py # Python multi-thread control |
In the Ocean script, several places have to be modified
1 | ; <!--DIR--> represents the working directory for specific project |
Source Code
1 | import os |
Reference
SKILL® and Spectre® are the trademarks of the Cadence Design Systems, Inc.
- Post link: https://triblemany.github.io/archives/d99e7696/automatic-simulation-with-ocean-script.html
- Copyright Notice: All articles in this blog are licensed under BY-NC-SA unless stating additionally.