Added extraction device type "csubcircuit", which should have been

added a long time ago, since capacitors use a different method for
calculating width and length than either transistors or resistors,
so subcircuits need a special class designator or else the extraction
may calculate the wrong dimensions for device width by totalling the
perimeter between the device and terminal types, as it would for a
MOSFET.
This commit is contained in:
Tim Edwards 2018-10-30 16:19:20 -04:00
parent 0944b02f5f
commit 7dc15a7d28
8 changed files with 34 additions and 4 deletions

View File

@ -588,6 +588,7 @@ spcdevHierVisit(hc, dev, scale)
break;
case DEV_SUBCKT:
case DEV_RSUBCKT:
case DEV_CSUBCKT:
case DEV_MSUBCKT:
devchar = 'X';
break;
@ -620,6 +621,7 @@ spcdevHierVisit(hc, dev, scale)
break;
case DEV_SUBCKT:
case DEV_RSUBCKT:
case DEV_CSUBCKT:
case DEV_MSUBCKT:
fprintf(esSpiceF, "%d", esSbckNum++);
break;
@ -681,6 +683,7 @@ spcdevHierVisit(hc, dev, scale)
/* Drop through to below (no break statement) */
case DEV_RSUBCKT:
case DEV_CSUBCKT:
/* RC-like subcircuits are exactly like other subcircuits */
/* except that the "gate" node is treated as an identifier */
/* only and is not output. */
@ -1051,6 +1054,7 @@ spcdevHierMergeVisit(hc, dev, scale)
else
m = esFMult[cfp->esFMIndex] + (fp->l / cfp->l);
break;
case DEV_CSUBCKT:
case DEV_CAP:
case DEV_CAPREV:
if (fp->dev->dev_type == esNoModelType)
@ -1451,6 +1455,7 @@ mergeThem:
else
m = esFMult[cfp->esFMIndex] + (fp->l / cfp->l);
break;
case DEV_CSUBCKT:
case DEV_CAP:
case DEV_CAPREV:
if (fp->dev->dev_type == esNoModelType)

View File

@ -2145,6 +2145,7 @@ spcdevVisit(dev, hierName, scale, trans)
{
case DEV_SUBCKT:
case DEV_RSUBCKT:
case DEV_CSUBCKT:
case DEV_MSUBCKT:
break;
case DEV_DIODE:
@ -2234,6 +2235,7 @@ spcdevVisit(dev, hierName, scale, trans)
break;
case DEV_SUBCKT:
case DEV_RSUBCKT:
case DEV_CSUBCKT:
case DEV_MSUBCKT:
devchar = 'X';
break;
@ -2270,6 +2272,7 @@ spcdevVisit(dev, hierName, scale, trans)
break;
case DEV_SUBCKT:
case DEV_RSUBCKT:
case DEV_CSUBCKT:
case DEV_MSUBCKT:
fprintf(esSpiceF, "%d", esSbckNum++);
break;
@ -2327,6 +2330,7 @@ spcdevVisit(dev, hierName, scale, trans)
/* Drop through to below (no break statement) */
case DEV_RSUBCKT:
case DEV_CSUBCKT:
/* RC-like subcircuits are exactly like other subcircuits */
/* except that the "gate" node is treated as an identifier */
/* only and is not output. */
@ -3488,6 +3492,7 @@ parallelDevs(f1, f2)
case DEV_SUBCKT:
case DEV_RSUBCKT:
case DEV_CSUBCKT:
break;
}
return NOT_PARALLEL;
@ -3665,6 +3670,7 @@ mergeThem:
else
m = esFMult[cfp->esFMIndex] + (fp->l / cfp->l);
break;
case DEV_CSUBCKT:
case DEV_CAP:
case DEV_CAPREV:
if (fp->dev->dev_type == esNoModelType)

View File

@ -639,6 +639,7 @@ efBuildDevice(def, class, type, r, argc, argv)
case DEV_SUBCKT:
case DEV_MSUBCKT:
case DEV_RSUBCKT:
case DEV_CSUBCKT:
argstart = 0;
}
@ -719,6 +720,7 @@ efBuildDevice(def, class, type, r, argc, argv)
case DEV_CAP:
case DEV_CAPREV:
case DEV_RSUBCKT:
case DEV_CSUBCKT:
case DEV_MSUBCKT:
case DEV_SUBCKT:
case DEV_DIODE:

View File

@ -44,7 +44,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
/* This must match the definition for extDevTable in extract/ExtBasic.c */
char *extDevTable[] = {"fet", "mosfet", "asymmetric", "bjt", "devres",
"devcap", "devcaprev", "diode", "pdiode", "ndiode",
"subckt", "rsubckt", "msubckt", NULL};
"subckt", "rsubckt", "msubckt", "csubckt", NULL};
#endif
/*
@ -344,6 +344,7 @@ readfile:
case DEV_SUBCKT:
case DEV_MSUBCKT:
case DEV_RSUBCKT:
case DEV_CSUBCKT:
ac = 7; /* Actually can have many arguments, which */
break; /* we will deal with in efBuildDevice(). */
}

View File

@ -183,6 +183,7 @@ EFGetLengthAndWidth(dev, lptr, wptr)
case DEV_SUBCKT:
case DEV_MSUBCKT:
case DEV_RSUBCKT:
case DEV_CSUBCKT:
case DEV_DIODE:
case DEV_PDIODE:
case DEV_NDIODE:

View File

@ -56,7 +56,7 @@ static char sccsid[] = "@(#)ExtBasic.c 4.13 MAGIC (Berkeley) 12/5/85";
#ifdef MAGIC_WRAPPER
char *extDevTable[] = {"fet", "mosfet", "asymmetric", "bjt", "devres",
"devcap", "devcaprev", "diode", "pdiode", "ndiode", "subckt",
"rsubckt", "msubckt", NULL};
"rsubckt", "msubckt", "csubckt", NULL};
#endif
/* --------------------- Data local to this file ---------------------- */
@ -2076,6 +2076,7 @@ extOutputDevices(def, transList, outFile)
case DEV_CAP:
case DEV_CAPREV:
case DEV_CSUBCKT:
hasModel = strcmp(ExtCurStyle->exts_transName[t], "None");
if (hasModel)
{
@ -2144,8 +2145,17 @@ extOutputDevices(def, transList, outFile)
(void) ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg);
}
extOutputDevParams(reg, t, outFile, length, width);
if (subsName != NULL)
fprintf(outFile, " \"%s\"", subsName);
if (ExtCurStyle->exts_deviceClass[t] == DEV_CSUBCKT)
{
fprintf(outFile, " \"%s\"", (subsName == NULL) ?
"None" : subsName);
}
else /* SPICE semiconductor resistor */
{
if (subsName != NULL)
fprintf(outFile, " \"%s\"", subsName);
}
}
else
{

View File

@ -212,6 +212,9 @@ static keydesc devTable[] = {
"msubcircuit", DEV_MSUBCKT, 3, 11,
"name dev-types [N] [term1-types ... termN-types [sub-types|None sub-node]] [options]",
"csubcircuit", DEV_CSUBCKT, 4, 7,
"name dev-types terminal-types [sub-types|None sub-node] [options]",
0
};
@ -2177,6 +2180,7 @@ ExtTechLine(sectionName, argc, argv)
break;
case DEV_RSUBCKT:
case DEV_CSUBCKT:
nterm = 2;
DBTechNoisyNameMask(argv[4], &termtypes[0]); /* terminals */
termtypes[1] = DBZeroTypeBits;

View File

@ -52,6 +52,7 @@ extern int ExtDoWarn; /* Bitmask of above */
#define DEV_SUBCKT 10 /* general-purpose subcircuit */
#define DEV_RSUBCKT 11 /* Resistor-like subcircuit. */
#define DEV_MSUBCKT 12 /* MOSFET-like subcircuit. */
#define DEV_CSUBCKT 13 /* Capacitor-like subcircuit. */
/* Device names for .ext file output (new in version 7.2) */
/* (defined in extract/ExtBasic.c *and* extflat/EFread.c) */