From 47a7aac050f036dc401f99bfcadaa57dfed3b3c7 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 16 Aug 2025 09:26:24 +0200 Subject: [PATCH] Add degradation monitor code model to extradev --- src/xspice/icm/xtradev/degmonitor/cfunc.mod | 212 +++++++++++++++++++ src/xspice/icm/xtradev/degmonitor/ifspec.ifs | 110 ++++++++++ src/xspice/icm/xtradev/modpath.lst | 1 + visualc/xspice/xtradev.vcxproj | 4 + 4 files changed, 327 insertions(+) create mode 100644 src/xspice/icm/xtradev/degmonitor/cfunc.mod create mode 100644 src/xspice/icm/xtradev/degmonitor/ifspec.ifs diff --git a/src/xspice/icm/xtradev/degmonitor/cfunc.mod b/src/xspice/icm/xtradev/degmonitor/cfunc.mod new file mode 100644 index 000000000..07aa30776 --- /dev/null +++ b/src/xspice/icm/xtradev/degmonitor/cfunc.mod @@ -0,0 +1,212 @@ +/*.......1.........2.........3.........4.........5.........6.........7.........8 +================================================================================ + +FILE degmonitor/cfunc.mod + +Public Domain + +Universty Duisburg-Essen +Duisburg, Germany +Project Flowspace + +AUTHORS + + 15 Aug 2025 Holger Vogt + + +MODIFICATIONS + + + +SUMMARY + + This file contains the model-specific routines used to + functionally describe degradation monitor code model. + + +INTERFACES + + FILE ROUTINE CALLED + + +REFERENCED FILES + + Inputs from and outputs to ARGS structure. + + +NON-STANDARD FEATURES + + NONE + +===============================================================================*/ + +/*=== INCLUDE FILES ====================*/ + + + + +/*=== CONSTANTS ========================*/ + + + + +/*=== MACROS ===========================*/ + + + + +/*=== LOCAL VARIABLES & TYPEDEFS =======*/ + +static void +cm_degmon_callback(ARGS, Mif_Callback_Reason_t reason) +{ + switch (reason) { + case MIF_CB_DESTROY: { + double *constfac = STATIC_VAR (constfac); + if (constfac) + free(constfac); + STATIC_VAR (constfac) = NULL; + double *sintegral = STATIC_VAR (sintegral); + if (sintegral) + free(sintegral); + STATIC_VAR (sintegral) = NULL; + break; + } + } +} + + +/*=== FUNCTION PROTOTYPE DEFINITIONS ===*/ + + + + + +/*============================================================================== + +FUNCTION void cm_seegen() + +AUTHORS + + 15 Aug 2025 Holger Vogt + +SUMMARY + + This function implements the degradation monitor code model. + +INTERFACES + + FILE ROUTINE CALLED + +RETURNED VALUE + + Returns inputs and outputs via ARGS structure. + +GLOBAL VARIABLES + + NONE + +NON-STANDARD FEATURES + + model source: + IIS EAS, 2025 + + +==============================================================================*/ + +/*=== CM_SEEGEN ROUTINE ===*/ + +void cm_degmon(ARGS) /* structure holding parms, + inputs, outputs, etc. */ +{ + double vd; /* drain voltage */ + double vg; /* gate voltage */ + double vs; /* source voltage */ + double vb; /* bulk voltage */ + double A; /* degradation model parameter */ + double Ea; /* degradation model parameter */ + double b; /* degradation model parameter */ + double L1; /* degradation model parameter */ + double L2; /* degradation model parameter */ + double n; /* degradation model parameter */ + double c; /* degradation model parameter */ + double L; /* channel length */ + double *constfac; /* static storage of const factor in model equation */ + int tfut; + double tsim; + double deg; /* monitor output */ + double sintegrand = 0; + double *sintegral; + double k = 1.38062259e-23; /* Boltzmann */ + + + if (ANALYSIS != MIF_TRAN) { + return; + } + + + + /* Retrieve frequently used parameters... */ + + A = PARAM(A); + Ea = PARAM(Ea); + b = PARAM(b); + L1 = PARAM(L1); + L2 = PARAM(L2); + n = PARAM(n); + b = PARAM(b); + c = PARAM(c); + tfut = PARAM(tfuture); + tsim = TSTOP; + + + if (INIT==1) { + + double Temp = TEMPERATURE + 273.15; + + if (PORT_SIZE(nodes) != 4) + { + + } + + CALLBACK = cm_degmon_callback; + + /* Allocate storage for constant_factor */ + STATIC_VAR(constfac) = (double *) malloc(sizeof(double)); + constfac = (double *) STATIC_VAR(constfac); + *constfac = c * A * exp(Ea / k / Temp) * (L1 + pow((1 / L) , L2)); + + STATIC_VAR(sintegral) = (double *) malloc(sizeof(double)); + sintegral = (double *) STATIC_VAR(sintegral); + *sintegral = 0.; + + + } + else { + + + double x1, x2; + + constfac = (double *) STATIC_VAR(constfac); + sintegral = (double *) STATIC_VAR(sintegral); + + vd = INPUT(nodes[0]); + vg = INPUT(nodes[1]); + vs = INPUT(nodes[2]); + vb = INPUT(nodes[3]); + + if (vd - vs > 0) { + x1 = 1. / (*constfac * exp (b / (vd - vs))); + x2 = -1. / n; + sintegrand = pow(x1 , x2); + *sintegral = *sintegral + sintegrand * (T(0) - T(1)); + } + OUTPUT(mon) = *sintegral; + + if (T(0) == tsim) { + *sintegral = *sintegral * tfut / tsim; + deg = 1. / (c * (pow(*sintegral, -1.* n))); + cm_message_printf("Degradation deg = %e\n", deg); + } + } +} diff --git a/src/xspice/icm/xtradev/degmonitor/ifspec.ifs b/src/xspice/icm/xtradev/degmonitor/ifspec.ifs new file mode 100644 index 000000000..b4765d0db --- /dev/null +++ b/src/xspice/icm/xtradev/degmonitor/ifspec.ifs @@ -0,0 +1,110 @@ +/*.......1.........2.........3.........4.........5.........6.........7.........8 +================================================================================ +Public Domain + + +Universty Duisburg-Essen +Duisburg, Germany +Project Flowspace + +AUTHORS + +Holger Vogt 19 May 2025 + + + +SUMMARY + + This file contains the interface specification file for the + degradation monitor code model. + +===============================================================================*/ + +NAME_TABLE: + +C_Function_Name: cm_degmon +Spice_Model_Name: degmon +Description: "degradation monitor" + + +PORT_TABLE: + +Port_Name: nodes mon +Description: "deg mon input" "monitor" +Direction: in out +Default_Type: v v +Allowed_Types: [v] [v] +Vector: yes no +Vector_Bounds: [- -] - +Null_Allowed: no yes + + +PARAMETER_TABLE: + +Parameter_Name: a ea +Description: "A" "Ea" +Data_Type: real real +Default_Value: 500e-12 20e-12 +Limits: - - +Vector: no no +Vector_Bounds: - - +Null_Allowed: yes yes + + +PARAMETER_TABLE: + +Parameter_Name: b L1 +Description: "b" "L1" +Data_Type: real real +Default_Value: 0 0 +Limits: - - +Vector: no no +Vector_Bounds: - - +Null_Allowed: yes yes + + +PARAMETER_TABLE: + +Parameter_Name: L2 n +Description: "L2" "n" +Data_Type: real real +Default_Value: 0 0.5 +Limits: - - +Vector: no no +Vector_Bounds: - - +Null_Allowed: yes yes + +PARAMETER_TABLE: + +Parameter_Name: c tfuture +Description: "c" "future time" +Data_Type: real int +Default_Value: 10 3153360000 +Limits: - - +Vector: no no +Vector_Bounds: - - +Null_Allowed: yes yes + +PARAMETER_TABLE: + +Parameter_Name: L +Description: "channel length" +Data_Type: real +Default_Value: 10 +Limits: - +Vector: no +Vector_Bounds: - +Null_Allowed: yes + + +STATIC_VAR_TABLE: + +Static_Var_Name: constfac +Data_Type: pointer +Description: "constant factor" + +STATIC_VAR_TABLE: + +Static_Var_Name: sintegral +Data_Type: pointer +Description: "integrated degradation" diff --git a/src/xspice/icm/xtradev/modpath.lst b/src/xspice/icm/xtradev/modpath.lst index 53d9cbea3..b5b53cb42 100644 --- a/src/xspice/icm/xtradev/modpath.lst +++ b/src/xspice/icm/xtradev/modpath.lst @@ -11,3 +11,4 @@ memristor sidiode pswitch seegenerator +degmonitor diff --git a/visualc/xspice/xtradev.vcxproj b/visualc/xspice/xtradev.vcxproj index 6a9b35f54..a51536f75 100644 --- a/visualc/xspice/xtradev.vcxproj +++ b/visualc/xspice/xtradev.vcxproj @@ -220,6 +220,8 @@ ..\..\src\xspice\%(RelativeDir);%(AdditionalIncludeDirectories) + + @@ -263,6 +265,8 @@ + +