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") thennetlist=nilinPort = infile( "listnet.txt" )when( inPortwhile( gets( nextline inPort )nextline = car(parseString(nextline, "\n"))nextline = car(parseString(nextline, " "))netlist=cons(concat(nextline),netlist));end whileclose( 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 foreachfprintf(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, netlistline = "" foreach(subclass, subclasses sum_net = concat(net, "_", subclass) sprintf(line, "%-30s, %-6L",line, length(eval(sum_net)) ) );end foreach subclassfprintf(writeOutFile, "%s %s\n", net, line));end foreach net of netlistfprintf(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.
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.
In reply to Randy R:
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 ?