- Author Ruibin Mao, Zhicheng Xu
- Date May 7th, 2023
OCEAN is a very powerful tool which can do everything you do using the GUI of virtuoso. It can create, simulate and process the netlist in a batch mode which can highly accelerate the simulation, especially when you regularly change the configuration and parameters. It's recommended to read this Cadence OCEAN Lab before you lean this tutorial: CadenceOCEANLab
In this Tutorial, I will introduce how to use Python and OCEAN to Create the netlist, and use OCEAN to run the simulation, process the signals and dump the result to the specific file and format even with special functions applied.
Specifically, in this tutorial, we will simulate a matrix multiplication that contains three (5, 8) weight matrices and an (8, 5) input vector. Since we got three weight matrices, we will need three different netlists. We will simulate these three sets of netlists by just using OCEAN to change the parameter settings. We will run these three simulations and plot, and save the results in a single run session. Moreover, we will also apply a non-linear function exp() to the output and send the output to a specific file.
In the directory, you will find:
1t1r.scsA simple 1T1R subckt.netlistgen.pyA python file used to generate the required netlist and ocean script like parameter definition.run.ocnOCEAN Script for running the whole simulation.runshell command to run the simulationcleanClean the current working directory
You can directly run the simulation by:
python netlistgen.py
./runwhich will generate the netlist and simulate using OCEAN. You will see these additional folders and files:
./design: Used to store the filenetlistnetlistHeaderandnetlistFooter. These three files are needed for OCEAN to generate the Spectre Netlist./signal: Used to store the Row PWL Signals../ocean: Three OCEAN files containing the definition of conductance parameters usingdesVar()command../results/psf, ./results/simResult:psffolder is used to store waveform result generated by spectre.simResultis used to store the printed signal files and the processed signal data.trueResults.data: True matrix multiplication result.
To run multiple simulations using OCEAN, In this sample run.ocn file, there are several key implementations:
for()loop is used to load the parameters contained in the./ocean/desVar[0, 1, 2].ocn.resultsDir()is specified in each loop simulation to store the results in different directories.ocnPrintandfprintf()are used to store the simulations and dump the signals into specific files. Built-in funcitonvalue()is used to extract the signals at specific time and send it toexp()function and then put the results in files. You can define any functions you want in OCEAN.