• 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. Passing parameters into an ocean script...

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 143
  • Views 17401
  • 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

Passing parameters into an ocean script...

CADcasualty
CADcasualty over 6 years ago

I did do some digging into this topic and was dismayed to see that this didn't look possible. However, those older posts were maybe 7 or 8 years so I'm hopeful this may have been rectified by now...

I have a lengthy ocean script that runs a sim and plots results. The issue is that I have 3 different versions of the schematic so I'm looking for a sensible way to specify the schematic (or some other argument that can be used to do the job) when I load the ocean script on the command line. I could, of course, write 3 virtually identical scripts where each only differs in the schematic specified, but that's against my religion :-). Any ideas?

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago

    The simplest way is to set a UNIX environment variable before the code is loaded, and then you can use getShellEnvVar("CELLNAME") or whatever from within the OCEAN script.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • CADcasualty
    CADcasualty over 6 years ago in reply to Andrew Beckett

    Thanks Andrew. Please don't take this personally, but IMHO that's got "hack" written all over it.

    Is it worth logging a request to allow ocean scripts run from the command line to allow passed parameters, or is that just a lost cause? Another possible thought - can an ocean script pause to accept a user input in response to a generated prompt and take that answer to modify the program flow? I usually don't like doing such things because the pausing for a response means the script can't be run in a regression suite- although in that case your suggestion would work).

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to CADcasualty

    I agree it's a bit of a kludge. There's a function in SKILL called argv() but this doesn't work with "ocean" or "virtuoso" - but I think it's reasonable that there ought to be a way of getting the command line arguments passed in so that you could do:

    ocean -restore yourCode.ocn mylib mycell myview

    and then retrieve these additional arguments somehow. So yes, go ahead and file a support request so that we can get this into R&D.

    You could potentially use gets() to read from standard input, but I'm not sure how well that would work (I've never tried it with ocean).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • CADcasualty
    CADcasualty over 6 years ago in reply to Andrew Beckett

    Thanks - I'll file that support request. In the meantime, I did try embedding a gets() command within my ocean script but the program just marched right past it and kept going to the end of the script :-(.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • CADcasualty
    CADcasualty over 6 years ago in reply to CADcasualty

    Another thought. I might just make 3 small "header" ocean scripts that basically just specify the schematic to simulate and then call a core ocean script to put the circuit through its paces and plot the results. How does one ocean script call (or jump to) another?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to CADcasualty

    What I'd do is wrap your common code in a function definition:

    procedure(MyCommonOCEAN(lib cell view)
       ...
       ...
       ; the ocean code you had originally

    )

    Then in the three scripts, do:

    load("commonCode.ocn")
    MyCommonOCEAN("mylib" "mycell" "schematic")

    or similar - that way you are cleanly communicating with the common code. Then you can just do "ocean -restore file1.ocn" or "ocean -restore file2.ocn" to run the individual variant.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • CADcasualty
    CADcasualty over 6 years ago in reply to Andrew Beckett

    Thanks Andrew. Your example just made me think of something. I'm at home so I can't try this out, but rather than having 3 separate "header" scripts and a common code script, why couldn't I just write *everything* as a single procedure. All I'd have to do is load it first and then I could just invoke the procedure and pass all the parameters I want that way. It is a two step process (for the first run only), but it's only one file to worry about... 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to CADcasualty

    Yes, that would work, of course.

    Andrew.

    • 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