
/*
 * Structures for model: xfer
 *
 * 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("table", 0, (IF_REAL|IF_VECTOR), "PWL table: frequency/magnitude/phase"),
    IOP("file", 1, IF_STRING, "File in Touchstone format"),
    IOP("r_i", 2, IF_FLAG, "table is in real/imaginary format"),
    IOP("db", 3, IF_FLAG, "table is in magnitude(dB)/phase format"),
    IOP("rad", 4, IF_FLAG, "phase in radians, not degrees"),
    IOP("span", 5, IF_INTEGER, "Length of table rows"),
    IOP("offset", 6, IF_INTEGER, "Offset within row"),
};


static IFparm MIFpTable[] = {
    OP("table", 7, IF_STRING, "Internal copy of data"),
    OP("warned", 8, IF_INTEGER, "Warning indicator"),
};


static Mif_Port_Type_t MIFportEnum0[] = {
    MIF_VOLTAGE,
    MIF_DIFF_VOLTAGE,
    MIF_CURRENT,
    MIF_DIFF_CURRENT,
};


static char *MIFportStr0[] = {
    "v",
    "vd",
    "i",
    "id",
};


static Mif_Port_Type_t MIFportEnum1[] = {
    MIF_VOLTAGE,
    MIF_DIFF_VOLTAGE,
    MIF_CURRENT,
    MIF_DIFF_CURRENT,
};


static char *MIFportStr1[] = {
    "v",
    "vd",
    "i",
    "id",
};


static Mif_Conn_Info_t MIFconnTable[] = {
  {
    "in",
    "input",
    MIF_IN,
    MIF_VOLTAGE,
    "v",
    4,
    MIFportEnum0,
    MIFportStr0,
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
  {
    "out",
    "output",
    MIF_OUT,
    MIF_VOLTAGE,
    "v",
    4,
    MIFportEnum1,
    MIFportStr1,
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
  },
};

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

static union Mif_Parse_Value r_i_default[] = {
    { .bvalue=MIF_FALSE },
};

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

static union Mif_Parse_Value rad_default[] = {
    { .bvalue=MIF_FALSE },
};

static union Mif_Parse_Value span_default[] = {
    { .ivalue=3 },
};

static union Mif_Parse_Value offset_default[] = {
    { .ivalue=1 },
};


static Mif_Param_Info_t MIFparamTable[] = {
  {
    "table",
    "PWL table: frequency/magnitude/phase",
    MIF_REAL,
    1,
    table_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_TRUE,
    MIF_FALSE,
    0,
    MIF_TRUE,
    3,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "file",
    "File in Touchstone format",
    MIF_STRING,
    0,
    NULL,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "r_i",
    "table is in real/imaginary format",
    MIF_BOOLEAN,
    1,
    r_i_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "db",
    "table is in magnitude(dB)/phase format",
    MIF_BOOLEAN,
    1,
    db_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "rad",
    "phase in radians, not degrees",
    MIF_BOOLEAN,
    1,
    rad_default,
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "span",
    "Length of table rows",
    MIF_INTEGER,
    1,
    span_default,
    MIF_TRUE,
    { .ivalue=3 },
    MIF_FALSE,
    { .bvalue=MIF_FALSE },
    MIF_FALSE,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_FALSE,
    0,
    MIF_TRUE,
  },
  {
    "offset",
    "Offset within row",
    MIF_INTEGER,
    1,
    offset_default,
    MIF_TRUE,
    { .ivalue=1 },
    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[] = {
  {
    "table",
    "Internal copy of data",
    MIF_STRING,
    MIF_FALSE,
  },
  {
    "warned",
    "Warning indicator",
    MIF_INTEGER,
    MIF_FALSE,
  },
};


extern void cm_xfer(Mif_Private_t *);

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

SPICEdev cm_xfer_info = {
    .DEVpublic = {
        .name = "xfer",
        .description = "AC transfer function block",
        .terms = &val_terms,
        .numNames = &val_numNames,
        .termNames = NULL,
        .numInstanceParms = &val_numInstanceParms,
        .instanceParms = MIFpTable,
        .numModelParms = &val_numModelParms,
        .modelParms = MIFmPTable,
        .flags = 0,

        .cm_func = cm_xfer,
        .num_conn = 2,
        .conn = MIFconnTable,
        .num_param = 7,
        .param = MIFparamTable,
        .num_inst_var = 2,
        .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
};

