From 39a0fe78cd863dde017249551d891a1220773238 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 11 May 2025 16:41:47 +0200 Subject: [PATCH] Add a parameter m (output multiplicator) to spice2poly code model. --- src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod | 12 +++++++----- .../icm/spice2poly/icm_spice2poly/ifspec.ifs | 14 +++++++++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod b/src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod index df6fdff20..b869d0845 100644 --- a/src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod +++ b/src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod @@ -47,7 +47,7 @@ required syntax. This model may also be called directly as follows: a1 [ ] xxx - .model xxx spice2poly ( coef = [ ] ) + .model xxx spice2poly ( coef = [ ] [m = val] ) Refer to the 2G6 User Guide for an explanation of the coefficients. @@ -102,12 +102,14 @@ void spice2poly (ARGS) double sum; /* Temporary for accumulating sum of terms */ double product; /* Temporary for accumulating product */ - + double mult; /* multplicator for G and F sources */ /* Get number of input values */ num_inputs = PORT_SIZE(in); + mult = PARAM(m); + /* If this is the first call to the model, allocate the static variable */ /* array */ @@ -165,7 +167,7 @@ void spice2poly (ARGS) /* Add the product times the appropriate coefficient into the sum */ sum += coef[i] * product; } - OUTPUT(out) = sum; + OUTPUT(out) = sum * mult; /* Compute and output the partials for each input */ @@ -201,13 +203,13 @@ void spice2poly (ARGS) sum += coef[j] * product; } - PARTIAL(out,in[i]) = sum; + PARTIAL(out,in[i]) = sum * mult; /* If this is DC analysis, save the partial for use as AC gain */ /* value in an AC analysis */ if(ANALYSIS == MIF_DC) - STATIC_VAR(acgains[i]) = sum; + STATIC_VAR(acgains[i]) = sum * mult; } /* Free the allocated items and return */ diff --git a/src/xspice/icm/spice2poly/icm_spice2poly/ifspec.ifs b/src/xspice/icm/spice2poly/icm_spice2poly/ifspec.ifs index 6aab4de10..02f4b6387 100644 --- a/src/xspice/icm/spice2poly/icm_spice2poly/ifspec.ifs +++ b/src/xspice/icm/spice2poly/icm_spice2poly/ifspec.ifs @@ -16,7 +16,8 @@ AUTHORS MODIFICATIONS - + 11/05/2025 Holger Vogt + new parameter m (multiplicator) SUMMARY @@ -67,6 +68,17 @@ Vector: yes Vector_Bounds: [2 -] Null_Allowed: no +PARAMETER_TABLE: + +Parameter_Name: m +Description: "multiplicator" +Data_Type: real +Default_Value: 1 +Limits: - +Vector: no +Vector_Bounds: - +Null_Allowed: yes + STATIC_VAR_TABLE: