From 4db43d9612018dd5566e44b9d7bc641b37604646 Mon Sep 17 00:00:00 2001 From: Justin Fisher Date: Mon, 1 Jun 2026 14:38:40 +0200 Subject: [PATCH] parser: fix BSIM-BULK (level 77) model type lookup for OSDI MOSFETs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit inpdomod.c: Add case 77 to the MOS level switch so that .model lines with level=77 resolve to the bsimbulk OSDI device type instead of leaving INPmodType=-1. Without this, BSIM-BULK model cards are registered with an invalid type and instances later fail to load. inp2m.c: Add bsimbulk to the model-type allowlist in INP2M() so that MOSFET instances using an OSDI BSIM-BULK model (M-prefix) are accepted instead of rejected with 'incorrect model type'. This is the minimum subset needed for a single-model BSIM-BULK test case to parse. The multi-bin handling change to inpgmod.c that accompanied the original fix is omitted here — it is unrelated to the PMOS-polarity wiring demonstration this branch is for. --- src/spicelib/parser/inp2m.c | 3 ++- src/spicelib/parser/inpdomod.c | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/spicelib/parser/inp2m.c b/src/spicelib/parser/inp2m.c index 75554b834..330fce353 100644 --- a/src/spicelib/parser/inp2m.c +++ b/src/spicelib/parser/inp2m.c @@ -137,7 +137,8 @@ INP2M(CKTcircuit *ckt, INPtables *tab, struct card *current) thismodel->INPmodType != INPtypelook("HiSIM2") && thismodel->INPmodType != INPtypelook("HiSIMHV1") && thismodel->INPmodType != INPtypelook("HiSIMHV2") && - thismodel->INPmodType != INPtypelook("VDMOS")) + thismodel->INPmodType != INPtypelook("VDMOS") && + thismodel->INPmodType != INPtypelook("bsimbulk")) { LITERR ("incorrect model type"); return; diff --git a/src/spicelib/parser/inpdomod.c b/src/spicelib/parser/inpdomod.c index 2b8bb6c77..8a0c50848 100644 --- a/src/spicelib/parser/inpdomod.c +++ b/src/spicelib/parser/inpdomod.c @@ -380,9 +380,16 @@ char *INPdomodel(CKTcircuit *ckt, struct card *image, INPtables * tab) err = tprintf("Device type HiSIMHV version %s not available in this binary\n", ver); } break; + case 77: /* BSIM-BULK (OSDI) */ + type = INPtypelook("bsimbulk"); + if (type < 0) { + err = INPmkTemp + ("Device type bsimbulk not available - load bsimbulk.osdi before .model\n"); + } + break; default: /* placeholder; use level xxx for the next model */ err = INPmkTemp - ("Only MOS device levels 1-6,8-10,14,49,54-58,60,68,73 are supported in this binary\n"); + ("Only MOS device levels 1-6,8-10,14,49,54-58,60,68,73,77 are supported in this binary\n"); break; } INPmakeMod(modname, type, image);