From 06b73b405646557b4198e46021eead4d6b0944f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rp=C3=A1d=20B=C5=B1rmen?= Date: Mon, 15 Sep 2025 10:25:08 +0200 Subject: [PATCH] ceqqjd, ceqqjs should be scaled with mult_q. This fixes erratic simulation behavior when mult_i != mult_q. --- src/spicelib/devices/bsim4/b4ld.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/spicelib/devices/bsim4/b4ld.c b/src/spicelib/devices/bsim4/b4ld.c index 5001e12f3..fa7d56f96 100644 --- a/src/spicelib/devices/bsim4/b4ld.c +++ b/src/spicelib/devices/bsim4/b4ld.c @@ -5006,9 +5006,9 @@ line900: - ceqgstot + Istoteq) + mult_q * (ceqqg + ceqqb + ceqqd + ceqqgmid)); } else - { here->BSIM4rhsdb = mult_i * (ceqjd + ceqqjd); + { here->BSIM4rhsdb = mult_i * (ceqjd /*+ ceqqjd */) + mult_q * ceqqjd); here->BSIM4rhsbPrime = (mult_i * (ceqbd + ceqbs + Ibtoteq) - mult_q * ceqqb); - here->BSIM4rhssb = mult_i * (ceqjs + ceqqjs); + here->BSIM4rhssb = mult_i * (ceqjs /*+ ceqqjs*/) + mult_q * ceqqjs; here->BSIM4rhssPrime = (mult_i * (ceqdrn - ceqbs + ceqjs - ceqgstot + Istoteq) + mult_q * (ceqqd + ceqqg + ceqqb + ceqqjd + ceqqjs + ceqqgmid)); } @@ -5037,9 +5037,9 @@ line900: - ceqgstot + Istoteq) + mult_q * (ceqqg + ceqqb + ceqqd + ceqqgmid))); } else - { (*(ckt->CKTrhs + here->BSIM4dbNode) -= mult_i * (ceqjd + ceqqjd)); + { (*(ckt->CKTrhs + here->BSIM4dbNode) -= mult_i * (ceqjd /*+ ceqqjd*/) + mult_q * ceqqjd); (*(ckt->CKTrhs + here->BSIM4bNodePrime) += (mult_i * (ceqbd + ceqbs + Ibtoteq) - mult_q * ceqqb)); - (*(ckt->CKTrhs + here->BSIM4sbNode) -= mult_i * (ceqjs + ceqqjs)); + (*(ckt->CKTrhs + here->BSIM4sbNode) -= mult_i * (ceqjs /*+ ceqqjs*/) + mult_q * ceqqjs); (*(ckt->CKTrhs + here->BSIM4sNodePrime) += (mult_i * (ceqdrn - ceqbs + ceqjs - ceqgstot + Istoteq) + mult_q * (ceqqd + ceqqg + ceqqb + ceqqjd + ceqqjs + ceqqgmid))); }