Browse Source

inp2m.c, #7/9c, rewrite valid_numnodes() using model_numnodes()

pre-master-46
rlar 9 years ago
parent
commit
6edd684020
  1. 48
      src/spicelib/parser/inp2m.c

48
src/spicelib/parser/inp2m.c

@ -38,48 +38,12 @@ model_numnodes(int type)
static bool
valid_numnodes(int numnodes, INPmodel *thismodel, card *current)
{
bool valid;
switch (numnodes) {
case 7:
valid =
thismodel->INPmodType == INPtypelook("B4SOI") ||
thismodel->INPmodType == INPtypelook("B3SOIPD") ||
thismodel->INPmodType == INPtypelook("B3SOIFD") ||
thismodel->INPmodType == INPtypelook("B3SOIDD");
if (!valid)
LITERR ("only level 55-58: B3SOI(PD|FD|DD) and B4SOI can have 7 nodes");
return valid;
case 6:
valid =
thismodel->INPmodType == INPtypelook("B4SOI") ||
thismodel->INPmodType == INPtypelook("B3SOIPD") ||
thismodel->INPmodType == INPtypelook("B3SOIFD") ||
thismodel->INPmodType == INPtypelook("B3SOIDD") ||
thismodel->INPmodType == INPtypelook("HiSIMHV1") ||
thismodel->INPmodType == INPtypelook("HiSIMHV2") ||
thismodel->INPmodType == INPtypelook("SOI3");
if (!valid)
LITERR ("only level 55-58,61,62: B3SOI(PD|FD|DD), B4SOI, STAG (SOI3) and HiSIMHV can have 6 nodes");
return valid;
case 5:
valid =
thismodel->INPmodType == INPtypelook("B4SOI") ||
thismodel->INPmodType == INPtypelook("B3SOIPD") ||
thismodel->INPmodType == INPtypelook("B3SOIFD") ||
thismodel->INPmodType == INPtypelook("B3SOIDD") ||
thismodel->INPmodType == INPtypelook("HiSIMHV1") ||
thismodel->INPmodType == INPtypelook("HiSIMHV2") ||
thismodel->INPmodType == INPtypelook("SOI3");
if (!valid)
LITERR ("only level 55-58,61,62: B3SOI(PD|FD|DD), B4SOI, STAG (SOI3) and HiSIMHV can have 5 nodes");
return valid;
default:
return TRUE;
}
bool valid = model_numnodes(thismodel->INPmodType) >= numnodes;
if (!valid)
LITERR ("too much nodes connected to instance");
return valid;
}

Loading…
Cancel
Save