Merge branch 'master' into magic-8.2

This commit is contained in:
Tim Edwards 2019-10-30 03:00:09 -04:00
commit 131728190c
3 changed files with 69 additions and 40 deletions

View File

@ -1625,6 +1625,10 @@ esMakePorts(hc, cdata)
{ {
nn->efnn_node->efnode_flags |= EF_PORT; nn->efnn_node->efnode_flags |= EF_PORT;
nn->efnn_port = -1; // Will be sorted later nn->efnn_port = -1; // Will be sorted later
// Diagnostic
// TxPrintf("Port connection in %s from net %s to net %s (%s)\n",
// def->def_name, locname, name, portname);
} }
} }
@ -1634,9 +1638,6 @@ esMakePorts(hc, cdata)
updef = portdef; updef = portdef;
} }
// Diagnostic
// TxPrintf("Connection in %s to net %s (%s)\n", def->def_name,
// name, portname);
} }
} }

View File

@ -1372,10 +1372,11 @@ subcktVisit(use, hierName, is_top)
EFNode *snode; EFNode *snode;
Def *def = use->use_def; Def *def = use->use_def;
EFNodeName *nodeName; EFNodeName *nodeName;
int portorder, portmax, imp_max, tchars; int portorder, portmax, portidx, imp_max, tchars;
char stmp[MAX_STR_SIZE]; char stmp[MAX_STR_SIZE];
char *instname, *subcktname; char *instname, *subcktname;
DevParam *plist, *pptr; DevParam *plist, *pptr;
EFNodeName **nodeList;
if (is_top == TRUE) return 0; /* Ignore the top-level cell */ if (is_top == TRUE) return 0; /* Ignore the top-level cell */
@ -1467,35 +1468,53 @@ subcktVisit(use, hierName, is_top)
/* Port numbers need not start at zero or be contiguous. */ /* Port numbers need not start at zero or be contiguous. */
/* They will be printed in numerical order. */ /* They will be printed in numerical order. */
portorder = 0; nodeList = (EFNodeName **)mallocMagic((portmax + 1) * sizeof(EFNodeName *));
while (portorder <= portmax) for (portidx = 0; portidx <= portmax; portidx++)
{ nodeList[portidx] = (EFNodeName *)NULL;
for (snode = (EFNode *) def->def_firstn.efnode_next;
for (snode = (EFNode *) def->def_firstn.efnode_next;
snode != &def->def_firstn; snode != &def->def_firstn;
snode = (EFNode *) snode->efnode_next) snode = (EFNode *) snode->efnode_next)
{ {
if (!(snode->efnode_flags & EF_PORT)) continue; if (!(snode->efnode_flags & EF_PORT)) continue;
for (nodeName = snode->efnode_name; nodeName != NULL; for (nodeName = snode->efnode_name; nodeName != NULL;
nodeName = nodeName->efnn_next) nodeName = nodeName->efnn_next)
{
EFNodeName *nn;
HashEntry *he;
char *pname;
portidx = nodeName->efnn_port;
if (nodeList[portidx] == NULL)
{ {
int portidx = nodeName->efnn_port; nodeList[portidx] = nodeName;
if (portidx == portorder) }
{ else if (EFHNBest(nodeName->efnn_hier, nodeList[portidx]->efnn_hier))
if (tchars > 80) {
{ nodeList[portidx] = nodeName;
fprintf(esSpiceF, "\n+");
tchars = 1;
}
tchars += spcdevOutNode(hierName, nodeName->efnn_hier,
"subcircuit", esSpiceF);
break;
}
} }
if (nodeName != NULL) break;
} }
portorder++;
} }
for (portidx = 0; portidx <= portmax; portidx++)
{
nodeName = nodeList[portidx];
if (nodeName == NULL)
TxError("No port connection on port %d; need to resolve.\n", portidx);
else
{
if (tchars > 80)
{
fprintf(esSpiceF, "\n+");
tchars = 1;
}
tchars += spcdevOutNode(hierName, nodeName->efnn_hier,
"subcircuit", esSpiceF);
}
}
freeMagic(nodeList);
/* Look for all implicit substrate connections that are */ /* Look for all implicit substrate connections that are */
/* declared as local node names, and put them last. */ /* declared as local node names, and put them last. */
@ -1615,7 +1634,7 @@ topVisit(def, doStub)
Def *def; Def *def;
bool doStub; bool doStub;
{ {
EFNode *snode; EFNode *snode, *basenode;
EFNodeName *sname, *nodeName; EFNodeName *sname, *nodeName;
HashSearch hs; HashSearch hs;
HashEntry *he; HashEntry *he;
@ -1668,7 +1687,9 @@ topVisit(def, doStub)
snode = sname->efnn_node; snode = sname->efnn_node;
if (snode->efnode_flags & EF_PORT) if (snode->efnode_flags & EF_PORT)
if (snode->efnode_name->efnn_port < 0) {
pname = nodeSpiceName(snode->efnode_name->efnn_hier, &basenode);
if (basenode->efnode_name->efnn_port < 0)
{ {
if (tchars > 80) if (tchars > 80)
{ {
@ -1676,11 +1697,12 @@ topVisit(def, doStub)
fprintf(esSpiceF, "\n+"); fprintf(esSpiceF, "\n+");
tchars = 1; tchars = 1;
} }
pname = nodeSpiceName(snode->efnode_name->efnn_hier);
fprintf(esSpiceF, " %s", pname); fprintf(esSpiceF, " %s", pname);
tchars += strlen(pname) + 1; tchars += strlen(pname) + 1;
snode->efnode_name->efnn_port = portorder++; basenode->efnode_name->efnn_port = portorder++;
} }
snode->efnode_name->efnn_port = basenode->efnode_name->efnn_port;
}
} }
} }
else else
@ -1714,7 +1736,7 @@ topVisit(def, doStub)
fprintf(esSpiceF, "\n+"); fprintf(esSpiceF, "\n+");
tchars = 1; tchars = 1;
} }
pname = nodeSpiceName(snode->efnode_name->efnn_hier); pname = nodeSpiceName(snode->efnode_name->efnn_hier, NULL);
fprintf(esSpiceF, " %s", pname); fprintf(esSpiceF, " %s", pname);
tchars += strlen(pname) + 1; tchars += strlen(pname) + 1;
break; break;
@ -2771,7 +2793,8 @@ FILE *outf;
/* Canonical name */ /* Canonical name */
nn = (EFNodeName *) HashGetValue(he); nn = (EFNodeName *) HashGetValue(he);
if (outf) if (outf)
fprintf(outf, "%s", nodeSpiceName(nn->efnn_node->efnode_name->efnn_hier)); fprintf(outf, "%s", nodeSpiceName(nn->efnn_node->efnode_name->efnn_hier,
NULL));
/* Mark node as visited */ /* Mark node as visited */
if ((nodeClient *)nn->efnn_node->efnode_client == (ClientData)NULL) if ((nodeClient *)nn->efnn_node->efnode_client == (ClientData)NULL)
@ -2982,7 +3005,7 @@ spcdevOutNode(prefix, suffix, name, outf)
return 0; return 0;
} }
nn = (EFNodeName *) HashGetValue(he); nn = (EFNodeName *) HashGetValue(he);
nname = nodeSpiceName(nn->efnn_node->efnode_name->efnn_hier); nname = nodeSpiceName(nn->efnn_node->efnode_name->efnn_hier, NULL);
fprintf(outf, " %s", nname); fprintf(outf, " %s", nname);
/* Mark node as visited */ /* Mark node as visited */
@ -3028,8 +3051,8 @@ spccapVisit(hierName1, hierName2, cap)
if (cap <= EFCapThreshold) if (cap <= EFCapThreshold)
return 0; return 0;
fprintf(esSpiceF, esSpiceCapFormat ,esCapNum++,nodeSpiceName(hierName1), fprintf(esSpiceF, esSpiceCapFormat ,esCapNum++,nodeSpiceName(hierName1, NULL),
nodeSpiceName(hierName2), cap); nodeSpiceName(hierName2, NULL), cap);
return 0; return 0;
} }
@ -3064,8 +3087,8 @@ spcresistVisit(hierName1, hierName2, res)
HierName *hierName2; HierName *hierName2;
float res; float res;
{ {
fprintf(esSpiceF, "R%d %s %s %g\n", esResNum++, nodeSpiceName(hierName1), fprintf(esSpiceF, "R%d %s %s %g\n", esResNum++, nodeSpiceName(hierName1, NULL),
nodeSpiceName(hierName2), res / 1000.); nodeSpiceName(hierName2, NULL), res / 1000.);
return 0; return 0;
} }
@ -3100,7 +3123,7 @@ spcsubVisit(node, res, cap, resstr)
if (node->efnode_flags & EF_SUBS_NODE) if (node->efnode_flags & EF_SUBS_NODE)
{ {
hierName = (HierName *) node->efnode_name->efnn_hier; hierName = (HierName *) node->efnode_name->efnn_hier;
nsn = nodeSpiceName(hierName); nsn = nodeSpiceName(hierName, NULL);
*resstr = StrDup((char **)NULL, nsn); *resstr = StrDup((char **)NULL, nsn);
return 1; return 1;
} }
@ -3150,7 +3173,7 @@ spcnodeVisit(node, res, cap)
if (!isConnected && node->efnode_flags & EF_PORT) isConnected = TRUE; if (!isConnected && node->efnode_flags & EF_PORT) isConnected = TRUE;
hierName = (HierName *) node->efnode_name->efnn_hier; hierName = (HierName *) node->efnode_name->efnn_hier;
nsn = nodeSpiceName(hierName); nsn = nodeSpiceName(hierName, NULL);
if (esFormat == SPICE2 || esFormat == HSPICE && strncmp(nsn, "z@", 2)==0 ) { if (esFormat == SPICE2 || esFormat == HSPICE && strncmp(nsn, "z@", 2)==0 ) {
static char ntmp[MAX_STR_SIZE]; static char ntmp[MAX_STR_SIZE];
@ -3195,7 +3218,7 @@ nodeVisitDebug(node, res, cap)
EFAttr *ap; EFAttr *ap;
hierName = (HierName *) node->efnode_name->efnn_hier; hierName = (HierName *) node->efnode_name->efnn_hier;
nsn = nodeSpiceName(hierName); nsn = nodeSpiceName(hierName, NULL);
TxError("** %s (%x)\n", nsn, node); TxError("** %s (%x)\n", nsn, node);
printf("\t client.name=%s, client.m_w=%p\n", printf("\t client.name=%s, client.m_w=%p\n",
@ -3218,23 +3241,27 @@ nodeVisitDebug(node, res, cap)
* *
* Side effects: * Side effects:
* Allocates nodeClients for the node. * Allocates nodeClients for the node.
* Returns the node in the "rnode" pointer, if non-NULL.
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
static char esTempName[MAX_STR_SIZE]; static char esTempName[MAX_STR_SIZE];
char *nodeSpiceName(hname) char *nodeSpiceName(hname, rnode)
HierName *hname; HierName *hname;
EFNode **rnode;
{ {
EFNodeName *nn; EFNodeName *nn;
HashEntry *he; HashEntry *he;
EFNode *node; EFNode *node;
if (rnode) *rnode = (EFNode *)NULL;
he = EFHNLook(hname, (char *) NULL, "nodeName"); he = EFHNLook(hname, (char *) NULL, "nodeName");
if ( he == NULL ) if ( he == NULL )
return "errGnd!"; return "errGnd!";
nn = (EFNodeName *) HashGetValue(he); nn = (EFNodeName *) HashGetValue(he);
node = nn->efnn_node; node = nn->efnn_node;
if (rnode) *rnode = node;
if ( (nodeClient *) (node->efnode_client) == NULL ) { if ( (nodeClient *) (node->efnode_client) == NULL ) {
initNodeClient(node); initNodeClient(node);

View File

@ -527,6 +527,7 @@ efAddNodes(hc, stdcell)
HashSetValue(he, (char *) newname); HashSetValue(he, (char *) newname);
newname->efnn_node = newnode; newname->efnn_node = newnode;
newname->efnn_hier = hierName; newname->efnn_hier = hierName;
newname->efnn_port = -1;
if (newnode->efnode_name) if (newnode->efnode_name)
{ {
newname->efnn_next = newnode->efnode_name->efnn_next; newname->efnn_next = newnode->efnode_name->efnn_next;