diff --git a/.gitignore b/.gitignore index 18ea638f..f6595db9 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ tcltk/ext2sim.sh magic/tclmagic.dylib tcltk/magicdnull.dSYM/ tcltk/magicexec.dSYM/ +reconfigure.sh diff --git a/VERSION b/VERSION index 45f4fa96..3d7c223d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.270 +8.3.271 diff --git a/database/DBcellcopy.c b/database/DBcellcopy.c index 0e90fefd..9f685e8b 100644 --- a/database/DBcellcopy.c +++ b/database/DBcellcopy.c @@ -396,7 +396,7 @@ DBCellGenerateSubstrate(scx, subType, notSubMask, subShieldMask, targetDef) Plane *tempPlane; int plane; Rect rect; - TileTypeBitMask subMask; + TileTypeBitMask allButSubMask; int dbEraseSubFunc(); int dbPaintSubFunc(); int dbEraseNonSub(); @@ -417,14 +417,7 @@ DBCellGenerateSubstrate(scx, subType, notSubMask, subShieldMask, targetDef) csd.csd_pNum = plane; csd.csd_modified = FALSE; - /* First erase the default substrate type everywhere. The substrate */ - /* type is, effectively, only a marker or visual reference. It has */ - /* no use and makes it harder to determine what is the global */ - /* substrate area. */ - TTMaskSetOnlyType(&subMask, subType); - DBTreeSrTiles(scx, &subMask, 0, dbEraseSubFunc, (ClientData)&csd); - - /* Now paint the substrate type in the temporary plane over the */ + /* First paint the substrate type in the temporary plane over the */ /* area of all substrate shield types. */ /* Note: xMask is always zero, as this is only called from extract routines */ DBTreeSrTiles(scx, subShieldMask, 0, dbPaintSubFunc, (ClientData)&csd); @@ -433,10 +426,17 @@ DBCellGenerateSubstrate(scx, subType, notSubMask, subShieldMask, targetDef) /* Now erase all areas that are non-substrate types in the source */ DBTreeSrTiles(scx, notSubMask, 0, dbEraseNonSub, (ClientData)&csd); - /* Finally, copy the destination plane contents onto tempPlane */ + /* Finally, copy the destination plane contents onto tempPlane, */ + /* ignoring the substrate type. */ + TTMaskZero(&allButSubMask); + TTMaskSetMask(&allButSubMask, &DBAllButSpaceBits); + TTMaskClearType(&allButSubMask, subType); DBSrPaintArea((Tile *)NULL, targetDef->cd_planes[plane], &TiPlaneRect, - &DBAllButSpaceBits, dbCopySubFunc, (ClientData)&csd); + &allButSubMask, dbCopySubFunc, (ClientData)&csd); + /* Now we have a plane where the substrate type has a strict */ + /* definition that it always marks areas of isolated substrate but */ + /* never areas of default substrate. Return this plane. */ return tempPlane; } diff --git a/extcheck/extcheck.c b/extcheck/extcheck.c index 58f4c2c5..ed0f66ee 100644 --- a/extcheck/extcheck.c +++ b/extcheck/extcheck.c @@ -89,7 +89,7 @@ main(argc, argv) EFVisitNodes(nodeVisit, (ClientData) NULL); #ifdef free_all_mem - EFFlatDone(); + EFFlatDone(NULL); EFDone(); #endif /* free_all_mem */ diff --git a/extflat/EFantenna.c b/extflat/EFantenna.c index 63d94493..dc127cfa 100644 --- a/extflat/EFantenna.c +++ b/extflat/EFantenna.c @@ -249,7 +249,7 @@ runantennacheck: efGates = 0; TxPrintf("Running antenna checks.\n"); EFVisitDevs(antennacheckVisit, (ClientData)editUse); - EFFlatDone(); + EFFlatDone(NULL); EFDone(); TxPrintf("antennacheck finished.\n"); diff --git a/extract/ExtCell.c b/extract/ExtCell.c index 14b9faa0..4335c937 100644 --- a/extract/ExtCell.c +++ b/extract/ExtCell.c @@ -277,19 +277,13 @@ extPrepSubstrate(def) /* substrate. If there is not a simple type representing the substrate */ /* then do not attempt to resolve substrate regions. */ + if ((subType = ExtCurStyle->exts_globSubstrateDefaultType) == -1) return NULL; + TTMaskZero(&subMask); TTMaskSetMask(&subMask, &ExtCurStyle->exts_globSubstrateTypes); - - for (subType = TT_TECHDEPBASE; subType < DBNumUserLayers; subType++) - if (TTMaskHasType(&subMask, subType)) - if (DBPlane(subType) == ExtCurStyle->exts_globSubstratePlane) - break; - TTMaskCom2(¬SubMask, &subMask); TTMaskAndMask(¬SubMask, &DBPlaneTypes[ExtCurStyle->exts_globSubstratePlane]); - if (subType == DBNumUserLayers) return NULL; - /* Generate the full flattened substrate into ha->ha_cumFlat (which */ /* was empty initially). This adds layer geometry for the */ /* substrate in the typical case where the substrate may be space */ diff --git a/extract/ExtCouple.c b/extract/ExtCouple.c index dea2d9c2..3d681b39 100644 --- a/extract/ExtCouple.c +++ b/extract/ExtCouple.c @@ -420,6 +420,7 @@ extAddOverlap(tbelow, ecpls) /* Quick check on validity of tile's ti_client record */ if (rbelow == (NodeRegion *)CLIENTDEFAULT) return 0; + if (rabove == (NodeRegion *)CLIENTDEFAULT) return 0; /* Compute the area of overlap */ ov.o_clip.r_xbot = MAX(LEFT(tbelow), LEFT(tabove)); @@ -908,10 +909,20 @@ extSideOverlap(tp, esws) /* If the nodes are electrically connected, then we don't add */ /* any side overlap capacitance to the node. */ - if (rtp == rbp) return (0); + if (rtp == rbp) return 0; + if (rtp == (NodeRegion *)CLIENTDEFAULT) return 0; + if (rbp == (NodeRegion *)CLIENTDEFAULT) return 0; - if (rtp < rbp) ck.ck_1 = rtp, ck.ck_2 = rbp; - else ck.ck_1 = rbp, ck.ck_2 = rtp; + if (rtp < rbp) + { + ck.ck_1 = rtp; + ck.ck_2 = rbp; + } + else + { + ck.ck_1 = rbp; + ck.ck_2 = rtp; + } he = HashFind(extCoupleHashPtr, (char *) &ck); if (CAP_DEBUG) extAdjustCouple(he, cap, "sideoverlap"); extSetCapValue(he, cap + extGetCapValue(he)); diff --git a/extract/ExtRegion.c b/extract/ExtRegion.c index 798c69b8..68e4858f 100644 --- a/extract/ExtRegion.c +++ b/extract/ExtRegion.c @@ -208,6 +208,7 @@ ExtLabelRegions(def, connTo, nodeList, clipArea) int quad, pNum; Point p; bool found; + TileType extSubType = 0; for (lab = def->cd_labels; lab; lab = lab->lab_next) { @@ -263,32 +264,56 @@ ExtLabelRegions(def, connTo, nodeList, clipArea) GEO_TOUCH(&lab->lab_rect, clipArea)) && (lab->lab_type != TT_SPACE)) { - NodeRegion *newNode; - int n; - int nclasses = ExtCurStyle->exts_numResistClasses; + /* If the label is the substrate type and is over */ + /* space, then assign the label to the default */ + /* substrate region. */ - n = sizeof (NodeRegion) + (sizeof (PerimArea) * (nclasses - 1)); - newNode = (NodeRegion *)mallocMagic((unsigned) n); - - ll = (LabelList *)mallocMagic(sizeof(LabelList)); - ll->ll_label = lab; - ll->ll_next = NULL; - if (lab->lab_flags & PORT_DIR_MASK) - ll->ll_attr = LL_PORTATTR; + if ((pNum == ExtCurStyle->exts_globSubstratePlane) && + TTMaskHasType(&ExtCurStyle->exts_globSubstrateTypes, + lab->lab_type)) + { + if (glob_subsnode != NULL) + { + ll = (LabelList *)mallocMagic(sizeof(LabelList)); + ll->ll_label = lab; + if (lab->lab_flags & PORT_DIR_MASK) + ll->ll_attr = LL_PORTATTR; + else + ll->ll_attr = LL_NOATTR; + ll->ll_next = glob_subsnode->nreg_labels; + glob_subsnode->nreg_labels = ll; + } + } else - ll->ll_attr = LL_NOATTR; + { + NodeRegion *newNode; + int n; + int nclasses; - newNode->nreg_next = *nodeList; - newNode->nreg_pnum = pNum; - newNode->nreg_type = lab->lab_type; - newNode->nreg_ll = lab->lab_rect.r_ll; - newNode->nreg_cap = (CapValue)0; - newNode->nreg_resist = 0; - for (n = 0; n < nclasses; n++) - newNode->nreg_pa[n].pa_perim = newNode->nreg_pa[n].pa_area = 0; - newNode->nreg_labels = ll; + nclasses = ExtCurStyle->exts_numResistClasses; + n = sizeof (NodeRegion) + (sizeof (PerimArea) * (nclasses - 1)); + newNode = (NodeRegion *)mallocMagic((unsigned) n); - *nodeList = newNode; + ll = (LabelList *)mallocMagic(sizeof(LabelList)); + ll->ll_label = lab; + ll->ll_next = NULL; + if (lab->lab_flags & PORT_DIR_MASK) + ll->ll_attr = LL_PORTATTR; + else + ll->ll_attr = LL_NOATTR; + + newNode->nreg_next = *nodeList; + newNode->nreg_pnum = pNum; + newNode->nreg_type = lab->lab_type; + newNode->nreg_ll = lab->lab_rect.r_ll; + newNode->nreg_cap = (CapValue)0; + newNode->nreg_resist = 0; + for (n = 0; n < nclasses; n++) + newNode->nreg_pa[n].pa_perim = newNode->nreg_pa[n].pa_area = 0; + newNode->nreg_labels = ll; + + *nodeList = newNode; + } } } } diff --git a/extract/ExtTech.c b/extract/ExtTech.c index 6f1e263c..f533198c 100644 --- a/extract/ExtTech.c +++ b/extract/ExtTech.c @@ -747,7 +747,7 @@ extTechStyleInit(style) style->exts_sheetResist[r] = 0; style->exts_cornerChop[r] = 1.0; - style->exts_viaResist[r] = 0; + style->exts_viaResist[r] = (ResValue) 0; style->exts_height[r] = 0.0; style->exts_thick[r] = 0.0; style->exts_areaCap[r] = (CapValue) 0; @@ -826,7 +826,7 @@ extTechStyleInit(style) style->exts_antennaRatio[r].ratioGate = 0.0; style->exts_antennaRatio[r].ratioDiffA = 0.0; style->exts_antennaRatio[r].ratioDiffB = 0.0; - style->exts_resistByResistClass[r] = 0; + style->exts_resistByResistClass[r] = (ResValue) 0; TTMaskZero(&style->exts_typesByResistClass[r]); style->exts_typesResistChanged[r] = DBAllButSpaceAndDRCBits; TTMaskSetType(&style->exts_typesResistChanged[r], TT_SPACE); @@ -841,6 +841,7 @@ extTechStyleInit(style) // the techfile. style->exts_globSubstratePlane = -1; + style->exts_globSubstrateDefaultType = -1; TTMaskZero(&style->exts_globSubstrateTypes); TTMaskZero(&style->exts_globSubstrateShieldTypes); style->exts_globSubstrateName = (char *)NULL; @@ -906,6 +907,33 @@ aToCap(str) return capVal; } +/* + * ---------------------------------------------------------------------------- + * + * aToRes -- + * + * Utility procedure for reading resistance values. + * + * Returns: + * A value of type ResValue. + * + * Side effects: + * none. + * ---------------------------------------------------------------------------- + */ + +ResValue +aToRes(str) + char *str; +{ + ResValue resVal; + if (sscanf(str, "%d", &resVal) != 1) { + resVal = (ResValue) 0; + TechError("Resistance value %s must be a number\n", str); + } + return resVal; +} + /* * ---------------------------------------------------------------------------- * @@ -1048,7 +1076,7 @@ ExtTechSimpleAreaCap(argc, argv) capVal = aToCap(argv[argc - 1]); if (argc == 4) - plane2 = -1; + plane2 = ExtCurStyle->exts_globSubstratePlane; else plane2 = DBTechNoisyNamePlane(argv[argc - 2]); @@ -1098,12 +1126,37 @@ ExtTechSimpleAreaCap(argc, argv) } } - /* Defaults from the "substrate" line */ - TTMaskSetMask(&subtypes, &ExtCurStyle->exts_globSubstrateTypes); - TTMaskClearMask(&subtypes, &ExtCurStyle->exts_globSubstrateShieldTypes); - TTMaskClearType(&subtypes, TT_SPACE); - TTMaskSetMask(&shields, &ExtCurStyle->exts_globSubstrateShieldTypes); - TTMaskClearMask(&shields, &ExtCurStyle->exts_globSubstrateTypes); + /* Defaults from the "substrate" line, if used, and if the arguments */ + /* do not specify the plane and shielding types. */ + + if ((ExtCurStyle->exts_globSubstratePlane != -1) && (argc == 4)) + { + TTMaskSetMask(&subtypes, &ExtCurStyle->exts_globSubstrateTypes); + TTMaskClearMask(&subtypes, &ExtCurStyle->exts_globSubstrateShieldTypes); + TTMaskClearType(&subtypes, TT_SPACE); + + /* If the substrate type is used for isolated substrate regions, */ + /* then the substrate plane is also a shielding plane, and the */ + /* default substrate type is a shielding type. */ + + if (ExtCurStyle->exts_globSubstrateDefaultType != -1) + { + pshield |= PlaneNumToMaskBit(ExtCurStyle->exts_globSubstratePlane); + + /* The substrate default type now marks isolated regions */ + /* and so is not itself a substrate type. */ + + TTMaskClearType(&subtypes, ExtCurStyle->exts_globSubstrateDefaultType); + + /* All types on the substrate plane that are not substrate */ + /* are by definition shielding types. */ + + for (t = TT_TECHDEPBASE; t < DBNumTypes; t++) + if (DBPlane(t) == ExtCurStyle->exts_globSubstratePlane) + if (!TTMaskHasType(&ExtCurStyle->exts_globSubstrateTypes, t)) + TTMaskSetType(&shields, t); + } + } /* Now record all of the overlap capacitances */ @@ -1116,7 +1169,8 @@ ExtTechSimpleAreaCap(argc, argv) for (t = TT_TECHDEPBASE; t < DBNumTypes; t++) { - if (!TTMaskHasType(&subtypes, t)) continue; + if (!TTMaskHasType(&subtypes, t)) + continue; if (s == t) continue; /* shouldn't happen */ if (ExtCurStyle->exts_overlapCap[s][t] > (CapValue) 0) @@ -1196,12 +1250,12 @@ ExtTechSimplePerimCap(argc, argv) capVal = aToCap(argv[argc - 1]); - if (argc >= 4) - plane2 = DBTechNoisyNamePlane(argv[argc - 2]); + if (argc == 4) + plane2 = ExtCurStyle->exts_globSubstratePlane; else - plane2 = -1; + plane2 = DBTechNoisyNamePlane(argv[argc - 2]); - if (argc > 5) + if (argc > 4) { DBTechNoisyNameMask(argv[argc - 3], &subtypes); TTMaskSetMask(allExtractTypes, &subtypes); @@ -1252,12 +1306,37 @@ ExtTechSimplePerimCap(argc, argv) TTMaskClearType(&subtypes, TT_SPACE); } - /* Defaults from the "substrate" line */ - TTMaskSetMask(&subtypes, &ExtCurStyle->exts_globSubstrateTypes); - TTMaskClearMask(&subtypes, &ExtCurStyle->exts_globSubstrateShieldTypes); - TTMaskClearType(&subtypes, TT_SPACE); - TTMaskSetMask(&shields, &ExtCurStyle->exts_globSubstrateShieldTypes); - TTMaskClearMask(&shields, &ExtCurStyle->exts_globSubstrateTypes); + /* Defaults from the "substrate" line, if used, and if the arguments */ + /* do not specify the plane and shielding types. */ + + if ((ExtCurStyle->exts_globSubstratePlane != -1) && (argc == 4)) + { + TTMaskSetMask(&subtypes, &ExtCurStyle->exts_globSubstrateTypes); + TTMaskClearMask(&subtypes, &ExtCurStyle->exts_globSubstrateShieldTypes); + TTMaskClearType(&subtypes, TT_SPACE); + + /* If the substrate type is used for isolated substrate regions, */ + /* then the substrate plane is also a shielding plane, and the */ + /* default substrate type is a shielding type. */ + + if (ExtCurStyle->exts_globSubstrateDefaultType != -1) + { + pshield |= PlaneNumToMaskBit(ExtCurStyle->exts_globSubstratePlane); + + /* The substrate default type now marks isolated regions */ + /* and so is not itself a substrate type. */ + + TTMaskClearType(&subtypes, ExtCurStyle->exts_globSubstrateDefaultType); + + /* All types on the substrate plane that are not substrate */ + /* are by definition shielding types. */ + + for (t = TT_TECHDEPBASE; t < DBNumTypes; t++) + if (DBPlane(t) == ExtCurStyle->exts_globSubstratePlane) + if (!TTMaskHasType(&ExtCurStyle->exts_globSubstrateTypes, t)) + TTMaskSetType(&shields, t); + } + } /* Record all of the sideoverlap capacitances */ @@ -1273,7 +1352,9 @@ ExtTechSimplePerimCap(argc, argv) TTMaskSetMask(&ExtCurStyle->exts_sideEdges[s], ¬types); for (t = 0; t < DBNumTypes; t++) { - if (!TTMaskHasType(¬types, t)) continue; + if (!TTMaskHasType(¬types, t)) + continue; + if (DBIsContact(t)) continue; TTMaskSetMask(&ExtCurStyle->exts_sideOverlapOtherTypes[s][t], &subtypes); @@ -1771,6 +1852,7 @@ ExtTechLine(sectionName, argc, argv) int n, l, i, j, size, val, p1, p2, p3, nterm, iterm, class; PlaneMask pshield, pov; CapValue capVal, gscap, gccap; + ResValue resVal; TileTypeBitMask types1, types2, termtypes[MAXSD]; TileTypeBitMask near, far, ov, shield, subsTypes, idTypes; char *subsName, *transName, *cp, *endptr, *paramName; @@ -2048,10 +2130,10 @@ ExtTechLine(sectionName, argc, argv) "(in milliohms/square).\n", argv[argc - 1]); break; } - val = atoi(argv[argc - 1]); + resVal = aToRes(argv[argc - 1]); for (t = TT_TECHDEPBASE; t < DBNumTypes; t++) if (TTMaskHasType(&types1, t)) - ExtCurStyle->exts_viaResist[t] = val; + ExtCurStyle->exts_viaResist[t] = resVal; break; case CSCALE: ExtCurStyle->exts_capScale = strtol(argv[1], &endptr, 10); @@ -2519,7 +2601,7 @@ ExtTechLine(sectionName, argc, argv) TechError("Fet resistivity %s must be numeric\n", argv[3]); break; } - val = atoi(argv[3]); + resVal = aToRes(argv[3]); isLinear = (strcmp(argv[2], "linear") == 0); for (t = TT_TECHDEPBASE; t < DBNumTypes; t++) { @@ -2529,9 +2611,9 @@ ExtTechLine(sectionName, argc, argv) for (devptr = ExtCurStyle->exts_device[t]; devptr; devptr = devptr->exts_next) { he = HashFind(&devptr->exts_deviceResist, argv[2]); - HashSetValue(he, (spointertype)val); + HashSetValue(he, (spointertype)resVal); if (isLinear) - devptr->exts_linearResist = val; + devptr->exts_linearResist = resVal; } } } @@ -2949,7 +3031,7 @@ ExtTechLine(sectionName, argc, argv) } } else - val = atoi(argv[2]); + resVal = aToRes(argv[2]); if (argc == 4) chop = atof(argv[3]); @@ -2957,11 +3039,11 @@ ExtTechLine(sectionName, argc, argv) for (t = TT_TECHDEPBASE; t < DBNumTypes; t++) if (TTMaskHasType(&types1, t)) { - ExtCurStyle->exts_sheetResist[t] = val; + ExtCurStyle->exts_sheetResist[t] = resVal; ExtCurStyle->exts_cornerChop[t] = chop; ExtCurStyle->exts_typeToResistClass[t] = class; } - ExtCurStyle->exts_resistByResistClass[class] = val; + ExtCurStyle->exts_resistByResistClass[class] = resVal; ExtCurStyle->exts_typesByResistClass[class] = types1; } break; @@ -2998,6 +3080,23 @@ ExtTechLine(sectionName, argc, argv) ExtCurStyle->exts_globSubstrateShieldTypes = idTypes; ExtCurStyle->exts_globSubstratePlane = DBTechNoisyNamePlane(argv[2]); + /* The "default" substrate type is a type that is in the */ + /* list of substrate types and exists on the substrate */ + /* plane, where space on the same plane is also declared to */ + /* be the substrate type. */ + + if (ExtCurStyle->exts_globSubstratePlane != -1) + { + TileType subType; + for (subType = TT_TECHDEPBASE; subType < DBNumUserLayers; subType++) + if (TTMaskHasType(&ExtCurStyle->exts_globSubstrateTypes, subType)) + if (DBPlane(subType) == ExtCurStyle->exts_globSubstratePlane) + { + ExtCurStyle->exts_globSubstrateDefaultType = subType; + break; + } + } + /* Handle optional substrate node name */ if (argc == 4) ExtCurStyle->exts_globSubstrateName = StrDup((char **)NULL, argv[3]); diff --git a/extract/extract.h b/extract/extract.h index d1d665cd..66c2c740 100644 --- a/extract/extract.h +++ b/extract/extract.h @@ -102,4 +102,6 @@ extern void ExtGetZAxis(); extern void ExtDumpCaps(); +extern int extEnumTilePerim(); + #endif /* _EXTRACT_H */ diff --git a/extract/extractInt.h b/extract/extractInt.h index f258b207..ab27be87 100644 --- a/extract/extractInt.h +++ b/extract/extractInt.h @@ -44,9 +44,7 @@ extern CapValue extGetCapValue(); extern void extSetCapValue(); extern void extCapHashKill(); -typedef int ResValue; /* Warning: in some places resistances are stored - * as ints. This is here for documentation only. - */ +typedef int ResValue; typedef struct { char areaType; /* ANTENNAMODEL_SURFACE or ANTENNAMODEL_SIDEWALL */ @@ -881,6 +879,7 @@ typedef struct extstyle TileTypeBitMask exts_globSubstrateTypes; int exts_globSubstratePlane; TileTypeBitMask exts_globSubstrateShieldTypes; + TileType exts_globSubstrateDefaultType; /* Scaling */ /* diff --git a/utils/main.h b/utils/main.h index 2add0bcb..f034fdab 100644 --- a/utils/main.h +++ b/utils/main.h @@ -93,7 +93,6 @@ extern Transform RootToEditTransform; /* global procedures */ extern void MainExit(int); /* a way of exiting that cleans up after itself */ -// These are not declared anywhere -// extern bool MainLoadStyles(), MainLoadCursors(); /* Used during init & reset */ +extern void magicMain(); #endif /* _MAIN_H */