SKILL Q: Getting simulation result for selected instances in schematic

Discussion in 'Cadence' started by svenn.are, Oct 1, 2003.

  1. svenn.are

    svenn.are Guest

    Hi,
    when using Affirma ADE it is possible to annotate the instances in a
    schematic with values from DC simulation. I now try to write a SKILL
    program that cycles all transistors in my schematic page and extracts
    important data like node voltages and drain currents and write to a
    text file for later viewing in excel.

    A bit reading in the skartist.pdf give me some indication on how to
    access the simulator and the sessions. Problem is that the
    documentation for the psf access is a bit over my head. Seems that I
    have to define callbacks for my simulator in order to access entries
    in the database.

    During experimentation in CIW I tried to use the procedure
    asiMapNetName as it is used in the example for
    asiDefineDataMappingFunction. I typed in the example from the manual
    and got a curious error message related to asiMapNetName:
    *WARNING* Could not open Run Object File
    /tmp/test/spectreS/schematic/psf/psf/runObjFile.

    Checking the unix file system show me that there is no psf in the psf
    directory with spectreS. I then decided to investigate asiMapNetName
    on its own:

    setq cs (asiGetCurrentSession)
    setq dirId (asiGetPsfDir cs)
    asiMapNetName dirId (list 'something 'stupid)

    I have to do a
    asiMapNetName "/tmp/test/spectreS/schematic/" (list 'something
    'stupid) to open the runObjFile but then I don't know what the list
    argument are supposed to achieve.

    The simulator is running in a design kit using spectreS socket
    simulation.

    Question is if the three database access functions:
    asiDefineDataMappingFunction
    asiDefineDataAccessFunction
    asiInit<yourSimulator>DataAccessFunction
    are the proper functions to use.

    I can of course use the spectre.ic file for info on the dc operating
    point, but I wanted to be able to extend my program to extract data
    from a transient simulation at a specific simulation time also.
     
    svenn.are, Oct 1, 2003
    #1
  2. Use OCEAN, not these functions.

    Read the OCEAN manual, it is designed to do these kind of things.
    The asi interface is mainly for people integrating simulators into ADE.
    It avoids having to do all this low level stuff - and hey, it's intended
    to be easy to use for non-programmers!

    Sorry for the quick, non-illustrative example, but I'm a bit short of time
    today (and in a hotel).

    Regards,

    Andrew.
     
    Andrew Beckett, Oct 1, 2003
    #2
  3. svenn.are

    svenn.are Guest

    OCEAN is very much tuned towards line printers, I find, when I try to
    use the report() function to get the OpBegin values from a spectreS
    session. the lines are nicely broken on 132 columns and folded so that
    it is not so easy to read it into excel.

    I tried to manipulate the line length with the setup() command, but no
    luck.

    What I am targeting at with my efforts is a routine that works as
    follows:
    In schematic at any level I select none, one or more elements. If none
    are selected, then all are scanned, else only the selected ones.

    The routine extracts the full hierarchical path so that I can access
    the data from psf. The data to extract is defined in a list in the
    script. No need for a user interface.

    This can't be that difficult. I have with my basic programming
    knowledge been able to do that in Tcl on another program, so why does
    it have to be so difficult in Cadence?
     
    svenn.are, Oct 2, 2003
    #3
  4. Svenn,

    It isn't really that hard in OCEAN. Here's an example, which goes
    through the whole process of running a simulation, and printing out the
    operating point information for either the selected components, or all
    components at this level of hierarchy. Of course, you can omit the
    running of the simulation ever type.

    I wrote the example in C-like syntax to make it easier to read for
    those in the audience who aren't lisp fiends (despite lisp syntax
    being my normal modus operandi).

    report() is just an example of a report for all components. Below shows
    a few different ways of getting at the data (some commented out).

    It's certainly easier doing it this way than trying to use the asi functions
    or trying to access the psf data directly.

    Regards,

    Andrew.

    ;------------------------------------------------------------------------
    ; run the simulation
    ;------------------------------------------------------------------------
    simulator('spectre)
    design("mylib" "level2" "schematic")
    path("./models")
    modelFile('("rfModels.scs" ""))
    analysis('dc ?saveOppoint t)
    temp(27)
    run()

    selectResults('dcOpInfo)
    ;------------------------------------------------------------------------
    ; now start getting the results for this level
    ;------------------------------------------------------------------------
    hierPath=geGetInstHier()
    hierPathLen=strlen(hierPath)
    ;------------------------------------------------------------------------
    ; record the available outputs at this level of
    ; hierarchy for convenience
    ;------------------------------------------------------------------------
    thisLevel=makeTable('local nil)
    foreach(output outputs()
    when(substring(output 1 hierPathLen)==hierPath
    thisLevel[output]=t
    ) ; when
    ) ; foreach
    ;------------------------------------------------------------------------
    ; now find the components to get the op point data for
    ;------------------------------------------------------------------------
    toReport=nil
    if(geGetSelSet() then
    foreach(inst geGetSelSet()
    when(thisLevel[outputName=strcat(hierPath "/" inst~>name)]
    toReport=cons(outputName toReport)
    ) ; when
    ) ; foreach
    else
    toReport=thisLevel->?
    ) ; if
    ;------------------------------------------------------------------------
    ; and then report the oppoint data for these devices
    ;------------------------------------------------------------------------
    foreach(output sort(toReport 'alphalessp)
    printf("Info for %s:\n" output)
    ;; dumb print
    ; ocnPrint(pv(output "??"))
    ;; if we know what type it is, could use something
    ;; like
    ; foreach(paramName outputParams("bsim3v3")
    ; printf("%s = %L\n" paramName pv(output paramName))
    ; ) ; foreach
    ;; final method is to get all the parameter values
    ;; as a waveform by using "??" argument to pv.
    paramInfo=pv(output "??")
    paramNameVec=drGetWaveformXVec(paramInfo)
    paramValVec=drGetWaveformYVec(paramInfo)
    for(i 0 sub1(drVectorLength(x))
    printf("%s = %g\n" drGetElem(paramNameVec i) drGetElem(paramValVec i))
    ) ; for
    ) ; foreach
     
    Andrew Beckett, Oct 2, 2003
    #4
  5. svenn.are

    S. Badel Guest

    run a dc operating point simulation (dcOp)
    then, with ocean you can get opearting points for any instance.
    example ocean script:

    design(netlistFile)
    modelFile(smth)
    desVar(smth) ...

    analysis('dc ?saveOppoint t)
    save('all)
    run()

    openResults(designDir)
    selectResults( 'dcOpInfo )

    cgd=getData("M0")~>cgd
    cgs=getData("M0")~>cgs
    id=getData("M0")~>id
    ..
    ..
    ..


    by using outputs() you get a list of all instances which have
    operating point informations (transitors, caps, res, sources ...)
    for example, a transistor has the following information available:
    - capacitances
    - currents
    - voltages
    - transconductances
    - on resistance
    - threshold voltage
    - region of operation
    - power
    - beta
    - and a few more

    hope this is what you're looking for,
    s.badel
     
    S. Badel, Oct 3, 2003
    #5
  6. svenn.are

    svenn.are Guest

    I could use some of the hints, thanks.

    I came up with an alpha solution not taking a schematic as input, but
    accessing directly via ocean. But I can't get the (getq instId
    parameter) to work it is always returning nil. if I try to replace
    with a hard-coded "ids" of "cds" then I get the numberical value, but
    in this version I get only nil. It must have something with me not
    understanding symbols and strings in the getq syntax.
    tried to use -> and ~> syntax, but also failed.

    simulator( 'spectreS )
    design( "...")
    resultsDir( "..." )
    path( "..." )

    (selectResult 'opBegin )
    (foreach instance (outputs) ;; iteratr over all items
    (setq instId (getData instance))
    (foreach parameter (getq instId ?) ;; iterate over all parameters
    (sprintf paramstr "%s" parameter)
    (printf "%s.%s=%L " instance parameter (getq instId parameter))))
     
    svenn.are, Oct 6, 2003
    #6
  7. Svenn,

    You need to use get() if you want the parameter name to be evaluated.
    getq() implicitly "quotes" the second argument - and is directly the
    same as -> ; when you are doing (getq instId parameter) you are
    getting the value of a parameter called "parameter", which doesn't exist,
    hence the nil.

    So just put (get instId parameter) instead.

    Andrew.
     
    Andrew Beckett, Oct 6, 2003
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.