📄 libtotech.java
字号:
// get general information from the "factors" cell Cell np = null; for(int i=dependentLibs.length-1; i>=0; i--) { np = dependentLibs[i].findNodeProto("factors"); if (np != null) break; } if (np == null) { error.markError(null, null, "Cell with general information, called 'factors', is missing"); return null; } GeneralInfo gi = parseCell(np); // get layer information LayerInfo [] lList = extractLayers(dependentLibs); if (lList == null) return null; // get arc information ArcInfo [] aList = extractArcs(dependentLibs, lList); if (aList == null) return null; // get node information NodeInfo [] nList = extractNodes(dependentLibs, lList, aList); if (nList == null) return null; for(NodeInfo ni: nList) ni.arcsShrink = ni.func == PrimitiveNode.Function.PIN && !ni.wipes; // create the pure-layer associations for(int i=0; i<lList.length; i++) { if (lList[i].pseudo) continue; // find the pure layer node for(int j=0; j<nList.length; j++) { if (nList[j].func != PrimitiveNode.Function.NODE) continue; NodeInfo.LayerDetails nld = nList[j].nodeLayers[0]; if (nld.layer == lList[i]) { lList[i].pureLayerNode = nList[j]; break; } } } // add the component menu information if available Variable var = Library.getCurrent().getVar(Info.COMPMENU_KEY); if (var != null) { String compMenuXML = (String)var.getObject(); List<Xml.PrimitiveNode> nodes = new ArrayList<Xml.PrimitiveNode>(); for(int i=0; i<nList.length; i++) { Xml.PrimitiveNode xnp = new Xml.PrimitiveNode(); xnp.name = nList[i].name; xnp.function = nList[i].func; nodes.add(xnp); } List<Xml.ArcProto> arcs = new ArrayList<Xml.ArcProto>(); for(int i=0; i<aList.length; i++) { Xml.ArcProto xap = new Xml.ArcProto(); xap.name = aList[i].name; arcs.add(xap); } Xml.MenuPalette xmp = Xml.parseComponentMenuXMLTechEdit(compMenuXML, nodes, arcs); int menuWid = xmp.numColumns; int menuHei = xmp.menuBoxes.size() / menuWid; gi.menuPalette = new Object[menuHei][menuWid]; int i = 0; for(int y=0; y<menuHei; y++) { for(int x=0; x<menuWid; x++) { List<Object> items = xmp.menuBoxes.get(i++); Object item = null; if (items.size() == 1) { item = items.get(0); } else if (items.size() > 1) { List<Object> convItems = new ArrayList<Object>(); for(Object obj : items) { if (obj != null) convItems.add(obj); } if (convItems.size() > 0) item = convItems; } gi.menuPalette[y][x] = item; } } } Xml.Technology t = makeXml(newTechName, gi, lList, nList, aList); if (fileName != null) t.writeXml(fileName); Technology tech = new Technology(lib.getGeneric(), t); tech.setup(lib.getDatabase()); // switch to this technology System.out.println("Technology " + tech.getTechName() + " built."); WindowFrame.updateTechnologyLists(); return tech; }// private void checkAndWarn(LayerInfo [] lList, ArcInfo [] aList, NodeInfo [] nList)// {// // make sure there is a pure-layer node for every nonpseudo layer// for(int i=0; i<lList.length; i++)// {// if (lList[i].pseudo) continue;// boolean found = false;// for(int j=0; j<nList.length; j++)// {// NodeInfo nIn = nList[j];// if (nIn.func != PrimitiveNode.Function.NODE) continue;// if (nIn.nodeLayers[0].layer == lList[i])// {// found = true;// break;// }// }// if (found) continue;// System.out.println("Warning: Layer " + lList[i].name + " has no associated pure-layer node");// }//// // make sure there is a pin for every arc and that it uses pseudo-layers// for(int i=0; i<aList.length; i++)// {// // find that arc's pin// boolean found = false;// for(int j=0; j<nList.length; j++)// {// NodeInfo nIn = nList[j];// if (nIn.func != PrimitiveNode.Function.PIN) continue;//// for(int k=0; k<nIn.nodePortDetails.length; k++)// {// ArcInfo [] connections = nIn.nodePortDetails[k].connections;// for(int l=0; l<connections.length; l++)// {// if (connections[l] == aList[i])// {// // pin found: make sure it uses pseudo-layers// boolean allPseudo = true;// for(int m=0; m<nIn.nodeLayers.length; m++)// {// LayerInfo lin = nIn.nodeLayers[m].layer;// if (!lin.pseudo) { allPseudo = false; break; }// }// if (!allPseudo)// System.out.println("Warning: Pin " + nIn.name + " is not composed of pseudo-layers");//// found = true;// break;// }// }// if (found) break;// }// if (found) break;// }// if (!found)// System.out.println("Warning: Arc " + aList[i].name + " has no associated pin node");// }// } /** * Method to parse the miscellaneous-info cell in "np" and return a GeneralInfo object that describes it. */ private GeneralInfo parseCell(Cell np) { // create and initialize the GRAPHICS structure GeneralInfo gi = new GeneralInfo(); for(Iterator<NodeInst> it = np.getNodes(); it.hasNext(); ) { NodeInst ni = it.next(); int opt = Manipulate.getOptionOnNode(ni); String str = Info.getValueOnNode(ni); switch (opt) { case Info.TECHSHORTNAME: gi.shortName = str; break; case Info.TECHSCALE: gi.scale = TextUtils.atof(str); gi.scaleRelevant = true; break; case Info.TECHFOUNDRY: gi.defaultFoundry = str; break; case Info.TECHDEFMETALS: gi.defaultNumMetals = TextUtils.atoi(str); break; case Info.TECHDESCRIPT: gi.description = str; break; case Info.TECHSPICEMINRES: gi.minRes = TextUtils.atof(str); break; case Info.TECHSPICEMINCAP: gi.minCap = TextUtils.atof(str); break; case Info.TECHMAXSERIESRES: gi.maxSeriesResistance = TextUtils.atof(str); break; case Info.TECHGATESHRINK: gi.gateShrinkage = TextUtils.atof(str); break; case Info.TECHGATEINCLUDED: gi.includeGateInResistance = str.equalsIgnoreCase("yes"); break; case Info.TECHGROUNDINCLUDED: gi.includeGround = str.equalsIgnoreCase("yes"); break; case Info.TECHTRANSPCOLORS: Color [] colors = GeneralInfo.getTransparentColors(ni); if (colors != null) gi.transparentColors = colors; break; case Info.CENTEROBJ: break; default: error.markError(ni, np, "Unknown node in miscellaneous-information cell"); break; } } return gi; } /************************************* LAYER ANALYSIS *************************************/ /** * Method to scan the "dependentlibcount" libraries in "dependentLibs", * and build the layer structures for it in technology "tech". Returns true on error. */ private LayerInfo [] extractLayers(Library [] dependentLibs) { // first find the number of layers Cell [] layerCells = Info.findCellSequence(dependentLibs, "layer-", Info.LAYERSEQUENCE_KEY); if (layerCells.length <= 0) { System.out.println("No layers found"); return null; } // create the layers LayerInfo [] lis = new LayerInfo[layerCells.length]; for(int i=0; i<layerCells.length; i++) { lis[i] = LayerInfo.parseCell(layerCells[i]); if (lis[i] == null) { error.markError(null, layerCells[i], "Error parsing layer information"); continue; } }// // get the design rules// drcsize = us_teclayer_count*us_teclayer_count/2 + (us_teclayer_count+1)/2;// us_tecedgetlayernamelist();// if (us_tecdrc_rules != 0)// {// dr_freerules(us_tecdrc_rules);// us_tecdrc_rules = 0;// }// nodecount = Info.findCellSequence(dependentLibs, "node-", Generate.NODERSEQUENCE_KEY);// us_tecdrc_rules = dr_allocaterules(us_teceddrclayers, nodecount, x_("EDITED TECHNOLOGY"));// if (us_tecdrc_rules == NODRCRULES) return(TRUE);// for(i=0; i<us_teceddrclayers; i++)// (void)allocstring(&us_tecdrc_rules.layernames[i], us_teceddrclayernames[i], el_tempcluster);// for(i=0; i<nodecount; i++)// (void)allocstring(&us_tecdrc_rules.nodenames[i], &nodesequence[i].protoname[5], el_tempcluster);// if (nodecount > 0) efree((CHAR *)nodesequence);// var = NOVARIABLE;// for(i=dependentlibcount-1; i>=0; i--)// {// var = getval((INTBIG)dependentLibs[i], VLIBRARY, VSTRING|VISARRAY, x_("EDTEC_DRC"));// if (var != NOVARIABLE) break;// }// us_teceditgetdrcarrays(var, us_tecdrc_rules);// // see which design rules exist// for(i=0; i<us_teceddrclayers; i++)// {// if (us_tecdrc_rules.minwidth[i] >= 0) us_tecflags |= HASDRCMINWID;// if (*us_tecdrc_rules.minwidthR[i] != 0) us_tecflags |= HASDRCMINWIDR;// }// for(i=0; i<drcsize; i++)// {// if (us_tecdrc_rules.conlist[i] >= 0) us_tecflags |= HASCONDRC;// if (*us_tecdrc_rules.conlistR[i] != 0) us_tecflags |= HASCONDRCR;// if (us_tecdrc_rules.unconlist[i] >= 0) us_tecflags |= HASUNCONDRC;// if (*us_tecdrc_rules.unconlistR[i] != 0) us_tecflags |= HASUNCONDRCR;// if (us_tecdrc_rules.conlistW[i] >= 0) us_tecflags |= HASCONDRCW;// if (*us_tecdrc_rules.conlistWR[i] != 0) us_tecflags |= HASCONDRCWR;// if (us_tecdrc_rules.unconlistW[i] >= 0) us_tecflags |= HASUNCONDRCW;// if (*us_tecdrc_rules.unconlistWR[i] != 0) us_tecflags |= HASUNCONDRCWR;// if (us_tecdrc_rules.conlistM[i] >= 0) us_tecflags |= HASCONDRCM;// if (*us_tecdrc_rules.conlistMR[i] != 0) us_tecflags |= HASCONDRCMR;// if (us_tecdrc_rules.unconlistM[i] >= 0) us_tecflags |= HASUNCONDRCM;// if (*us_tecdrc_rules.unconlistMR[i] != 0) us_tecflags |= HASUNCONDRCMR;// if (us_tecdrc_rules.edgelist[i] >= 0) us_tecflags |= HASEDGEDRC;// if (*us_tecdrc_rules.edgelistR[i] != 0) us_tecflags |= HASEDGEDRCR;// }// for(i=0; i<us_tecdrc_rules.numnodes; i++)// {// if (us_tecdrc_rules.minnodesize[i*2] > 0 ||// us_tecdrc_rules.minnodesize[i*2+1] > 0) us_tecflags |= HASMINNODE;// if (*us_tecdrc_rules.minnodesizeR[i] != 0) us_tecflags |= HASMINNODER;// }// // store this information on the technology object// if ((us_tecflags&(HASCONDRCW|HASUNCONDRCW)) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_wide_limitkey, us_tecdrc_rules.widelimit,// VFRACT|VDONTSAVE);// if ((us_tecflags&HASDRCMINWID) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_min_widthkey, (INTBIG)us_tecdrc_rules.minwidth,// VFRACT|VDONTSAVE|VISARRAY|(tech.layercount<<VLENGTHSH));// if ((us_tecflags&HASDRCMINWIDR) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_min_width_rulekey, (INTBIG)us_tecdrc_rules.minwidthR,// VSTRING|VDONTSAVE|VISARRAY|(tech.layercount<<VLENGTHSH));// if ((us_tecflags&HASCONDRC) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_connected_distanceskey,// (INTBIG)us_tecdrc_rules.conlist, VFRACT|VDONTSAVE|VISARRAY|(drcsize<<VLENGTHSH));// if ((us_tecflags&HASCONDRCR) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_connected_distances_rulekey,// (INTBIG)us_tecdrc_rules.conlistR, VSTRING|VDONTSAVE|VISARRAY|(drcsize<<VLENGTHSH));// if ((us_tecflags&HASUNCONDRC) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_unconnected_distanceskey,// (INTBIG)us_tecdrc_rules.unconlist, VFRACT|VDONTSAVE|VISARRAY|(drcsize<<VLENGTHSH));// if ((us_tecflags&HASUNCONDRCR) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_unconnected_distances_rulekey,// (INTBIG)us_tecdrc_rules.unconlistR, VSTRING|VDONTSAVE|VISARRAY|(drcsize<<VLENGTHSH));// if ((us_tecflags&HASCONDRCW) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_connected_distancesWkey,// (INTBIG)us_tecdrc_rules.conlistW, VFRACT|VDONTSAVE|VISARRAY|(drcsize<<VLENGTHSH));// if ((us_tecflags&HASCONDRCWR) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_connected_distancesW_rulekey,// (INTBIG)us_tecdrc_rules.conlistWR, VSTRING|VDONTSAVE|VISARRAY|(drcsize<<VLENGTHSH));// if ((us_tecflags&HASUNCONDRCW) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_unconnected_distancesWkey,// (INTBIG)us_tecdrc_rules.unconlistW, VFRACT|VDONTSAVE|VISARRAY|(drcsize<<VLENGTHSH));// if ((us_tecflags&HASUNCONDRCWR) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_unconnected_distancesW_rulekey,// (INTBIG)us_tecdrc_rules.unconlistWR, VSTRING|VDONTSAVE|VISARRAY|(drcsize<<VLENGTHSH));// if ((us_tecflags&HASCONDRCM) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_connected_distancesMkey,// (INTBIG)us_tecdrc_rules.conlistM, VFRACT|VDONTSAVE|VISARRAY|(drcsize<<VLENGTHSH));// if ((us_tecflags&HASCONDRCMR) != 0)// (void)setvalkey((INTBIG)tech, VTECHNOLOGY, dr_connected_distancesM_rulekey,// (INTBIG)us_tecdrc_rules.conlistMR, VSTRING|VDONTSAVE|VISARRAY|(drcsize<<VLENGTHSH));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -