• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. How to run Spectre simulation with ocean script without...

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 145
  • Views 13545
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to run Spectre simulation with ocean script without initializing environment every time I simulate it?

eit2012
eit2012 over 3 years ago

Hi,
I am currently trying to run the Virtuoso Spectre simulation by using a Python script. The way I did this is to manually set up the simulator in the virtuoso GUI interface and export an ocean script for the simulator. After that, I just run os.system("ocean -replay opamp.ocn > oceandump.out") in my python script for running the virtuoso simulation without opening the Virtuoso GUI interface. Right now, the problem is that the simulation run time is too long compared to my GUI interface run time. In the Virtuoso GUI interface, after I set up my simulator, it only costs 28 seconds for a simulation while my script running cost 1 minute 38 seconds. I break down my script run time, and it takes 1 minute to initialize the simulator by loading multiple .cxt files. Is there a more efficient way to run Virtuoso Spectre simulation by using a script or command lines without initializing the environment every time I simulate it?

  • Cancel
  • eit2012
    eit2012 over 3 years ago

    Here is the code for my ocn files (I am sorry that I have to scrub some of the information):

    ;====================== Set to XL mode =========================================
    ocnSetXLMode()
    ocnxlProjectDir( "~/simulation" )
    ocnxlTargetCellView( "op_amp" "twostage_opamp_test" "adexl" )
    ocnxlResultsLocation( "#########################" )
    ocnxlSimResultsLocation( "#############################" )
    ocnxlMaxJobFail( 20 )

    ;====================== Tests setup ============================================

    ;---------- Test "op_amp:twostage_opamp_test:1" -------------
    ocnxlBeginTest("op_amp:twostage_opamp_test:1")
    simulator( 'spectre )
    design( "op_amp" "twostage_opamp_test" "schematic")
    modelFile(
    '("####################allModels.scs" "tt")
    '("#########################wafer.scs" "")
    '("########################design.scs" "")
    )
    analysis('ac ?start "1" ?stop "10G" ?dec "100" )
    analysis('dc ?saveOppoint t )
    desVar( "VDD" "" )
    envOption(
    'analysisOrder list("dc" "pz" "dcmatch" "stb" "tran" "envlp" "ac" "lf" "noise" "xf" "sp" "pss" "pac" "pstb" "pnoise" "pxf" "psp" "qpss" "qpac" "qpnoise" "qpxf" "qpsp" "hb" "hbac" "hbstb" "hbnoise" "hbxf" "sens" "acmatch")
    )
    option( ?categ 'turboOpts
    'numThreads "16"
    'mtOption "Manual"
    'apsplus t
    'errorLevel "Liberal"
    )
    save( 'i "/V0/MINUS" )
    temp( 27 )
    ocnxlOutputExpr( "value(dB20(VF(\"/VOUT\")) 2)" ?name "Gain" ?plot t)
    ocnxlOutputExpr( "IDC(\"/V0/MINUS\")" ?name "I" ?plot t)
    ocnxlOutputExpr( "phaseMargin(VF(\"/VOUT\"))" ?name "PM" ?plot t)
    ocnxlOutputExpr( "unityGainFreq(VF(\"/VOUT\"))" ?name "UGF" ?plot t)
    ocnxlEndTest() ; "op_amp:twostage_opamp_test:1"

    ;====================== Sweeps setup ===========================================
    ocnxlSweepVar("VDD" "1.2")

    ;====================== Model Group setup ==========================================

    ;====================== Corners setup ==========================================
    ocnxlCorner( "C0"
    '(
    ("variable" "temperature" "27")
    ("variable" "VDD" "1.2")
    ("model" "########################allModels.scs" ?section "\"ss\" \"ff\"")
    ("model" "########################wafer.scs" ?section "")
    ("model" "########################design.scs" ?section "")
    ("modelGroup" "")
    )
    )

    ;====================== Checks and Asserts setup ============================================
    ocnxlPutChecksAsserts(?netlist nil)

    ;====================== Test v/s corners setup =================================

    ;====================== Job setup ==============================================
    ocnxlJobSetup( '(
    "blockemail" "1"
    "configuretimeout" "300"
    "distributionmethod" "Local"
    "jobruntype" "ICRP"
    "estimatecpuvalue" ""
    "estimatememoryvalue" ""
    "lingertimeout" "300"
    "maxjobs" "1"
    "name" "ADE XL Default"
    "preemptivestart" "1"
    "reconfigureimmediately" "1"
    "runtimeout" "-1"
    "showerrorwhenretrying" "1"
    "showoutputlogerror" "0"
    "startmaxjobsimmed" "1"
    "starttimeout" "300"
    "usesameprocess" "1"
    ) )

    ;====================== Disabled items =========================================

    ;====================== Run Mode Options ======================================

    ;====================== Starting Point Info ======================================

    ;====================== Run command ============================================
    ocnxlRun( ?mode 'sweepsAndCorners ?nominalCornerEnabled nil ?allCornersEnabled t ?allSweepsEnabled t)
    ocnxlOutputSummary(?exprSummary t ?specSummary t ?detailed t ?wave t)
    ocnxlOpenResults()
    ocnxlExportOutputView( "opamp.csv" "Detail-Transpose")
    ;====================== End XL Mode command ===================================
    ocnxlEndXLMode()
    exit

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Halffield
    Halffield over 2 years ago in reply to eit2012

    I have the same issue. I’m following. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 2 years ago in reply to Halffield

    Dear eit2012,

    eit2012 said:
    Right now, the problem is that the simulation run time is too long compared to my GUI interface run time. In the Virtuoso GUI interface, after I set up my simulator, it only costs 28 seconds for a simulation while my script running cost 1 minute 38 seconds. I break down my script run time, and it takes 1 minute to initialize the simulator by loading multiple .cxt files. Is there a more efficient way to run Virtuoso Spectre simulation by using a script or command lines without initializing the environment every time I simulate it?

    I think the basic issue is that you are opening adexl (maestro?) for each simulation. It appears there is only a single simulation performed each time the opamp.ocn file is called by your script. If I read it correctly, you call the opamp.ocn script numerous times to run a set of simulations. Might it be possible to modify your opamp.ocn script to include a set of N corner simulations or a design variable value sweep of N simulations such that a single call to opamp.ocn will perform some or all of the simulations your Python script currently performs. This will reduce the number of calls to opamp.ocn from N to 1 and distribute the initialization time Tinit over N jobs (average of Tinit/N) instead of a single job with initialization time of Tinit?

    If this is to possible, there are other options - for example create a netlist, modify it with your Python script and call spectre directly. Of course, you will then be responsible for defining the database structure in lieu of using the Maestro data base structure. Prior to adexl being available, this is the method I used to run a series of corners with ocean (not oceanXL).

    I do have some documentation on this rather old methodology that I placed at URL:

    www.dropbox.com/.../sub_corners_generic_101507v1p0.pdf

    if you have any interest.

    Otherwise,  I do not know if you happened to see it, but there is a Troubleshooting article at URL:

    https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1Od0000000nXeoEAE&pageName=ArticleContent&id=a1Od0000000nXeoEAE&oMenu=Documents%20which%20may%20be%20similar%20to%20this%20document

    that contains a SKILL command to eliminate the loading of functions in your .cdsinit file. If you need some of these functions, perhaps you can load the one or two you need in lieu of all of these in your .cdsinit. This will reduce the initialization time.

    I hope this helps a little!

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information