From c5f47d3c1b237f2322d11c12d43ae0d69db035ea Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Wed, 11 Apr 2018 11:14:04 +0200 Subject: [PATCH] Error message and exit if a vdmos device instance has different source and bulk node (have to be the same). --- src/spicelib/devices/vdmos/vdmosset.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/spicelib/devices/vdmos/vdmosset.c b/src/spicelib/devices/vdmos/vdmosset.c index 145c7772f..edf0bcc41 100644 --- a/src/spicelib/devices/vdmos/vdmosset.c +++ b/src/spicelib/devices/vdmos/vdmosset.c @@ -98,6 +98,16 @@ VDMOSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, for (here = VDMOSinstances(model); here != NULL; here = VDMOSnextInstance(here)) { + /* Check if source and bulk nodes are the same. + * The power MOS devices in fact are 3-terminal devices, + * but the actual device input still uses 4 terminals to be compatible. + */ + if (here->VDMOSbNode != here->VDMOSsNode) { + fprintf(stderr, "\nError: source and bulk nodes of device %s have to be the same!\n", + here->VDMOSname); + controlled_exit(1); + } + /* allocate a chunk of the state vector */ here->VDMOSstates = *states; *states += VDMOSnumStates;