diff --git a/src/frontend/ChangeLog b/src/frontend/ChangeLog
index 86c15baf3..3927215f3 100644
--- a/src/frontend/ChangeLog
+++ b/src/frontend/ChangeLog
@@ -1,3 +1,10 @@
+2001-01-23 Paolo Nenzi
+
+ * subckt.c: added some code (very, very experimental)
+ to support mos devices with variable number of nodes
+ (5 to 7) in subcircuit expansion. This hack is necessary
+ since SOI devices can have up to 7 nodes.
+
2000-11-07 Arno W. Peters
* com_history, com_alias, parser/cshpar.c, parser/complete.c:
diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c
index a0c28970f..65c3f2ae1 100644
--- a/src/frontend/subckt.c
+++ b/src/frontend/subckt.c
@@ -584,7 +584,7 @@ numnodes(char *name)
struct subs *sss;
char *s, *t, buf[4 * BSIZE_SP];
wordlist *wl;
- int n, i;
+ int n, i, gotit;
while (*name && isspace(*name))
name++;
@@ -612,6 +612,41 @@ numnodes(char *name)
return (sss->su_numargs);
}
n = inp_numnodes(c);
+
+ /* Added this code for variable number of nodes on BSIM3SOI devices */
+ /* The consequence of this code is that the value returned by the */
+ /* inp_numnodes(c) call must be regarded as "maximun number of nodes */
+ /* for a given device type. */
+ /* Paolo Nenzi Jan-2001 */
+
+ /* I hope that works, this code is very very untested */
+
+ if (c=='m') { /* IF this is a mos */
+
+ i = 0;
+ s = buf;
+ gotit = 0;
+ t = gettok(&s); /* Skip component name */
+ while ((i < n) && (*s) && !gotit) {
+ t = gettok(&s);
+ for (wl = modnames; wl; wl = wl->wl_next)
+ if (eq(t, wl->wl_word))
+ gotit = 1;
+ i++;
+ }
+
+ /* Note: node checks must be done on #_of_node-1 because the */
+ /* "while" cicle increments the counter even when a model is */
+ /* recognized. This code may be better! */
+
+ if (i < 5) {
+ fprintf(cp_err, "Error: too few nodes for MOS: %s\n", name);
+ return(0);
+ }
+ return(i-1); /* compesate the unnecessary inrement in the while cicle */
+ }
+
+
if (nobjthack || (c != 'q'))
return (n);
for (s = buf, i = 0; *s && (i < 4); i++)
@@ -931,7 +966,7 @@ inp_numnodes(char c)
case 'j': return (3);
case 'k': return (0);
case 'l': return (2);
- case 'm': return (7);
+ case 'm': return (7); /* This means that 7 is the maximun number of nodes */
case 'o': return (4);
case 'q': return (4);
case 'r': return (2);