• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X PCB Editor
  3. Help me with Via parameter !

Stats

  • Replies 12
  • Subscribers 159
  • Views 16180
  • Members are here 0
More Content

Help me with Via parameter !

luanvn81
luanvn81 over 13 years ago

 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

  • Sign in to reply
  • Cancel
  • eDave
    eDave over 13 years ago

    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 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • luanvn81
    luanvn81 over 13 years ago

     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.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
<
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information