
/*
 * Structures for model: pswitch
 *
 * 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("cntl_off", 0, IF_REAL, "control 'off' val"),
    IOP("cntl_on", 1, IF_REAL, "control 'on' val"),
    IOP("log", 2, IF_FLAG, "Log-linear switch"),
    IOP("r_off", 3, IF_REAL, "off resistance"),
    IOP("r_on", 4, IF_REAL, "on resistance"),
    IOP("r_cntl_in", 5, IF_REAL, "input resistance for control terminal"),
};


static IFparm MIFpTable[] = {
    OP("locdata", 6, IF_STRING, "local static data"),
};


static Mif_Port_Type_t MIFportEnum0[] = {
    MIF_CONDUCTANCE,
    MIF_DIFF_CONDUCTANCE,
};


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


static Mif_Port_Type_t MIFportEnum1[] = {
    MIF_DIFF_CONDUCTANCE,
};


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


static Mif_Conn_Info_t MIFconnTable[] = {
  {
    "cntl_in",
    "input",
    MIF_INOUT,
    MIF_DIFF_CONDUCTANCE,
    "gd",
    2,
    MIFportEnum0,
    MIFportStr0,
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
  {
    "out",
    "resistive output",
    MIF_INOUT,
    MIF_DIFF_CONDUCTANCE,
    "gd",
    1,
    MIFportEnum1,
    MIFportStr1,
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
};

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

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

static union Mif_Parse_Value log_default[] = {
    { .bvalue=MIF_TRUE },
};

static union Mif_Parse_Value r_off_default[] = {
    { .rvalue=1.000000e+12 },
};

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

static union Mif_Parse_Value r_cntl_in_default[] = {
    { .rvalue=1.000000e+12 },
};


static Mif_Param_Info_t MIFparamTable[] = {
  {
    "cntl_off",
    "control 'off' val",
    MIF_REAL,
    1,
    cntl_off_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "cntl_on",
    "control 'on' val",
    MIF_REAL,
    1,
    cntl_on_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "log",
    "Log-linear switch",
    MIF_BOOLEAN,
    1,
    log_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "r_off",
    "off resistance",
    MIF_REAL,
    1,
    r_off_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "r_on",
    "on resistance",
    MIF_REAL,
    1,
    r_on_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "r_cntl_in",
    "input resistance for control terminal",
    MIF_REAL,
    1,
    r_cntl_in_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",
    "local static data",
    MIF_STRING,
    MIF_FALSE,
  },
};


extern void cm_pswitch(Mif_Private_t *);

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

SPICEdev cm_pswitch_info = {
    .DEVpublic = {
        .name = "pswitch",
        .description = "analog PSPICE compatible switch",
        .terms = &val_terms,
        .numNames = &val_numNames,
        .termNames = NULL,
        .numInstanceParms = &val_numInstanceParms,
        .instanceParms = MIFpTable,
        .numModelParms = &val_numModelParms,
        .modelParms = MIFmPTable,
        .flags = 0,

        .cm_func = cm_pswitch,
        .num_conn = 2,
        .conn = MIFconnTable,
        .num_param = 6,
        .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
};

