Tags: OCEAN, programming languages, script languages, SKILL

————————

OCEANOpen Command Environment for Analysis. OCEAN is based on SKILL programming language.

.

SKILL – a scripting language. SKILL is not an acronym. It is a name.

————————

/* */ – a block comments

—–> example 1: /* commented text */

—–> example 2:

—–> —–> /* commented text 1

—–> —–> commented text 2

—–> —–> commented text 3 */

.

.

; (semicolon) – a line comment

—–> example: a = 10 ; commented text

.

.

analysis() – set chosen analysis with its parameters

—–> example: analysis(‘tran ?stop “250n” ?errpreset “conservative” )

.

.

average() – calculate an average value of the chosen signal over the entire range x value range of the simulation

—–> example: vbandgap = average(v(“/instance_bandgap/vbandgap”))

.

.

awvAnalog2Digital() – analog-to-digital; change the analog signal to its digital representation

—–> usage: awvAnalog2Digital( o_wave|n_val n_vhi n_vlo n_vc n_timex t_thresholdType )

—–> —–> o_wave – input waveform

—–> —–> n_val – input scalar

—–> —–> n_vhi – high threshold value. Used only when t_thresholdType is “hilo”.

—–> —–> n_vlo – low threshold value. Used only when t_thresholdType is “hilo”.

—–> —–> n_vc – central threshold value. Used only when t_thresholdType is “center”.

—–> —–> n_timex – value that sets logic X

—–> —–> t_thresholdType – equal to “hilo” or “center”. When equal to “center”, a high state “1” occurs when the signal value is >= (higher or equal) than n_vc. Otherwise, the digital value is equal to “0”. When t_thresholdType is equal to “hilo”, “1” is displayed if the signal value is greater than n_vhi, “0” is displayed if the signal value is lower than n_vlo, and n_timex value is displayed for the rest.

—–> example: awvAnalog2Digital(v(“/output” ?result “tran”) nil nil 0.6 1 “centre” )

.

.

awvDigital2Analog() – digital-to-analog

.

.

case()

—–> usage:

—–> —–> case( value

—–> —–> —–> ( value_1

—–> —–> —–> —–> command_1

—–> —–> —–> —–> command_2

—–> —–> —–> )

—–> —–> —–> ( value_2

—–> —–> —–> —–> command_3

—–> —–> —–> —–> command_4

—–> —–> —–> )

—–> —–> ); case

.

.

clip() – cut a waveform to the chosen x range

—–> usage: clip( waveform from to)

—–> example 1: output_clipped = clip( v(“/output”) 5m 9m) ; output_clipped contains v(“/output”) signal from 5ms to 9ms (tran simulation)

—–> example 2: output_clipped = clip( v(“/output”) nil nil) ; output_clipped contains original v(“/output”) signal

—–> example 3: output_clipped = clip( v(“/output”) nil 9m) ; output_clipped contains v(“/output”) signal from 0ms to 9ms (tran simulation)

—–> example 4: output_clipped = clip( v(“/output”) 5m nil) ; output_clipped contains v(“/output”) signal from 5ms to the end of the simulation (tran simulation)

.

.

close() – close previously opened file

—–> fp = outfile( “/home/user/Desktop/file.txt” “w”) ; open fp file

—–> fprintf( fp “Results are following: \n” ); write to fp file

—–> close(fp) ; close fp file

.

.

converge()

—–> converge( ‘ic “/node_a” “0” ) ; set initial conditions for tran analysis

—–> converge( ‘ic “/node_c” “0” )

—–> converge( ‘ic “/node_b” “vdd” )

—–> converge( ‘ic “/node_d” “vdd” )

.

.

cross() – calculate an x-axis value of the chosen signal, when the y-axis value of the signal is equal to the threshold value on the chosen edge for the chosen crossing

—–> usage: cross(signal threshold edge_number “edge_type” nil nil)

—–> —–> signal – chosen signal

—–> —–> threshold – searched y-axis value

—–> —–> edge_number – number of the crossing (e.g. second 0.6 V value is searched)

—–> —–> “edge_type”:

—–> —–> —–> “either”

—–> —–> —–> “falling”

—–> —–> —–> “rising”

—–> example:

—–> —–> v_output = getData(“/output”)

—–> —–> v_input_minus = getData(“/input_minus”)

—–> —–> opamp_gain_dB = dB20(VF(“/output”)/VF(“/input_minus”)) ; calculate opamp gain characteristic in dB

—–> —–> opamp_unity_gain_frequency = cross(opamp_gain_dB 0 1 “either” nil nil ) ; calculate opamp unity gain frequency

.

.

dB20()

—–> example:

—–> —–> v_output = getData(“/output”) ; !!! read data – voltages !!!

—–> —–> v_input_minus = getData(“/input_minus”)

—–> —–> opamp_gain_dB = dB20(VF(“/output”)/VF(“/input_minus”)) ; calculate opamp gain characteristic in dB

.

.

delete() – delete information for the chosen command

—–> usage: delete( s_command [g_commandArg1] [g_commandArg2] … )

—–> example 1:

—–> —–> analysis(‘tran ?stop “45n” ) ; run first tran analysis

—–> —–> (…)

—–> —–> delete(‘analysis) ; delete all information in analysis command

—–> —–> analysis(‘tran ?stop “245n” ) ; run second tran analysis

—–> example 2:

—–> —–> delete(‘analysis ‘tran) ; delete only tran section of the command analysis

.

.

design()

—–> example: design( “/home/john/simulation/adc_test/spectre/schematic/netlist/netlist” )

.

.

desVar() – set design variable value

—–> usage: desVar( “variable” value )

—–> example: desVar( “vdd” 1.2 )

.

.

envOption()

—–> example:

—–> —–> analysis(‘tran ?stop “250n” ?errpreset “conservative” )

—–> —–> envOption(

—–> —–> —–> ‘analysisOrder list(“tran”)

—–> —–> )

.

.

envSetVal()

—–> example 1: envSetVal(“wavescan.application” “VIVALicenseCheckoutOrder” ‘string “ADE,VIVA”) ; default is VIVA,ADE

—–> example 2: envSetVal(“license” “ADELicenseCheckoutOrder” ‘string “GXL,L,XL”) ; default is L,XL,GXL

.

.

foreach()

—–> example 1:

—–> —–> foreach( vdd vdd_list

—–> —–> —–> printf(“%3.2f\n”,vdd) ; print a debug information to the console

—–> —–> )

.

.

fp() – pointer to the file

—–> example:

—–> —–> fp = outfile(“/home/mateusz.teodorowski/Desktop/Cadence_results/7p7v_rx_test_tran.csv” “w”)

; open the file

—–> —–> fprintf(fp “%3.2f\t\t%d\t\t%s\n”,power_supply,temperature,corner,i_i1*1000*1000,vgs1)

; write to the file

.

.

fprintf() – write to a file

—–> example:

—–> —–> fp = outfile( “/home/john/file.txt” “w”); open the file

—–> —–> fprintf( fp “%3.2f\n”,vdd); write to the file

.

.

freq() – compute frequency of the chosen signal

.

.

getData()

—–> example: vdd = getData(“/vdd”)

.

.

if()

—–> usage: if( … then … else … )

—–> example:

—–> —–> if( variable == value

—–> —–> —–> then

—–> —–> —–> —–> command_1

—–> —–> —–> —–> command_2

—–> —–> —–> else

—–> —–> —–> —–> command_3

—–> —–> —–> —–> command_4

—–> —–> —–> —–> command_5

—–> —–> )

.

.

list()

—–> example: vdd_list = list( 1.2 0.98 1.32 )

.

.

modelFile() – set models in a simulation

—–> example:

—–> —–> modelFile(

—–> —–> —–> ‘(“/home/john/models/SPECTRE/design_wrapper.lib.scs” “mainlib”)

—–> —–> —–> ‘(“/home/john/models/SPECTRE/design_wrapper.lib.scs” “FET_tt”)

—–> —–> —–> ‘(“/home/john/models/SPECTRE/design_wrapper.lib.scs” “res_nom”)

—–> —–> )

.

.

nth() – take n-th element for a list

—–> nth() assume zero-based index

—–>

—–> usage: nth( index_of_a_desired_element name_of_a_list)

—–>

—–> example:

—–> —–> letter_list = list( “A” “B” “C”)

—–> —–> index_1_character = nth(1 letter_list) ;index_1_character = “B”

.

.

openResults() – open simulation results

—–> example:

—–> —–> run() ; run the simulation

—–> —–> openResults( “/home/john/simulation_data”)

—–> —–> selectResult( ‘tran ) ; select tran result

.

.

option()

.

.

phaseDegUnwrapped() – calculate phase

—–> example:

—–> —–> v_output = getData(“/output”) ; read “output” signal

—–> —–> v_input_minus = getData(“/input_minus”) ; read “input_minus” signal

—–> —–> opamp_phase = phaseDegUnwrapped(VF(“/output”)/VF(“/input_minus”)) ; calculate opamp phase

.

.

printf() – print information to the console

—–> example: printf(“power supply = %3.2f\n”,power_supply)

.

.

resultsDir()

.

.

round() – round the floating point value to its closest integer value

.

—–> usage 1: round(value)

—–> usage 2: round(variable)

.

—–> example 1: round(0.5) ; result is 1

—–> example 2: round(0.49) ; result is 0

—–> example 3: round(-0.49) ; result is 0

—–> example 4: round(-0.5) ; result is -1

.

—–> example 4: round(1.234567 * 100.00) / 100.00 ; how to round floating point precision number to given number of digits. Here 1.234567 is rounded to 1.23.

.

.

run() – run a configured simulation

—–> example:

—–> —–> analysis(‘tran ?stop “250n” ?errpreset “conservative” )

—–> —–> envOption(

—–> —–> —–> ‘analysisOrder list(“tran”)

—–> —–> )

—–> —–> run()

.

.

save() – for example choose currents to be saved. These currents can be plotted.

—–> example:

—–> —–> saveOption( ‘currents “selected” ) ; turn on the option to save currents

—–> —–> save(

—–> —–> —–> ‘i “/instance_opamp/vdd” ; save the power supply current sourced by opamp

—–> —–> —–> ‘i “/instance_opamp_/M3/D” ; save drain current through transistor M3

—–> —–> )

.

.

saveOption() – for example, turn on the option to save currents

—–> example:

—–> —–> saveOption( ‘currents “selected” ) ; turn on the option to save currents

—–> —–> save(

—–> —–> —–> ‘i “/instance_opamp/vdd” ; save the power supply current sourced by opamp

—–> —–> —–> ‘i “/instance_opamp_/M3/D” ; save drain current through transistor M3

—–> —–> )

.

.

selectResults() – select a folder where simulation results are

—–> example 1:

—–> —–> run() ; run the simulation

—–> —–> openResults(“/home/john/simulation_data”)

—–> —–> selectResult( ‘tran ) ; select tran result

.

—–> example 2:

—–> —–> openResults(“/home/john/simulation_data”)

—–> —–> selectResult( ‘ac ) ; select ac result

.

.

simulator() – choose the simulator you want to use

—–> example: simulator( ‘spectre ) ; choose spectre simulator

.

.

sprintf()

.

.

temp() – set simulation temperature

—–> example: temp( temperature )

.

.

value() – read y-axis value of the signal for the given x-axis value

—–> example:

—–> —–> v_output = getData(“/output”) ; read “output” voltage

—–> —–> v_input_minus = getData(“/input_minus”) ; read “input_minus” voltage

—–> —–> opamp_gain_dB_dc_value = value(opamp_gain_dB 1k ) ; calculate opamp DC gain (AC analysis)

—–> —–> opamp_gain_dB_30_MHz_value = value(opamp_gain_dB 30Meg ) ; calculate opamp 30 MHz gain

.

.

ymax() – find maximum y-axis value of a given signal

—–> example: ymax(signal)

.

.

ymin() – find minimum y-axis value of a given signal

—–> example: ymin(signal)