From 396441e1ea80e93276db0c90548660291c4adc4b Mon Sep 17 00:00:00 2001 From: rlar Date: Tue, 7 Mar 2017 20:47:58 +0100 Subject: [PATCH] inp2m.c, #3/9c, abstraction, introduce model_numnodes() Note: This commit does not change behaviour in any way, yet one can instantly see some sickness now. Some of the models definitely do not have 7 nodes, Actually we would like to fetch the number of terminals from struct IFdevice, slot terms or slot numNames But it turns out several models publish bogus values. For example "B4SOI", which has 7 nodes, but claims to have 8 --- src/spicelib/parser/inp2m.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/spicelib/parser/inp2m.c b/src/spicelib/parser/inp2m.c index 0b388a8d1..8509ebb39 100644 --- a/src/spicelib/parser/inp2m.c +++ b/src/spicelib/parser/inp2m.c @@ -13,6 +13,24 @@ Modified: 2001 Paolo Nenzi (Cider Integration) #include "inpxx.h" +static int +model_numnodes(int type) +{ + if (type == INPtypelook("B4SOI") || + type == INPtypelook("B3SOIPD") || + type == INPtypelook("B3SOIFD") || + type == INPtypelook("B3SOIDD") || + type == INPtypelook("HiSIMHV1") || + type == INPtypelook("HiSIMHV2") || + type == INPtypelook("SOI3")) + { + return 7; + } + + return 4; +} + + static bool valid_numnodes(int numnodes, INPmodel *thismodel, card *current) { @@ -220,13 +238,7 @@ INP2M(CKTcircuit *ckt, INPtables *tab, card *current) IFC (bindNode, (ckt, fast, 4, node[3])); /* use type - not thismodel->INPmodType as it might not exist! */ - if (type == INPtypelook("B4SOI") || - type == INPtypelook("B3SOIPD") || - type == INPtypelook("B3SOIFD") || - type == INPtypelook("B3SOIDD") || - type == INPtypelook("HiSIMHV1") || - type == INPtypelook("HiSIMHV2") || - type == INPtypelook("SOI3")) + if (model_numnodes(type) > 4) { switch (numnodes) { case 4: