SKILL go into all instances and do something:

Discussion in 'Cadence' started by raf, Oct 24, 2004.

  1. raf

    raf Guest

    Hi,

    I have this piece of skill code someone provided me with:

    cv = geGetEditCellView()
    leLayerSize(cv, list("via12" "drawing") 0.05 list("via12" "drawing"))
    leLayerSize(cv, list("via12" "drawing") 0.2 list("metal1" "drawing"))

    and I'm wondering if there is a way I can apply it to every level of
    hierarchy in my layout.

    -Raf
     
    raf, Oct 24, 2004
    #1
  2. raf

    Jim Newton Guest

    how about the following?


    ;; call a given function on every level of the hierarchy
    ;; if the same cv appears twice then only apply the function to it once.
    (defun do_something_to_hierarchy ( d_cv u_fun done_cvs)

    ;; call the function on this level
    (funcall u_fun d_cv)

    ;; remember the cellview so we don't call the function twice on it
    ;; in case it appears multiple times in the hierarchy
    (tconc done_cvs d_cv)

    ;; if there are any instances, take a look at their masters
    (foreach d_im (or d_cv~>instanceMasters
    d_cv~>instMasters)
    (cond
    ;; if we have already examined the cv then simply skip it
    ((member d_im (car done_cvs)))

    ;; if it is a pcell then also skip it
    ((is_pcell d_im))

    ;; otherwise descend into this cellview recursively
    (t
    (do_something_to_hierarchy d_im u_fun done_cvs)))))

    (defun is_pcell ( d_cv)
    (or master~>superMaster
    master~>isParamCell))

    (defun the_layer_operation ( d_cv)
    (leLayerSize d_cv '("via12" "drawing") 0.05 '("via12" "drawing"))
    (leLayerSize d_cv '("via12" "drawing") 0.2 '("metal1" "drawing")))

    (defun layer_op_on_hier ( d_cv)
    (do_something_to_hierarchy d_cv 'the_layer_operation (list nil)))
     
    Jim Newton, Oct 24, 2004
    #2
  3. procedure( AddReps(rep repss)
    prog( (masters master reps)
    reps = cons(rep repss)
    masters = rep~>instHeaders~>master
    while(masters
    master = car(masters)
    masters = cdr(masters)
    unless(master~>superMaster || master~>isParamCell ||
    member(master reps)
    reps = AddReps(master reps)
    )
    )
    return(reps)
    )
    )

    procedure( doSomething( (rootrep getEditRep()) )
    prog( (reps rep)
    reps = AddReps(rootrep nil)
    while( reps && result
    rep = car(reps)
    reps = cdr(reps)
    leLayerSize(rep, list("via12" "drawing") 0.05 list("via12"
    "drawing"))
    leLayerSize(rep, list("via12" "drawing") 0.2 list("metal1"
    "drawing"))
    )
    )
    )
     
    Diva Physical Verification, Oct 24, 2004
    #3
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.