
/*
 * Structures for model: sidiode
 *
 * Automatically generated by cmpp preprocessor
 *
 * !!! DO NOT EDIT !!!
 *
 */


#include "ngspice/ngspice.h"
#include <stdio.h>
#include "ngspice/devdefs.h"
#include "ngspice/ifsim.h"
#include "ngspice/mifdefs.h"
#include "ngspice/mifproto.h"
#include "ngspice/mifparse.h"


static IFparm MIFmPTable[] = {
    IOP("ron", 0, IF_REAL, "resistance on-state"),
    IOP("roff", 1, IF_REAL, "resistance off-state"),
    IOP("vfwd", 2, IF_REAL, "forward voltage"),
    IOP("vrev", 3, IF_REAL, "reverse breakdown voltage"),
    IOP("ilimit", 4, IF_REAL, "limit of on-current"),
    IOP("revilimit", 5, IF_REAL, "limit of breakdown current"),
    IOP("epsilon", 6, IF_REAL, "width quadrat. r 1"),
    IOP("revepsilon", 7, IF_REAL, "width quadratic region 2"),
    IOP("rrev", 8, IF_REAL, "resistance in breakdown"),
};


static IFparm MIFpTable[] = {
    OP("locdata", 9, IF_STRING, "table with constants"),
};


static Mif_Port_Type_t MIFportEnum0[] = {
    MIF_DIFF_CONDUCTANCE,
};


static char *MIFportStr0[] = {
    "gd",
};


static Mif_Conn_Info_t MIFconnTable[] = {
  {
    "ds",
    "diode port",
    MIF_INOUT,
    MIF_DIFF_CONDUCTANCE,
    "gd",
    1,
    MIFportEnum0,
    MIFportStr0,
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
};

static union Mif_Parse_Value ron_default[] = {
    { .rvalue=1.000000e+00 },
};

static union Mif_Parse_Value roff_default[] = {
    { .rvalue=1.000000e+00 },
};

static union Mif_Parse_Value vfwd_default[] = {
    { .rvalue=0.000000e+00 },
};

static union Mif_Parse_Value vrev_default[] = {
    { .rvalue=1.000000e+30 },
};

static union Mif_Parse_Value ilimit_default[] = {
    { .rvalue=1.000000e+30 },
};

static union Mif_Parse_Value revilimit_default[] = {
    { .rvalue=1.000000e+30 },
};

static union Mif_Parse_Value epsilon_default[] = {
    { .rvalue=0.000000e+00 },
};

static union Mif_Parse_Value revepsilon_default[] = {
    { .rvalue=0.000000e+00 },
};

static union Mif_Parse_Value rrev_default[] = {
    { .rvalue=0.000000e+00 },
};


static Mif_Param_Info_t MIFparamTable[] = {
  {
    "ron",
    "resistance on-state",
    MIF_REAL,
    1,
    ron_default,
    MIF_TRUE,
    { .rvalue=1.000000e-06 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "roff",
    "resistance off-state",
    MIF_REAL,
    1,
    roff_default,
    MIF_TRUE,
    { .rvalue=1.000000e-12 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "vfwd",
    "forward voltage",
    MIF_REAL,
    1,
    vfwd_default,
    MIF_TRUE,
    { .rvalue=0.000000e+00 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "vrev",
    "reverse breakdown voltage",
    MIF_REAL,
    1,
    vrev_default,
    MIF_TRUE,
    { .rvalue=0.000000e+00 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "ilimit",
    "limit of on-current",
    MIF_REAL,
    1,
    ilimit_default,
    MIF_TRUE,
    { .rvalue=1.000000e-15 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "revilimit",
    "limit of breakdown current",
    MIF_REAL,
    1,
    revilimit_default,
    MIF_TRUE,
    { .rvalue=1.000000e-15 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "epsilon",
    "width quadrat. r 1",
    MIF_REAL,
    1,
    epsilon_default,
    MIF_TRUE,
    { .rvalue=0.000000e+00 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "revepsilon",
    "width quadratic region 2",
    MIF_REAL,
    1,
    revepsilon_default,
    MIF_TRUE,
    { .rvalue=0.000000e+00 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "rrev",
    "resistance in breakdown",
    MIF_REAL,
    1,
    rrev_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
};


static Mif_Inst_Var_Info_t MIFinst_varTable[] = {
  {
    "locdata",
    "table with constants",
    MIF_STRING,
    MIF_FALSE,
  },
};


extern void cm_sidiode(Mif_Private_t *);

static int val_terms             = 0;
static int val_numNames          = 0;
static int val_numInstanceParms  = 1;
static int val_numModelParms     = 9;
static int val_sizeofMIFinstance = sizeof(MIFinstance);
static int val_sizeofMIFmodel    = sizeof(MIFmodel);

SPICEdev cm_sidiode_info = {
    .DEVpublic = {
        .name = "sidiode",
        .description = "simple diode",
        .terms = &val_terms,
        .numNames = &val_numNames,
        .termNames = NULL,
        .numInstanceParms = &val_numInstanceParms,
        .instanceParms = MIFpTable,
        .numModelParms = &val_numModelParms,
        .modelParms = MIFmPTable,
        .flags = 0,

        .cm_func = cm_sidiode,
        .num_conn = 1,
        .conn = MIFconnTable,
        .num_param = 9,
        .param = MIFparamTable,
        .num_inst_var = 1,
        .inst_var = MIFinst_varTable,
    },

    .DEVparam = NULL,
    .DEVmodParam = MIFmParam,
    .DEVload = MIFload,
    .DEVsetup = MIFsetup,
    .DEVunsetup = MIFunsetup,
    .DEVpzSetup = NULL,
    .DEVtemperature = NULL,
    .DEVtrunc = MIFtrunc,
    .DEVfindBranch = NULL,
    .DEVacLoad = MIFload,
    .DEVaccept = NULL,
    .DEVdestroy = NULL,
    .DEVmodDelete = MIFmDelete,
    .DEVdelete = MIFdelete,
    .DEVsetic = NULL,
    .DEVask = MIFask,
    .DEVmodAsk = MIFmAsk,
    .DEVpzLoad = NULL,
    .DEVconvTest = MIFconvTest,
    .DEVsenSetup = NULL,
    .DEVsenLoad = NULL,
    .DEVsenUpdate = NULL,
    .DEVsenAcLoad = NULL,
    .DEVsenPrint = NULL,
    .DEVsenTrunc = NULL,
    .DEVdisto = NULL,
    .DEVnoise = NULL,
    .DEVsoaCheck = NULL,
    .DEVinstSize = &val_sizeofMIFinstance,
    .DEVmodSize = &val_sizeofMIFmodel,

#ifdef CIDER
    .DEVdump = NULL,
    .DEVacct = NULL,
#endif

#ifdef KLU
    .DEVbindCSC = MIFbindCSC,
    .DEVbindCSCComplex = MIFbindCSCComplex,
    .DEVbindCSCComplexToReal = MIFbindCSCComplexToReal,
#endif
};

