How to count instances in a hierarchy

Discussion in 'Cadence' started by spectrallypure, Feb 18, 2006.

  1. Hi all! Could somebody please tell if there exists a way in Virtuoso
    (schematic editor) to count all the instances of cell that exist within
    a given hierarchy (that is, the current schematic and all lower
    hierarchies)? I am looking for something like a summary of all the
    cells used and the number of instances of each cell, for statistical
    purposes.

    I tried to use the results browser to search in the files generated by
    the netlisting process during simulation (I am using Spectre, btw),
    but found nothing. Any ideas?

    Thanks in advance and best regards,

    Jorge Luis.
     
    spectrallypure, Feb 18, 2006
    #1
  2. There's currently nothing to produce this BOM-like information (Bill of
    Materials) - you could of course do it with some SKILL code to traverse the
    hierarchy and count all the components.

    I don't have anything lying around to do this - perhaps somebody else in the
    group does?

    Regards,

    Andrew.
     
    Andrew Beckett, Feb 21, 2006
    #2
  3. spectrallypure

    llc Guest

    I have a separate program that operates on GDSII data.
     
    llc, Feb 28, 2006
    #3
  4. spectrallypure

    llc Guest

    I have a separate program that operates on GDSII data.
     
    llc, Feb 28, 2006
    #4
  5. In Virtuoso Layout the command is Design -> Hierarchy -> Tree ...
    (you don't need to have this processed on the GDSII)

    Unfortunatly, this menu Tree does not exist in Virtuoso Schematic.

    ======================

    http://cmp.imag.fr
    ======================
     
    Kholdoun TORKI, Mar 3, 2006
    #5
  6. I didn't have time to thouroughly check the output but I think this will do an accurate
    count. It was correct for a schematic with a couple of levels of hierearchy and some
    iterated instances.
    The fucntion will print out the instance information as well as define a global
    table called _schTreeTable that can be accessed outside the function.



    procedure(getSchAllInstCnt(@optional (start geGetWindowCellView()) (firstTime t) (itInstCnt 1))
    let((cells instSch cl cn startTime)
    when(firstTime
    startTime = getCurrentTime()
    _schTreeTable = makeTable("tree" 0)
    _schTreeTable[start~>cellName] = 1
    )
    cells = setof(x start~>instances x~>purpose == "cell" && x~>instTerms)
    foreach(inst cells
    cl = inst~>master~>lib~>name
    cn = inst~>master~>cellName
    _schTreeTable[cn] = _schTreeTable[cn] + itInstCnt*inst~>numInst
    instSch = nil
    when(ddGetObj(cl cn "schematic")
    instSch = dbOpenCellViewByType(cl cn "schematic" nil "r"))
    when(instSch getSchAllInstCountFromHier(instSch nil inst~>numInst*itInstCnt))
    );foreach inst
    when(firstTime
    foreach(x _schTreeTable[?] printf("%L ------> %L\n" x _schTreeTable[x]))
    printf("Instance count took %L seconds \n" compareTime( getCurrentTime() startTime))
    )
    t
    ); let
    );procedure
     
    Dominic Duvarney, Mar 3, 2006
    #6
  7. spectrallypure

    TimRoy1 Guest

    Hi Dominic,

    Thanks for posting the skill but the getSchAllInstCountFromHier()
    procedure is missing.

    Tim
     
    TimRoy1, Mar 7, 2006
    #7
  8. My apologies Tim, I renamed the function to shorten the name but missed the call
    to itself in the procedure. getSchAllInstCountFromHier() should be getSchAllInstCnt().


    procedure(getSchAllInstCnt(@optional (start geGetWindowCellView()) (firstTime t) (itInstCnt 1))
    let((cells instSch cl cn startTime)
    when(firstTime
    startTime = getCurrentTime()
    _schTreeTable = makeTable("tree" 0)
    _schTreeTable[start~>cellName] = 1
    )
    cells = setof(x start~>instances x~>purpose == "cell" && x~>instTerms)
    foreach(inst cells
    cl = inst~>master~>lib~>name
    cn = inst~>master~>cellName
    _schTreeTable[cn] = _schTreeTable[cn] + itInstCnt*inst~>numInst
    instSch = nil
    when(ddGetObj(cl cn "schematic") instSch = dbOpenCellViewByType(cl cn
    "schematic" nil "r"))
    when(instSch getSchAllInstCnt( instSch nil inst~>numInst*itInstCnt))
    );foreach inst
    when(firstTime
    foreach(x _schTreeTable[?] printf("%L ------> %L\n" x _schTreeTable[x]))
    printf("Instance count took %L seconds \n" compareTime( getCurrentTime() startTime))
    )
    t
    ); let
    );procedure
     
    Dominic Duvarney, Mar 7, 2006
    #8
  9. spectrallypure

    TimRoy1 Guest

    Thanks Dominic!

    That worked great.

    Tim
     
    TimRoy1, Mar 7, 2006
    #9
  10. spectrallypure

    Jimka Guest

    What would you like to do with arrayed instances
    and mfactors? If you are happy treating such instances
    as simple instances, and you only want to look in schematic cellviews
    and you want to look to the bottom of the hierarhy with no special
    stopping
    special cases you could do something like the following.

    untested

    ;; call a given function on all instances found in a schematic
    hierarchy
    (defun traverse (d_cv u_fun)
    (foreach d_inst d_cv~>instances
    (funcall u_fun d_inst)
    (when (ddGetObj d_inst~>libName d_inst~>cellName "schematic")
    (traverse (dbOpenCellViewByType d_inst~>libName
    d_inst~>cellName
    "schematic"
    nil
    "r")))))

    (inScheme
    ;; build a hash table which counts all instances in a schematic
    hierarchy.
    ;; and finally print out a report of the hierarchy
    (defun count_instances (@optional (d_cv (geGetEditCellView)))
    (let ((hash (makeTable 'count 0)))
    (traverse d_cv
    (lambda (inst)
    hash[(list inst~>libName inst~>cellName)] = 1 + hash[(list
    inst~>libName inst~>cellName)]))
    (foreach key hash
    (printf "%d: %L\n" key)))))
     
    Jimka, Mar 10, 2006
    #10
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.