1 /********** 2 Copyright 1991 Regents of the University of California. All rights reserved. 3 Authors: 1987 Karti Mayaram, 1991 David Gates 4 **********/ 5 6 #ifndef NUMD_H 7 #define NUMD_H 8 9 /* data structures used to describe 1D numerical diodes */ 10 11 /* circuit level includes */ 12 #include "ngspice/ifsim.h" 13 #include "ngspice/cktdefs.h" 14 #include "ngspice/gendefs.h" 15 16 /* device level includes */ 17 #include "ngspice/onemesh.h" 18 #include "ngspice/onedev.h" 19 #include "ngspice/profile.h" 20 #include "ngspice/numglobs.h" 21 #include "ngspice/carddefs.h" 22 23 /* information needed per instance */ 24 typedef struct sNUMDinstance { 25 26 struct GENinstance gen; 27 28 #define NUMDmodPtr(inst) ((struct sNUMDmodel *)((inst)->gen.GENmodPtr)) 29 #define NUMDnextInstance(inst) ((struct sNUMDinstance *)((inst)->gen.GENnextInstance)) 30 #define NUMDname gen.GENname 31 #define NUMDstate gen.GENstate 32 33 #define NUMDvoltage NUMDstate 34 #define NUMDid NUMDstate+1 35 #define NUMDconduct NUMDstate+2 36 #define NUMDnumStates 3 37 38 const int NUMDposNode; /* number of positive node of diode */ 39 const int NUMDnegNode; /* number of negative node of diode */ 40 ONEdevice *NUMDpDevice; 41 GLOBvalues NUMDglobals; /* Temp.-Dep. Global Parameters */ 42 int NUMDtype; /* device type pn or np */ 43 double NUMDarea; /* area factor for the diode */ 44 double NUMDtemp; /* instance temperature */ 45 double NUMDc11; /* small-signal capacitance */ 46 double NUMDy11r; /* small-signal admittance, real part */ 47 double NUMDy11i; /* small-signal admittance, imag part */ 48 int NUMDprint; /* number of timesteps after which print 49 * internal */ 50 char *NUMDicFile; /* Name of initial condition file */ 51 double *NUMDnegPosPtr; /* pointer to sparse matrix at 52 * (negative,positive) */ 53 double *NUMDposNegPtr; /* pointer to sparse matrix at 54 * (positive,negative) */ 55 double *NUMDposPosPtr; /* pointer to sparse matrix at 56 * (positive,positive) */ 57 double *NUMDnegNegPtr; /* pointer to sparse matrix at 58 * (negative,negative) */ 59 60 int NUMDoff; /* 'off' flag for diode */ 61 unsigned NUMDsmSigAvail:1; /* flag to indicate small-signal done */ 62 unsigned NUMDareaGiven:1; /* flag to indicate area was specified */ 63 unsigned NUMDicFileGiven:1; /* flag to indicate init. cond. file given */ 64 unsigned NUMDtempGiven:1; /* flag to indicate temp was specified */ 65 unsigned NUMDprintGiven:1; /* flag to indicate if print was specified */ 66 } NUMDinstance; 67 68 69 /* per model data */ 70 71 typedef struct sNUMDmodel { /* model structure for a diode */ 72 73 struct GENmodel gen; 74 75 #define NUMDmodType gen.GENmodType 76 #define NUMDnextModel(inst) ((struct sNUMDmodel *)((inst)->gen.GENnextModel)) 77 #define NUMDinstances(inst) ((NUMDinstance *)((inst)->gen.GENinstances)) 78 #define NUMDmodName gen.GENmodName 79 80 MESHcard *NUMDxMeshes; /* list of xmesh cards */ 81 MESHcard *NUMDyMeshes; /* list of ymesh cards */ 82 DOMNcard *NUMDdomains; /* list of domain cards */ 83 BDRYcard *NUMDboundaries; /* list of boundary cards */ 84 DOPcard *NUMDdopings; /* list of doping cards */ 85 ELCTcard *NUMDelectrodes; /* list of electrode cards */ 86 CONTcard *NUMDcontacts; /* list of contact cards */ 87 MODLcard *NUMDmodels; /* list of model cards */ 88 MATLcard *NUMDmaterials; /* list of material cards */ 89 MOBcard *NUMDmobility; /* list of mobility cards */ 90 METHcard *NUMDmethods; /* list of method cards */ 91 OPTNcard *NUMDoptions; /* list of option cards */ 92 OUTPcard *NUMDoutputs; /* list of output cards */ 93 ONEtranInfo *NUMDpInfo; /* transient analysis information */ 94 DOPprofile *NUMDprofiles; /* expanded list of doping profiles */ 95 DOPtable *NUMDdopTables; /* list of tables used by profiles */ 96 ONEmaterial *NUMDmatlInfo; /* list of material info structures */ 97 } NUMDmodel; 98 99 /* type of 1D diode */ 100 #define PN 1 101 #define NP -1 102 103 /* device parameters */ 104 enum { 105 NUMD_AREA = 1, 106 NUMD_IC_FILE, 107 NUMD_OFF, 108 NUMD_PRINT, 109 NUMD_TEMP, 110 NUMD_VD, 111 NUMD_ID, 112 NUMD_G11, 113 NUMD_C11, 114 NUMD_Y11, 115 NUMD_G12, 116 NUMD_C12, 117 NUMD_Y12, 118 NUMD_G21, 119 NUMD_C21, 120 NUMD_Y21, 121 NUMD_G22, 122 NUMD_C22, 123 NUMD_Y22, 124 }; 125 126 /* model parameters */ 127 /* NOTE: all true model parameters have been moved to IFcardInfo structures */ 128 #define NUMD_MOD_NUMD 101 129 130 /* device questions */ 131 132 /* model questions */ 133 134 #include "numdext.h" 135 136 #endif /* NUMD_H */ 137