Corrected hierarchical SPICE extraction to reset the subcircuit

name-to-number mapping used for the HSPICE format between
subcircuits.  Otherwise, subcircuits with the same instance ID
remain in the table and may cause nodes to be output with a name
that collides with other names in the same subcircuit.  This only
affects output in HSPICE format.
This commit is contained in:
Tim Edwards 2018-12-12 17:23:35 -05:00
parent fc0645a88e
commit f3a95c74fe
2 changed files with 20 additions and 3 deletions

View File

@ -44,6 +44,10 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "utils/runstats.h" #include "utils/runstats.h"
#include "ext2spice/ext2spice.h" #include "ext2spice/ext2spice.h"
/* These global values are defined in ext2spice.c */
extern HashTable subcktNameTable;
extern DQueue subcktNameQueue;
// Structure passed to esHierVisit // Structure passed to esHierVisit
typedef struct _defflagsdata { typedef struct _defflagsdata {
@ -1871,6 +1875,15 @@ esHierVisit(hc, cdata)
esSbckNum = 0; esSbckNum = 0;
esNodeNum = 10; esNodeNum = 10;
/* Reset the subcircuit hash table, if using HSPICE format */
if (esFormat == HSPICE)
{
HashInit(&subcktNameTable, 32, HT_STRINGKEYS);
#ifndef UNSORTED_SUBCKT
DQInit(&subcktNameQueue, 64);
#endif
}
EFFlatDone(); EFFlatDone();
return 0; return 0;
} }

View File

@ -1369,6 +1369,10 @@ subcktVisit(use, hierName, is_top)
/* Retain instance name unless esDoRenumber is set, or format is Spice2 */ /* Retain instance name unless esDoRenumber is set, or format is Spice2 */
if (use->use_id == NULL || esDoRenumber == TRUE || esFormat == SPICE2) if (use->use_id == NULL || esDoRenumber == TRUE || esFormat == SPICE2)
{ {
/* NOTE: This really needs to update subcktNameTable so that */
/* it tracks between instance names and node names, when using */
/* HSPICE format + esDoRenumber. */
fprintf(esSpiceF, "X%d", esSbckNum++); fprintf(esSpiceF, "X%d", esSbckNum++);
tchars = 5; tchars = 5;
} }
@ -3268,10 +3272,10 @@ char *efHNSprintfPrefix(hierName, str)
* nodeHspiceName -- * nodeHspiceName --
* *
* Convert the hierarchical node name used in Berkeley spice * Convert the hierarchical node name used in Berkeley spice
* to a name understodd by hspice and hopefully by the user. * to a name understood by hspice and hopefully by the user.
* *
* Results: * Results:
* A somewhat meaningfull node name * A somewhat meaningful node name
* *
* Side effects: * Side effects:
* Mucks with the hash table above. * Mucks with the hash table above.
@ -3306,7 +3310,7 @@ int nodeHspiceName(s)
sf = p + 1; sf = p + 1;
/* /*
* look up prefix in the hash table ad create it if doesnt exist * look up prefix in the hash table and create it if doesn't exist
*/ */
if ((he = HashLookOnly(&subcktNameTable, s)) == NULL) if ((he = HashLookOnly(&subcktNameTable, s)) == NULL)
{ {