
/*
 * Structures for model: bidi_bridge
 *
 * 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("direction", 0, IF_INTEGER, "force direction"),
    IOP("input_load", 1, IF_REAL, "capacitive input load (F)"),
    IOP("strength", 2, IF_INTEGER, "output strength"),
    IOP("smooth", 3, IF_INTEGER, "smoothing level"),
    IOP("in_low", 4, IF_REAL, "maximum 0-valued analog input"),
    IOP("in_high", 5, IF_REAL, "minimum 1-valued analog input"),
    IOP("out_low", 6, IF_REAL, "minimum analog output voltage for 'ZERO' digital input"),
    IOP("out_high", 7, IF_REAL, "maximum analog output voltage for 'ONE' digital input"),
    IOP("drive_low", 8, IF_REAL, "max current to ground"),
    IOP("drive_high", 9, IF_REAL, "max current to ground"),
    IOP("r_stl", 10, IF_REAL, "low taper resistance"),
    IOP("r_sth", 11, IF_REAL, "high taper resistance"),
    IOP("r_low", 12, IF_REAL, "drive resistor to ground"),
    IOP("r_high", 13, IF_REAL, "drive resistor to out_high"),
    IOP("t_rise", 14, IF_REAL, "rise time 0 -> 1"),
    IOP("t_fall", 15, IF_REAL, "fall time 1 -> 0"),
    IOP("rise_delay", 16, IF_REAL, "rise delay 0 -> 1"),
    IOP("fall_delay", 17, IF_REAL, "fall delay 1 -> 0"),
};


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


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


static Mif_Port_Type_t MIFportEnum1[] = {
    MIF_DIGITAL,
};


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


static Mif_Port_Type_t MIFportEnum2[] = {
    MIF_DIGITAL,
};


static char *MIFportStr2[] = {
    "d",
};


static Mif_Conn_Info_t MIFconnTable[] = {
  {
    "a",
    "analog",
    MIF_INOUT,
    MIF_CONDUCTANCE,
    "g",
    2,
    MIFportEnum0,
    MIFportStr0,
    MIF_TRUE,
    MIF_TRUE,
    1,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
  {
    "d",
    "digital in/out",
    MIF_INOUT,
    MIF_DIGITAL,
    "d",
    1,
    MIFportEnum1,
    MIFportStr1,
    MIF_TRUE,
    MIF_TRUE,
    1,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
  {
    "dir",
    "direction",
    MIF_IN,
    MIF_DIGITAL,
    "d",
    1,
    MIFportEnum2,
    MIFportStr2,
    MIF_TRUE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
};

static union Mif_Parse_Value direction_default[] = {
    { .ivalue=2 },
};

static union Mif_Parse_Value input_load_default[] = {
    { .rvalue=1.000000e-12 },
};

static union Mif_Parse_Value strength_default[] = {
    { .ivalue=0 },
};

static union Mif_Parse_Value smooth_default[] = {
    { .ivalue=0 },
};

static union Mif_Parse_Value in_low_default[] = {
    { .rvalue=1.000000e-01 },
};

static union Mif_Parse_Value in_high_default[] = {
    { .rvalue=9.000000e-01 },
};

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

static union Mif_Parse_Value out_high_default[] = {
    { .rvalue=3.300000e+00 },
};

static union Mif_Parse_Value drive_low_default[] = {
    { .rvalue=2.000000e-02 },
};

static union Mif_Parse_Value drive_high_default[] = {
    { .rvalue=2.000000e-02 },
};

static union Mif_Parse_Value r_stl_default[] = {
    { .rvalue=2.000000e+01 },
};

static union Mif_Parse_Value r_sth_default[] = {
    { .rvalue=2.000000e+01 },
};

static union Mif_Parse_Value r_low_default[] = {
    { .rvalue=1.000000e+04 },
};

static union Mif_Parse_Value r_high_default[] = {
    { .rvalue=1.000000e+04 },
};

static union Mif_Parse_Value t_rise_default[] = {
    { .rvalue=1.000000e-09 },
};

static union Mif_Parse_Value t_fall_default[] = {
    { .rvalue=1.000000e-09 },
};

static union Mif_Parse_Value rise_delay_default[] = {
    { .rvalue=1.000000e-09 },
};

static union Mif_Parse_Value fall_delay_default[] = {
    { .rvalue=1.000000e-09 },
};


static Mif_Param_Info_t MIFparamTable[] = {
  {
    "direction",
    "force direction",
    MIF_INTEGER,
    1,
    direction_default,
    MIF_TRUE,
    { .ivalue=0 },
    MIF_TRUE,
    { .ivalue=2 },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "input_load",
    "capacitive input load (F)",
    MIF_REAL,
    1,
    input_load_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "strength",
    "output strength",
    MIF_INTEGER,
    1,
    strength_default,
    MIF_TRUE,
    { .ivalue=0 },
    MIF_TRUE,
    { .ivalue=2 },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "smooth",
    "smoothing level",
    MIF_INTEGER,
    1,
    smooth_default,
    MIF_TRUE,
    { .ivalue=0 },
    MIF_TRUE,
    { .ivalue=2 },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "in_low",
    "maximum 0-valued analog input",
    MIF_REAL,
    1,
    in_low_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "in_high",
    "minimum 1-valued analog input",
    MIF_REAL,
    1,
    in_high_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "out_low",
    "minimum analog output voltage for 'ZERO' digital input",
    MIF_REAL,
    1,
    out_low_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "out_high",
    "maximum analog output voltage for 'ONE' digital input",
    MIF_REAL,
    1,
    out_high_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "drive_low",
    "max current to ground",
    MIF_REAL,
    1,
    drive_low_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "drive_high",
    "max current to ground",
    MIF_REAL,
    1,
    drive_high_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_stl",
    "low taper resistance",
    MIF_REAL,
    1,
    r_stl_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,
  },
  {
    "r_sth",
    "high taper resistance",
    MIF_REAL,
    1,
    r_sth_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,
  },
  {
    "r_low",
    "drive resistor to ground",
    MIF_REAL,
    1,
    r_low_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,
  },
  {
    "r_high",
    "drive resistor to out_high",
    MIF_REAL,
    1,
    r_high_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,
  },
  {
    "t_rise",
    "rise time 0 -> 1",
    MIF_REAL,
    1,
    t_rise_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,
  },
  {
    "t_fall",
    "fall time 1 -> 0",
    MIF_REAL,
    1,
    t_fall_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,
  },
  {
    "rise_delay",
    "rise delay 0 -> 1",
    MIF_REAL,
    1,
    rise_delay_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,
  },
  {
    "fall_delay",
    "fall delay 1 -> 0",
    MIF_REAL,
    1,
    fall_delay_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,
  },
};


extern void cm_bidi_bridge(Mif_Private_t *);

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

SPICEdev cm_bidi_bridge_info = {
    .DEVpublic = {
        .name = "bidi_bridge",
        .description = "bidirectional digital/analog node bridge",
        .terms = &val_terms,
        .numNames = &val_numNames,
        .termNames = NULL,
        .numInstanceParms = &val_numInstanceParms,
        .instanceParms = NULL,
        .numModelParms = &val_numModelParms,
        .modelParms = MIFmPTable,
        .flags = 0,

        .cm_func = cm_bidi_bridge,
        .num_conn = 3,
        .conn = MIFconnTable,
        .num_param = 18,
        .param = MIFparamTable,
        .num_inst_var = 0,
        .inst_var = NULL,
    },

    .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
};

