How can i get the library list?

Discussion in 'Cadence' started by Íõ³É³¬, Jun 28, 2004.

  1. Íõ³É³¬

    Íõ³É³¬ Guest

    HI
    I want to get all schmematic in a library and operate them with skill.
    How can I get the all schematic list in my library?

    thanks
    Wang chengchao
     
    Íõ³É³¬, Jun 28, 2004
    #1
  2. Íõ³É³¬

    Erik Wanta Guest

    Wang:
    schlist=list()

    foreach(cell ddGetObj("libName")~>cells

    when(member("schematic" cell~>views~>name)

    schlist=append1(schlist cell~>name)

    ) ; when

    ) ; foreach

    dprint(schlist)
     
    Erik Wanta, Jun 28, 2004
    #2
  3. Just a little point - you'd be better off doing:

    schlist=cons(cell~>name schlist)

    than using append1, since if the library has a very large number of schematics,
    building that list is going to be quite expensive, as appends have to copy the
    list in the first argument before adding the entry on the end. So you end up
    copying each list cell n*(n+1)/2 times, i.e. O(2), so if there are 10,000
    schematics, that means roughly 50 million list cell copies. That ends up with
    a lot of garbage being collected.

    Since the order of the list of cells is not terribly meaningful, I see little
    benefit in keeping that order when you do the append1, so you're not losing
    out by using cons. If you really want the order to be maintained, you can
    always do a one-off reverse() of the list at the end, or use tconc() to build
    the list in the right order (efficiently) to start off with. append is a
    non-destructive list operator (like most list operators), which is why it
    copies the list first.

    So this is a little away from the original request, and a bit pedantic on my
    part, but I like to make sure that bad habits don't set in early!

    Regards,

    Andrew.
     
    Andrew Beckett, Jun 29, 2004
    #3
  4. Íõ³É³¬

    Jim Newton Guest

    you could also try something like the following if you
    are concerned about the order of the list and absolutely
    want each new cell name at the end of the list.

    ;; build two lists, one of cells and one of cell names
    schlist = setof( cell ddGetObj("libName")~>cells
    member("schematic" cell~>views~>name))~>name

    or better

    ;; use mapcan to efficiently build a list of selected names
    schlist = foreach( mapcan cell ddGetObj("libName")~>cells
    when( member("schematic" cell~>views~>name)
    list( cell~>name)))

     
    Jim Newton, Jun 29, 2004
    #4
  5. Íõ³É³¬

    ??? Guest

    thank all
     
    ???, Jul 6, 2004
    #5
  6. Íõ³É³¬

    fogh Guest

    ^^^^^^^^
    Jim, you can better check on the viewtype. Many designers use a different name.
     
    fogh, Jul 19, 2004
    #6
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.