Code to check for instance

Discussion in 'Cadence' started by PolyPusher, Aug 24, 2009.

  1. PolyPusher

    PolyPusher Guest

    *WARNING* dbiGetHeaderMasterCellView: Failed to open cellView
    (AC_block symbol) from lib (crdc_custom_work) in 'r' mode because
    cellview does not exist.

    I have some code that reports the connectivity of an instance and
    places it in a file. In some cases some instances in the schematic
    are mapped(not sure if this is the right description) to the wrong
    library(they are "blinking" if that helps :). Is there a way to
    check for this condition and continue?

    Something like:

    if unable to open cellview, then print in the CIW "Failed to find
    instance", else continue with original code.

    Code is below.

    Thank you in advance,
    Eric


    procedure(EFConnectivity(fileName @optional (cvEFcon geGetEditCellView
    ()))
    let((prt PIN EFInstance EFCellname EFTerm EFNet EFCellPin
    EFPinCellname EFTermName EFPinNetName EFX EFCon_list EFCon_pins
    EFConInst EFConInstName EFConXtemp EFConInstNamePrev)

    EFConInstNamePrev="EFNoInst"
    EFCon_pins=nil
    EFCon_list=nil
    PIN="PIN"
    EFX=0

    unless(prt=outfile(fileName)
    error("Could not open %s for writing" fileName)
    ) ; unless

    fprintf(prt "Connectivity Report Format:Instance.Cellname.InstTerm
    (pins).net")
    fprintf(prt "\n")
    fprintf(prt "\n")


    when(cvEFcon
    foreach( inst cvEFcon~>instances
    EFInstance=inst~>name
    EFCellname=inst~>master~>cellName
    foreach( instTerm inst~>instTerms
    EFTerm=instTerm~>name
    EFNet=instTerm~>net~>name

    EFCon_list=append(EFCon_list list(strcat(EFInstance "."
    EFCellname "." EFTerm " - " EFNet )))

    );foreach
    );foreach
    );when

    ;sort the output
    EFCon_list=sort(EFCon_list nil)

    ;==========addition for pins
    PIN="PIN"
    when(cvEFcon
    foreach( inst cvEFcon~>instances
    if(rexMatchp(PIN inst~>name)
    then EFCellPin=inst~>name
    EFPinCellname=inst~>master~>cellName
    );if
    if( inst~>net
    then
    EFTermName=inst~>net~>term~>name
    EFPinNetName=inst~>net~>name
    EFCon_pins=append(EFCon_pins list(strcat(EFCellPin "."
    EFPinCellname "." EFTermName " - " EFPinNetName )))
    );if
    );foreach
    );when
    ;==============end pin addition
    EFCon_pins=sort(EFCon_pins nil)


    foreach( mapc EFConX EFCon_list
    EFConXtemp=nil
    EFConXtemp=EFConX
    EFConInst=nil
    EFConInst=append(EFConInst list(EFConXtemp))
    EFConInstName=nil
    EFConInstName=car(parseString(car(parseString(car(EFConInst)
    "."))))

    if(EFConInstName==EFConInstNamePrev

    then
    fprintf(prt EFConX)
    fprintf(prt "\n")
    else
    fprintf(prt "\n");new instance, add a space in the file
    fprintf(prt EFConX)
    fprintf(prt "\n")
    );if


    EFConInstNamePrev=EFConInstName;capture previous value for if, then,
    else above
    )
    fprintf(prt "\n")
    foreach( mapc EFConX EFCon_pins ;process pins seperately to save
    space in file, no space between "pin instances"
    fprintf(prt EFConX)
    fprintf(prt "\n")

    );foreach

    close(prt)
    view(get_filename(prt))
    )
    t
    )
     
    PolyPusher, Aug 24, 2009
    #1
  2. PolyPusher

    Riad KACED Guest

    Hi Eric,

    You can use the errset() function to catch anny errors and run your
    skill in a safe environment.
    Would this help in your case ?

    Cheers,
    Riad.
     
    Riad KACED, Aug 24, 2009
    #2
  3. Riad KACED wrote, on 08/24/09 18:07:
    Better to explicitly code for the case rather than trapping errors with errset -
    I'd always say that's a last resort, and for trapping things which are out of
    your control.

    If you do something like:

    if(inst~>master then
    ; cellView is bound, so can do your processing...
    ...
    else
    ; do whatever you want to do (print a message?) if the master isn't bound
    ...
    )

    At the right places in the code, then you can handle it. The master attribute
    will be nil if it isn't bound.

    Regards,

    Andrew.
     
    Andrew Beckett, Aug 25, 2009
    #3
  4. PolyPusher

    PolyPusher Guest

    I went with Andrew's suggestion and was able to implement it.

    Thank you both very much,
    Eric
     
    PolyPusher, Aug 25, 2009
    #4
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.