Option "ext2spice subcircuit top" was implemented wrong and would

cause a crash.  Corrected the implementation as well as implemented
an option for "subcircuit top auto" that generates a subcircuit
header or not depending on the presence or absense of ports in the
top level cell.
This commit is contained in:
Tim Edwards 2018-03-28 12:09:19 -04:00
parent f19400be1e
commit ba2db7bbd3
2 changed files with 20 additions and 8 deletions

View File

@ -1787,8 +1787,26 @@ esHierVisit(hc, cdata)
fprintf(esSpiceF, "* Black-box entry subcircuit for %s abstract view\n",
def->def_name);
/* Automatic subcircuit handling for top level: Check if the top */
/* level has any ports defined. If so, make a subcircuit record */
/* for it. If not, don't. */
if ((def == topdef) && (locDoSubckt == AUTO))
{
/* Determine if there are ports */
locDoSubckt = FALSE;
for (snode = (EFNode *) def->def_firstn.efnode_next;
snode != &def->def_firstn;
snode = (EFNode *) snode->efnode_next)
if (snode->efnode_flags & (EF_PORT | EF_SUBS_PORT))
{
locDoSubckt = TRUE;
break;
}
}
/* Generate subcircuit header */
if ((def != topdef) || (def->def_flags & DEF_SUBCIRCUIT))
if ((def != topdef) || (def->def_flags & DEF_SUBCIRCUIT) || (locDoSubckt == TRUE))
topVisit(def, doStub);
else
fprintf(esSpiceF, "\n* Top level circuit %s\n\n", topdef->def_name);
@ -1835,7 +1853,7 @@ esHierVisit(hc, cdata)
}
}
if ((def != topdef) || (def->def_flags & DEF_SUBCIRCUIT))
if ((def != topdef) || (def->def_flags & DEF_SUBCIRCUIT) || (locDoSubckt == TRUE))
fprintf(esSpiceF, ".ends\n\n");
else
fprintf(esSpiceF, ".end\n\n");

View File

@ -845,13 +845,7 @@ runexttospice:
locDoSubckt = FALSE;
if (esDoHierarchy)
{
if ((esDoSubckt == TRUE) || (locDoSubckt == TRUE))
topVisit(efFlatRootDef, FALSE);
ESGenerateHierarchy(inName, flatFlags);
if ((esDoSubckt == TRUE) || (locDoSubckt == TRUE))
fprintf(esSpiceF, ".ends\n");
}
else
{