Home > Community > Forums > PCB SKILL > Count via by netlist help ?

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Count via by netlist help ? 

Last post Thu, Jul 5 2012 7:08 PM by luanvn81. 2 replies.
Started by luanvn81 04 Jul 2012 11:04 PM. Topic has 2 replies and 2370 views
Page 1 of 1 (3 items)
Sort Posts:
  • Wed, Jul 4 2012 11:04 PM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 58
    • Points 875
    Count via by netlist help ? Reply

     Hi everybody! I'm writting a skill to count number of via of net in a list nets. before I show my problem, please see my code below:

    ......................

     ;========Declare Subclasses==========
    subclasses = '( "VP24", "VP2" )

    ;========Check input file==========
    if(isFile("listnet.txt") then
    netlist=nil
    inPort = infile( "listnet.txt" )
    when( inPort
    while( gets( nextline inPort )
    nextline = car(parseString(nextline, "\n"))
    nextline = car(parseString(nextline, " "))
    netlist=cons(concat(nextline),netlist)
    );end while
    close( inPort )
    netlist=reverse(netlist)
    ;========== Write out file===============================================
        writeOutFile = outfile( "./Count_via_report.csv" )

    ;========== Format Intro for outfile ====================================
    intro="Net_name,"
    foreach(subclass, subclasses
        sprintf(intro,strcat(intro, " Layer_", subclass,"," ))
    );end foreach
    fprintf(writeOutFile, "%s\n\n",intro)

    ;==========format what to do for each layer and caculateing them=============================
    foreach(subclass, subclasses
    axlVisibleDesign(nil)
    axlVisibleLayer(strcat("via class/", subclass) t)
    axlVisibleUpdate(t)
    axlSetFindFilter(?enabled '(noall vias) ?onButtons '(noall vias))
    allViasInSubclass = axlGetSelSet(axlAddSelectAll())
    axlClearSelSet()

    ;========Create for each net in each layer a symbol in order to count number vias of that net=========
    foreach(net, netlist
        sum_net = concat(net, "_", subclass)
        set(sum_net , nil)
        sum_net  = setof(via, allViasInSubclass, via->net->name == get_pname(net))
    );end foreach net
    );end foreach subclass

    ;===========Format output data for outfile =============================
    foreach(net, netlist
    line = ""
      foreach(subclass, subclasses
        sum_net = concat(net, "_", subclass)
        sprintf(line, "%-30s, %-6L",line, length(eval(sum_net)) )
      );end foreach subclass
    fprintf(writeOutFile, "%s %s\n", net, line)
    );end foreach net of netlist

    fprintf(writeOutFile "END OF FILE")
    close(writeOutFile)
    ........................

    my problem is: When i get number vias for each net by command    "setof(...... ) "  ,  sum_net is a list and having values in it. But when I recall them to display in output file , It become a symbol. 

      How can i fix it? Please help me.

    Thanks !

    Luan.

     

    • Post Points: 20
  • Thu, Jul 5 2012 8:58 AM

    • Randy R
    • Top 50 Contributor
    • Joined on Wed, Jul 16 2008
    • Dupont, WA
    • Posts 192
    • Points 3,025
    Re: Count via by netlist help ? Reply

    A few things to try:

    It looks like "net" is just text whereas get_pname() is looking for a symbol.  This may be causing the error.
    Try:  sum_net  = setof(via, allViasInSubclass, via->net->name == net)
    Then you can use length(sum_net) to get the number of vias.

    Notes:
      It looks like you'll only get the vias from the last subclass in subclasses.  Check your loops and consider how you want to get this information to the output data section.
      Also, your output data section will probably need some changes.

    Hope this helps.

    Good Day, R².
    • Post Points: 20
  • Thu, Jul 5 2012 7:08 PM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 58
    • Points 875
    Re: Count via by netlist help ? Reply

     Hi Randy R!

     Thank for your reply,  I don't know why but when I replace  command  setof(....)  by below code, my skill works OK.

       here is my replace code : 

     foreach(net, netlist
        sumnet = concat(net, "_", subclass)
        set(sumnet, nil)
       foreach(via allViasInSubclass
         when(via->net->name == get_pname(net)
           set(sumnet, cons(via, eval(sumnet)))
        );end when
       ); end foreach via
    );end foreach net

    ................

    my output code still works without problems, I only want to try to use command setof  for this. Who can help me fix it ?

    Thank!

    Luan.

    Viet Nam.

     

    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by luanvn81 at 04 Jul 2012 11:04 PM. Topic has 2 replies.