Trouble debugging script.

Discussion in 'Cadence' started by eric.d.fitzsimmons, Apr 15, 2009.

  1. All,

    I have been working on this script. It grabs the instance, cellname,
    pin(term) and net from instance in schematic and places it in a
    form. I also have a sort feature, but it is buggy. I believe it
    might be when I declare variables in the procedure EFSortExecutionCB
    and pass it to the procedure EFSortByPinForm there is some issue.

    I am still fairly new to skill, am I using variables correctly in this
    script? Anyone see anything wrong with
    the two procedures above?

    Any other comments?

    Thank you in advance,
    Eric


    procedure(EFCreateNetForm()

    let((EFNetsBox EFTermsOrNet )

    cv=geGetEditCellView()
    EFNet_list=nil
    when(cv
    foreach( inst cv~>instances
    EFInstance=inst~>name
    EFCellname=inst~>master~>cellName
    foreach( instTerm inst~>instTerms
    Term=instTerm~>name
    Net=instTerm~>net~>name
    printf(EFInstance)
    printf(".")
    printf(EFCellname)
    printf(".")
    printf(Term)
    printf(" - ")
    printf(Net)
    printf("\n")

    EFNet_list=append(EFNet_list list(strcat( "|" EFInstance "."
    EFCellname "." Term " - " Net )))

    );foreach
    );foreach
    );when
    t
    );let

    ;sort the output
    EFNet_list=sort(EFNet_list nil)

    ;=============================================
    ;section below defines form
    ;=============================================

    EFDualMode = hiCreateRadioField(
    ?name 'EFDualMode
    ?prompt "Sort data by?"
    ?value "None"
    ?defValue "None"
    ?choices list("None" "Instance" "Cellname" "Pin" "Net")
    ?callback
    list("case(EFInstanceNetsForm->EFDualMode->value
    (\"None\"
    EFInstanceNetsForm->EFSortBy->editable = nil
    )
    (\"Instance\"
    EFInstanceNetsForm->EFSortBy->editable = t
    )
    (\"Cellname\"
    EFInstanceNetsForm->EFSortBy->editable = t
    )
    (\"Pin\"
    EFInstanceNetsForm->EFSortBy->editable = t
    )
    (\"Net\"
    EFInstanceNetsForm->EFSortBy->editable = t
    )
    )");end case
    )

    EFSortBy = hiCreateStringField(
    ?name 'EFSortBy
    ?prompt "Instance, Net, Cellname or Pin"
    ?editable nil
    ?value ""
    )

    EFNetsBox = hiCreateListBoxField(
    ?name 'EFListBoxField
    ?prompt " "
    ?choices EFNet_list
    ?value nil
    ?multipleSelect nil
    ?numRows length(EFNet_list)
    )

    ;;; defines the form

    hiCreateAppForm(
    ?name 'EFInstanceNetsForm
    ?formTitle "Instance Nets"
    ?callback "EFSortExecutionCB(hiGetCurrentForm())"
    ?fields
    list(
    EFDualMode
    EFSortBy
    EFNetsBox
    )
    ?help ""

    ) ; hiCreateAppForm

    hiDisplayForm(EFInstanceNetsForm)

    );procedure
    EFCreateNetForm()
    ;=================================================================
    ;After Form is up and All data is listed in list box, accept input
    ;for a sort. Create new forms for each. Use hiGetCurrentform on all.
    ;=================================================================

    procedure(EFSortExecutionCB(form)

    let((EFSortByans EFInstanceToSortBy EFCellnameToSortBy EFPinToSortBy
    EFNetToSortBy)

    EFSortByans=form->EFDualMode->value

    if(EFSortByans=="None"
    then EFSortByNoneForm()
    );if

    if(EFSortByans=="Instance"
    then EFInstanceToSortBy=form->EFSortBy->value
    EFSortByInstanceForm()
    );if

    if(EFSortByans=="Cellname"
    then EFCellnameToSortBy=form->EFSortBy->value
    EFSortByCellnameForm()
    );if

    if(EFSortByans=="Pin"
    then EFPinToSortBy=form->EFSortBy->value
    printf(EFPinToSortBy)
    EFSortByPinForm()
    );if

    if(EFSortByans=="Net"
    then EFNetToSortBy=form->EFSortBy->value
    EFSortByNetForm()
    );if


    );let
    );procedure EFSortExecution()

    procedure(EFSortByInstanceForm()

    let((EFNetsBox EFTermsOrNet EFInstanceVar)
    cv=geGetEditCellView()
    EFNet_list=nil
    when(cv
    foreach( inst cv~>instances
    EFInstance=inst~>name
    EFCellname=inst~>master~>cellName
    foreach( instTerm inst~>instTerms
    Term=instTerm~>name
    Net=instTerm~>net~>name
    if(EFInstanceToSortBy==nil
    then EFNet_list=append(EFNet_list list(strcat( "|" EFInstance "."
    EFCellname "." Term " - " Net )))

    );if

    if(EFInstanceToSortBy==EFInstance
    then EFNet_list=append(EFNet_list list(strcat( "|" EFInstance "."
    EFCellname "." Term " - " Net )))

    );if

    );foreach
    );foreach
    );when
    t
    );let

    ;sort the output
    EFNet_list=sort(EFNet_list nil)

    EFInstanceNetsForm->EFListBoxField->choices=EFNet_list

    )

    procedure(EFSortByCellnameForm()

    let((EFNetsBox EFTermsOrNet EFInstanceVar)
    cv=geGetEditCellView()
    EFNet_list=nil
    when(cv
    foreach( inst cv~>instances
    EFInstance=inst~>name
    EFCellname=inst~>master~>cellName
    foreach( instTerm inst~>instTerms
    Term=instTerm~>name
    Net=instTerm~>net~>name
    if(EFCellnameToSortBy==nil
    then EFNet_list=append(EFNet_list list(strcat( "|" EFInstance "."
    EFCellname "." Term " - " Net )))

    );if

    if(EFCellnameToSortBy==EFCellname
    then EFNet_list=append(EFNet_list list(strcat( "|" EFInstance "."
    EFCellname "." Term " - " Net )))

    );if

    );foreach
    );foreach
    );when
    t
    );let

    ;sort the output
    EFNet_list=sort(EFNet_list nil)

    EFInstanceNetsForm->EFListBoxField->choices=EFNet_list

    )

    procedure(EFSortByPinForm()

    let((EFNetsBox EFTermsOrNet EFInstanceVar)
    cv=geGetEditCellView()
    EFNet_list=nil
    printf(EFPinToSortBy)
    when(cv
    foreach( inst cv~>instances
    EFInstance=inst~>name
    EFCellname=inst~>master~>cellName
    foreach( instTerm inst~>instTerms
    Term=instTerm~>name
    Net=instTerm~>net~>name
    if(EFPinToSortBy==Term
    then EFNet_list=append(EFNet_list list(strcat( "|" EFInstance "."
    EFCellname "." Term " - " Net )))

    );if

    );foreach
    );foreach
    );when
    t
    );let

    ;sort the output
    EFNet_list=sort(EFNet_list nil)

    EFInstanceNetsForm->EFListBoxField->choices=EFNet_list

    )

    procedure(EFSortByNetForm()

    let((EFNetsBox EFTermsOrNet EFInstanceVar)
    cv=geGetEditCellView()
    EFNet_list=nil
    when(cv
    foreach( inst cv~>instances
    EFInstance=inst~>name
    EFCellname=inst~>master~>cellName
    foreach( instTerm inst~>instTerms
    Term=instTerm~>name
    Net=instTerm~>net~>name
    if(EFNetToSortBy==nil
    then EFNet_list=append(EFNet_list list(strcat( "|" EFInstance "."
    EFCellname "." Term " - " Net )))

    );if

    if(EFNetToSortBy==Net
    then EFNet_list=append(EFNet_list list(strcat( "|" EFInstance "."
    EFCellname "." Term " - " Net )))

    );if

    );foreach
    );foreach
    );when
    t
    );let

    ;sort the output
    EFNet_list=sort(EFNet_list nil)

    EFInstanceNetsForm->EFListBoxField->choices=EFNet_list

    )

    procedure(EFSortByNoneForm()

    let((EFNetsBox EFTermsOrNet EFInstanceVar)
    cv=geGetEditCellView()
    EFNet_list=nil
    when(cv
    foreach( inst cv~>instances
    EFInstance=inst~>name
    EFCellname=inst~>master~>cellName
    foreach( instTerm inst~>instTerms
    Term=instTerm~>name
    Net=instTerm~>net~>name
    EFNet_list=append(EFNet_list list(strcat( "|" EFInstance "."
    EFCellname "." Term " - " Net )))
    );foreach
    );foreach
    );when
    t
    );let

    ;sort the output
    EFNet_list=sort(EFNet_list nil)

    EFInstanceNetsForm->EFListBoxField->choices=EFNet_list

    )
     
    eric.d.fitzsimmons, Apr 15, 2009
    #1
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.