1 /*---------------------------------------------------------------------
2 Do not change this data manually,
3 it will be automatically updated by RCS
7 ----------------------------------------------------------------------*/
9 * Copyright (c) 2002 Nederlandse NXP Semiconductors
10 * NXP Research Laboratories
11 * Eindhoven, The Netherlands
14 * Author : Andreas Gessner
15 * Co-Author : Bart Kost, Rob Klaassen
19 * History : <date> <name> <changes>
20 * 30-01-02 Andreas Gessner Updated according to the type names
21 * stated in the SDD V0.7
22 * 13-02-02 Andreas Gessner Updated according to the SDD V0.8
23 * 05-03-02 Andreas Gessner Added: err_parameter_not_readable,
24 * err_parameter_not_writeable
26 * -> p_model_data added as argument
27 * (needed to select default values,
29 * 13-03-02 Andreas Gessner Nodal voltages added to
30 * instance variables structure.
31 * Initial values added, controlling
34 * 20-03-02 Andreas Gessner Branch seperated -> branch type
35 * not needed anymore, branch_voltages
36 * deleted, branch charges added,
37 * gmin_status included
40 * 05-11-02 Bart Kost Changed interface to support
41 * different clipping values for N/P,
42 * removed pp_op_info (duplicate),
43 * renamed from PMK_ to SK_.
46 * This file declares the data structures of the SiMKit
59 #include "stdarg.h" /* Needed for debugging */
62 * The SiMKit model interface version number.
63 * Any time the interface changes this value has to be increased.
64 * The SiMKit adapters for Pstar, spectre and ADS use this define also
65 * to check whether their code supports the interface version the compiled
66 * model library reports.
68 * Version 1: February 2007 The first numbered version of the SK interface
69 * Version 2: February 2007 Added parameter 'p_is_param_changed' to
70 * set_model_params and to set_inst_params (ER18977)
71 * Added p_ev_ig_available array to SK_MODEL (ER19057)
73 #define SK_INTERFACE_VERSION 2
76 typedef char sk_boolean
;
77 typedef int sk_integer
;
78 typedef double sk_real
;
79 typedef short sk_short_integer
;
80 typedef float sk_short_real
;
82 /********************************************************************
84 ********************************************************************/
87 #define SK_BRANCH_CURRENT( branch_nr) \
88 p_i_data->inst_variables.p_output_ev[branch_nr].value
89 #define SK_CONDUCTANCE( branch_nr, ctrl_ev_nr) \
90 p_i_data->inst_variables.p_output_ev[branch_nr].p_derivatives[ctrl_ev_nr]
91 #define SK_BRANCH_CHARGE( branch_nr) \
92 p_i_data->inst_variables.p_output_ev[branch_nr].value
93 #define SK_CAPACITANCE( branch_nr, ctrl_ev_nr) \
94 p_i_data->inst_variables.p_output_ev[branch_nr].p_derivatives[ctrl_ev_nr]
96 /* Insert noise in the instance variables structure */
97 #define SK_SET_BIAS_DEP_NOISE( source_nr, value ) p_i_data->inst_variables.p_bias_dep_noise_parts[source_nr] = value;
98 #define SK_SET_FREQ_DEP_NOISE( source_nr, value ) p_i_data->inst_variables.p_freq_dep_noise_parts[source_nr] = value;
101 /********************************************************************
102 * D A T A D E C L A R A T I O N S *
103 ********************************************************************/
105 typedef unsigned int sk_unint
;
106 typedef unsigned int SK_MASK_TYPE
;
108 typedef SK_MASK_TYPE SK_AFFECTS_TYPE
;
109 #define SK_AT_AFFECTS_NONE 0x0000
110 #define SK_AT_TEMP_AFFECTS 0x0001
111 #define SK_AT_AFFECTS_OP_POINT 0x0002
112 #define SK_AT_OP_POINT_AFFECTS 0x0004
114 typedef SK_MASK_TYPE SK_INIT_CONTROL
;
115 #define SK_IC_EVAL_COMMON_PARAMS 0x0001
116 #define SK_IC_GEOM_SCALING 0x0002
117 #define SK_IC_TEMP_SCALING 0x0004
118 #define SK_IC_MULT_SCALING 0x0008
120 typedef SK_MASK_TYPE SK_EVAL_CONTROL
;
121 #define SK_EC_CURRENTS 0x0001
122 #define SK_EC_CHARGES 0x0002
123 #define SK_EC_CONDUCTANCES 0x0004
124 #define SK_EC_CAPACITANCES 0x0008
125 #define SK_EC_OP_INFO 0x0010
126 #define SK_EC_BIAS_DEP_NOISE 0x0020
127 #define SK_EC_FREQ_DEP_NOISE 0x0040
128 #define SK_EC_H_NOISE 0x0080
129 #define SK_EC_U_NOISE 0x0100
130 #define SK_EC_H_NOISE_ADS 0x0200
132 typedef SK_MASK_TYPE SK_CLIP_TYPE
;
133 #define SK_CB_NONE 0x0000
134 #define SK_CB_LOWER 0x0001
135 #define SK_CB_UPPER 0x0010
136 #define SK_CB_BOTH 0x0011
139 * Parameter scaling types to support the Spectre 'scale' parameter.
140 * Maxiset instance parameters that have a length in their unit, are scaled.
141 * For example, the value of a parameter with unit "m^2" is
142 * multiplied by factor^2. This also goes for complex units, e.g. m^2/V.
146 SK_SF_NONE
, /**< no length unit */
147 SK_SF_DIVIDE
, /**< 1/m */
148 SK_SF_POW_MIN_TWO
, /**< 1/m^2 */
149 SK_SF_POW_MIN_THREE
, /**< 1/m^3 */
150 SK_SF_POW_MIN_FOUR
, /**< 1/m^4 */
151 SK_SF_MULTIPLY
, /**< m */
152 SK_SF_POW_TWO
, /**< m^2 */
153 SK_SF_POW_THREE
, /**< m^3 */
154 SK_SF_POW_FOUR
/**< m^4 */
157 /* Model family type for several uses:
158 * 1) Determine which initial guess to use by default
159 * 2) Determine if Vds limiting should be performed (unwanted SD interchange)
164 SK_MODEL_FAMILY_MOST
, /* SD interchange limiting */
165 SK_MODEL_FAMILY_BJT
, /* exponent limiting */
166 SK_MODEL_FAMILY_GENERIC
/* no special processing */
169 /* SK_device_type for internal use (p_data->type) and calling of init_model() */
170 #define SK_DT_N 0x0001
171 #define SK_DT_P 0x0002
172 #define SK_DT_NPN 0x0004
173 #define SK_DT_PNP 0x0008
174 #define SK_DT_NPNV 0x0010
175 #define SK_DT_PNPV 0x0020
176 #define SK_DT_NPNL 0x0040
177 #define SK_DT_PNPL 0x0080
178 #define SK_DT_NONE 0x4000
179 #define SK_DT_DEFAULT 0x8000
181 /* ADS known only N or P, so use these. NEVER use these in the models! */
182 #define SK_DT_GENERIC_N (SK_DT_N | SK_DT_NPN | SK_DT_NPNV | SK_DT_NPNL)
183 #define SK_DT_GENERIC_P (SK_DT_P | SK_DT_PNP | SK_DT_PNPV | SK_DT_PNPL)
185 #define SK_NODE_NUMBER_NONE -1
204 SK_ERR_PARAMETER_NOT_READABLE
,
205 SK_ERR_PARAMETER_NOT_WRITEABLE
,
206 SK_ERR_UNKNOWN_PARAMETER
,
207 SK_ERR_UNKNOWN_TYPE_STRING
,
215 const SK_NODE_TYPE type
;
220 const sk_unint number
;
222 const SK_NODE
*p_pos_node
;
223 const SK_NODE
*p_neg_node
;
224 const sk_unint n_ctrl_ev
;
225 const sk_unint
*p_ctrl_ev_index
;
231 * SK_NT_THERMAL : noise is neither function of frequency nor time varying
232 * SK_NT_SHOT : noise is time varying, but not a function of frequency
233 * SK_NT_FLICKER : noise = |h(t)|/frequency
234 * SK_NT_UNCORR : general case where noise = |h(t)|*|U(|h(t)|,f)|
235 * SK_NT_CORR_REAL : general case of real correlated sources
236 * SK_NT_CORR_IMAG : general case of imag correlated sources
250 * The spectral current density is given by noise = |h(t)|*|U(|h|,f)|.
251 * So for each source there is a bias dep part h(t) and a
252 * freq dep part u(|h|,f). If a u-function also depends on h-functions
253 * of other sources, then p_foreign_h_index is used to store
254 * source number of these noise sources.
255 * The p_foreign_h_index is set in the model code.
256 * Currently only mos1100 and mos1101 have noise source sight for which
257 * p_foreign_h_index is used.
258 * The p_foreign_h_index can be used for all noise types (SK_NOISE_TYPE).
259 * The nodes p_pos/neg_node_corr are used to model correlated noise sources.
263 const sk_unint number
;
265 const SK_NOISE_TYPE type
;
266 const SK_NODE
*p_pos_node
;
267 const SK_NODE
*p_neg_node
;
268 const SK_NODE
*p_pos_node_corr
;
269 const SK_NODE
*p_neg_node_corr
;
270 const sk_unint n_foreign_h
;
271 const sk_unint
*p_foreign_h_index
;
287 sk_real d2result_ddV
;
288 sk_real d2result_dTdV
;
298 sk_real dOne_over_Vt_dT
;
307 SK_LIM_TYPE limiting_type
;
310 sk_boolean inverse_function_applied
;
311 sk_boolean dc_or_disc_timestep
;
314 SK_ERROR (*p_eval_diode
) (
323 sk_boolean spec_approx
,
324 sk_boolean dc_or_disc_timestep
,
325 sk_integer iter_count
,
326 sk_boolean
*p_inverse_func_applied
,
329 SK_ERROR (*p_eval_exp
) (
332 sk_real
*p_value
, /* out */
333 sk_real
*p_dvalue
); /* out */
335 SK_ERROR (*p_eval_v_check
) (
337 sk_real Imax
, /* in */
339 sk_real
*p_v_check
); /* out */
341 SK_ERROR (*p_limit_temperature
) (
344 sk_boolean spec_approx
,
345 sk_integer iter_count
,
346 sk_boolean
*p_inverse_func_applied
);
347 /* Functions eval_v_check_new, eval_exp, eval_diode with temperature derivatives */
348 /* Init values for linearized exp(V/Vt) */
349 SK_ERROR (*p_eval_v_check_new
) (
350 sk_real Imax
, /* in */
352 sk_real dIs_dT
, /* in */
353 sk_real One_over_Vt
, /* in */
354 sk_real dOne_over_Vt_dT
, /* in */
355 SK_EXPLIM_PARAMS
*p_params
); /* out */
357 /* Calculates the possibly linearized exp(V/Vt) */
358 SK_ERROR (*p_eval_explim_new
) (
360 SK_EXPLIM_PARAMS
*p_params
, /* in */
361 SK_EXPLIM_RESULTS
*p_results
); /* out */
363 /* Calculates the possibly linearized Is*(exp(V/Vt) -1) */
364 SK_ERROR (*p_eval_diode_new
) (
368 sk_boolean spec_approx
,
369 sk_boolean dc_or_disc_timestep
,
370 sk_integer iter_count
,
371 sk_boolean
*p_inverse_func_applied
,
372 SK_EXPLIM_PARAMS
*p_params
,
373 SK_EXPLIM_RESULTS
*p_results
);
377 /* New initial guess */
396 } SK_INITIAL_GUESS_TYPE
;
398 typedef sk_real SK_INITIAL_EV
;
399 typedef unsigned SK_REGION
;
401 /* Definition structure for EVs. One per EV. */
404 const SK_INITIAL_EV
*p_initial_value
;
405 const SK_NODE
*p_pos_node
;
406 const SK_NODE
*p_neg_node
;
409 /* Value storage for EVs. One per EV. */
413 sk_real previous_value
;
414 sk_real not_truncated_value
;
415 sk_boolean is_truncated
;
416 sk_boolean is_initial_guess
;
417 const SK_EV_DESCRIP
*p_ev_descrip
;
420 /* Value storage for output variables (currents, charges and their derivatives).
425 sk_real
*p_derivatives
;
426 const SK_BRANCH
*p_ev_descrip
;
430 /* data structure used to transfer the bias from the adapter */
431 /* to the Modelkit and to transfer the calculated quantities */
432 /* from the Modelkit to the simulator adapters */
442 /* EVs. Number of entries = N_EV */
445 /* Output values and derivatives. Number of entries = N_TOTAL_BRANCHES */
446 SK_OUTPUT_EV
*p_output_ev
;
449 /* entries : [N_NOISE_SOURCES] */
450 sk_real
*p_bias_dep_noise_parts
;
451 sk_real
*p_freq_dep_noise_parts
;
453 /* topology modifier */
454 SK_STATUS_TYPE
*p_branch_status
;
455 /* N_TOTAL_BRANCHES entries */
456 SK_STATUS_TYPE
*p_noise_source_status
;
457 /* N_NOISE_SOURCES entries */
459 sk_real
*p_opo_values
;
460 /* points to start of operating parameter section
461 within values array of inst_data structure (JvP, May 16 2002) */
463 SK_LIMITING
*p_limit_info
;
465 /* didv_min enabler */
466 sk_boolean insert_didvmin
;
470 /* transfers simulation data from the simulator to the model */
474 /* needed for temperature scaling */
475 /* ( eval_int_params() ) */
478 /* needed for frequency dependent */
479 /* noise density calculation */
480 /* ( eval_model() ) */
483 /* needed for scaling in spectre */
484 /* ( eval_int_params() ) */
485 /* ( get_inst_params() ) */
489 /* Parameter types */
490 #define SK_PT_NONE 0x0000
491 #define SK_PT_MAXISET_MODEL 0x0001
492 #define SK_PT_MAXISET_INST 0x0002
493 #define SK_PT_MINISET 0x0004
494 #define SK_PT_ELECTRICALSET 0x0008
495 #define SK_PT_OPERATINGPOINT 0x0010
496 typedef SK_MASK_TYPE SK_PARAM_TYPE
;
498 /* parameter descriptor */
501 const sk_unint number
;
503 const char *p_description
;
505 const sk_boolean is_readable
;
506 const sk_boolean is_writeable
;
507 const sk_boolean is_model_param
;
508 const SK_SCALING_FACTOR scaling_type
;
509 const SK_CLIP_TYPE clip_type_n
;
510 const SK_CLIP_TYPE clip_type_p
;
511 const sk_real clip_low_n
;
512 const sk_real clip_low_p
;
513 const sk_real clip_high_n
;
514 const sk_real clip_high_p
;
515 const sk_real default_value_n
;
516 const sk_real default_value_p
;
517 const SK_AFFECTS_TYPE dependency
;
518 const SK_PARAM_TYPE param_type
;
519 } SK_PARAM_DESCRIPTOR
;
522 /* parameter descriptor define for unused fields */
523 #define SK_NOT_USED 0
526 /* Model and instance parameters together form the maxiset */
527 #define SK_PARAM_MAXI_MODEL(name, p_descr, p_unit, \
528 clip_type_n, clip_type_p, \
529 clip_low_n, clip_low_p, clip_high_n, clip_high_p, default_n, default_p) \
530 static SK_PARAM_DESCRIPTOR PARAM_MAXI_MODEL_ ## name = \
532 PARNUM_MAXI_MODEL_ ## name, \
538 clip_type_n, clip_type_p, \
539 clip_low_n, clip_low_p, \
540 clip_high_n, clip_high_p, \
541 default_n, default_p, \
542 SK_AT_AFFECTS_OP_POINT, \
543 SK_PT_MAXISET_MODEL \
546 #define SK_PARAM_MAXI_INST(name, p_descr, p_unit, scaling_type, \
547 clip_type_n, clip_type_p, \
548 clip_low_n, clip_low_p, clip_high_n, clip_high_p, default_n, default_p) \
549 static SK_PARAM_DESCRIPTOR PARAM_MAXI_INST_ ## name = \
551 PARNUM_MAXI_INST_ ## name, \
557 clip_type_n, clip_type_p, \
558 clip_low_n, clip_low_p, \
559 clip_high_n, clip_high_p, \
560 default_n, default_p, \
561 SK_AT_AFFECTS_OP_POINT, \
566 #define SK_PARAM_MINI(name, p_descr, p_unit, clip_type_n, clip_type_p, \
567 clip_low_n, clip_low_p, clip_high_n, clip_high_p) \
568 static SK_PARAM_DESCRIPTOR PARAM_MINI_ ## name = \
570 PARNUM_MINI_ ## name, \
574 FALSE, FALSE, FALSE, \
576 clip_type_n, clip_type_p, \
577 clip_low_n, clip_low_p, \
578 clip_high_n, clip_high_p, \
579 SK_NOT_USED, SK_NOT_USED, \
580 SK_AT_AFFECTS_OP_POINT, \
585 #define SK_PARAM_ELEC(name, p_descr, p_unit, clip_type_n, clip_type_p, \
586 clip_low_n, clip_low_p, clip_high_n, clip_high_p) \
587 static SK_PARAM_DESCRIPTOR PARAM_ELEC_ ## name = \
589 PARNUM_ELEC_ ## name, \
593 TRUE, FALSE, FALSE, \
595 clip_type_n, clip_type_p, \
596 clip_low_n, clip_low_p, \
597 clip_high_n, clip_high_p, \
598 SK_NOT_USED, SK_NOT_USED, \
599 SK_AT_AFFECTS_OP_POINT | SK_AT_TEMP_AFFECTS, \
600 SK_PT_ELECTRICALSET \
603 /* Operating point */
604 #define SK_PARAM_OP(name, p_descr, p_unit) \
605 static SK_PARAM_DESCRIPTOR PARAM_OP_ ## name = \
607 PARNUM_OP_ ## name, \
611 TRUE, FALSE, FALSE, \
613 SK_NOT_USED, SK_NOT_USED, \
614 SK_NOT_USED, SK_NOT_USED, \
615 SK_NOT_USED, SK_NOT_USED, \
616 SK_NOT_USED, SK_NOT_USED, \
617 SK_AT_OP_POINT_AFFECTS, \
618 SK_PT_OPERATINGPOINT \
622 /* Access parameter values */
623 #define MM(a) p_m_data->values[PARNUM_MAXI_MODEL_##a]
624 #define MI(a) p_i_data->values[PARNUM_MAXI_INST_##a-N_MODEL_PARAMS]
625 #define MS(a) p_i_data->values[PARNUM_MINI_##a-N_MODEL_PARAMS]
626 #define ES(a) p_i_data->values[PARNUM_ELEC_##a-N_MODEL_PARAMS]
627 #define OP(a) p_i_data->values[PARNUM_OP_##a-N_MODEL_PARAMS]
629 #define ES_dVT(a) p_i_data->values_dVT[PARNUM_ELEC_##a-N_MODEL_PARAMS]
633 /* Macros for testing parameter states */
634 #define SK_IS_PARAM_READABLE(p_param) ((p_param)->is_readable)
635 #define SK_IS_PARAM_WRITEABLE(p_param) ((p_param)->is_writeable)
636 #define SK_IS_TEMP_AFFECTS_PARAM(p_param) \
637 ((p_param)->dependency & SK_AT_TEMP_AFFECTS)
638 #define SK_IS_OP_AFFECTS_PARAM(p_param) \
639 ((p_param)->dependency & SK_AT_OP_POINT_AFFECTS)
640 #define SK_IS_PARAM_AFFECTS_OP(p_param) \
641 ((p_param)->dependency & SK_AT_AFFECTS_OP_POINT)
644 /* model descriptor */
648 const sk_real didv_min
;
649 const sk_real version_nr
;
652 const sk_unint n_terminals
;
653 const sk_unint n_static_branches
;
654 const sk_unint n_static_linear_branches
;
655 const sk_unint n_dynamic_branches
;
656 const sk_unint n_dynamic_linear_branches
;
657 const sk_unint n_gmin_branches
;
658 const sk_unint n_didvmin_branches
;
659 const sk_unint n_noise_sources
;
660 const sk_unint n_int_nodes
;
661 const SK_BRANCH
*p_branch_DS
; /* For MOS unwanted SD interch.*/
662 const SK_NODE
**pp_term_nodes
;
663 const SK_NODE
**pp_int_nodes
;
664 const sk_unint n_model_params
;
665 const sk_unint n_inst_params
;
666 const sk_unint n_op_info
;
667 const sk_unint model_data_size
;
668 const sk_unint inst_data_size
;
669 const SK_PARAM_DESCRIPTOR
**pp_params
; /* Please note: it is assumed
671 n_model_params model params
672 followed by n_inst_params
673 instance parameters followed
674 by n_op_info op point
676 const SK_BRANCH
**pp_static_branches
;
677 const SK_BRANCH
**pp_static_linear_branches
;
678 const SK_BRANCH
**pp_dynamic_branches
;
679 const SK_BRANCH
**pp_dynamic_linear_branches
;
680 const SK_BRANCH
**pp_gmin_branches
;
681 const SK_BRANCH
**pp_didvmin_branches
;
682 const SK_NOISE_SOURCE
**pp_noise_sources
;
684 /* interface functions */
685 SK_ERROR (*p_init_model
) ( void *p_model_data
,
688 SK_ERROR (*p_init_inst
) ( const void *p_model_data
,
690 SK_INST_VARIABLES
**pp_inst_variables
,
691 const char* p_inst_name
,
692 const char** pp_occ_ind
,
693 const char** pp_sit
);
695 SK_ERROR (*p_set_model_params
) ( void *p_model_data
,
696 const sk_unint
*p_param_id_list
,
697 const sk_real
*p_value_list
,
698 const sk_unint n_params
,
699 sk_boolean
*p_is_param_changed
);
701 SK_ERROR (*p_set_inst_params
) ( void *p_inst_data
,
702 const sk_unint
*p_param_id_list
,
703 const sk_real
*p_value_list
,
704 const sk_unint n_params
,
705 sk_boolean
*p_is_param_changed
);
707 SK_ERROR (*p_get_model_params
) ( const void *p_model_data
,
708 const sk_unint
*p_param_id_list
,
709 sk_real
*p_value_list
,
710 const sk_unint n_params
,
711 const SK_SIM_DATA
*p_sim_data
);
713 SK_ERROR (*p_get_inst_params
) ( const void *p_inst_data
,
714 const sk_unint
*p_param_id_list
,
715 sk_real
*p_value_list
,
716 const sk_unint n_params
,
717 const SK_SIM_DATA
*p_sim_data
);
719 SK_ERROR (*p_reset_model_params
)( void *p_model_data
,
720 const sk_unint
*p_param_id_list
,
721 const sk_unint n_params
);
723 SK_ERROR (*p_reset_inst_params
) ( const void *p_model_data
,
725 const sk_unint
*p_param_id_list
,
726 const sk_unint n_params
);
728 SK_ERROR (*p_eval_int_params
) ( void *p_model_data
,
730 const SK_SIM_DATA
*p_sim_data
,
731 const SK_INIT_CONTROL flag
);
733 SK_ERROR (*p_eval_model
) ( const void *p_model_data
,
735 const SK_SIM_DATA
*p_sim_data
,
736 const SK_EVAL_CONTROL flag
);
738 SK_ERROR (*p_eval_u_noise
) ( const void *p_model_data
,
739 const void *p_inst_data
,
740 sk_unint noise_src_number
,
741 const sk_real frequency
,
742 SK_COMPLEX
*p_h_noise
,
743 SK_COMPLEX
*p_u_noise
);
745 /* start new initial guess */
747 const sk_boolean
*p_ev_ig_available
;
748 const SK_EV_DESCRIP
**pp_ev_descrip
;
750 SK_MODEL_FAMILY model_family
;
753 /******************************************************************************/
755 /* Interface that the models use to report info / warnings / errors to the
756 _simulator_ (as opposed to the adapter, which uses SK_ERROR). The adapter
757 implements the function below which converts this information to simulator
758 specific status reporting. */
763 SK_REP_COPYRIGHT_NOTICE
,
764 SK_REP_PARAMETER_CLIPPED
,
765 SK_REP_NEGATIVE_WEFF
,
766 SK_REP_NEGATIVE_LEFF
,
768 SK_REP_PARAMETER_READONLY
,
769 SK_REP_PARAMETER_UNKNOWN
,
770 SK_REP_SIMKIT_MESSAGE
,
771 SK_REP_DEVICE_TOO_HOT
,
772 SK_REP_OUT_OF_MEMORY
,
773 SK_REP_FAILED_GEOM_CHECK
777 * Type of a function to report warnings, errors and debug output in a simulator
778 * specific way. This function may be called by the adapter
779 * itself or any model.
780 * @param aStatus Message type
781 * @param anInfo Strings to be put in the message
783 typedef void (*SK_REPORT_TO_SIMULATOR_FUNC
)(SK_REPORT_STATUS aStatus
, const char* anInfo
[]);
785 #define SK_REPORT_INFO_SIZE 6
787 #define COMPLEX_MULT_ASSIGN(u, v) { \
788 sk_real r_real,r_imag; \
789 r_real=(u).Real*(v).Real-(u).Imag*(v).Imag; \
790 r_imag=(u).Real*(v).Imag+(u).Imag*(v).Real; \
795 #define COMPLEX_DIV_ASSIGN(u, v) { \
796 sk_real r_real,r_imag,norm2; \
797 norm2=(v).Real*(v).Real+(v).Imag*(v).Imag; \
798 r_real=(u).Real*(v).Real+(u).Imag*(v).Imag; \
799 r_imag=-(u).Real*(v).Imag+(u).Imag*(v).Real; \
800 (u).Real=r_real/norm2; \
801 (u).Imag=r_imag/norm2; \
805 /******************************************************************************/
807 /* DATA DECLARATIONS (no structures) */
808 /* defines / typedefs / macros ... */
810 /*----------------------- Type definitions ---------------------------------*/
812 /* Defines for boolean values */
819 /*------------------------- Release flag dependent -------------------------*/
822 #define MAINTENANCE FALSE /* Release version */
824 #define MAINTENANCE TRUE /* Development version */
827 /*------------------------- Computer system macros -------------------------*/
830 /*----------------------- Computer system definition -----------------------*/
833 #define CASE_SENSITIVE_FILENAMES TRUE
834 #define LOWERCASE_FILENAMES TRUE
836 #define MIXED_SIGNAL_SUPPORT TRUE
839 #define tolower(c) ( isupper(c) ? ((c)-'A'+'a') : (c) )
842 #define toupper(c) ( islower(c) ? ((c)-'a'+'A') : (c) )
845 /*------------------------ Definitions for Constants -----------------------*/
847 /* VAX-11 constants !! */
848 #define MIN_INTEGER ((long int) -2147483647)
849 #define MAX_INTEGER 2147483647
850 #define MIN_NUMBER 3.0E-39
851 #define MAX_NUMBER 1.7E38
852 #define UNDEF_NUMBER 1.654321E38
853 #define UNDEF_BOF_RESULT 1.6E38
854 #define N_SIGNIFICANT_DIGITS 14
856 /* constants dependent on VAX-11 constants;
857 * requirements: 1/P_INFINITY > MIN_NUMBER
859 * TOLERANCE exponent <= N_SIGNIFICANT_DIGITS
861 #define P_INFINITY (MAX_NUMBER/100.0)
862 #define TOLERANCE 1.0E-12
867 #define LN_MINDOUBLE -800.0
870 /*---------------------------------------------------------------------------*
871 * Fundamental Physical Constants *
872 * source: Handbook of Chemistry and Physics, 54th edition, 1973 *
873 *---------------------------------------------------------------------------*/
874 #define PI 3.14159265358979323844 /* 21 decimal digits */
875 #define TWOPI 6.28318530717958647688 /* 21 decimal digits */
876 #define SQRT2 1.41421356237309504880 /* 21 decimal digits */
877 #define DEGPERRAD 57.29577951308232087721 /* 22 decimal digits */
878 #define Q_ELECTRON 1.6021918E-19 /* Electron charge (C) */
879 #define K_BOLTZMANN 1.3806226E-23 /* Boltzmann's constant (J/K)*/
880 #define EPSILON_0 8.854214871e-12 /* diele.con. (F/m) */
881 #define EPSILON_OX 3.453143800e-11 /* permittivity of SiO2 (F/m)*/
882 #define EPSILON_SI (11.7*EPSILON_0) /* diele.con. of silicon(F/m)*/
883 #define KELVIN_CONVERSION 273.15 /* Celsius to Kelvin (K) */
885 /* Derived from these: */
886 #define K_B_div_Q_EL 8.61708691805812512584e-5
888 /* Macro to get rid of GCC's unused parameter warning. When using the GCC
889 compiler this applies the unused attribute and also mangles the variable
890 name so that you really can't use it. */
892 #define SK_UNUSED(x) UNUSED_ ## x __attribute__((unused))
894 #define SK_UNUSED(x) x