SKILL for schematic hierarchy tree

Discussion in 'Cadence' started by Bernd Fischer, Oct 20, 2003.

  1. Hi,

    I have in mind that I saw any time a posting with
    a SKILL script for a hierarchy tree, for schematics.
    It was similar to the 'Design -> Hierarchy -> Tree ...'
    command in the Virtuoso Layout editor.
    Unfortunately I didn't copy the script at that day.

    Did someone have that script or could name me a reference
    where to get it.

    Thanks Bernd
     
    Bernd Fischer, Oct 20, 2003
    #1
  2. Hi Bernd,

    Don't think I've posted this before. It doesn't handle config views, it's just a simple
    view switching approach. There's a PCR asking for this functionality as part of
    the tools, PCR 213600. Hopefully one day it will get integrated.

    /* abSchTree.il

    Author A.D.Beckett
    Group Structured Custom, Cadence Design Systems Ltd.
    Machine SUN
    Date Oct 30, 1995
    Modified
    By

    Function to perform the equivalent of the "tree" function
    for schematics

    There are two entry points in this file:

    (abSchTree [optional key arguments])
    Low level entry point - no form. Just uses arguments to define how and
    where the tree gets created

    (abHiSchTree)
    Form interface to abSchTree.

    ***************************************************

    SCCS Info: @(#) abSchTree.il 08/07/01.15:31:07 1.1

    */

    /***************************************************************
    * *
    * (abCompareCellName inst1 inst2) *
    * *
    * Comparison function when sorting the instHeaders *
    * *
    ***************************************************************/

    (procedure (abCompareCellName inst1 inst2)
    (let (result)
    (forall property '(libName cellName viewName)
    (equal (setq result (strcmp (dbGet inst1 property) (dbGet inst2 property))) 0))
    (lessp result 0)))

    /************************************************************************
    * *
    * (abSchTree @key (cellView (geGetEditCellView)) *
    * (viewList "schematic cmos.sch symbol") *
    * (stopList "symbol") *
    * (port poport) *
    * (displayPins nil) *
    * (indent 0)) *
    * *
    * Recursive function to output a "tree" like display from the specified *
    * cellView downwards using the specified view and stop lists. The pins *
    * can be displayed as well if desired. The indent is for internal use *
    * only and controls the indent level that this cellView's instances *
    * are printed at. *
    * *
    ************************************************************************/

    (procedure (abSchTree @key (cellView (geGetEditCellView))
    (viewList "schematic cmos.sch symbol")
    (stopList "symbol")
    (port poport)
    (displayPins nil)
    (indent 0))
    (let (sortedHeaders formatString count stopAtList)
    (setq stopAtList (parseString stopList))
    (setq sortedHeaders (sort (dbGetq cellView instHeaders) 'abCompareCellName))
    (foreach header sortedHeaders
    /* count the number of instances */
    (setq count (length
    (if displayPins
    /* if we're displaying pins, count them all regardless */
    (dbGetq header instances)
    /* otherwise only count those without purpose pin */
    (setof inst
    (dbGetq header instances)
    (nequal (dbGetq inst purpose) "pin")))))
    /* when there was at least one (so that pins can be filtered out) */
    (when (greaterp count 0)
    (sprintf formatString "%%%ds %%s %%s %%s (%%d)\n" indent)
    (fprintf port formatString ""
    (dbGetq header libName)
    (dbGetq header cellName)
    (dbGetq header viewName)
    count)
    /* switch views */
    (setq switchedView (dbGetAnyInstSwitchMaster
    (car (dbGetq header instances))
    viewList))
    (when switchedView
    (unless (member (dbGetq switchedView viewName) stopAtList)
    (abSchTree ?cellView switchedView
    ?viewList viewList
    ?stopList stopList
    ?port port
    ?displayPins displayPins
    ?indent (plus indent 2)))
    /* I did try closing the switched cell, but it
    didn't work properly. Have to live with this, I suppose! */
    )
    )
    )
    t))


    /***************************************************************
    * *
    * (abCreateHiSchTreeForm) *
    * *
    * Create the form for the schematic tree function *
    * *
    ***************************************************************/

    (procedure (abCreateHiSchTreeForm)
    (let (topOrCurrent viewList stopList displayPins)
    (setq topOrCurrent
    (hiCreateRadioField
    ?name 'topOrCurrent
    ?prompt "Starting cell"
    ?choices '("current" "top")))
    (setq viewList
    (hiCreateStringField
    ?name 'viewList
    ?prompt "View list"
    ?value "schematic cmos.sch symbol"))
    (setq stopList
    (hiCreateStringField
    ?name 'stopList
    ?prompt "Stop list"
    ?value "symbol"))
    (setq displayPins
    (hiCreateBooleanButton
    ?name 'displayPins
    ?buttonText "Display pins"
    ?value nil))
    (setq abHiSchTreeForm
    (hiCreateAppForm
    ?name 'abHiSchTreeForm
    ?formTitle "Schematic Tree"
    ?callback 'abHiSchTreeCB
    ?fields (list
    topOrCurrent viewList stopList displayPins)))
    abHiSchTreeForm))

    /***************************************************************
    * *
    * (abHiSchTreeCB form) *
    * *
    * Callback for the schematic tree form. *
    * Opens the file, outputs the header information and *
    * then calls abSchTree to recursively descend down the *
    * hierarchy. *
    * Then the output file is viewed and deleted. *
    * *
    ***************************************************************/

    (procedure (abHiSchTreeCB form)
    (let (cellView port fileName)
    (setq cellView
    (if (equal (getq (getq form topOrCurrent) value) "top")
    (geGetTopLevelCellView (getq form treeWindow))
    (geGetEditCellView (getq form treeWindow))))
    (if cellView
    (progn
    (setq oport (outfile (setq fileName (makeTempFileName "/tmp/schTree"))))
    (if oport
    (progn
    (fprintf oport "%40s\n","Design Hierarchy")
    (fprintf oport "*******************************************************\n")
    (fprintf oport "Library : %s\n" (dbGetq cellView libName))
    (fprintf oport "Cell : %s\n" (dbGetq cellView cellName))
    (fprintf oport "View : %s\n" (dbGetq cellView viewName))
    (fprintf oport "Option : %s to bottom\n" (getq (getq form topOrCurrent) value))
    (fprintf oport "*******************************************************\n\n")
    (abSchTree ?cellView cellView
    ?viewList (getq (getq form viewList) value)
    ?stopList (getq (getq form stopList) value)
    ?displayPins (getq (getq form displayPins) value)
    ?port oport
    )
    (close oport)
    (view fileName nil "Tree")
    (deleteFile fileName)
    )
    (error "Couldn't open output file"))
    )
    (error "Couldn't find cellView"))
    ))

    /***************************************************************
    * *
    * (abHiSchTree) *
    * *
    * Display a form controlling the tree generation *
    * *
    ***************************************************************/

    (procedure (abHiSchTree)
    /* create the form if it doesn't exist */
    (unless (and (boundp 'abHiSchTreeForm) abHiSchTreeForm)
    (abCreateHiSchTreeForm))
    /* store the window on the form so that it will always use the window
    that was current when the command was invoked */
    (putpropq abHiSchTreeForm (hiGetCurrentWindow) treeWindow)
    (hiDisplayForm abHiSchTreeForm))
     
    Andrew Beckett, Oct 20, 2003
    #2
  3. Bernd Fischer

    Partha Guest

    Bernd,
    From Virtuoso Schematic Composer SKILL Functions Reference doc,

    schGetCellViewListInSearchScope(
    d_cvId
    t_scope
    d_topcvId
    t_viewNameList
    t_libName
    t_mode
    )
    => l_cvList/nil

    Partha
     
    Partha, Oct 20, 2003
    #3
  4. Bernd Fischer

    fogh Guest

    Andrew,
    This is a funny way of using a side effect of forall. Seems to me that
    optimisation and precedence rules ensure that the viewName comparison
    will not happen unless lib and cell names are already identical. But is
    it always so ? I remember for instance that there was an option in the
    turbo-pascal compiler to turn off boolean eval optimisation, so that the
    executable would always evaluate all arguments of boolean operators. Is
    there no risk that the skill interpreter can be "tweaked" to evaluate
    all predicates in a forall ?
    Probably not. Anyway... nice code. It left me puzzled for a while.
    It's maybe worth mentioning it in a skill manual.
     
    fogh, Dec 4, 2003
    #4
  5. Frederic,

    Yes, it's intentional.

    It's not a side effect of forall - forall is supposed to iterate over the list
    until the statement in the body becomes non-nil. It's a way of giving
    up part way through a list (you can use (exists) for doing this kind of thing
    too).

    You're probably thinking of expression short-circuiting - like being
    able to do things like:

    b!=0 && 1/b

    you can guarantee that 1/b won't get evaluated unless b is non-zero. There's
    not a switch in SKILL to turn that optimisation off.

    Regards,

    Andrew.
     
    Andrew Beckett, Dec 5, 2003
    #5
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.