Home > Community > Forums > PCB SKILL > Help me with Via parameter !

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: *

 Help me with Via parameter ! 

Last post Fri, Apr 13 2012 1:34 AM by luanvn81. 12 replies.
Started by luanvn81 21 Mar 2012 08:33 PM. Topic has 12 replies.
Page 1 of 1 (13 items)
Sort Posts:
  • Wed, Mar 21 2012 8:33 PM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 45
    • Points 660
    Help me with Via parameter ! Reply

     Hi everyone!
    I have a skill file ( download from internet), I'm researching it but there are something I don't understand, so I hope evertone can help me. And here is it:
    *****************************************************************
    axlCmdRegister( "myCompanyViaReport" `myCompanyViaReport)
    (defun myCompanyViaReport ()
    ; Find all of the vias in the design
    allViasInDesign=list()
    originalVisible=axlVisibleGet()
    designName = axlCurrentDesign()
    axlVisibleDesign(t)
    axlShell("redisplay")
    axlSetFindFilter(?enabled '(noall vias) ?onButtons '(noall vias))
    allViasInDesign=axlGetSelSet(axlAddSelectAll())
    axlClearSelSet()
    ; Open a file to work on
    if(length(allViasInDesign)==0
    then
    axlUIConfirm("No vias in this design. Please try another design.")
    else
    writeOutFile = outfile("./TBL-DesignViaReport.csv" "w")
    fprintf(writeOutFile strcat("Design Via Report for " designName "\n\n"))
    fprintf(writeOutFile "Via Location,Via Net Name,Padstack Name,Via Start
    Layer,Via End Layer\n")
    ; Output data for each via to the file
    foreach(via allViasInDesign
    viaLocation = sprintf(nil "%L:%L" car(via->xy) cadr(via->xy))
    fprintf(writeOutFile strcat(viaLocation ","))
    fprintf(writeOutFile strcat(via->net->name ","))
    fprintf(writeOutFile strcat(via->name ","))
    fprintf(writeOutFile strcat(car(via->startEnd) ","))
    fprintf(writeOutFile strcat(cadr(via->startEnd) "\n"))
    );end foreach via allViasInDesign
    ; Close the file and wrap up
    fprintf(writeOutFile "END OF FILE")
    close(writeOutFile)
    axlVisibleSet(originalVisible)
    axlShell("redisplay")
    axlUIConfirm( "Report has been generated in your working directory." )
    ; This next line launches Excel and displays the report
    axlHttp("TBL-DesignViaReport.csv")
    );end if length(allViasInDesign)==0
    );end defun myCompanyViaReport
    ********************************************************************
    ??????????????????
    - How can I know paramerter of Vias such as ViaLocation, via net name, via name, via start layer, end layer in order to make this:
    ================================================================
    viaLocation = sprintf(nil "%L:%L" car(via->xy) cadr(via->xy))
    fprintf(writeOutFile strcat(viaLocation ","))
    fprintf(writeOutFile strcat(via->net->name ","))
    fprintf(writeOutFile strcat(via->name ","))
    fprintf(writeOutFile strcat(car(via->startEnd) ","))
    fprintf(writeOutFile strcat(cadr(via->startEnd) "\n")
    ================================================================

    I'm using Allegro 16.3 and it seem can't run with BB via.
    Tks!
    Luanvn81

    • Post Points: 20
  • Wed, Mar 21 2012 8:46 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 599
    • Points 12,740
    Re: Help me with Via parameter ! Reply
    I tested the code. It works OK. I get a report in my working directory.
    Dave Elder, Tait Communications
    • Post Points: 20
  • Thu, Mar 22 2012 8:36 PM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 45
    • Points 660
    Re: Help me with Via parameter ! Reply

     Hi!

    Thank for your test!

    I have tested in 4 layer board and using through via, it's OK.  but I test with another brd and  got following error:

    E- *Error* strcat: argument #1 should be either a string or a symbol (type template = "S") - nil  and I found that one via have dummy net.So Skill file got error.

      By the way, can you explain to me some things in this Skill file:

    1/ I have changed  "axlVisibleDesign(t)" into "axlVisibleDesign(nil)" and add line  "axlVisibleLayer("etch/top" t) but program can't get via on top layer and warning "No vias in this design. Please try another design". How can I get via on top layer?

    2/  How the mark "->"  & "," in line    fprintf(writeOutFile strcat(via->net->name ",")) can be understand ?

    3/ How can I know Via properties in this skill file  in order to print to my file [Ex :fprintf(writeOutFile strcat(via->net->name ",")) ]

       Base on  Via's property  when "show element" via???

     I'm sorry , but I'm trying to learn skill myself.

    Tks.

    Luan.

     

    • Post Points: 20
  • Sun, Mar 25 2012 12:24 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 599
    • Points 12,740
    Re: Help me with Via parameter ! Reply
    Hi Luan,
     
    1/ Turn on layer "VIA CLASS/TOP"
     
    2/ I suggest you read the Skill Language User Manual. "The arrow ( -> ) operator gives you a simple way of indirectly accessing properties stored on a symbol's property list". The comma (",") is just printing the comma into the output file
     
    fprintf(writeOutFile strcat(via->net->name ",")) would be better written as fprintf(writeOutFile strcat(via->net->name || "DummyNet" ","))
     
    3/ To find all properties of a via, type via ->?? (assuming "via" is the dbid of the via you wish to know the properties of).

    I suggest that you read the available manuals. Learning Skill will be difficult without some background reading or training.

    Dave
    Dave Elder, Tait Communications
    • Post Points: 20
  • Mon, Mar 26 2012 11:17 PM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 45
    • Points 660
    Re: Help me with Via parameter ! Reply

     Hi Dave!

    Thank you for your reply. I will  read the manuals clearly as your advice. 

    Can you show me one problem more?

    I wanna count via layerVP24 and Vp22 and my  code skill like below:

    ..........

     axlVisibleDesign(nil)
    axlVisibleLayer("via class/VP24" t)
    axlShell("redisplay")
    axlSetFindFilter(?enabled '(noall vias) ?onButtons '(noall vias))
    allViasInDesign=axlGetSelSet(axlAddSelectAll())
    axlClearSelSet()
    writeOutFile = outfile( "TempFile.tmp" ) ; open write tmp file
    foreach(via allViasInDesign
    viaLocation = sprintf(nil "%L:%L" car(via->xy) cadr(via->xy))
    netname=via->net->name
    if(nindex(netname "HC")!=nil then
    fprintf(writeOutFile strcat(via->name ","))
    fprintf(writeOutFile strcat(viaLocation ","))
    fprintf(writeOutFile strcat(via->net->name "\n"))
    else
    if(nindex(netname "LC")!=nil then
    ;fprintf(writeOutFile strcat("Top" " layer" ","))
    fprintf(writeOutFile strcat(via->name ","))
    fprintf(writeOutFile strcat(viaLocation ","))
    fprintf(writeOutFile strcat(via->net->name "\n"))
    else
    if(nindex(netname "GND")!=nil then
    fprintf(writeOutFile strcat(via->name ","))
    fprintf(writeOutFile strcat(viaLocation ","))
    fprintf(writeOutFile strcat(via->net->name "\n"))
    );end HC
    );end LC
    );end GND
    );end foreach

    axlVisibleDesign(nil)
    axlVisibleLayer("via class/VP22" t)
    axlShell("redisplay")
    axlSetFindFilter(?enabled '(noall vias) ?onButtons '(noall vias))
    allViasInDesign=axlGetSelSet(axlAddSelectAll())
    axlClearSelSet()
    foreach(via allViasInDesign
    viaLocation = sprintf(nil "%L:%L" car(via->xy) cadr(via->xy))
    netname=via->net->name
    if(nindex(netname "HC")!=nil then
    fprintf(writeOutFile strcat(via->name ","))
    fprintf(writeOutFile strcat(viaLocation ","))
    fprintf(writeOutFile strcat(via->net->name "\n"))
    else
    if(nindex(netname "LC")!=nil then
    fprintf(writeOutFile strcat(via->name ","))
    fprintf(writeOutFile strcat(viaLocation ","))
    fprintf(writeOutFile strcat(via->net->name "\n"))
    else
    if(nindex(netname "GND")!=nil then
    fprintf(writeOutFile strcat(via->name ","))
    fprintf(writeOutFile strcat(viaLocation ","))
    fprintf(writeOutFile strcat(via->net->name "\n"))
    );end HC
    );end LC
    );end GND
    );end foreach
    ............................

    my problem is:

    How can I write out via list of VP22 in another collumn(as below)

                    Layer Vp24                                                                    Layer Vp22

    ---------------------------------------------------------------------------------------------------------------------

      Vianame    Via location   Via net name                         Vianame    Via location   Via net name

       xxxxx           xxxxxx             xxxxxx                          xxxxx           xxxxxx             xxxxxx   

       xxxxx           xxxxxx             xxxxxx                          xxxxx           xxxxxx             xxxxxx  

       xxxxx           xxxxxx             xxxxxx                          xxxxx           xxxxxx             xxxxxx  

       xxxxx           xxxxxx             xxxxxx                          xxxxx           xxxxxx             xxxxxx  

     Tks.

    Luan.

     

     

    • Post Points: 20
  • Tue, Mar 27 2012 2:43 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 599
    • Points 12,740
    Re: Help me with Via parameter ! Reply

    Hopefully this code will get you started:

     

    subclasses = '("VP24", "VP22")

    foreach(subclass, subclasses

    viaList = stringToSymbol(strcat("viaList_", subclass))

    set(viaList, nil)

    axlVisibleDesign(nil)

    axlVisibleLayer(strcat("via class/", subclass) t)

    ;axlShell("redisplay")

    axlVisibleUpdate(t)

    axlSetFindFilter(?enabled '(noall vias) ?onButtons '(noall vias))

    allViasInSubclass = axlGetSelSet(axlAddSelectAll())

    axlClearSelSet()

    foreach(via allViasInSubclass

    netname = via ->net ->name

    when(netname && (nindex(netname "HC") || nindex(netname "LC") || nindex(netname "GND"))

    set(viaList, cons(via, eval(viaList)))

    )

    );end foreach via

    );end foreach subclass

    writeOutFile = outfile( "TempFile.tmp" ) ; open write tmp file

    foreach(sublass, subclasses

    fprintf(writeOutFile, "                                 %-49s", strcat("Layer ", sublass))

    )

    fprintf(writeOutFile, "\n\n")

    foreach(sublass, subclasses

    fprintf(writeOutFile, "----------------------------------------------------------------------------------")

    )

    fprintf(writeOutFile, "\n\n")

    foreach(sublass, subclasses

    fprintf(writeOutFile, "  Vianame                      Via location         Via net name                  ")

    )

    fprintf(writeOutFile, "\n\n")

     

    while(exists(sublass, subclasses, eval(stringToSymbol(strcat("viaList_", subclass))))

    line = ""

    foreach(sublass, subclasses

    viaList = stringToSymbol(strcat("viaList_", subclass))

    via = car(eval(viaList))

    viaLocation = sprintf(nil "%L:%L" car(via ->xy) cadr(via ->xy))

    sprintf(line, "%s%-30s %-20s %-30s", line, via ->name, viaLocation, via ->net ->name)

    set(viaList, cdr(eval(viaList)))

    )

    fprintf(writeOutFile, "%s\n", line)

    )

    close(writeOutFile) 

    Dave Elder, Tait Communications
    • Post Points: 20
  • Wed, Mar 28 2012 7:30 AM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 45
    • Points 660
    Re: Help me with Via parameter ! Reply

    Hi Dave!

    Thank for yours reply! you are really a good man, I really admire you.Your code is perfect, I only fix  the letter "sublass" by "subclass" in your code and then it works now, it has written out  file "tempfile.tmp", but in command line in allegro appear error" :

    E- *Error* fprintf/sprintf: format spec. incompatible with data - "Format is '%s%-30s %-20s %-30s', argument #2 is nil"

    Tks.  I'm so sorry for disturance you.

    Luan.

    • Post Points: 20
  • Wed, Mar 28 2012 12:07 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 599
    • Points 12,740
    Re: Help me with Via parameter ! Reply

    Thanks for finding my typo! I think the "L" key on my keyboard might be stuck.

    This code should be better but look for improvements. It's only meant as a guide. 

     

    subclasses = '("VP24", "VP22")

    foreach(subclass, subclasses

    viaList = stringToSymbol(strcat("viaList_", subclass))

    set(viaList, nil)

    axlVisibleDesign(nil)

    axlVisibleLayer(strcat("via class/", subclass) t)

    ;axlShell("redisplay")

    axlVisibleUpdate(t)

    axlSetFindFilter(?enabled '(noall vias) ?onButtons '(noall vias))

    allViasInSubclass = axlGetSelSet(axlAddSelectAll())

    axlClearSelSet()

    foreach(via allViasInSubclass

    netname = via ->net ->name

    when(netname && (nindex(netname "HC") || nindex(netname "LC") || nindex(netname "GND"))

    set(viaList, cons(via, eval(viaList)))

    )

    );end foreach via

    );end foreach subclass

    writeOutFile = outfile( "TempFile.tmp" ) ; open write tmp file

    foreach(subclass, subclasses

    fprintf(writeOutFile, "                                 %-49s", strcat("Layer ", subclass))

    )

    fprintf(writeOutFile, "\n\n")

    foreach(subclass, subclasses

    fprintf(writeOutFile, "----------------------------------------------------------------------------------")

    )

    fprintf(writeOutFile, "\n\n")

    foreach(subclass, subclasses

    fprintf(writeOutFile, "  Vianame                      Via location         Via net name                  ")

    )

    fprintf(writeOutFile, "\n\n")

     

    while(exists(subclass, subclasses, eval(stringToSymbol(strcat("viaList_", subclass))))

    line = ""

    foreach(subclass, subclasses

    viaList = stringToSymbol(strcat("viaList_", subclass))

    via = car(eval(viaList))

    if(via then

    sprintf(viaLocation "%L:%L" car(via ->xy) cadr(via ->xy))

    sprintf(line, "%s%-30s %-20s %-30s", line, via ->name, viaLocation, via ->net ->name)

    else

    sprintf(line, "%82s", line)

    )

    set(viaList, cdr(eval(viaList)))

    )

    fprintf(writeOutFile, "%s\n", line)

    )

    close(writeOutFile)

     

    Dave Elder, Tait Communications
    • Post Points: 20
  • Fri, Apr 6 2012 9:01 PM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 45
    • Points 660
    Re: Help me with Via parameter ! Reply

     Hi ! thank for your code. It works OK, I have changed writting out method in order to apply for many layers.

      Now. Can you show me other problem ?

    I'm testing a code, but there something I don't know. Here the code.

      axlCmdRegister( "Reportvia" `Reportvia)
    (defun Reportvia ()

    if(isFile("netlist.txt") then
    netlist = list()
    netlist = nil
    inPort = infile( "netlist.txt" )
    when( inPort
    while( gets( nextline inPort )
    netlist = cons(concat(nextline),netlist)
    );end while
    close( inPort )
    netlist=reverse(netlist)
    );end when
    else
    axlUIConfirm( "File netlist.txt can't be found!")
    exit()
    );end if

          foreach(netname, netlist
            netlist->netname = 10    ; property of each net name =10
          );end foreach

        writeOutFile = outfile( "./Via_report.txt" )

          foreach(netname, netlist
           fprintf(writeOutFile, "%s %d\n", get_pname(concat(netname)), netlist->netname)
           );end foreach
          close(writeOutFile)

    );end defun

    1/ Can you show me  if the netlist.txt file isn't exist ==> ;E- *Error* eval: unbound variable - netlist. How can I resolve it?

    2/ In order to print netname out, is there any others way to get name of net.

    3/ the result of my code : (via_report.txt), - and the result don't like as I wish.

    D1_HC1_4
     10
    netname 10 
    10 10
    D1_HC2
     10
    D1_HC3
     10
    D1_HC4
     10
    D1_HC5 10
     

     ===> please show me where is wrong?how can I fix it?

    (my netlist is: 

    D1_HC1_4
    D1_HC2
    D1_HC3
    D1_HC4
    D1_HC5

    )

    tks.

    Luan.

    • Post Points: 20
  • Tue, Apr 10 2012 1:45 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 599
    • Points 12,740
    Re: Help me with Via parameter ! Reply

    Hi Luan,

    exit doesn't behave as you are expecting. You can't use it to "exit" your code like this.

    Your code is very confusing. Is this what you are trying to do?

     

    axlCmdRegister( "Reportvia" 'Reportvia)

    defun( Reportvia ()

    if(isFile("netlist.txt") then

    netlist = nil

    inPort = infile( "netlist.txt" )

    when( inPort

    while( gets( nextline inPort )

    nextline = car(parseString(nextline, "\n"))

    netlist = cons(concat(nextline), netlist)

    );end while

    close( inPort )

    netlist = reverse(netlist)

    foreach(netname, netlist

    netname ->count = 10

    );end foreach

    writeOutFile = outfile( "./Via_report.txt" )

    foreach(netname, netlist

    fprintf(writeOutFile, "%s %d\n", get_pname(netname), netname ->count)

    );end foreach

    close(writeOutFile)

     

    );end when

    else

    axlUIConfirm( "File netlist.txt can't be found!")

    );end if

    );end defun

    Dave Elder, Tait Communications
    • Post Points: 20
  • Wed, Apr 11 2012 2:45 AM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 45
    • Points 660
    Re: Help me with Via parameter ! Reply

     Hi Dave! Actually I want to count number of vias for each net (in netlist.txt)  layer by layer in brd data, and this is whole my code:

     axlCmdRegister( "Reportvia" `Reportvia)
    (defun Reportvia ()
     originalVisible=axlVisibleGet()
     designName = axlCurrentDesign()

    subclasses = '("VP24, VP23, VP22" )

    ;========Check & get input file==========
    if(isFile("netlist.txt") then
    netlist=list()
    netlist=nil
    inPort = infile( "netlist.txt" )
    when( inPort
    while( gets( nextline inPort )
    nextline = car(parseString(nextline, "\n"))
    netlist=cons(concat(nextline),netlist)
    );end while
    close( inPort )
    netlist=reverse(netlist)

    ;==========format what to do for each subclass ==========================
    foreach(subclass, subclasses  

    ;========== Get vias layer by layer & save in a list=====================
    viaList = concat("viaList_", subclass)
    set(viaList, nil)                                       
    axlVisibleDesign(nil)
    axlVisibleLayer(strcat("via class/", subclass) t)
    axlVisibleUpdate(t)
    axlSetFindFilter(?enabled '(noall vias) ?onButtons '(noall vias))
    allViasInSubclass = axlGetSelSet(axlAddSelectAll())
    axlClearSelSet()

    ;===== Create listnetslayer & set list's elements = netlist's element====
    netlistlayer = concat("netlist_", subclass)
    set(netlistlayer,eval(netlist))

    ;========== Caculating number of vias each net in layer =================
    foreach(netname, netlistlayer
       sumvias = setof(via, allViasInSubclass, via->net->name = get_pname(netname))
       netname->count = length(sumvias)
    );end foreach netname
    );end foreach subclass

    ;========== Write out file========
        writeOutFile = outfile( "./Via_by_layer_and_netname_report.txt" ) ; open write tmp file

    ;========== Format outfile =======
       ; ##########NOT FORMAT YET###########
       fprintf(writeOutFile "END OF FILE")

    close(writeOutFile)
    );end when
    ;======= Review begin status======
    else
    axlUIConfirm( "File netlist.txt can't be found!")
    axlVisibleSet(originalVisible)
    axlShell("redisplay")
    );enf if netlist.txt
    );end defun

    ?: =====>  E- *Error* eval: undefined function - D1_HC1_4 , can you show me how to fix this error.

    Thanks alot.

    Luan.

    • Post Points: 20
  • Wed, Apr 11 2012 1:18 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 599
    • Points 12,740
    Re: Help me with Via parameter ! Reply

    Hi Luan,

    There must be easier was to do this but here are some corrections:

     defun( Reportvia ()

    originalVisible=axlVisibleGet()

    designName = axlCurrentDesign()

    subclasses = '("VP24, VP23, VP22" )

     

    ;========Check & get input file==========

    if(isFile("netlist.txt") then

    ;netlist=list(); unnecessary

    netlist=nil

     

    inPort = infile( "netlist.txt" )

    when( inPort

    while( gets( nextline inPort )

    nextline = car(parseString(nextline, "\n"))

    netlist=cons(concat(nextline), netlist)

    );end while

    close( inPort )

    netlist = reverse(netlist)

     

    ;==========format what to do for each subclass ==========================

    foreach(subclass, subclasses

     

    ;========== Get vias layer by layer & save in a list=====================

    viaList = concat("viaList_", subclass)

    set(viaList, nil)

    axlVisibleDesign(nil)

    axlVisibleLayer(strcat("via class/", subclass) t)

    axlVisibleUpdate(t)

    axlSetFindFilter(?enabled '(noall vias) ?onButtons '(noall vias))

    allViasInSubclass = axlGetSelSet(axlAddSelectAll())

    axlClearSelSet()

     

    ;===== Create listnetslayer & set list's elements = netlist's element====

    netlistlayer = concat("netlist_", subclass)

    set(netlistlayer, netlist)

     

    ;========== Caculating number of vias each net in layer =================

    foreach(netname, eval(netlistlayer)

      ;sumvias = setof(via, allViasInSubclass, via->net->name = get_pname(netname))

      sumvias = setof(via, allViasInSubclass, via ->net ->name == get_pname(netname))

      netname ->count = length(sumvias)

    );end foreach netname

    );end foreach subclass

     

    ;========== Write out file========

    writeOutFile = outfile( "./Via_by_layer_and_netname_report.txt" ) ; open write tmp file

     

    ;========== Format outfile =======

    ; ##########NOT FORMAT YET###########

    fprintf(writeOutFile "END OF FILE")

     

    close(writeOutFile)

    );end when

    ;======= Review begin status======

     

    else

    axlUIConfirm( "File netlist.txt can't be found!")

    axlVisibleSet(originalVisible)

    axlShell("redisplay")

    );enf if netlist.txt

    );end defun 

    Dave Elder, Tait Communications
    • Post Points: 20
  • Fri, Apr 13 2012 1:34 AM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 45
    • Points 660
    Re: Help me with Via parameter ! Reply

     Hi! I sorry for disturbing  you once more, but I have found an error that i can't fix it. The code works but it's seem  not correctly.

    the result is as below: 

     Net_name         Layer_Vp24          Layer_VP22

     D1_HC1_12            593                        593

     D1_HC13_14            51                        51

    Instead of:

    ( exactly result)

      Net_name         Layer_Vp24          Layer_VP22

     D1_HC1_12            604                       593

     D1_HC13_14            501                       51

     ==>I think the number of via of Vp24 are replaced by the number via of VP22, but i didn't find error in the agorithm.

    Here're whole code:

     axlCmdRegister( "Reportvia" `Reportvia)
    (defun Reportvia ()
     originalVisible=axlVisibleGet()
     designName = axlCurrentDesign()

    ;========Declare Subclasses==========
    subclasses = '( "VP24", "VP22")
    ;subclasses = '("VP24", "VP23" , "VP22" ,"VP21" ,"VP20" ,"VP19" ,"VP18" ,"VP17" ,"VP16" ,"VP15" ,"VP14" ,"VP13" ,"VP12" ,"VP11",
    ;               "VP10" ,"VP9" ,"VP8" ,"VP7" ,"VP6" ,"VP5" ,"VP4" ,"VP3" ,"VP2" ,"AL1-v" ,"AL2-V - JUNCTION" ,"BL-v" ,"CL-v" )

    ;========Check input file==========
    if(isFile("netlist.txt") then
    netlist=nil
    inPort = infile( "netlist.txt" )
    when( inPort
    while( gets( nextline inPort )
    nextline = car(parseString(nextline, "\n"))
    nextline = car(parseString(nextline, " "))      ;check if there're blank
    netlist=cons(concat(nextline),netlist)
    );end while
    close( inPort )
    netlist=reverse(netlist)

    ;==========format what to do for each layer =============================
    foreach(subclass, subclasses  

    ;========== Get vias by layer ===========================================
    axlVisibleDesign(nil)
    axlVisibleLayer(strcat("via class/", subclass) t)
    axlVisibleUpdate(t)
    axlSetFindFilter(?enabled '(noall vias) ?onButtons '(noall vias))
    allViasInSubclass = axlGetSelSet(axlAddSelectAll())
    axlClearSelSet()

    ;===== Create listnetslayer & set list's elements = netlist's element====
    netlistlayer = concat("netlist_", subclass)
    set(netlistlayer,netlist)

    ;========== Caculating number of vias each net in layer =================
    foreach(netname, eval(netlistlayer)
       sumvias = setof(via, allViasInSubclass, via->net->name == get_pname(netname))
       netname->count = length(sumvias)
    );end foreach netname
    );end foreach subclass

    ;========== Write out file===============================================
        writeOutFile = outfile( "./Via_layer_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 output data for outfile =============================
    ;while(exists... : check if all list of suppied layer # nil then print out...  
    while(exists(subclass, subclasses, eval(concat("netlist_", subclass)))
    foreach(net, netlist
    line = ""
    foreach(subclass, subclasses
        netlistlayer = concat("netlist_", subclass)
           netname = car(eval(netlistlayer))
           sprintf(line, "%-30s, %-6d",line, netname->count)
           set(netlistlayer, cdr(eval(netlistlayer)))
    );end foreach subclass
        fprintf(writeOutFile, "%s %s\n", net, line)
    );end foreach net of netlist
    );end while
    fprintf(writeOutFile "END OF FILE")
    close(writeOutFile)

    ;======= Review begin status======
    axlVisibleSet(originalVisible)
    axlShell("redisplay")
    axlUIConfirm( "Report has been generated in your working directory!" )
    axlHttp("Via_layer_report.csv")

    );end when
    else
    axlUIConfirm( "File netlist.txt can't be found!")
    ;);enf if netlist.txt
    );end defun

    Tks.

    Luan.

     

    • Post Points: 5
Page 1 of 1 (13 items)
Sort Posts:
Started by luanvn81 at 21 Mar 2012 08:33 PM. Topic has 12 replies.