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
+20 -13
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;