Move reference designator from A to N
replace inp2n by a copy of inp2a OSDI is now called in case N: in inppas2
This commit is contained in:
parent
3a6074324d
commit
f2c6d1702e
|
|
@ -1,127 +1,100 @@
|
||||||
/**********
|
/**********
|
||||||
Permit to use it as your wish.
|
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||||
Author: 2007 Gong Ding, gdiso@ustc.edu
|
Author: 1988 Thomas L. Quarles
|
||||||
University of Science and Technology of China
|
Modified: 2001 Paolo Nenzi (Cider Integration)
|
||||||
**********/
|
**********/
|
||||||
|
|
||||||
#include "ngspice/ngspice.h"
|
#include "ngspice/ngspice.h"
|
||||||
|
|
||||||
#ifdef NDEV
|
#include "ngspice/devdefs.h"
|
||||||
|
#include "ngspice/fteext.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include "ngspice/ifsim.h"
|
#include "ngspice/ifsim.h"
|
||||||
#include "ngspice/inpdefs.h"
|
#include "ngspice/inpdefs.h"
|
||||||
#include "../devices/ndev/ndevdefs.h"
|
|
||||||
#include "ngspice/inpmacs.h"
|
#include "ngspice/inpmacs.h"
|
||||||
#include "ngspice/fteext.h"
|
|
||||||
#include "inpxx.h"
|
#include "inpxx.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
void INP2N(CKTcircuit *ckt, INPtables * tab, struct card *current)
|
void INP2N(CKTcircuit *ckt, INPtables *tab, struct card *current) {
|
||||||
{
|
/* Mname <node> <node> <node> <node> <model> [L=<val>]
|
||||||
/* parse a numerical device card */
|
* [W=<val>] [AD=<val>] [AS=<val>] [PD=<val>]
|
||||||
/* Nname <node> <node> [<node> ...] [<mname>] */
|
* [PS=<val>] [NRD=<val>] [NRS=<val>] [OFF]
|
||||||
/* The NUMD should have a private .model card */
|
* [IC=<val>,<val>,<val>]
|
||||||
|
*/
|
||||||
|
|
||||||
int mytype; /* the type we determine NDEV are */
|
int type; /* the type the model says it is */
|
||||||
int type = 0; /* the type the model says it is */
|
char *line; /* the part of the current line left to parse */
|
||||||
char *line; /* the part of the current line left to parse */
|
char *name; /* the resistor's name */
|
||||||
char *saveline; /* ... just in case we need to go back... */
|
// limit to at most 20 nodes
|
||||||
char *name; /* the NDEV's name */
|
const int max_i = 20;
|
||||||
char *model; /* the name of the NDEV's model */
|
CKTnode *node[20];
|
||||||
|
int error; /* error code temporary */
|
||||||
int term; /* the number of node */
|
int numnodes; /* flag indicating 4 or 5 (or 6 or 7) nodes */
|
||||||
char *nnamex; /* serve as a temporary name */
|
GENinstance *fast; /* pointer to the actual instance */
|
||||||
char *nname[7]; /* the array of CKT node's name */
|
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||||
char *bname[7]; /* the array of NDEV electrode's name */
|
double leadval; /* actual value of unlabeled number */
|
||||||
CKTnode *node[7]; /* the array of CKT node's node pointer */
|
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||||
|
GENmodel *mdfast; /* pointer to the actual model */
|
||||||
int error; /* error code temporary */
|
int i;
|
||||||
int i;
|
|
||||||
INPmodel *thismodel; /* pointer to model structure describing our model */
|
|
||||||
GENmodel *mdfast = NULL; /* pointer to the actual model */
|
|
||||||
GENinstance *fast; /* pointer to the actual instance */
|
|
||||||
NDEVinstance *pinst;
|
|
||||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
|
||||||
double leadval; /* actual value of unlabeled number */
|
|
||||||
|
|
||||||
mytype = INPtypelook("NDEV");
|
line = current->line;
|
||||||
if (mytype < 0) {
|
|
||||||
LITERR("Device type NDEV not supported by this binary\n");
|
INPgetNetTok(&line, &name, 1);
|
||||||
return;
|
INPinsert(&name, tab);
|
||||||
|
|
||||||
|
for (i = 0;; i++) {
|
||||||
|
char *token;
|
||||||
|
INPgetNetTok(&line, &token, 1);
|
||||||
|
|
||||||
|
if (i >= 2) {
|
||||||
|
txfree(INPgetMod(ckt, token, &thismodel, tab));
|
||||||
|
|
||||||
|
/* /1* check if using model binning -- pass in line since need 'l' and 'w' *1/ */
|
||||||
|
/* if (!thismodel) */
|
||||||
|
/* txfree(INPgetModBin(ckt, token, &thismodel, tab, line)); */
|
||||||
|
|
||||||
|
if (thismodel) {
|
||||||
|
INPinsert(&token, tab);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
line = current->line;
|
if (i >= max_i) {
|
||||||
INPgetTok(&line, &name, 1);
|
LITERR("could not find a valid modelname");
|
||||||
INPinsert(&name, tab);
|
return;
|
||||||
|
|
||||||
/* get the node number here */
|
|
||||||
saveline=line;
|
|
||||||
term = 0;
|
|
||||||
do {
|
|
||||||
INPgetNetTok(&line, &nnamex, 1);
|
|
||||||
term++;
|
|
||||||
}while(*nnamex);
|
|
||||||
line=saveline;
|
|
||||||
term=(term-2)/2;
|
|
||||||
if (term > 7) {
|
|
||||||
LITERR("Numerical device has too many nodes, the limitation is 7\n");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
for(i=0;i<term;i++) {
|
INPtermInsert(ckt, &token, tab, &node[i]);
|
||||||
INPgetNetTok(&line, &nname[i], 1);
|
}
|
||||||
INPgetNetTok(&line, &bname[i], 1);
|
|
||||||
INPtermInsert(ckt, &nname[i], tab, &node[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
saveline = line; /* save then old pointer */
|
type = thismodel->INPmodType;
|
||||||
|
mdfast = thismodel->INPmodfast;
|
||||||
|
IFdevice *dev = ft_sim->devices[type];
|
||||||
|
|
||||||
INPgetNetTok(&line, &model, 1);
|
if (!dev->registry_entry) {
|
||||||
|
LITERR("incorrect model type! Expected OSDI device");
|
||||||
if (*model) {
|
|
||||||
/* token isn't null */
|
|
||||||
if (INPlookMod(model)) {
|
|
||||||
/* If this is a valid model connect it */
|
|
||||||
INPinsert(&model, tab);
|
|
||||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
|
||||||
if (thismodel != NULL) {
|
|
||||||
if (mytype != thismodel->INPmodType) {
|
|
||||||
LITERR("incorrect model type");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mdfast = thismodel->INPmodfast;
|
|
||||||
type = thismodel->INPmodType;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LITERR("Numerical device should always have a model card\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
IFC(newInstance, (ckt, mdfast, &fast, name));
|
|
||||||
} else {
|
|
||||||
LITERR("Numerical device should always have a model card\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i=0;i<term;i++) {
|
|
||||||
IFC(bindNode, (ckt, fast, i+1, node[i]));
|
|
||||||
}
|
|
||||||
/* save acture terminal number to instance */
|
|
||||||
pinst = (NDEVinstance *)fast;
|
|
||||||
pinst->term = term;
|
|
||||||
for(i=0;i<term;i++) {
|
|
||||||
pinst->bname[i]=bname[i];
|
|
||||||
pinst->node[i]=node[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab));
|
|
||||||
if (waslead) {
|
|
||||||
LITERR("The numerical device was lead berfor.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
LITERR("not enough nodes");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i > *dev->terms) {
|
||||||
|
LITERR("too many nodes connected to instance");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
numnodes = i;
|
||||||
|
|
||||||
|
IFC(newInstance, (ckt, mdfast, &fast, name));
|
||||||
|
|
||||||
|
for (i = 0; i < *dev->terms; i++)
|
||||||
|
if (i < numnodes)
|
||||||
|
IFC(bindNode, (ckt, fast, i + 1, node[i]));
|
||||||
|
else
|
||||||
|
GENnode(fast)[i] = -1;
|
||||||
|
|
||||||
|
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab));
|
||||||
|
if (waslead)
|
||||||
|
LITERR(" error: no unlabeled parameter permitted on osdi devices\n");
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
|
||||||
int Dummy1;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -99,12 +99,7 @@ void INPpas2(CKTcircuit *ckt, struct card *data, INPtables * tab, TSKtask *task)
|
||||||
/* blank line (tab leading) */
|
/* blank line (tab leading) */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef OSDI
|
#ifdef XSPICE
|
||||||
case 'A': /* Aname <cm connections> <mname> */
|
|
||||||
// OSDI handles xspice
|
|
||||||
INP2A(ckt, tab, current);
|
|
||||||
break;
|
|
||||||
#elif XSPICE
|
|
||||||
/* gtri - add - wbk - 10/23/90 - add case for 'A' devices */
|
/* gtri - add - wbk - 10/23/90 - add case for 'A' devices */
|
||||||
|
|
||||||
case 'A': /* Aname <cm connections> <mname> */
|
case 'A': /* Aname <cm connections> <mname> */
|
||||||
|
|
@ -174,7 +169,7 @@ void INPpas2(CKTcircuit *ckt, struct card *data, INPtables * tab, TSKtask *task)
|
||||||
[IC=<val>,<val>,<val>] */
|
[IC=<val>,<val>,<val>] */
|
||||||
INP2M(ckt, tab, current);
|
INP2M(ckt, tab, current);
|
||||||
break;
|
break;
|
||||||
#ifdef NDEV
|
#ifdef OSDI
|
||||||
case 'N':
|
case 'N':
|
||||||
/* Nname [<node>...] [<mname>] */
|
/* Nname [<node>...] [<mname>] */
|
||||||
INP2N(ckt, tab, current);
|
INP2N(ckt, tab, current);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue