/* CONUTIL (GED) -- Net List Functions */ /* CONUTIL (GED) -- Netzlistenfunktionen */ /* -- INTENDED FOR KEY-CALL USE -- */ /* // Copyright (c) 1993-2012 Oliver Bartels F+E, Muenchen // Author: Manfred Baumeister // Changes History: // rl (120427) RELEASED FOR BAE V7.8. // rl (101019) RELEASED FOR BAE V7.6. // rl (100331) ENHANCEMENT: // Added net pin list with zoom functionality to net assistent. // rl (100115) ENHANCEMENT: // Added pick part net selection option. // rl (091020) RELEASED FOR BAE V7.4. // rl (090507) ENHANCEMENT: // Added trace length/width and via count violations to report. // rl (090304) ENHANCEMENT: // Added net pin count options to net assistant. // rl (081014) RELEASED FOR BAE V7.2. // rl (071029) RELEASED FOR BAE V7.0. // rl (071025) ENHANCEMENT: // Added trace/via data display to net data report. // rl (071015) ENHANCEMENT: // Added part level traces to net bounding box scan. // rl (070921) ENHANCEMENT: // Added attribute support to net assistant. // rl (070504) ENHANCEMENT: // Added unrouted/routed nets highlight options. // rl (070126) ENHANCEMENT: // Added net assistant dialog box. // rl (060829) RELEASED FOR BAE V6.8. // rl (050906) RELEASED FOR BAE V6.6. // rl (050510) ENHANCEMENT: // Added net attribute search function. // rl (041022) ENHANCEMENT: // Added net manipulation options to net highlight functions. // rl (040831) RELEASED FOR BAE V6.4. // rl (030904) RELEASED FOR BAE V6.2. // rl (030410) ENHANCEMENT: // Added skip to net option in all net highlight. // rl (021209) RELEASED FOR BAE V6.0. // rl (021017) ENHANCEMENT: // Introduced generic net name selection box. // rl (020618) RELEASED FOR BAE V5.4. // rl (010625) RELEASED FOR BAE V5.0. // rl (000508) RELEASED FOR BAE V4.6. // rl (990625) RELEASED FOR BAE V4.4. // rl (990503) ENHANCEMENT: // Added abort with highlight option for "Highlight Nets". // rl (980910) RELEASED FOR BAE V4.2. // mb (980712) ENHANCEMENT: // Pulldown menu delimiters introduced. // mb (980712) ENHANCEMENT: // Dynamic multi-language support introduced. // rl (970929) RELEASED FOR BAE V4.0. // mb (960919) RELEASED FOR BAE V3.4. // mb (950913) IMPROVEMENT: // Introduced scan function with pin scan to zoomtonet() // in order to find and display single pin nets. // mb (95) RELEASED FOR BAE V3.2. // mb (941114) ENHANCEMENT: // Introduced zoom to signal functions ("All Nets/Zoom", // "Named Nets/Zoom") to the "Highlight Nets" menu. // mb (940614) BUGFIX: // Net data report to re-init pin count before net pin listing. // mb (94) RELEASED FOR BAE V3.0. // mb (94) ORIGINAL CODING: // integrated ALLNETHL, NETHIGHL, NETDATA, UPDPART. // mb (93) RELEASED FOR BAE V2.6. // mb (93) ORIGINAL CODING. // // DESCRIPTION // // The conutil User Language program activates a menu with a // series of advanced netlist functions such as net data report, // net highlight, open pins report, netlist check, etc. */ // Includes #include "pop.ulh" // User Language popup utilities #include "lay.ulh" // User Language layout utilities // Disable undo state request #pragma ULCALLERNOUNDO // Messages string UPRABORT = M_UPRABORT(); string REPNET = M("Netz : '","Net : '"); string REPNONET = M("(nicht gefunden)","(not found)"); string REPNETNAME = M("Netz ............: '%s'", "Net ............: '%s'"); string REPNUMBER = M(" Nummer .......: %d"," Number ......: %d"); string REPVIAS = M(" Vias .........: %d"," Vias ........: %d"); string REPVIASV = M("! Vias .........: %d > Netzlimit %d", "! Vias ........: %d > Net limit %d"); string REPTRACES = M(" Bahnen .......: %d"," Traces ......: %d"); string REPLENGTH = M(" Gesamtlaenge..: %s %s", " Total length : %s %s"); string REPLENGTHV = M("! Gesamtlaenge..: %s %s > Netzlimit %s %s", "! Total length : %s %s > Netz limit %s %s"); string REPWIDTH = M(" Bahnbreite ...: %s %s", " Trace width .: %s %s"); string REPWIDTHV = M("! Bahnbreite ...: %s %s < Netzmindestvorgabe %s %s", "! Trace width .: %s %s < Netz min. width %s %s"); string REPMWIDTH = M(" Bahnbreite ...: min. %s %s max. %s %s", " Trace width .: min. %s %s max. %s %s"); string REPMWIDTHV = M("! Bahnbreite ...: min. %s %s max. %s %s < Netzmindestvorgabe %s %s", "! Trace width .: min. %s %s max. %s %s < Net min. width %s %s"); string REPPRIOR = M(" Prioritaet ...: %d"," Priority ....: %d"); string REPDISTDEF = M(" Abstand ......: default", " Distance ....: default"); string REPDIST = M(" Abstand ......: %s %s", " Distance ....: %s %s"); string REPPINCNT = M(" Pins .........: %d"," Pins ........: %d"); string REPATTRIB = " %s %.*s: '%s'"; string REPUPLACED = M(" (unpl.)"," (unpl.)"); string REPNPRIO = M("Prioritaet","Priority"); string REPNDIST = M("Mindestabstand","Clearance"); string REPNRWIDTH = M("Bahnbreitenvorgabe","Trace Width"); string REPNNUMBER = M("Netznummer","Net Number"); string REPUPDPART = M("Geaenderte Gehaeusezuweisungen", "Changed Package Assignments"); string REPPACKHD1 = M("Bauteil Makro Netzliste Makro Platziert", "Part Macro Netlist Macro Placed"); string REPNOUPDPART = M("Keine Bauteile mit falschen Gehaeusezuweisungen gefunden!", "No Parts with wrong Package Assignments found!"); string REPSCANATT = M("Scannen Bauteile/Attribute...", "Scanning parts/attributes..."); string REPATTL = M("Definierte Attribute :","Defined Attributes : "); string REPATTVALL = M("Attributwerte zu '%s' :", "Attribute values for '%s' : "); string REPNETL = M("Gefundene Netze :","Matching Nets : "); string REPNETLIST = M("%s%s%d Pins","%s%s%d Pins"); string REPNETLISTS = M("%s%s%d Pin","%s%s%d Pin"); string WRNNOPINATT = M("Keine Pinattribute definiert!", "No pin attributes defined!"); string WRNNOPARTATT = M("Keine Bauteilattribute definiert!", "No part attributes defined!"); string WRNNONETS = M("Keine Netze mit Wert '%s' fuer Attribut '%s' gefunden!", "No nets with value '%s' for attribute '%s' found!"); string WRNNOATTRVAL = M("Keine Werte fuer Attribut '%s' definiert!", "No attribute value definitions for '%s' found!"); string WRNWPINSET1 = M("Info: Nur %d der %d Pins des Netzes '%s'", "Info: Only %d out of %d pins of net '%s'"); string WRNWPINSET2 = M(" haben die gewaehlte Anschlussbreite %s mm!", " have definied %s mm as routing width!"); string UPRFCT = M("Funktion selektieren!","Select Function!"); string UPRFCT1 = M("&Highlight Netze","&Highlight Nets"); string UPRFCT2 = M("%&Report Netzdaten","%&Report Net Data"); string UPRFCT3 = M("Report Pin&status","Report Pin &Status"); string UPRFCT4 = M("%Pruefen &Gehaeuse","%Check &Part Types"); string UPRFCT5 = M("&Pruefen Netzliste","&Check Net List"); string UPRFCT6 = M("%&Netzlisten-Ausgabe","%&Net List Output"); string UPRFCT7 = M("%Netzlisten&assistent","%Net List &Assistant"); string UPRHLFCT = M("Highlight-Funktion selektieren!", "Select Net Highlight Function!"); string UPRHLALL = M("A&lle Netze","&All Nets"); string UPRHLNAM = M("Benannte &Netze","Named &Nets"); string UPRHLALLZ = M("%Alle Netze/&Zoom","%All Nets/&Zoom"); string UPRHLNAMZ = M("Benannte Netze/Z&oom","Named Nets/Z&oom"); string UPRHLUNROUT = M("%&Ungeroutete Netze","%&Unrouted Nets"); string UPRHLROUT = M("&Geroutete Netze","&Routed Nets"); string UPRHLATTZ = M("%Attribut&suche/Zoom","%Attribute &Search/Zoom"); string UPRHLSAV1 = M("%Highlight/&Farben Laden", "%Load &Highlight/Colors"); string UPRHLSAV2 = M("Highlight/F&arben Speichern", "Save H&ighlight/Colors"); string UPRHLSAV3 = M("Highlight/Farben Loes&chen", "Dele&te Highlight/Colors"); string UPRHLSAV4 = M("%S&ichtbarkeit Laden","%&Load Visibility"); string UPRHLSAV5 = M("Sic&htbarkeit Speichern","Save &Visibility"); string UPRHLSAV6 = M("Sichtbarkeit Lo&eschen","&Delete Visibility"); string UPRCONTX = M("' (:Weiter, :Abbruch) ", "' (:Continue, :Abort) "); string UPRCONTY = M("' (:Weiter, : Funktionsliste,:Abbruch) ", "' (:Continue, : Function List, :Abort) "); string UPRNFCT1 = M("&a Abbruch","&a Abort"); string UPRNFCT2 = M("&h Abbruch mit Highlight", "&h Abort with Highlight"); string UPRNFCT3 = M("&x Netzbahnen fixieren","&x Fix Net"); string UPRNFCT4 = M("&u Netzbahnen freigeben","&u Unfix Net"); string UPRNFCT5 = M("&d Netzbahnen loeschen","&u Delete Net"); string UPRNFCT6 = M("&s Netz Bahnbreiten setzen", "&s Set Net Trace Width"); string UPRNFCT7 = M("&- Vorheriges Netz","&- Previous Net"); string UPRNETNAME = M("Netzname ? ","Net Name ? "); string UPRSELANAM = M("Attributname ? ","Attribute Name ?"); string UPRSELAVAL = M("Attributwert(smuster) ? ", "Attribute Value (Pattern) ?"); string UPRPINCNT = M("Anzahl Pins ? ","Pin Count ?"); string UPRMINPINCNT = M("Mindestanzahl Pins ? ","Minimum Pin Count ?"); string UPRMAXPINCNT = M("Maximalanzahl Pins ? ","Maximum Pin Count ?"); string UINSTOP = M("a","x"); string UINHIGHL = M("h","h"); string UINFUNC = M("f","f"); string UINPREV = M("-","-"); string UINFIX = M("x","x"); string UINUNFIX = M("u","u"); string UINDELETE = M("d","d"); string UINSIZE = M("s","s"); string UPRTRCWM = M("Bahnbreite [mm] ? ","Trace Width [mm] ? "); string UPRTRCWI = M("Bahnbreite [Inch] ? ","Trace Width [Inch] ? "); string UPRNETFUNC = M("Netzfunktionen","Net Functions"); string UPRNETDFUNC = M("Doppelklick :","Double Click :"); string UPRHIGHLIGHT = M("Highlight","Highlight"); string UPRHLTOGGLE = M("Netz ein/aus","Toggle Net"); string UPRNHLTOGGLE = M("Highlight ein/aus","Toggle Highlight"); string UPRHLFOCUS = M("Fokus ein/aus","Toggle Focus"); string UPRHLRESET = M("Alle aus","Reset All"); string UPRMCTOGGLE = M("Airline ein/aus","Toggle Airline"); string UPRMCON = M("Alle ein","Enable All"); string UPRHLCOLOR = M("Einfaerbung","Color Net"); string UPRHLLOAD = M("L","L"); string UPRHLSAVE = M("S","S"); string UPRCOLPICK = M("B","B"); string UPRCOL0 = M("keine Farbe","No color"); string UPRCOL1 = M("blau","blue"); string UPRCOL2 = M("gruen","green"); string UPRCOL3 = M("kobaltblau","cyan"); string UPRCOL4 = M("rot","red"); string UPRCOL5 = M("violett","magenta"); string UPRCOL6 = M("braun","brown"); string UPRCOL7 = M("hellgrau","light grey"); string UPRCOL8 = M("dunkelgrau","dark grey"); string UPRCOL9 = M("hellblau","light blue"); string UPRCOL10 = M("hellgruen","light green"); string UPRCOL11 = M("hellkobaltblau","light cyan"); string UPRCOL12 = M("hellrot","light red"); string UPRCOL13 = M("hellviolett","light magenta"); string UPRCOL14 = M("gelb","yellow"); string UPRCOL15 = M("weiss","white"); string UPRPOUTLINE = M("Kontur","Outline"); string UPRPFILLED = M("Gefuellt","Filled"); string UPRPDOTTED = M("Gestrichelt","Dotted"); string UPRPATTERN = M("Muster %d","Pattern %d"); string UPRZOOMTO = M("Zoom zu","Zoom to"); string UPRZOOMLAST = M("Zoom alt","Zoom Last"); string UPRZOOMALL = M("Zoom Uebersicht","Zoom All"); string UPRNETPICK = M("Pick","Pick"); string UPRNETINFO = M("Report Netzdaten","Report Net Data"); string UPRAUTOFOCUS = M("Autofokus","Autofocus"); string UPRUNETDATA = M("Netzdaten:","Net Data:"); string UPRNNETDATA = M("Netzdaten zu '%s':","Net Data of '%s':"); string UPRNETPINS = M("Netzpins:","Net Pins:"); string UPRNNETPINS = M("Netzpins zu '%s':","Net Pins of '%s':"); string UPRSELECT = M("Selektieren","Select"); string UPRDESELECT = M("Deselektieren","Deselect"); string UPRADDCF = M("Fuellbereich","Copper Fill Area"); string UPRADDAC = M("Potentialflaeche","Active Copper"); string UPRMADDCF = M("Neuer &Fuellbereich","Add Copper &Fill Area"); string UPRMADDAC = M("&Potentialflaeche" ,"Add &Active Copper"); string UPRLAYER = M("Lage","Layer"); string UPRNOLAYER = M("Keine Lagenvorgabe","No Layer Default"); string UPRSELLAY = M("Lage waehlen!","Select Layer!"); string UPRNETDATA = M("Netzdaten '%s'","Net Data '%s'"); string UPRSELATTR = M("$ - Attributauswahl","$ - Attribute Selection"); string UPRATYP = M("Attributtyp selektieren!","Select Attibute Type!"); string UPRATYP1 = M("&Netzattribut","&Net Attribute"); string UPRATYP2 = M("&Bauteilattribut","&Part Attribute"); string UPRATYP3 = M("&Pinattribut","P&in Attribute"); string UPRATYP4 = M("%Bau&teilnetze","%Pa&rt Nets"); string UPRATYP5 = M("%Pin&anzahl","%Pin &Count"); string UPRATYP6 = M("M&indestpinanzahl","&Minimum Pin Count"); string UPRATYP7 = M("M&aximalpinanzahl","M&aximum Pin Count"); string UPRATYP8 = M("%Netzname &$","%Net Name &$"); string UPRSELPART = M("Bauteil selektieren!","Select Part!"); string ERRDBLNETDB = M("Netzassistent ist bereits aktiv!", "Net Assistant already active!"); string ERRNOWIN = M("Nur in Windowsumgebungen verfuegbar!", "Windows Environment needed!"); string ERRINPVAL = M_ERRINPVAL(); string ITMPRT = M("Bauteil","Part"); string ITMPIN = M("Pin","Pin"); string ITMWIDTH = M("Breite","Width"); #define REPPINH1 "%-*s %-*s %-*s" #define REPPINH2 "%.*s %.*s %.*s" #define REPPIN "%-*s %-*s %*s" #define ITMULINE "========================================" #define REPPACKHD2 "=============== =============== ===============" #define REPPACKAGE "%-15s %-15s %-15s" #define ITMUDOT "......................................." int ATTFLEN = strlen(REPDIST)-11 /* Attribute field length */; // INI file parameter name definitions #define PAR_NETNSEP "NETNAMESEP_GED" // Net name seperator #define PAR_NETBOXH "NETLISTBOXH_GED" // Net list box height #define PAR_INFOBOXH "NETINFOBOXH_GED" // Net info list box height #define PAR_NETINFO "NETINFODISP_GED" // Net info display flag #define PAR_PINBOXH "NETPINBOXH_GED" // Net pin list box height #define PAR_NETPINS "NETPINDISP_GED" // Net pin display flag #define PAR_ZOOMEXP "PINZOOMEXP_GED" // Net pin zoom expansion value // Global User Language program variables #define UL_UNCONPIN "unconpin" // ULP: Report Open Pins #define UL_CHECKLNL "checklnl" // ULP: Check Net List #define UL_CONBAE "conbae" // ULP: Connection List Output #define UL_NETSTAT "netstat" // ULP: Net Highlight Database #define GV_HLREQUEST "hlrequest" // Highlight request variable #define GV_NAMEFIELD "na_nameidx" // Name field index #define GV_INFOFIELD "na_infidx" // Net info field index #define GV_PINFIELD "na_pinidx" // Pin listbox field index #define GV_PINCNT "na_pincnt" // Pin listbox current pin count #define GV_LAYFIELD "na_layeridx" // Layer field index #define GV_FUNCFIELD "na_funcidx" // Function field index #define GV_COLFIELD "na_colidx" // Color index #define GV_FOCUSFIELD "na_focusidx" // Autofocus flag field index #define GV_LAYNUM "na_layer" // Layer code // Destination unit designators string UNIT = bae_getcoorddisp() ? "[\"]" : "[mm]"; // Unit designator // Globals #define BUTWIDTH 11.0 // Button width #define BUTSPC 12.0 // Button spacing #define COLFIN 2 // Fade in color value string NETSEP = bae_inistrval(PAR_NETNSEP," ") /* Net name seperator */; double NETBOXH = bae_inidblval(PAR_NETBOXH,6.8) /* Net list box height */; double INFOBOXH = bae_inidblval(PAR_INFOBOXH,6.0) /* Net info box height */; int INFODISP = bae_iniintval(PAR_NETINFO,1) /* Net info display flag */; double PINBOXH = bae_inidblval(PAR_PINBOXH,4.0) /* Net pin list box height */; int PINDISP = bae_iniintval(PAR_NETPINS,1) /* Net pin list display flag */; double ZOOMEXP = bae_inidblval(PAR_ZOOMEXP,0.005) /* Net pin zoom window expansion */; STRINGS headl /* Header list */; int headn = 0 /* Header count */; STRINGS entryl /* Entry list */; int entryn = 0 /* Entry count */; double zoomlx,zoomly /* Zoom lower boundaries */; double zoomux,zoomuy /* Zoom upper boundaries */; int curnetnum /* Current net tree number */; string curnetname /* Current net name */; string curpinname /* Current pin name */; int curnetpn = 2 /* Current net pin count */; int curseltyp /* Current net selection type */; string curattrname /* Current attribute name */; string curattrval /* Current attribute value */; double trcminwidth /* Trace min. width */; double trcmaxwidth /* Trace max. width */; double trcslen /* Trace scan length */; int trcscnt /* Trace scan count */; int viascnt /* Via scan count */; int chgflag = 0 /* Figure list change flag */; // Main program void main() { index L_CNET cnet /* Net list index */; // Abort if invalid plan class if (varget(VAR_PDBOXIDX,0) && bae_planddbclass()!=DDBCLLAY) error_class(); // Select connection list function bae_promptdialog(UPRFCT); switch (bae_askmenu(8,UPRFCT1,UPRFCT2, UPRFCT3,UPRFCT4,UPRFCT5,UPRFCT6,UPRFCT7,UPRABORT)) { // Net highlight case 0 : // Select highlight function bae_promptdialog(UPRHLFCT); switch (bae_askmenu(14,UPRHLALL,UPRHLNAM, UPRHLALLZ,UPRHLNAMZ,UPRHLUNROUT,UPRHLROUT,UPRHLATTZ, UPRHLSAV1,UPRHLSAV2,UPRHLSAV3,UPRHLSAV4,UPRHLSAV5,UPRHLSAV6, UPRABORT)) { // All net highlight case 0 : allnethighlight(0); break; // Named net highlight case 1 : nethighlight(0); break; // All net highlight with zoom case 2 : allnethighlight(1); break; // Named net highlight with zoom case 3 : nethighlight(1); break; // Unrouted nets highlight case 4 : forall (cnet where cnet.PINN>1 && cnet.VIS && cnet.UNRPOOL>=0) ged_highlnet(cnet.NUMBER,1); break; // Routed nets highlight case 5 : forall (cnet where cnet.PINN>1 && cnet.VIS && cnet.UNRPOOL<0) ged_highlnet(cnet.NUMBER,1); break; // Attribute search net with highlight & zoom case 6 : netattrsearch(); break; // Net highlight/coloring load case 7 : bae_storemenuiact(3,0,LMB); runulprog(UL_NETSTAT); break; // Net highlight/coloring save case 8 : bae_storemenuiact(3,1,LMB); runulprog(UL_NETSTAT); break; // Net highlight/coloring delete case 9 : bae_storemenuiact(3,2,LMB); runulprog(UL_NETSTAT); break; // Net visibility status load case 10 : bae_storemenuiact(3,3,LMB); runulprog(UL_NETSTAT); break; // Net visibility status save case 11 : bae_storemenuiact(3,4,LMB); runulprog(UL_NETSTAT); break; // Net visibility status delete case 12 : bae_storemenuiact(3,5,LMB); runulprog(UL_NETSTAT); break; } break; // Report net data case 1 : netdata(); break; // Report open pins case 2 : // Run the report open pins program runulprogexit(UL_UNCONPIN); // Check part types case 3 : updpartrep(); break; // Check net list case 4 : // Run the check net list program runulprogexit(UL_CHECKLNL); // Connection list output case 5 : // Run the connection list output program runulprogexit(UL_CONBAE); // Net list assistant case 6 : netassistant(); break; } } // Net highlight routines void allnethighlight(int zoomflag) /* // Highlight all nets step by step // Parameters : // int zoomflag : Zoom to net request flag */ { index L_FIGURE fig /* Figure list index */; index L_CNET net /* Net index */; index L_CNET nnet /* New net index */; index L_CNET netl[] /* Net list */; int netn = 0 /* Net count */; string answer /* Answer string */; double width /* Trace width */; int repflag /* Repeat flag */; int i /* Loop control variable */; // Loop for all nets forall (net) { netl[netn]=net; netn++; } // Loop for all nets for (i=0;i0) i-=2; else i--; repflag=0; break; // Fix net case 3 : // Dehighlight net ged_highlnet(net.NUMBER,0); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Fix traces and vias forall (fig where fig.GROUP && !fig.FIXED && (fig.TYP==L_FIGPATH || fig.TYP==L_FIGUREF)) { // Save current state for undo if (!chgflag) { bae_callmenu(MNU_BAESAVESTATE); chgflag=1; } ged_elemfixchg(fig,1); } // Reset the group bae_callmenu(MNU_GEDGRPRESE); i--; repflag=0; break; // Unfix net case 4 : // Dehighlight net ged_highlnet(net.NUMBER,0); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Unfix traces and vias forall (fig where fig.GROUP && fig.FIXED && (fig.TYP==L_FIGPATH || fig.TYP==L_FIGUREF)) { // Save current state for undo if (!chgflag) { bae_callmenu(MNU_BAESAVESTATE); chgflag=1; } ged_elemfixchg(fig,0); } // Reset the group bae_callmenu(MNU_GEDGRPRESE); i--; repflag=0; break; // Delete net case 5 : // Dehighlight net ged_highlnet(net.NUMBER,0); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Deselect non trace and via elements forall (fig where fig.GROUP && fig.TYP!=L_FIGPATH && fig.TYP!=L_FIGUREF) ged_elemgrpchg(fig,0); // Delete the group bae_callmenu(MNU_GEDDELGRP); i--; repflag=0; break; // Set net trace width case 6 : // Get segment width ged_getpathwidth(width,0.0); if (askdist(width,lay_defusrunit()?UPRTRCWI: UPRTRCWM,0) || width==0.0) // Invalid input value error(ERRINPVAL); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Change trace width forall (fig where fig.GROUP && fig.TYP==L_FIGPATH) { // Save current state for undo if (!chgflag) { bae_callmenu(MNU_BAESAVESTATE); chgflag=1; } ged_elemsizechg(fig,width); } // Reset the group bae_callmenu(MNU_GEDGRPRESE); i--; repflag=0; break; // Abort without highlight case (-1) : // Dehighlight net ged_highlnet(net.NUMBER,0); return; default : // Dehighlight net ged_highlnet(net.NUMBER,0); if (answer!="") { // Try to locate net if (lay_findcontree(answer,nnet)==0) lay_findcontree(answer,net); // Highlight net ged_highlnet(net.NUMBER,1); // Zoom to signal on request if (zoomflag) zoomtonet(net); } else { repflag=0; } } } // Done } void nethighlight(int zoomflag) /* // Highlight Named Nets // Parameters : // int zoomflag : Zoom to net request flag */ { index L_CNET net /* Net index */; index L_FIGURE fig /* Figure list index */; string netname /* Net name */; string answer /* Answer string */; double width /* Trace width */; int res /* Result code */; // Repetively select named nets while ((res=ged_asktreeidx(netname,net,3))!=(-1)) { // Check if valid tree index if (res!=0 && res!=3) { // Prompt user for continue if (asknetcontinue(netname+REPNONET,0,"")) // Abort request ? break; continue; } // Highlight net ged_highlnet(net.NUMBER,1); answer=bae_peekiact()==2 ? askstr("",MAXKEYLEN) : "" ; // Zoom to signal on request if (zoomflag) zoomtonet(net); if (answer!="") bae_storetextiact(1,answer); // Prompt user for continue switch (asknetcontinue(net.NAME,1,"")) { // Abort with highlight case 1 : // Done return; // Return to previous net case 2 : break; // Fix net case 3 : // Dehighlight net ged_highlnet(net.NUMBER,0); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Fix traces and vias forall (fig where fig.GROUP && !fig.FIXED && (fig.TYP==L_FIGPATH || fig.TYP==L_FIGUREF)) { // Save current state for undo if (!chgflag) { bae_callmenu(MNU_BAESAVESTATE); chgflag=1; } ged_elemfixchg(fig,1); } // Reset the group bae_callmenu(MNU_GEDGRPRESE); break; // Unfix net case 4 : // Dehighlight net ged_highlnet(net.NUMBER,0); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Unfix traces and vias forall (fig where fig.GROUP && fig.FIXED && (fig.TYP==L_FIGPATH || fig.TYP==L_FIGUREF)) { // Save current state for undo if (!chgflag) { bae_callmenu(MNU_BAESAVESTATE); chgflag=1; } ged_elemfixchg(fig,0); } // Reset the group bae_callmenu(MNU_GEDGRPRESE); break; // Delete net case 5 : // Dehighlight net ged_highlnet(net.NUMBER,0); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Deselect non trace and via elements forall (fig where fig.GROUP && fig.TYP!=L_FIGPATH && fig.TYP!=L_FIGUREF) ged_elemgrpchg(fig,0); // Delete the group bae_callmenu(MNU_GEDDELGRP); break; // Set net trace width case 6 : // Get segment width ged_getpathwidth(width,0.0); if (askdist(width,lay_defusrunit()?UPRTRCWI: UPRTRCWM,0) || width==0.0) // Invalid input value error(ERRINPVAL); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Change trace width forall (fig where fig.GROUP && fig.TYP==L_FIGPATH) { // Save current state for undo if (!chgflag) { bae_callmenu(MNU_BAESAVESTATE); chgflag=1; } ged_elemsizechg(fig,width); } // Reset the group bae_callmenu(MNU_GEDGRPRESE); break; // Abort without highlight case (-1) : // Dehighlight net ged_highlnet(net.NUMBER,0); return; default : ; } // Dehighlight net ged_highlnet(net.NUMBER,0); } // Done } void netattrsearch() /* // Search Nets */ { index L_CNET net /* Net index */; index L_CPIN pin /* Connection pin index */; index L_ATTRIBUTE att /* Attribute index */; index L_FIGURE fig /* Figure list index */; string netname /* Net name */; string attnam /* Attribute name */; string attval /* Attribute value */; string prompt = "" /* Prompt string */; string answer /* Answer string */; double width /* Trace width */; int tpn /* Total net pin count */; int spn /* Selected net pin count */; // Build attribute name list bae_prtdialog(REPSCANATT); entryn=0; gcname(REPNNUMBER); gcname(REPNPRIO); forall (net) forall (att of net) gcname(att.NAME); forall (net where net.RDIST!=0.0) { gcname(REPNDIST); break; } forall (net) forall (pin of net where pin.RWIDTH!=0.0) { gcname(REPNRWIDTH); break; } // Build the attribute selection popup menu headl[0]=REPATTL; headl[1]=""; headn=2; // Select net attribute name to be searched bae_setintpar(16,3050); if ((attnam=popupmenu(4,UPRSELANAM,headl,headn,entryl,entryn, UINPOPABORT,0,-1,-1,0,0,0,UINPOPABORT))=="" || attnam==UINPOPABORT) error_abort(); // Build attribute value list bae_prtdialog(REPSCANATT); entryn=0; switch (attnam) { case REPNPRIO : forall (net) gcname(itoa(net.PRIOR)); break; case REPNUMBER : forall (net) gcname(itoa(net.NUMBER)); break; case REPNDIST : forall (net where net.RDIST!=0.0) gcname(bae_numstring(cvtlength(net.RDIST,0,2),5)); break; case REPNRWIDTH : forall (net) forall (pin of net where pin.RWIDTH!=0.0) gcname(bae_numstring(cvtlength(pin.RWIDTH,0,2),5)); break; default : if (attnam[0]!='$') error_abort(); forall (net) forall (att of net where att.NAME==attnam) gcname(att.VALUE); } // Abort with warning if no attribute values found if (entryn==0) { sprintf(prompt,WRNNOATTRVAL,attnam); bae_msgbox(0,prompt,""); return; } // Build the attribute selection popup menu sprintf(headl[0],REPATTVALL,attnam); // Select net attribute value to be searched bae_setintpar(16,3051); if ((attval=popupmenu(4,UPRSELAVAL,headl,headn,entryl,entryn, UINPOPABORT,0,-1,-1,0,0,0,UINPOPABORT))==UINPOPABORT) error_abort(); // Store all matching nets entryn=0; switch (attnam) { case REPNPRIO : forall (net) if (attval==itoa(net.PRIOR)) gcname(net.NAME); break; case REPNNUMBER : forall (net) if (attval==itoa(net.NUMBER)) gcname(net.NAME); break; case REPNDIST : forall (net) if (attval==bae_numstring(cvtlength(net.RDIST,0,2),5)) gcname(net.NAME); break; case REPNRWIDTH : forall (net) forall (pin of net) if (attval== bae_numstring(cvtlength(pin.RWIDTH,0,2),5)) { gcname(net.NAME); break; } break; default : forall (net) // Search attribute forall (att of net where att.NAME==attnam && (strmatch(att.VALUE,attval) || att.VALUE==attval)) { gcname(net.NAME); break; } } // Check if nets found if (entryn==0) { sprintf(prompt,WRNNONETS,attval,attnam); bae_msgbox(0,prompt,""); return; } // Build the net selection popup menu headl[0]=REPNETL; headl[1]=""; headn=2; // Repetively select named nets bae_setintpar(16,3062); while ((netname=popupmenu(1,UPRNETNAME,headl,headn, entryl,entryn,UINPOPABORT,0,-1,-1,0,0,0,UINPOPABORT))!="" && netname!=UINPOPABORT) { // Check if valid tree index if (lay_findcontree(netname,net)!=0) { // Prompt user for continue if (asknetcontinue(netname+REPNONET,0,"")) // Abort request ? break; continue; } // Check if routing width attribute if (attnam==REPNRWIDTH) { tpn=spn=0; forall (pin of net) { tpn++; if (attval== bae_numstring(cvtlength(pin.RWIDTH,0,2),5)) spn++; } if (tpn!=spn) { sprintf(prompt,WRNWPINSET1+WRNWPINSET2,spn,tpn, netname,attval); bae_msgbox(0,prompt,""); } } // Highlight net ged_highlnet(net.NUMBER,1); answer=bae_peekiact()==2 ? askstr("",MAXKEYLEN) : "" ; // Zoom to signal zoomtonet(net); if (answer!="") bae_storetextiact(1,answer); // Prompt user for continue switch (asknetcontinue(net.NAME,1,"")) { // Abort with highlight case 1 : // Done return; // Return to previous net case 2 : break; // Fix net case 3 : // Dehighlight net ged_highlnet(net.NUMBER,0); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Fix traces and vias forall (fig where fig.GROUP && !fig.FIXED && (fig.TYP==L_FIGPATH || fig.TYP==L_FIGUREF)) { // Save current state for undo if (!chgflag) { bae_callmenu(MNU_BAESAVESTATE); chgflag=1; } ged_elemfixchg(fig,1); } // Reset the group bae_callmenu(MNU_GEDGRPRESE); break; // Unfix net case 4 : // Dehighlight net ged_highlnet(net.NUMBER,0); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Unfix traces and vias forall (fig where fig.GROUP && fig.FIXED && (fig.TYP==L_FIGPATH || fig.TYP==L_FIGUREF)) { // Save current state for undo if (!chgflag) { bae_callmenu(MNU_BAESAVESTATE); chgflag=1; } ged_elemfixchg(fig,0); } // Reset the group bae_callmenu(MNU_GEDGRPRESE); break; // Delete net case 5 : // Dehighlight net ged_highlnet(net.NUMBER,0); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Deselect non trace and via elements forall (fig where fig.GROUP && fig.TYP!=L_FIGPATH && fig.TYP!=L_FIGUREF) ged_elemgrpchg(fig,0); // Delete the group bae_callmenu(MNU_GEDDELGRP); break; // Set net trace width case 6 : // Get segment width ged_getpathwidth(width,0.0); if (askdist(width,lay_defusrunit()?UPRTRCWI: UPRTRCWM,0) || width==0.0) // Invalid input value error(ERRINPVAL); // Reset the group bae_callmenu(MNU_GEDGRPRESE); // Select net ged_groupselect(7,net.NUMBER,1); // Change trace width forall (fig where fig.GROUP && fig.TYP==L_FIGPATH) { // Save current state for undo if (!chgflag) { bae_callmenu(MNU_BAESAVESTATE); chgflag=1; } ged_elemsizechg(fig,width); } // Reset the group bae_callmenu(MNU_GEDGRPRESE); break; // Abort without highlight case (-1) : // Dehighlight net ged_highlnet(net.NUMBER,0); return; default : ; } // Dehighlight net ged_highlnet(net.NUMBER,0); } // Done } void zoomtonet(index L_CNET net) /* // Zoom to a signal specified by net number // Parameter : // index L_CNET net : Net index */ { #define WEL 0.001 // Window enlarge length string hlreq /* Highlight request net name */; string msg /* Message string */; int netnum = net.NUMBER /* Net number */; // Init boundaries out of range zoomlx=bae_planwsux()+10.0; zoomly=bae_planwsuy()+10.0; zoomux=bae_planwslx()-10.0; zoomuy=bae_planwsly()-10.0; // Set the current global net number curnetnum=netnum; // Scan the pins if (lay_scanall(0.0,0.0,0.0,0,1, pinscan,NULL,pathscan,NULL,NULL,NULL,NULL)) error_scan(); // Scan the unroutes if (lay_scanpool(net.UNRPOOL,0.0,0.0,0.0,0,0, NULL,NULL,upathscan,NULL,NULL,NULL,NULL)) error_scan(); // Abort if invalid zoom range if (zoomlx-WEL>zoomux || zoomly-WEL>zoomuy) return; // Zoom to calculated boundaries bae_clriactqueue(); bae_storemouseiact(1,zoomlx-WEL,zoomly-WEL,0,LMB); bae_storemouseiact(1,zoomux+WEL,zoomuy+WEL,0,LMB); call(MNU_BAEZOOMWND); if (varget(GV_HLREQUEST,hlreq)) hlreq=""; if (hlreq!=net.NAME) { // Build the highlight/zoom to net request message sprintf(msg,"%d %s",MSGID_NETZOOMHL,net.NAME); // Send the highlight/zoom to net request message bae_sendmsg(msg,1); } vardelete(GV_HLREQUEST); } int pinscan(index L_MACRO macro,index L_POOL pool, int macinws,string refname,index L_LEVEL level) /* // Pin macro scan function // Return value : // 0 if out of workspace, 1 if inside, 2 if unknown, or (-1) on error // Parameters : // index L_MACRO macro : Macro index // index L_POOL pool : Macro pool index // int macinws : Macro in workspace flag // string refname : Macro reference name // index L_LEVEL level : Macro level */ { double x,y /* Macro coordinates */; double a /* Macro rotation angle */; int m /* Macro mirror flag */; int l /* Macro layer number */; int stktree /* Padstack tree number */; // Continue scan for part macros if (macro.CLASS==DDBCLLPRT) return(1); // Test if padstack macro if (macro.CLASS==DDBCLLSTK) { // Get the padstack tree number from level if ((stktree=lay_getlevtreenum(level))<0) // Invalid level tree stktree=(-1); // Test if padstack matches current net number if (stktree==curnetnum) { // Get macro coordinates lay_maccoords(x,y,a,m,l); // Update the zoom range if (zoomlx>x) zoomlx=x; if (zoomuxy) zoomly=y; if (zoomuylx) zoomlx=lx; if (zoomuxly) zoomly=ly; if (zoomuypoint.X) zoomlx=point.X; if (zoomuxpoint.Y) zoomly=point.Y; if (zoomuy0) { if (maxviacnt>=0 && vcnt>maxviacnt) sprintf(headl[headn],REPVIASV,vcnt,maxviacnt); else sprintf(headl[headn],REPVIAS,vcnt); headn++; } if (tcnt>0) { sprintf(headl[headn],REPTRACES,tcnt); headn++; if (maxtrclen>=0.0 && tlen>maxtrclen) sprintf(headl[headn],REPLENGTHV, bae_numstring(baecvtl(tlen),3),UNIT, bae_numstring(baecvtl(maxtrclen),3),UNIT); else sprintf(headl[headn],REPLENGTH, bae_numstring(baecvtl(tlen),3),UNIT); headn++; if (mintrcwidth>=0.0 && minwstrlen(attr.NAME) ? ATTFLEN-strlen(attr.NAME) : 0, ITMUDOT,attr.VALUE); headn++; } if (!fullinfo) return; // Test if pins defined if (net.PINN) { // Init the output field widths lprt=strlen(ITMPRT); lpin=strlen(ITMPIN); lwid=strlen(ITMWIDTH+UNIT); // Update the output field widths forall (pin of net) { lprt=maxint(lprt,strlen(pin.CPART.NAME)); lpin=maxint(lpin,strlen(pin.NAME)); } // Build the pin list header headl[headn]=" "; sprintf(headl[headn+1],REPPINH1, lprt,ITMPRT,lpin,ITMPIN,lwid,ITMWIDTH+UNIT); sprintf(headl[headn+2],REPPINH2, lprt,ITMULINE,lpin,ITMULINE,lwid,ITMULINE); headn+=3; } // Build the pin list display pn=0; forall (pin of net) { sprintf(pl[pn],REPPIN,lprt,pin.CPART.NAME, lpin,pin.NAME,lwid,bae_numstring(baecvtl(pin.RWIDTH),4)); pn++; } // Display the net data via popup sprintf(msg,UPRNETDATA,net.NAME); bae_setintpar(16,3063); if (popupmenu(0,msg,headl,headn,pl,pn, "",0,1,1,headn+pn+2,0,0,"")==UINPOPABORT) error_abort(); headn=4; } double treepathlen( int treenum,int trccnt=0,int viacnt=0,double minwidth=0.0,double maxwidth=0.0) /* // Get tree path length function // Return value : // trace path length of given tree // Parameters : // int netmode : Net query mode // int treenum : Path tree number // int trccnt=0 : Trace count // int viacnt=0 : Via count // double minwidth=0.0 : Min. trace width // double maxwidth=0.0 : Max. trace width */ { index L_FIGURE fig /* Figure list index */; index L_UREF uref /* Unnamed reference (via) index */; index L_LINE path /* Path index */; index L_POINT p /* Point index */; double trclen = 0.0 /* Trace path length */; int pc /* Path point count */; double x1,y1 /* Previous coordinates */; int t1 /* Previous point type */; double x2,y2 /* Pre-previous coordinates */; int t2 /* Pre-previous point type */; int sc = 0 /* Segment count */; // Loop for all paths of selected tree forall (path where path.TREE==treenum) { // Update the trace length // Init the path point count pc=sc=0; // Loop for all path points forall (p of path) { // Increment the point counter pc++; // Get the segment length; update the trace length trclen+= segmentlen(pc,p.TYP,p.X,p.Y,t1,x1,y1,t2,x2,y2,sc); } // Update path width extrema if (trccnt==0) { minwidth=maxwidth=path.WIDTH; } else { if (minwidth>path.WIDTH) minwidth=path.WIDTH; if (maxwidthtrcminwidth) minwidth=trcminwidth; if (maxwidthpath.WIDTH) trcminwidth=path.WIDTH; if (trcmaxwidth=0 || curnetname=="" || lay_findcontree(curnetname,net)!=0) break; if (layer!=LAYERINV) layerfadein(layer,COLFIN,1); mousegrab(1); oldlaydefmode=ged_getlaydefmode(); bae_clriactqueue(); bae_storetextiact(1,curnetname); if (layer!=LAYERINV && layer=0 || curnetname=="" || lay_findcontree(curnetname,net)!=0) break; if (layer!=LAYERINV) layerfadein(layer,COLFIN,1); mousegrab(1); oldlaydefmode=ged_getlaydefmode(); bae_clriactqueue(); bae_storetextiact(1,curnetname); if (layer!=LAYERINV && layer>16; selcol&=0x0F; if (selpat || selcol==0) for (i=0;iUPRSELATTR) { bae_dialaddcontrol(PA_LBE,0,0,0,0.0,0.0,0.0,"",0, 0.0,0.0,0.0,UPRSELATTR); attdisp=1; } bae_dialaddcontrol(PA_LBE,0,0,0,0.0,0.0,0.0,"",0, 0.0,0.0,0.0,curnetname); if (maxnetpin=curnetpn ? 1 : 0); // Maximum pin count case 6 : return(cnet.PINN<=curnetpn ? 1 : 0); // Part match case 7 : forall (pin of cnet) if (pin.CPART.NAME==curattrname) return(1); break; // Name (pattern) match case 0 : default : return(strmatch(cnet.NAME,curnetname)); } // No match return(0); } // User interaction routines int asknetcontinue(string netname,int highlflag,string answer) /* // Prompt for continue // Return value : // zero if ok, (-1) on abort request // Parameters : // string netname : Net name // int highlflag : Highlight flag // string answer : Answer string */ { // Prompt for continue bae_setmousetext(""); answer=bae_readtext( REPNET+netname+(highlflag ? UPRCONTY : UPRCONTX),MAXKEYLEN); strlower(answer); // Check for abort command if (answer==UINPOPABORT || answer==UINSTOP) { answer=""; // User abort request return(-1); } else if (highlflag) { switch (answer) { case UINHIGHL : answer=""; // User abort with highlight request return(1); case UINPREV : answer=""; // Skip to previous net return(2); case UINFIX : answer=""; // Fix the net traces return(3); case UINUNFIX : answer=""; // Unfix the net traces return(4); case UINDELETE : answer=""; // Delete the net traces return(5); case UINSIZE : answer=""; // Set trace width return(6); case UINFUNC : answer=""; // Select net manipulation function bae_promptdialog(UPRFCT); switch (bae_askmenu(8,UPRNFCT1,UPRNFCT2,UPRNFCT3, UPRNFCT4,UPRNFCT5,UPRNFCT6,UPRNFCT7,UPRABORT)) { // Abort case 0 : return(-1); // Abort with highlight case 1 : return(1); // Fix traces case 2 : return(3); // Unfix traces case 3 : return(4); // Delete traces case 4 : return(5); // Set trace width case 5 : return(6); // Skip to previous net case 6 : return(2); default : return(-1); } } } return(0); } int gcname(string name) /* // Get or create a name list entry // Return value : // entry index // Parameters : // string name : Name */ { int slb = 0 /* Search lower boundary */; int sub = entryn-1 /* Search upper boundary */; int sidx /* Search index */; int compres /* Compare result */; // Loop until search area empty while (slb<=sub) { // Get the search index sidx=(slb+sub)>>1; // Get the comparison result if ((compres=strcmp(name,entryl[sidx]))==0) // Name found return(sidx); // Update the search area if (compres<0) sub=sidx-1; else slb=sidx+1; } // Update the name list for (sidx=entryn;sidx>slb;sidx--) entryl[sidx]=entryl[sidx-1]; // Insert name entryl[slb]=name; entryn++; // Return sheet index return(slb); } double atof_len(string val) /* Convert a string to length value with unit evaluation */ /* // string val : Value string */ { string convbuf /* Conversion buffer */; double mulfac /* Multiplication factor */; int sidx /* Source string index */; int didx /* Destination string index */; char c /* Scan character */; char c1, c2, c3, c4 /* Last scan character */; // Init. the scan variables sidx=didx=0; // Skip leading blanks/tabs while (val[sidx]!='\0' && (val[sidx]==' ' || val[sidx]=='\t')) sidx++; // Copy the number chars. while ((c=val[sidx])!='\0') { // Convert colons to dots if (c==',') c='.'; // Store the char. to the conv. buffer convbuf[didx++]=c; // Update the source char. index sidx++; } // Terminate the conversion buffer string convbuf[didx]='\0'; // Skip trailing blanks/tabs while (didx>0 && ((c=val[didx-1])==' ' || c=='\t')) didx--; // Get last (unit) characters c4= didx>=4 ? tolower(val[didx-4]) : '\0' ; c3= didx>=3 ? tolower(val[didx-3]) : '\0' ; c2= didx>=2 ? tolower(val[didx-2]) : '\0' ; c1= didx>=1 ? tolower(val[didx-1]) : '\0' ; // Get the units conversion factor if ((c4=='i' && c3=='n' && c2=='c' && c1=='h') || c1=='"' || c1=='\'') mulfac=25.4; else if (c3=='m' && c2=='i' && c1=='l') mulfac=0.0254; else if ((c2=='u' || c2=='\350' || c2=='\265') && c1=='m') mulfac=0.001; else mulfac=1.0; // Return the converted value return(cvtlength(mulfac*atof(convbuf),2,0)); } // User Language program end