Qucs-core  0.0.19
Data Structures | Defines | Functions | Variables
check_spice.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <assert.h>
#include <float.h>
#include <ctype.h>
#include "constants.h"
#include "check_spice.h"
#include "qucs_producer.h"
#include "hash.h"
#include "qucsdefs.h"
Include dependency graph for check_spice.cpp:

Go to the source code of this file.

Data Structures

struct  spice_device_t
struct  spice_device_table_t
struct  node_translation_t
struct  unit_translation_t
struct  property_translation_t
struct  property_field_t

Defines

#define foreach_value(values, val)
#define VAL_IS_NUMBER(val)
#define VAL_IS_DONE(val)   ((val) == NULL || (val)->hint & HINT_DONE)

Functions

struct value_tnetlist_reverse_values (struct value_t *values)
struct pair_tnetlist_reverse_pairs (struct pair_t *pairs)
struct node_tnetlist_reverse_nodes (struct node_t *nodes)
struct pair_tnetlist_append_pairs (struct pair_t *p1, struct pair_t *p2)
struct value_tnetlist_append_values (struct value_t *v1, struct value_t *v2)
struct node_tnetlist_append_nodes (struct node_t *n1, struct node_t *n2)
static struct define_tspice_find_definition (const char *n)
static struct node_tspice_translate_node (char *node)
static void spice_value_done (struct value_t *val)
static struct node_tspice_get_nodes (struct definition_t *def)
static const char * spice_evaluate_scale (char *value, char **endptr, double *factor)
static struct value_tspice_create_value (const char *ident)
static struct pair_tspice_get_pairs (struct definition_t *def)
static struct definition_tspice_find_device (struct definition_t *root, char *type)
static struct value_tspice_find_device_instance (struct definition_t *def)
static struct pair_tspice_generate_Model_pairs (struct value_t *values)
static struct pair_tspice_find_property (struct definition_t *def, const char *prop)
static struct pair_tspice_find_property_nocase (struct definition_t *def, const char *prop)
static struct pair_tspice_find_property_nocase (struct pair_t *pair, const char *prop)
static struct value_tspice_find_property (struct value_t *values, const char *prop)
static void spice_set_property_string (struct definition_t *def, const char *key, const char *val)
static double spice_evaluate_value (struct value_t *value)
static void netlist_free_value (struct value_t *value)
static void netlist_free_values (struct value_t *value)
void netlist_free_pair (struct pair_t *pair)
struct pair_tspice_del_property (struct pair_t *root, struct pair_t *pair)
static void spice_adjust_device (struct definition_t *def, struct definition_t *trandef)
static void spice_translate_device (struct definition_t *root, struct definition_t *def)
static struct define_tspice_get_qucs_definition (struct definition_t *def)
static int spice_translate_type (struct definition_t *def)
static int spice_count_nodes (struct definition_t *def)
static void netlist_free_nodes (struct node_t *node)
static void netlist_free_pairs (struct pair_t *pair)
static struct node_tspice_get_node (struct definition_t *def, int pos)
static void spice_translate_nodes (struct definition_t *def, int pass)
static void spice_translate_units (struct definition_t *def)
static void spice_adjust_default_properties (struct definition_t *def)
static void spice_adjust_optional_properties (struct definition_t *def)
void spice_adjust_alias_properties (struct definition_t *def, struct pair_t *pair)
void spice_adjust_properties (struct definition_t *def)
static void spice_append_pair (struct definition_t *def, const char *prop, const char *value, int replace)
static void spice_append_node (struct definition_t *def, char *node)
static char * spice_toupper (char *str)
static void spice_adjust_instance (struct definition_t *def)
static void spice_fixup_definition (struct definition_t *def)
static struct definition_tspice_add_definition (struct definition_t *root, struct definition_t *def)
static void netlist_destroy_intern (struct definition_t *)
static void netlist_free_definition (struct definition_t *def)
void spice_destroy (void)
struct definition_tspice_del_definition (struct definition_t *root, struct definition_t *def)
static char * spice_create_intern_node (void)
static void spice_adjust_vsource_nodes (struct definition_t *up, struct definition_t *dn)
static void spice_adjust_isource_nodes (struct definition_t *left, struct definition_t *right)
static struct definition_tspice_create_definition (struct definition_t *base, const char *type)
static double spice_get_property_value (struct definition_t *def, const char *key)
static void spice_set_property_value (struct definition_t *def, const char *key, double val)
static void spice_extract_properties (struct definition_t *def, struct value_t *values, struct property_field_t *field)
static char * spice_untranslated_text (struct definition_t *def)
static int spice_count_real_values (struct value_t *values)
static struct definition_tspice_translate_source (struct definition_t *root, struct definition_t *def, char type)
static char * spice_create_intern_para (void)
static int spice_evaluate_points (char **type, double start, double stop, double points)
static struct definition_tspice_create_para (struct definition_t *base)
static int spice_count_values (struct value_t *values)
static struct definition_tspice_find_definition (struct definition_t *root, const char *type, char *inst)
static struct definition_tspice_find_definition (struct definition_t *root, const char *type)
static void spice_add_property (struct definition_t *root, const char *type, const char *key, char *value)
static void spice_free_values (struct definition_t *def)
static void spice_collect_external_nodes (struct definition_t *def)
static struct definition_tspice_find_Model (char *instance)
static struct definition_tspice_add_Model (struct definition_t *def)
static struct definition_tspice_find_coupled (struct definition_t *root, struct definition_t *coupled, const char *type, char *inst)
static struct definition_tspice_find_coupled (struct definition_t *root, const char *type, char *inst1, char *inst2)
static struct definition_tspice_find_coupled_inductor (struct definition_t *root, struct definition_t *def, const char *type, char *inst)
static struct value_tspice_get_value_coupled (struct definition_t *def)
static char * spice_coupled_instance (struct definition_t *k1, struct definition_t *k2, struct definition_t *k3)
static struct definition_tspice_translate_coupled (struct definition_t *root, struct definition_t *def)
static struct definition_tspice_find_coupled (struct definition_t *root, qucs::hash< struct definition_t > *coupled, const char *type, char *inst)
static struct definition_tspice_search_coupled (struct definition_t *root, qucs::hash< struct definition_t > *K_hash, qucs::hash< struct definition_t > *L_hash, const char *type, char *inst)
static struct definition_tspice_translate_coupled_x (struct definition_t *root, struct definition_t *def)
static char * spice_create_eqnstr (struct definition_t *def, int p, char type)
static struct definition_tspice_add_edd_equation (struct definition_t *root, struct definition_t *def, int p, struct definition_t **i, struct definition_t **q)
static void spice2g6_nxtpwr (int *seq, int nd)
static double spice_get_value (struct value_t *val)
static char * spice_create_poly (struct value_t *prop, int nd, int integrate)
static struct definition_tspice_translate_poly (struct definition_t *root, struct definition_t *def)
static struct definition_tspice_translate_poly_lc (struct definition_t *root, struct definition_t *def)
static struct definition_tspice_post_translator (struct definition_t *root)
static struct definition_tspice_translate_action (struct definition_t *root, struct definition_t *def)
static void spice_translate_subcircuit (struct definition_t *sub)
static char * spice_create_intern_nodeset (void)
static struct definition_tspice_translate_nodeset (struct definition_t *root, struct definition_t *def)
static struct definition_tspice_translator (struct definition_t *root)
void spice_add_last_hint (struct value_t *val, int hint)
void spice_set_last_hint (struct value_t *val, int hint)
struct definition_tspice_checker_intern (struct definition_t *root)
int spice_checker (void)

Variables

struct definition_tdefinition_root = NULL
struct definition_tsubcircuit_root = NULL
struct definition_tdevice_root = NULL
int spice_errors = 0
char * spice_title = NULL
static struct property_t spice_noprops [] = { PROP_NO_PROP }
static struct property_t req_spice_R []
static struct property_t opt_spice_R []
static struct property_t req_spice_L []
static struct property_t req_spice_C []
static struct property_t req_spice_V []
static struct property_t req_spice_I []
static struct property_t req_spice_G []
static struct property_t req_spice_E []
static struct property_t req_spice_F []
static struct property_t req_spice_H []
static struct property_t req_spice_T []
static struct property_t req_spice_NODESET []
static struct property_t req_spice_IC []
struct define_t spice_definition_available []
struct spice_device_t spice_devices []
struct spice_device_table_t spice_device_table []
struct node_translation_t node_translations []
struct unit_translation_t unit_translations []
struct property_translation_t property_translations []
struct node_tspice_nodes = NULL

Define Documentation

#define foreach_value (   values,
  val 
)
Value:
for ((val) = (values); (val) != NULL; (val) = (val)->next) \
    if (!((val)->hint & HINT_DONE))

Definition at line 179 of file check_spice.cpp.

#define VAL_IS_DONE (   val)    ((val) == NULL || (val)->hint & HINT_DONE)

Definition at line 1383 of file check_spice.cpp.

#define VAL_IS_NUMBER (   val)
Value:
((val) != NULL && \
  (val)->hint & (HINT_NUMBER | HINT_NODE) && \
  !((val)->hint & HINT_DONE))

Definition at line 1378 of file check_spice.cpp.


Function Documentation

struct node_t* netlist_append_nodes ( struct node_t n1,
struct node_t n2 
) [read]

Definition at line 241 of file check_spice.cpp.

struct pair_t* netlist_append_pairs ( struct pair_t p1,
struct pair_t p2 
) [read]

Definition at line 221 of file check_spice.cpp.

struct value_t * netlist_append_values ( struct value_t v1,
struct value_t v2 
) [read]

Definition at line 231 of file check_spice.cpp.

static void netlist_destroy_intern ( struct definition_t root) [static]

Definition at line 1185 of file check_spice.cpp.

static void netlist_free_definition ( struct definition_t def) [static]

Definition at line 1172 of file check_spice.cpp.

static void netlist_free_nodes ( struct node_t node) [static]

Definition at line 859 of file check_spice.cpp.

void netlist_free_pair ( struct pair_t pair)

Definition at line 593 of file check_spice.cpp.

static void netlist_free_pairs ( struct pair_t pair) [static]

Definition at line 869 of file check_spice.cpp.

static void netlist_free_value ( struct value_t value) [static]

Definition at line 576 of file check_spice.cpp.

static void netlist_free_values ( struct value_t value) [static]

Definition at line 584 of file check_spice.cpp.

struct node_t* netlist_reverse_nodes ( struct node_t nodes) [read]

Definition at line 209 of file check_spice.cpp.

struct pair_t* netlist_reverse_pairs ( struct pair_t pairs) [read]

Definition at line 197 of file check_spice.cpp.

struct value_t* netlist_reverse_values ( struct value_t values) [read]

Definition at line 185 of file check_spice.cpp.

static void spice2g6_nxtpwr ( int seq,
int  nd 
) [static]

Definition at line 2178 of file check_spice.cpp.

static struct definition_t* spice_add_definition ( struct definition_t root,
struct definition_t def 
) [static, read]

Definition at line 1161 of file check_spice.cpp.

static struct definition_t* spice_add_edd_equation ( struct definition_t root,
struct definition_t def,
int  p,
struct definition_t **  i,
struct definition_t **  q 
) [static, read]

Definition at line 2143 of file check_spice.cpp.

void spice_add_last_hint ( struct value_t val,
int  hint 
)

Definition at line 3047 of file check_spice.cpp.

static struct definition_t* spice_add_Model ( struct definition_t def) [static, read]

Definition at line 1726 of file check_spice.cpp.

static void spice_add_property ( struct definition_t root,
const char *  type,
const char *  key,
char *  value 
) [static]

Definition at line 1671 of file check_spice.cpp.

void spice_adjust_alias_properties ( struct definition_t def,
struct pair_t pair 
)

Definition at line 1057 of file check_spice.cpp.

static void spice_adjust_default_properties ( struct definition_t def) [static]

Definition at line 977 of file check_spice.cpp.

static void spice_adjust_device ( struct definition_t def,
struct definition_t trandef 
) [static]

Definition at line 620 of file check_spice.cpp.

static void spice_adjust_instance ( struct definition_t def) [static]

Definition at line 1142 of file check_spice.cpp.

static void spice_adjust_isource_nodes ( struct definition_t left,
struct definition_t right 
) [static]

Definition at line 1253 of file check_spice.cpp.

static void spice_adjust_optional_properties ( struct definition_t def) [static]

Definition at line 1001 of file check_spice.cpp.

void spice_adjust_properties ( struct definition_t def)

Definition at line 1073 of file check_spice.cpp.

static void spice_adjust_vsource_nodes ( struct definition_t up,
struct definition_t dn 
) [static]

Definition at line 1241 of file check_spice.cpp.

static void spice_append_node ( struct definition_t def,
char *  node 
) [static]

Definition at line 1126 of file check_spice.cpp.

static void spice_append_pair ( struct definition_t def,
const char *  prop,
const char *  value,
int  replace 
) [static]

Definition at line 1107 of file check_spice.cpp.

int spice_checker ( void  )

Definition at line 3071 of file check_spice.cpp.

struct definition_t * spice_checker_intern ( struct definition_t root) [read]

Definition at line 3061 of file check_spice.cpp.

static void spice_collect_external_nodes ( struct definition_t def) [static]

Definition at line 1697 of file check_spice.cpp.

static int spice_count_nodes ( struct definition_t def) [static]

Definition at line 851 of file check_spice.cpp.

static int spice_count_real_values ( struct value_t values) [static]

Definition at line 1388 of file check_spice.cpp.

static int spice_count_values ( struct value_t values) [static]

Definition at line 1638 of file check_spice.cpp.

static char* spice_coupled_instance ( struct definition_t k1,
struct definition_t k2,
struct definition_t k3 
) [static]

Definition at line 1816 of file check_spice.cpp.

static struct definition_t* spice_create_definition ( struct definition_t base,
const char *  type 
) [static, read]

Definition at line 1266 of file check_spice.cpp.

static char* spice_create_eqnstr ( struct definition_t def,
int  p,
char  type 
) [static]

Definition at line 2134 of file check_spice.cpp.

static char* spice_create_intern_node ( void  ) [static]

Definition at line 1231 of file check_spice.cpp.

static char* spice_create_intern_nodeset ( void  ) [static]

Definition at line 2908 of file check_spice.cpp.

static char* spice_create_intern_para ( void  ) [static]

Definition at line 1580 of file check_spice.cpp.

static struct definition_t* spice_create_para ( struct definition_t base) [static, read]

Definition at line 1615 of file check_spice.cpp.

static char* spice_create_poly ( struct value_t prop,
int  nd,
int  integrate 
) [static]

Definition at line 2241 of file check_spice.cpp.

static struct value_t* spice_create_value ( const char *  ident) [static, read]

Definition at line 360 of file check_spice.cpp.

struct definition_t* spice_del_definition ( struct definition_t root,
struct definition_t def 
) [read]

Definition at line 1210 of file check_spice.cpp.

struct pair_t* spice_del_property ( struct pair_t root,
struct pair_t pair 
) [read]

Definition at line 601 of file check_spice.cpp.

void spice_destroy ( void  )

Definition at line 1194 of file check_spice.cpp.

static int spice_evaluate_points ( char **  type,
double  start,
double  stop,
double  points 
) [static]

Definition at line 1591 of file check_spice.cpp.

static const char* spice_evaluate_scale ( char *  value,
char **  endptr,
double *  factor 
) [static]

Definition at line 324 of file check_spice.cpp.

static double spice_evaluate_value ( struct value_t value) [static]

Definition at line 557 of file check_spice.cpp.

static void spice_extract_properties ( struct definition_t def,
struct value_t values,
struct property_field_t field 
) [static]

Definition at line 1321 of file check_spice.cpp.

static struct definition_t* spice_find_coupled ( struct definition_t root,
struct definition_t coupled,
const char *  type,
char *  inst 
) [static, read]

Definition at line 1754 of file check_spice.cpp.

static struct definition_t* spice_find_coupled ( struct definition_t root,
const char *  type,
char *  inst1,
char *  inst2 
) [static, read]

Definition at line 1772 of file check_spice.cpp.

static struct definition_t* spice_find_coupled ( struct definition_t root,
qucs::hash< struct definition_t > *  coupled,
const char *  type,
char *  inst 
) [static, read]

Definition at line 1977 of file check_spice.cpp.

static struct definition_t* spice_find_coupled_inductor ( struct definition_t root,
struct definition_t def,
const char *  type,
char *  inst 
) [static, read]

Definition at line 1791 of file check_spice.cpp.

static struct define_t* spice_find_definition ( const char *  n) [static, read]

Definition at line 251 of file check_spice.cpp.

static struct definition_t* spice_find_definition ( struct definition_t root,
const char *  type,
char *  inst 
) [static, read]

Definition at line 1648 of file check_spice.cpp.

static struct definition_t* spice_find_definition ( struct definition_t root,
const char *  type 
) [static, read]

Definition at line 1661 of file check_spice.cpp.

static struct definition_t* spice_find_device ( struct definition_t root,
char *  type 
) [static, read]

Definition at line 425 of file check_spice.cpp.

static struct value_t* spice_find_device_instance ( struct definition_t def) [static, read]

Definition at line 439 of file check_spice.cpp.

static struct definition_t* spice_find_Model ( char *  instance) [static, read]

Definition at line 1714 of file check_spice.cpp.

static struct pair_t* spice_find_property ( struct definition_t def,
const char *  prop 
) [static, read]

Definition at line 493 of file check_spice.cpp.

static struct value_t* spice_find_property ( struct value_t values,
const char *  prop 
) [static, read]

Definition at line 528 of file check_spice.cpp.

static struct pair_t* spice_find_property_nocase ( struct definition_t def,
const char *  prop 
) [static, read]

Definition at line 504 of file check_spice.cpp.

static struct pair_t* spice_find_property_nocase ( struct pair_t pair,
const char *  prop 
) [static, read]

Definition at line 516 of file check_spice.cpp.

static void spice_fixup_definition ( struct definition_t def) [static]

Definition at line 1149 of file check_spice.cpp.

static void spice_free_values ( struct definition_t def) [static]

Definition at line 1681 of file check_spice.cpp.

static struct pair_t* spice_generate_Model_pairs ( struct value_t values) [static, read]

Definition at line 472 of file check_spice.cpp.

static struct node_t* spice_get_node ( struct definition_t def,
int  pos 
) [static, read]

Definition at line 878 of file check_spice.cpp.

static struct node_t* spice_get_nodes ( struct definition_t def) [static, read]

Definition at line 292 of file check_spice.cpp.

static struct pair_t* spice_get_pairs ( struct definition_t def) [static, read]

Definition at line 378 of file check_spice.cpp.

static double spice_get_property_value ( struct definition_t def,
const char *  key 
) [static]

Definition at line 1279 of file check_spice.cpp.

static struct define_t* spice_get_qucs_definition ( struct definition_t def) [static, read]

Definition at line 735 of file check_spice.cpp.

static double spice_get_value ( struct value_t val) [static]

Definition at line 2224 of file check_spice.cpp.

static struct value_t* spice_get_value_coupled ( struct definition_t def) [static, read]

Definition at line 1806 of file check_spice.cpp.

static struct definition_t* spice_post_translator ( struct definition_t root) [static, read]

Definition at line 2516 of file check_spice.cpp.

static struct definition_t* spice_search_coupled ( struct definition_t root,
qucs::hash< struct definition_t > *  K_hash,
qucs::hash< struct definition_t > *  L_hash,
const char *  type,
char *  inst 
) [static, read]

Definition at line 1999 of file check_spice.cpp.

void spice_set_last_hint ( struct value_t val,
int  hint 
)

Definition at line 3054 of file check_spice.cpp.

static void spice_set_property_string ( struct definition_t def,
const char *  key,
const char *  val 
) [static]

Definition at line 539 of file check_spice.cpp.

static void spice_set_property_value ( struct definition_t def,
const char *  key,
double  val 
) [static]

Definition at line 1287 of file check_spice.cpp.

static char* spice_toupper ( char *  str) [static]

Definition at line 1133 of file check_spice.cpp.

static struct definition_t* spice_translate_action ( struct definition_t root,
struct definition_t def 
) [static, read]

Definition at line 2799 of file check_spice.cpp.

static struct definition_t* spice_translate_coupled ( struct definition_t root,
struct definition_t def 
) [static, read]

Definition at line 1829 of file check_spice.cpp.

static struct definition_t* spice_translate_coupled_x ( struct definition_t root,
struct definition_t def 
) [static, read]

Definition at line 2038 of file check_spice.cpp.

static void spice_translate_device ( struct definition_t root,
struct definition_t def 
) [static]

Definition at line 705 of file check_spice.cpp.

static struct node_t* spice_translate_node ( char *  node) [static, read]

Definition at line 259 of file check_spice.cpp.

static void spice_translate_nodes ( struct definition_t def,
int  pass 
) [static]

Definition at line 888 of file check_spice.cpp.

static struct definition_t* spice_translate_nodeset ( struct definition_t root,
struct definition_t def 
) [static, read]

Definition at line 2918 of file check_spice.cpp.

static struct definition_t* spice_translate_poly ( struct definition_t root,
struct definition_t def 
) [static, read]

Definition at line 2301 of file check_spice.cpp.

static struct definition_t* spice_translate_poly_lc ( struct definition_t root,
struct definition_t def 
) [static, read]

Definition at line 2434 of file check_spice.cpp.

static struct definition_t* spice_translate_source ( struct definition_t root,
struct definition_t def,
char  type 
) [static, read]

Definition at line 1405 of file check_spice.cpp.

static void spice_translate_subcircuit ( struct definition_t sub) [static]

Definition at line 2894 of file check_spice.cpp.

static int spice_translate_type ( struct definition_t def) [static]

Definition at line 766 of file check_spice.cpp.

static void spice_translate_units ( struct definition_t def) [static]

Definition at line 953 of file check_spice.cpp.

static struct definition_t* spice_translator ( struct definition_t root) [static, read]

Definition at line 2946 of file check_spice.cpp.

static char* spice_untranslated_text ( struct definition_t def) [static]

Definition at line 1345 of file check_spice.cpp.

static void spice_value_done ( struct value_t val) [static]

Definition at line 284 of file check_spice.cpp.


Variable Documentation

struct definition_t* definition_root = NULL

Definition at line 47 of file check_spice.cpp.

struct definition_t * device_root = NULL

Definition at line 49 of file check_spice.cpp.

struct property_t opt_spice_R[] [static]
Initial value:
 {
  { "Temp", PROP_REAL, { 26.85, PROP_NO_STR }, PROP_MIN_VAL (K) },
  PROP_NO_PROP }

Definition at line 58 of file check_spice.cpp.

struct property_t req_spice_C[] [static]
Initial value:
 {
  { "C", PROP_REAL, { 1e-12, PROP_NO_STR }, PROP_NO_RANGE }, PROP_NO_PROP }

Definition at line 65 of file check_spice.cpp.

struct property_t req_spice_E[] [static]
Initial value:

Definition at line 77 of file check_spice.cpp.

struct property_t req_spice_F[] [static]
Initial value:

Definition at line 80 of file check_spice.cpp.

struct property_t req_spice_G[] [static]
Initial value:

Definition at line 74 of file check_spice.cpp.

struct property_t req_spice_H[] [static]
Initial value:

Definition at line 83 of file check_spice.cpp.

struct property_t req_spice_I[] [static]
Initial value:
 {
  { "I", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_NO_RANGE }, PROP_NO_PROP }

Definition at line 71 of file check_spice.cpp.

struct property_t req_spice_IC[] [static]
Initial value:

Definition at line 92 of file check_spice.cpp.

struct property_t req_spice_L[] [static]
Initial value:
 {
  { "L", PROP_REAL, { 1e-9, PROP_NO_STR }, PROP_NO_RANGE }, PROP_NO_PROP }

Definition at line 62 of file check_spice.cpp.

struct property_t req_spice_NODESET[] [static]
Initial value:

Definition at line 89 of file check_spice.cpp.

struct property_t req_spice_R[] [static]
Initial value:

Definition at line 56 of file check_spice.cpp.

struct property_t req_spice_T[] [static]
Initial value:

Definition at line 86 of file check_spice.cpp.

struct property_t req_spice_V[] [static]
Initial value:

Definition at line 68 of file check_spice.cpp.

Definition at line 96 of file check_spice.cpp.

Definition at line 50 of file check_spice.cpp.

struct node_t * spice_nodes = NULL

Definition at line 1693 of file check_spice.cpp.

struct property_t spice_noprops[] = { PROP_NO_PROP } [static]

Definition at line 54 of file check_spice.cpp.

char * spice_title = NULL

Definition at line 51 of file check_spice.cpp.

struct definition_t* subcircuit_root = NULL

Definition at line 48 of file check_spice.cpp.