Corrected a typo in the previous commit that causes parameters to

be output twice for scaled devices (such as diodes in the sky130
process).  Above and beyond the typo, though, the implementation
of offsets is not very well thought out and needs to be revised.
For one, the +/- notation can be confused with signs in the
parameter expression;  that is also fixed in this commit.  But
there is currently no way to express both a scale and an offset
for a device parameter.
This commit is contained in:
Tim Edwards 2023-06-23 08:39:59 -04:00
parent 07267dc126
commit ca985edbd0
4 changed files with 39 additions and 26 deletions

View File

@ -1 +1 @@
8.3.405
8.3.406

View File

@ -714,20 +714,26 @@ efBuildDeviceParams(name, argc, argv)
newparm->parm_scale = atof(mult + 1);
}
else
{
newparm->parm_scale = 1.0;
if ((offset = strchr(pptr + 1, '+')) != NULL)
{
*offset = '\0';
newparm->parm_offset = atof(offset + 1);
/* NOTE: If extending feature to allow for both scale
* and offset, be sure to distinguish between +/- as an
* offset and +/- as a sign.
*/
if ((offset = strchr(pptr + 1, '+')) != NULL)
{
*offset = '\0';
newparm->parm_offset = atof(offset + 1);
}
else if ((offset = strchr(pptr + 1, '-')) != NULL)
{
*offset = '\0';
newparm->parm_offset = -atof(offset + 1);
}
else
newparm->parm_offset = 0.0;
}
else if ((offset = strchr(pptr + 1, '-')) != NULL)
{
*offset = '\0';
newparm->parm_offset = -atof(offset + 1);
}
else
newparm->parm_offset = 0.0;
// For parameters defined for cell defs, copy the whole
// expression verbatim into parm_name. parm_type is

View File

@ -1676,7 +1676,7 @@ extOutputParameters(def, transList, outFile)
fprintf(outFile, " %c=%s*%g",
plist->pl_param[0],
plist->pl_name, plist->pl_scale);
if (plist->pl_offset != 0.0)
else if (plist->pl_offset != 0.0)
fprintf(outFile, " %c=%s%+g",
plist->pl_param[0],
plist->pl_name, plist->pl_offset);

View File

@ -2391,22 +2391,29 @@ ExtTechLine(sectionName, argc, argv)
newParam->pl_scale = atof(mult);
}
else
{
newParam->pl_scale = 1.0;
if ((offset = strchr(paramName, '+')) != NULL)
{
*offset = '\0';
offset++;
newParam->pl_offset = atof(offset);
/* NOTE: If allowing both scale and offset, be sure
* to distinguish between +/- used for offsets and
* +/- used as sign.
*/
if ((offset = strchr(paramName, '+')) != NULL)
{
*offset = '\0';
offset++;
newParam->pl_offset = atof(offset);
}
else if ((offset = strchr(paramName, '-')) != NULL)
{
*offset = '\0';
offset++;
newParam->pl_offset = -atof(offset);
}
else
newParam->pl_offset = 0.0;
}
else if ((offset = strchr(paramName, '-')) != NULL)
{
*offset = '\0';
offset++;
newParam->pl_offset = -atof(offset);
}
else
newParam->pl_offset = 0.0;
newParam->pl_name = StrDup((char **)NULL, paramName);
newParam->pl_next = subcktParams;