Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / tas / stm / stm_model.y
1 /******************************************************************************/
2 /* */
3 /* Chaine de CAO & VLSI AVERTEC */
4 /* */
5 /* Produit: STM Version 1.00 */
6 /* Fichier: stm.y */
7 /* */
8 /* (c) copyright 2000 AVERTEC */
9 /* Tous droits reserves */
10 /* */
11 /* Auteur(s): Gilles Augustins */
12 /* */
13 /******************************************************************************/
14
15 %{
16 #define API_HIDE_TOKENS
17 #include API_H
18 #include STM_H
19 #include "stm.h"
20
21 /******************************************************************************/
22 /* private */
23 /******************************************************************************/
24
25 static chain_list *stmmodel_ch, *stmmodel_chp, *stmmodel_xchain, *stmmodel_ychain, *stmmodel_xydata;
26 static chain_list *stmmodel_energy_xchain, *stmmodel_energy_ychain, *stmmodel_energy_xydata;
27 static char stmmodel_xtype, stmmodel_ytype;
28 static char stmmodel_energy_xtype, stmmodel_energy_ytype;
29 static char stmmodel_dimension;
30 static char stmmodel_energy_dimension;
31 static int stmmodel_nx, stmmodel_ny;
32 static int stmmodel_energy_nx, stmmodel_energy_ny;
33 static float *stmmodel_ptfl;
34 static timing_model *stmmodel_model;
35 static timing_cell *stmmodel_cell;
36 static int stmmodel_index;
37 static float stmmodel_d_params[STM_NB_DUAL_PARAMS];
38 static float stmmodel_f_params[STM_NB_FALSE_PARAMS];
39 static float stmmodel_p_params[STM_NB_PATH_PARAMS];
40 static float stmmodel_c_params[STM_NB_CST_PARAMS];
41 static float stmmodel_i_params[1 + STM_NB_LINK_I_PARAMS * 16]; /* max = 16 pass transistors */
42 static float stmmodel_0_params[STM_NB_LINK_0_PARAMS];
43 static float stmmodel_n_params[STM_NB_LINK_N_PARAMS];
44 static float stmmodel_e_params[STM_NB_ENERGY_PARAMS];
45 static long stmmodel_deg_params[10];
46 static long stmmodel_coefdef_params[1024];
47 static float stmmodel_coeftab_params[1024];
48 static timing_varpolynom *stmmodel_var_params[3];
49 static timing_varpolynom **stmmodel_var_p;
50 static long *stmmodel_deg_p;
51 static long *stmmodel_coefdef_p;
52 static float *stmmodel_coeftab_p;
53 static int stmmodel_nb_var = 0;
54 static int stmmodel_deg_index = 0;
55 static int stmmodel_var_index = 0;
56 static int stmmodel_coefdef_index = 0;
57 static int stmmodel_coefdef_nb = 0;
58 static int stmmodel_coeftab_index = 0;
59 static float *stmmodel_d_p;
60 static float *stmmodel_f_p;
61 static float *stmmodel_p_p;
62 static float *stmmodel_c_p;
63 static float *stmmodel_i_p;
64 static float *stmmodel_0_p;
65 static float *stmmodel_n_p;
66 static float *stmmodel_e_p;
67 static char stmmodel_d;
68 static char stmmodel_f;
69 static char stmmodel_p;
70 static char stmmodel_c;
71 static char stmmodel_i;
72 static char stmmodel_0;
73 static char stmmodel_n;
74 static char stmmodel_e;
75 static long stmmodel_coefdef_mask = STM_COEF_DEFMASK;
76 static float vth;
77 static float vdd;
78 static float vt;
79 static float vf;
80 static char tran;
81 static char vnoise_model;
82 static float vnoise_scr;
83 static float vnoise_invth;
84 static noise_scr *scr_model;
85 static char stmmodel_energy_model_type;
86 static char *stmmodel_fct_ins;
87 static char *stmmodel_fct_file;
88 static char *stmmodel_fct_localname;
89 static APICallFunc *stmmodel_fct_fct;
90 static int sim_model_number;
91 static float stmmodel_iv_conf[4];
92 static float stmmodel_iv_input[4];
93 static float stmmodel_iv_init[1];
94 static int stmmodel_iv_nve;
95 static int stmmodel_iv_nvs;
96 static chain_list *stmmodel_iv_tabve;
97 static chain_list *stmmodel_iv_tabvs;
98 static chain_list *stmmodel_iv_tabiv;
99 static int stmmodel_iv_e;
100 static int stmmodel_iv_s;
101 static chain_list *stmmodel_iv_scane;
102 static chain_list *stmmodel_iv_scans;
103
104 /******************************************************************************/
105 /* function declarations */
106 /******************************************************************************/
107
108 int yyerror ();
109 int yylex ();
110
111 %}
112
113 %union {
114 char *t_pchar;
115 struct {
116 float t_float;
117 char t_float_string[128];
118 } t_struct3;
119
120 struct chain *t_pchain;
121
122 struct {
123 struct chain *CHAIN;
124 char TYPE;
125 } t_struct1;
126
127 struct {
128 struct chain *CHAIN;
129 char DIM;
130 } t_struct2;
131
132 char t_char;
133 long t_long;
134 APICallFunc *t_cf;
135 };
136
137 %token _SPDM
138 %token _ORDERS
139 %token _COEFS
140 %token _DUAL
141 %token _LINK_OUT
142 %token _LINK_PASS
143 %token _LINK_DUAL
144 %token _FALSE
145 %token _PATH
146 %token _SCM_DUAL
147 %token _SCM_GOOD
148 %token _SCM_FALSE
149 %token _SCM_PATH
150 %token _SCM_CST
151 %token _PCONF0
152 %token _PCONF1
153 %token _CAPAI
154 %token _CAPAI0
155 %token _CAPAI1
156 %token _CAPAI2
157 %token _CAPAI3
158 %token _VT0
159 %token _VT0C
160 %token _IRAP
161 %token _VDDIN
162 %token _VT
163 %token _THRESHOLD
164 %token _RINT
165 %token _VINT
166 %token _CHALF
167 %token _QINIT
168 %token _RCONF
169 %token _KR
170 %token _INPUT_THR
171 %token _IMAX
172 %token _AN
173 %token _BN
174 %token _ACTI
175 %token _BCTI
176 %token _CI
177 %token _CF
178 %token _K3
179 %token _K4
180 %token _K5
181 %token _RTOT
182 %token _KF
183 %token _VDDMAX
184 %token _VF_INPUT
185 %token _DATA
186 %token _DELAY
187 %token _SLEW
188 %token _CLOCK_SLEW_AXIS
189 %token _CST
190 %token <t_struct3> _ENUMBER
191 %token <t_pchar> _IDENTIFIER
192 %token _INPUT_SLEW_AXIS
193 %token _LOAD_AXIS
194 %token _MODEL
195 %token <t_struct3> _NUMBER
196 %token _SLEW_AXIS
197 %token _SPLINE
198 %token _NAME
199 %token _VTH
200 %token _VDD
201 %token _VF
202 %token _VARTHMIN
203 %token _VARTHMAX
204 %token _UNKNOWN
205 %token _NOISE_SCR
206 %token _ENERGY_TABLE
207 %token _ENERGY_CONST
208 %token _ENERGY_MODEL
209 %token _RSAT
210 %token _RLIN
211 %token _DRC
212 %token _RBR
213 %token _CBR
214 %token _FCT
215 %token _INSTANCE
216 %token _LOCALNAME
217 %token _SIM_MODEL
218 %token _FUNCTION
219 %token _FILE
220 %token _IV
221 %token _NVE
222 %token _NVS
223 %token _VE
224 %token _VS
225 %token _CONFLICT
226 %token _CURRENT
227 %token _INPUT
228 %token _INITIAL
229 %token <t_char> _ECHAR
230 %token _TRAN
231
232 %start first_model
233
234 %type <t_pchar> modelname
235 %type <t_pchain> val_list
236 %type <t_struct2> modeldata
237 %type <t_struct2> data
238 %type <t_pchain> array1D
239 %type <t_pchain> array1D_list
240 %type <t_pchain> array2D
241 %type <t_struct1> axis
242 %type <t_char> axistype
243 %type <t_struct3> val
244 %type <t_long> tmodel
245 %type <t_long> fctmodel
246 %type <t_long> tblmodel
247 %type <t_long> tbltype
248 %type <t_long> scmmodel
249 %type <t_long> scmtype
250 %type <t_long> plnmodel
251 %type <t_long> energytblmodel
252 %type <t_long> energytbltype
253 %type <t_long> energyparamsmodel
254 %type <t_pchain> param_list param
255 %type <t_cf> function
256 %type <t_long> nbve
257 %type <t_pchain> voltageve
258 %type <t_pchain> voltagevs
259 %type <t_pchain> current
260 %type <t_long> ivmodel
261
262 %%
263 first_model : model
264 {
265 YYACCEPT;
266 }
267 ;
268
269 model : _MODEL '(' modelname tmodel ')'
270 {
271 STM_MNAME = $3;
272 switch ($4 & STM_MOD_TYPEMASK) {
273
274 /*************/
275 /* TBL model */
276 /*************/
277
278 case STM_MOD_MODTBL :
279 if ((STM_CACHE==NULL)||(STM_PRELOAD=='Y')) {
280 stmmodel_model = stm_addmodel (STM_CNAME, $3);
281 stmmodel_model->VTH = vth;
282 stmmodel_model->VDD = vdd;
283 stmmodel_model->VT = vt;
284 stmmodel_model->VF = vf;
285 stmmodel_model->TTYPE = tran;
286 stmmodel_model->UTYPE = STM_MOD_MODTBL;
287 }
288 if ((STM_PRELOAD=='N') && stmmodel_xydata) {
289 // /* When chache is not used, STM_PRELOAD== 'N' anyway */
290 // printf ("\tPARSE model: %s\n", $3);
291 if (STM_CACHE != NULL) {
292 stmmodel_cell = stm_getcell (STM_CNAME);
293 stmmodel_model = (timing_model*)gethtitem (stmmodel_cell->MODEL_HT, namealloc ($3));
294 }
295 for (stmmodel_nx = 0, stmmodel_ch = stmmodel_xchain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT) stmmodel_nx++;
296 for (stmmodel_ny = 0, stmmodel_ch = stmmodel_ychain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT) stmmodel_ny++;
297 stmmodel_model->UMODEL.TABLE = stm_modtbl_create (stmmodel_nx, stmmodel_ny, stmmodel_xtype, stmmodel_ytype);
298 switch( vnoise_model ) {
299 case STM_NOISE_SCR:
300 stm_noise_create( stmmodel_model, STM_NOISE_SCR );
301 scr_model = stm_noise_getmodel_scr( stmmodel_model );
302 stm_noise_scr_update( scr_model, vnoise_scr, vnoise_invth );
303 break;
304 }
305 stm_modtbl_setXrange (stmmodel_model->UMODEL.TABLE, stmmodel_xchain, 1);
306 stm_modtbl_setYrange (stmmodel_model->UMODEL.TABLE, stmmodel_ychain, 1);
307 switch (stmmodel_dimension) {
308 case STM_CONST:
309 if (stmmodel_nx > 0 || stmmodel_ny > 0)
310 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
311 else {
312 stm_modtbl_setconst (stmmodel_model->UMODEL.TABLE, *(float*)stmmodel_xydata->DATA);
313 mbkfree((float*)stmmodel_xydata->DATA);
314 freechain (stmmodel_xydata);
315 }
316 break;
317 case STM_1D:
318 if (stmmodel_nx > 0 && stmmodel_ny > 0)
319 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
320 else {
321 stm_modtbl_set1Dset (stmmodel_model->UMODEL.TABLE, stmmodel_xydata, 1);
322 for (stmmodel_ch = stmmodel_xydata; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
323 mbkfree((float*)stmmodel_ch->DATA);
324 freechain (stmmodel_xydata);
325 }
326 break;
327 case STM_2D:
328 if (stmmodel_nx == 0 || stmmodel_ny == 0)
329 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
330 else {
331 stm_modtbl_set2Dset (stmmodel_model->UMODEL.TABLE, stmmodel_xydata, 1);
332 for (stmmodel_ch = stmmodel_xydata; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT) {
333 for (stmmodel_chp = (chain_list*)stmmodel_ch->DATA; stmmodel_chp; stmmodel_chp = stmmodel_chp->NEXT)
334 mbkfree((float*)stmmodel_chp->DATA);
335 freechain ((chain_list*)stmmodel_ch->DATA);
336 }
337 freechain (stmmodel_xydata);
338 }
339 break;
340 }
341 switch (stmmodel_energy_model_type) {
342 case STM_ENERGY_PARAMS :
343 stmmodel_e_p = stmmodel_e ? stmmodel_e_params : NULL;
344 stmmodel_model->ENERGYTYPE = STM_ENERGY_PARAMS;
345 stmmodel_model->ENERGYMODEL.EPARAMS = stm_energy_params_create (stmmodel_e_p);
346 break;
347 case STM_ENERGY_TABLE:
348 stmmodel_model->ENERGYTYPE = STM_ENERGY_TABLE;
349 for (stmmodel_energy_nx=0,stmmodel_ch=stmmodel_energy_xchain ; stmmodel_ch ; stmmodel_ch=stmmodel_ch->NEXT) stmmodel_energy_nx++;
350 for (stmmodel_energy_ny=0,stmmodel_ch=stmmodel_energy_xchain ; stmmodel_ch ; stmmodel_ch=stmmodel_ch->NEXT) stmmodel_energy_ny++;
351 stm_modtbl_setXrange (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xchain, 1);
352 stm_modtbl_setYrange (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_ychain, 1);
353 switch (stmmodel_energy_dimension) {
354 case STM_CONST:
355 if (stmmodel_energy_nx > 0 || stmmodel_energy_ny > 0)
356 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
357 else {
358 stm_modtbl_setconst (stmmodel_model->ENERGYMODEL.ETABLE, *(float*)stmmodel_energy_xydata->DATA);
359 mbkfree((float*)stmmodel_energy_xydata->DATA);
360 freechain (stmmodel_energy_xydata);
361 }
362 break;
363 case STM_1D:
364 if (stmmodel_energy_nx > 0 && stmmodel_energy_ny > 0)
365 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
366 else {
367 stm_modtbl_set1Dset (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xydata, 1);
368 for (stmmodel_ch = stmmodel_energy_xydata; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
369 mbkfree((float*)stmmodel_ch->DATA);
370 freechain (stmmodel_energy_xydata);
371 }
372 break;
373 case STM_2D:
374 if (stmmodel_energy_nx == 0 || stmmodel_energy_ny == 0)
375 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
376 else {
377 stm_modtbl_set2Dset (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xydata, 1);
378 for (stmmodel_ch = stmmodel_energy_xydata; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT) {
379 for (stmmodel_chp = (chain_list*)stmmodel_ch->DATA; stmmodel_chp; stmmodel_chp = stmmodel_chp->NEXT)
380 mbkfree((float*)stmmodel_chp->DATA);
381 freechain ((chain_list*)stmmodel_ch->DATA);
382 }
383 freechain (stmmodel_energy_xydata);
384 }
385 break;
386 }
387 for (stmmodel_ch = stmmodel_energy_xchain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
388 mbkfree((float*)stmmodel_ch->DATA);
389 for (stmmodel_ch = stmmodel_energy_ychain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
390 mbkfree((float*)stmmodel_ch->DATA);
391 freechain (stmmodel_energy_xchain);
392 freechain (stmmodel_energy_ychain);
393 break;
394 }
395 }
396 for (stmmodel_ch = stmmodel_xchain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
397 mbkfree((float*)stmmodel_ch->DATA);
398 for (stmmodel_ch = stmmodel_ychain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
399 mbkfree((float*)stmmodel_ch->DATA);
400 freechain (stmmodel_xchain);
401 freechain (stmmodel_ychain);
402 break;
403
404 /*************/
405 /* SCM model */
406 /*************/
407
408 case STM_MOD_MODSCM:
409 if ((STM_CACHE==NULL)||(STM_PRELOAD=='Y')) {
410 stmmodel_model = stm_addmodel (STM_CNAME, $3);
411 stmmodel_model->VTH = vth;
412 stmmodel_model->VDD = vdd;
413 stmmodel_model->VT = vt;
414 stmmodel_model->VF = vf;
415 stmmodel_model->TTYPE = tran;
416 stmmodel_model->UTYPE = STM_MOD_MODSCM;
417 }
418 if (STM_PRELOAD=='N') {
419 // /* When chache is not used, STM_PRELOAD== 'N' anyway */
420 // printf ("\tPARSE model: %s\n", $3);
421 if (STM_CACHE != NULL){
422 stmmodel_cell = stm_getcell (STM_CNAME);
423 stmmodel_model = (timing_model*)gethtitem (stmmodel_cell->MODEL_HT, namealloc ($3));
424 }
425 switch( vnoise_model ) {
426 case STM_NOISE_SCR:
427 stm_noise_create( stmmodel_model, STM_NOISE_SCR );
428 scr_model = stm_noise_getmodel_scr( stmmodel_model );
429 stm_noise_scr_update( scr_model, vnoise_scr, vnoise_invth );
430 break;
431 }
432 switch ($4 & STM_MODSCM_TYPEMASK) {
433 case STM_MODSCM_DUAL:
434 stmmodel_d_p = stmmodel_d ? stmmodel_d_params : NULL;
435 stmmodel_model->UMODEL.SCM = stm_modscm_dual_create (stmmodel_d_p);
436 break;
437 case STM_MODSCM_GOOD:
438 stmmodel_0_p = stmmodel_0 ? stmmodel_0_params : NULL;
439 stmmodel_i_p = stmmodel_i ? stmmodel_i_params : NULL;
440 stmmodel_n_p = stmmodel_n ? stmmodel_n_params : NULL;
441 stmmodel_d_p = stmmodel_d ? stmmodel_d_params : NULL;
442 stmmodel_model->UMODEL.SCM = stm_modscm_good_create (stmmodel_0_p, stmmodel_i_p, stmmodel_n_p, stmmodel_d_p);
443 break;
444 case STM_MODSCM_FALSE:
445 stmmodel_0_p = stmmodel_0 ? stmmodel_0_params : NULL;
446 stmmodel_i_p = stmmodel_i ? stmmodel_i_params : NULL;
447 stmmodel_n_p = stmmodel_n ? stmmodel_n_params : NULL;
448 stmmodel_f_p = stmmodel_f ? stmmodel_f_params : NULL;
449 stmmodel_model->UMODEL.SCM = stm_modscm_false_create (stmmodel_0_p, stmmodel_i_p, stmmodel_n_p, stmmodel_f_p);
450 break;
451 case STM_MODSCM_PATH:
452 stmmodel_0_p = stmmodel_0 ? stmmodel_0_params : NULL;
453 stmmodel_i_p = stmmodel_i ? stmmodel_i_params : NULL;
454 stmmodel_n_p = stmmodel_n ? stmmodel_n_params : NULL;
455 stmmodel_p_p = stmmodel_p ? stmmodel_p_params : NULL;
456 stmmodel_model->UMODEL.SCM = stm_modscm_path_create (stmmodel_0_p, stmmodel_i_p, stmmodel_n_p, stmmodel_p_p);
457 break;
458 case STM_MODSCM_CST:
459 stmmodel_c_p = stmmodel_c ? stmmodel_c_params : NULL;
460 stmmodel_model->UMODEL.SCM = stm_modscm_cst_create (stmmodel_c_p);
461 break;
462 }
463 switch (stmmodel_energy_model_type) {
464 case STM_ENERGY_PARAMS :
465 stmmodel_e_p = stmmodel_e ? stmmodel_e_params : NULL;
466 stmmodel_model->ENERGYTYPE = STM_ENERGY_PARAMS;
467 stmmodel_model->ENERGYMODEL.EPARAMS = stm_energy_params_create (stmmodel_e_p);
468 break;
469 case STM_ENERGY_TABLE:
470 stmmodel_model->ENERGYTYPE = STM_ENERGY_TABLE;
471 for (stmmodel_energy_nx=0,stmmodel_ch=stmmodel_energy_xchain ; stmmodel_ch ; stmmodel_ch=stmmodel_ch->NEXT) stmmodel_energy_nx++;
472 for (stmmodel_energy_ny=0,stmmodel_ch=stmmodel_energy_xchain ; stmmodel_ch ; stmmodel_ch=stmmodel_ch->NEXT) stmmodel_energy_ny++;
473 stm_modtbl_setXrange (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xchain, 1);
474 stm_modtbl_setYrange (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_ychain, 1);
475 switch (stmmodel_energy_dimension) {
476 case STM_CONST:
477 if (stmmodel_energy_nx > 0 || stmmodel_energy_ny > 0)
478 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
479 else {
480 stm_modtbl_setconst (stmmodel_model->ENERGYMODEL.ETABLE, *(float*)stmmodel_energy_xydata->DATA);
481 mbkfree((float*)stmmodel_energy_xydata->DATA);
482 freechain (stmmodel_energy_xydata);
483 }
484 break;
485 case STM_1D:
486 if (stmmodel_energy_nx > 0 && stmmodel_energy_ny > 0)
487 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
488 else {
489 stm_modtbl_set1Dset (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xydata, 1);
490 for (stmmodel_ch = stmmodel_energy_xydata; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
491 mbkfree((float*)stmmodel_ch->DATA);
492 freechain (stmmodel_energy_xydata);
493 }
494 break;
495 case STM_2D:
496 if (stmmodel_energy_nx == 0 || stmmodel_energy_ny == 0)
497 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
498 else {
499 stm_modtbl_set2Dset (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xydata, 1);
500 for (stmmodel_ch = stmmodel_energy_xydata; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT) {
501 for (stmmodel_chp = (chain_list*)stmmodel_ch->DATA; stmmodel_chp; stmmodel_chp = stmmodel_chp->NEXT)
502 mbkfree((float*)stmmodel_chp->DATA);
503 freechain ((chain_list*)stmmodel_ch->DATA);
504 }
505 freechain (stmmodel_energy_xydata);
506 }
507 break;
508 }
509 for (stmmodel_ch = stmmodel_energy_xchain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
510 mbkfree((float*)stmmodel_ch->DATA);
511 for (stmmodel_ch = stmmodel_energy_ychain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
512 mbkfree((float*)stmmodel_ch->DATA);
513 freechain (stmmodel_energy_xchain);
514 freechain (stmmodel_energy_ychain);
515 break;
516 }
517 }
518 break;
519
520 /*************/
521 /* PLN model */
522 /*************/
523
524 case STM_MOD_MODPLN:
525 if ((STM_CACHE==NULL)||(STM_PRELOAD=='Y')) {
526 stmmodel_model = stm_addmodel (STM_CNAME, $3);
527 stmmodel_model->VTH = vth;
528 stmmodel_model->VDD = vdd;
529 stmmodel_model->VT = vt;
530 stmmodel_model->VF = vf;
531 stmmodel_model->TTYPE = tran;
532 stmmodel_model->UTYPE = STM_MOD_MODPLN;
533 }
534 if (STM_PRELOAD=='N') {
535 if (STM_CACHE != NULL){
536 stmmodel_cell = stm_getcell (STM_CNAME);
537 stmmodel_model = (timing_model*)gethtitem (stmmodel_cell->MODEL_HT, namealloc ($3));
538 }
539 switch( vnoise_model ) {
540 case STM_NOISE_SCR:
541 stm_noise_create( stmmodel_model, STM_NOISE_SCR );
542 scr_model = stm_noise_getmodel_scr( stmmodel_model );
543 stm_noise_scr_update( scr_model, vnoise_scr, vnoise_invth );
544 break;
545 }
546 stmmodel_var_p = stmmodel_var_params;
547 stmmodel_deg_p = stmmodel_deg_params;
548 stmmodel_coefdef_p = stmmodel_coefdef_params;
549 stmmodel_coeftab_p = stmmodel_coeftab_params;
550 stmmodel_model->UMODEL.POLYNOM = stm_modpln_create (stmmodel_nb_var, stmmodel_deg_p, stmmodel_coefdef_p, stmmodel_coeftab_p, stmmodel_var_p);
551
552 switch (stmmodel_energy_model_type) {
553 case STM_ENERGY_PARAMS :
554 stmmodel_e_p = stmmodel_e ? stmmodel_e_params : NULL;
555 stmmodel_model->ENERGYTYPE = STM_ENERGY_PARAMS;
556 stmmodel_model->ENERGYMODEL.EPARAMS = stm_energy_params_create (stmmodel_e_p);
557 break;
558 case STM_ENERGY_TABLE:
559 stmmodel_model->ENERGYTYPE = STM_ENERGY_TABLE;
560 for (stmmodel_energy_nx=0,stmmodel_ch=stmmodel_energy_xchain ; stmmodel_ch ; stmmodel_ch=stmmodel_ch->NEXT) stmmodel_energy_nx++;
561 for (stmmodel_energy_ny=0,stmmodel_ch=stmmodel_energy_xchain ; stmmodel_ch ; stmmodel_ch=stmmodel_ch->NEXT) stmmodel_energy_ny++;
562 stm_modtbl_setXrange (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xchain, 1);
563 stm_modtbl_setYrange (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_ychain, 1);
564 switch (stmmodel_energy_dimension) {
565 case STM_CONST:
566 if (stmmodel_energy_nx > 0 || stmmodel_energy_ny > 0)
567 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
568 else {
569 stm_modtbl_setconst (stmmodel_model->ENERGYMODEL.ETABLE, *(float*)stmmodel_energy_xydata->DATA);
570 mbkfree((float*)stmmodel_energy_xydata->DATA);
571 freechain (stmmodel_energy_xydata);
572 }
573 break;
574 case STM_1D:
575 if (stmmodel_energy_nx > 0 && stmmodel_energy_ny > 0)
576 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
577 else {
578 stm_modtbl_set1Dset (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xydata, 1);
579 for (stmmodel_ch = stmmodel_energy_xydata; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
580 mbkfree((float*)stmmodel_ch->DATA);
581 freechain (stmmodel_energy_xydata);
582 }
583 break;
584 case STM_2D:
585 if (stmmodel_energy_nx == 0 || stmmodel_energy_ny == 0)
586 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
587 else {
588 stm_modtbl_set2Dset (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xydata, 1);
589 for (stmmodel_ch = stmmodel_energy_xydata; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT) {
590 for (stmmodel_chp = (chain_list*)stmmodel_ch->DATA; stmmodel_chp; stmmodel_chp = stmmodel_chp->NEXT)
591 mbkfree((float*)stmmodel_chp->DATA);
592 freechain ((chain_list*)stmmodel_ch->DATA);
593 }
594 freechain (stmmodel_energy_xydata);
595 }
596 break;
597 }
598 for (stmmodel_ch = stmmodel_energy_xchain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
599 mbkfree((float*)stmmodel_ch->DATA);
600 for (stmmodel_ch = stmmodel_energy_ychain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
601 mbkfree((float*)stmmodel_ch->DATA);
602 freechain (stmmodel_energy_xchain);
603 freechain (stmmodel_energy_ychain);
604 break;
605 }
606 }
607 break;
608
609 /*************/
610 /* FCT model */
611 /*************/
612
613 case STM_MOD_MODFCT:
614 // printf("warning: parsing functions in stm is not done yet...\n");
615 if ((STM_CACHE==NULL)||(STM_PRELOAD=='Y')) {
616 stmmodel_model = stm_addmodel (STM_CNAME, $3);
617 stmmodel_model->VTH = vth;
618 stmmodel_model->VDD = vdd;
619 stmmodel_model->VT = vt;
620 stmmodel_model->VF = vf;
621 stmmodel_model->TTYPE = tran;
622 stmmodel_model->UTYPE = STM_MOD_MODFCT;
623 }
624 if (STM_PRELOAD=='N') {
625 if (STM_CACHE != NULL) {
626 stmmodel_cell = stm_getcell (STM_CNAME);
627 stmmodel_model = (timing_model*)gethtitem (stmmodel_cell->MODEL_HT, namealloc ($3));
628 }
629 stmmodel_model->UMODEL.FUNCTION = stm_modfct_create (stmmodel_fct_ins, stmmodel_fct_localname, stmmodel_fct_fct);
630 //stmmodel_model->UMODEL.FUNCTION = stm_modfct_create (stmmodel_fct_fct, stmmodel_fct_file, stmmodel_fct_ins, NULL, sim_model_number);
631 }
632 break;
633
634 /*************/
635 /* IV model */
636 /*************/
637
638 case STM_MOD_MODIV:
639 if ((STM_CACHE==NULL)||(STM_PRELOAD=='Y')) {
640 stmmodel_model = stm_addmodel (STM_CNAME, $3);
641 stmmodel_model->VTH = vth;
642 stmmodel_model->VDD = vdd;
643 stmmodel_model->VT = vt;
644 stmmodel_model->VF = vf;
645 stmmodel_model->TTYPE = tran;
646 stmmodel_model->UTYPE = STM_MOD_MODIV;
647 }
648 if (STM_PRELOAD=='N') {
649 if (STM_CACHE != NULL) {
650 stmmodel_cell = stm_getcell (STM_CNAME);
651 stmmodel_model = (timing_model*)gethtitem (stmmodel_cell->MODEL_HT, namealloc ($3));
652 }
653 stmmodel_model->UMODEL.IV = stm_modiv_alloc( stmmodel_iv_nve, stmmodel_iv_nvs );
654
655 for( stmmodel_iv_e = stmmodel_iv_nve-1, stmmodel_iv_scane = stmmodel_iv_tabve ; stmmodel_iv_e >= 0 ; stmmodel_iv_e--, stmmodel_iv_scane = stmmodel_iv_scane->NEXT )
656 stmmodel_model->UMODEL.IV->VE[stmmodel_iv_e] = *((float*)(stmmodel_iv_scane->DATA));
657
658 for( stmmodel_iv_s = stmmodel_iv_nvs-1, stmmodel_iv_scans = stmmodel_iv_tabvs ; stmmodel_iv_s >= 0 ; stmmodel_iv_s--, stmmodel_iv_scans = stmmodel_iv_scans->NEXT )
659 stmmodel_model->UMODEL.IV->VS[stmmodel_iv_s] = *((float*)(stmmodel_iv_scans->DATA));
660
661 for( stmmodel_iv_e = stmmodel_iv_nve-1, stmmodel_iv_scane = stmmodel_iv_tabiv ; stmmodel_iv_e >= 0 ; stmmodel_iv_e--, stmmodel_iv_scane = stmmodel_iv_scane->NEXT ) {
662 for( stmmodel_iv_s = stmmodel_iv_nvs-1, stmmodel_iv_scans = (chain_list*)(stmmodel_iv_scane->DATA) ; stmmodel_iv_s >= 0 ; stmmodel_iv_s-- , stmmodel_iv_scans = stmmodel_iv_scans->NEXT ) {
663 stm_modiv_setis( stmmodel_model->UMODEL.IV, stmmodel_iv_nve, stmmodel_iv_nvs, *((float*)(stmmodel_iv_scans->DATA)));
664 }
665 }
666
667 stm_modiv_set_cf( stmmodel_model->UMODEL.IV, stmmodel_iv_conf[3], stmmodel_iv_conf[0], stmmodel_iv_conf[1], stmmodel_iv_conf[2] );
668 stm_modiv_set_in( stmmodel_model->UMODEL.IV, stmmodel_iv_input[0], stmmodel_iv_input[1], stmmodel_iv_input[2], stmmodel_iv_input[3] );
669 stm_modiv_set_ti( stmmodel_model->UMODEL.IV, stmmodel_iv_init[0] );
670
671 for( stmmodel_iv_scane = stmmodel_iv_tabve ; stmmodel_iv_scane ; stmmodel_iv_scane = stmmodel_iv_scane->NEXT )
672 mbkfree((float*)(stmmodel_iv_scane->DATA));
673 freechain( stmmodel_iv_tabve );
674
675 for( stmmodel_iv_scans = stmmodel_iv_tabvs ; stmmodel_iv_scans ; stmmodel_iv_scans = stmmodel_iv_scans->NEXT )
676 mbkfree((float*)(stmmodel_iv_scans->DATA));
677 freechain( stmmodel_iv_tabvs );
678
679 for( stmmodel_iv_scane = stmmodel_iv_tabiv ; stmmodel_iv_scane ; stmmodel_iv_scane = stmmodel_iv_scane->NEXT ) {
680 for( stmmodel_iv_scans = (chain_list*)(stmmodel_iv_scane->DATA) ; stmmodel_iv_scans ; stmmodel_iv_scans = stmmodel_iv_scans->NEXT )
681 mbkfree((float*)(stmmodel_iv_scans->DATA));
682 freechain( (chain_list*)(stmmodel_iv_scane->DATA) );
683 }
684 freechain( stmmodel_iv_tabiv );
685
686 switch( vnoise_model ) {
687 case STM_NOISE_SCR:
688 stm_noise_create( stmmodel_model, STM_NOISE_SCR );
689 scr_model = stm_noise_getmodel_scr( stmmodel_model );
690 stm_noise_scr_update( scr_model, vnoise_scr, vnoise_invth );
691 break;
692 }
693 switch (stmmodel_energy_model_type) {
694 case STM_ENERGY_PARAMS :
695 stmmodel_e_p = stmmodel_e ? stmmodel_e_params : NULL;
696 stmmodel_model->ENERGYTYPE = STM_ENERGY_PARAMS;
697 stmmodel_model->ENERGYMODEL.EPARAMS = stm_energy_params_create (stmmodel_e_p);
698 break;
699 case STM_ENERGY_TABLE:
700 stmmodel_model->ENERGYTYPE = STM_ENERGY_TABLE;
701 for (stmmodel_energy_nx=0,stmmodel_ch=stmmodel_energy_xchain ; stmmodel_ch ; stmmodel_ch=stmmodel_ch->NEXT) stmmodel_energy_nx++;
702 for (stmmodel_energy_ny=0,stmmodel_ch=stmmodel_energy_xchain ; stmmodel_ch ; stmmodel_ch=stmmodel_ch->NEXT) stmmodel_energy_ny++;
703 stm_modtbl_setXrange (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xchain, 1);
704 stm_modtbl_setYrange (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_ychain, 1);
705 switch (stmmodel_energy_dimension) {
706 case STM_CONST:
707 if (stmmodel_energy_nx > 0 || stmmodel_energy_ny > 0)
708 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
709 else {
710 stm_modtbl_setconst (stmmodel_model->ENERGYMODEL.ETABLE, *(float*)stmmodel_energy_xydata->DATA);
711 mbkfree((float*)stmmodel_energy_xydata->DATA);
712 freechain (stmmodel_energy_xydata);
713 }
714 break;
715 case STM_1D:
716 if (stmmodel_energy_nx > 0 && stmmodel_energy_ny > 0)
717 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
718 else {
719 stm_modtbl_set1Dset (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xydata, 1);
720 for (stmmodel_ch = stmmodel_energy_xydata; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
721 mbkfree((float*)stmmodel_ch->DATA);
722 freechain (stmmodel_energy_xydata);
723 }
724 break;
725 case STM_2D:
726 if (stmmodel_energy_nx == 0 || stmmodel_energy_ny == 0)
727 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
728 else {
729 stm_modtbl_set2Dset (stmmodel_model->ENERGYMODEL.ETABLE, stmmodel_energy_xydata, 1);
730 for (stmmodel_ch = stmmodel_energy_xydata; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT) {
731 for (stmmodel_chp = (chain_list*)stmmodel_ch->DATA; stmmodel_chp; stmmodel_chp = stmmodel_chp->NEXT)
732 mbkfree((float*)stmmodel_chp->DATA);
733 freechain ((chain_list*)stmmodel_ch->DATA);
734 }
735 freechain (stmmodel_energy_xydata);
736 }
737 break;
738 }
739 for (stmmodel_ch = stmmodel_energy_xchain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
740 mbkfree((float*)stmmodel_ch->DATA);
741 for (stmmodel_ch = stmmodel_energy_ychain; stmmodel_ch; stmmodel_ch = stmmodel_ch->NEXT)
742 mbkfree((float*)stmmodel_ch->DATA);
743 freechain (stmmodel_energy_xchain);
744 freechain (stmmodel_energy_ychain);
745 break;
746 }
747 }
748 break;
749 }
750 }
751 ;
752
753 tmodel : thresholds tblmodel noisemodel energymodel
754 {
755 $$ = $2;
756 }
757 | thresholds scmmodel noisemodel energymodel
758 {
759 $$ = $2;
760 }
761 | thresholds plnmodel noisemodel energymodel
762 {
763 $$ = $2;
764 }
765 | thresholds fctmodel
766 {
767 $$ = $2;
768 }
769 | thresholds ivmodel noisemodel energymodel
770 {
771 $$ = $2;
772 }
773 ;
774
775 thresholds : _VTH '(' val ')' _VDD '(' val ')' _VT '(' val ')' _VF '(' val ')' transition
776 {
777 if ((STM_CACHE==NULL)||(STM_PRELOAD == 'Y')) {
778 vth = $3.t_float;
779 vdd = $7.t_float;
780 vt = $11.t_float;
781 vf = $15.t_float;
782 }
783 }
784 ;
785
786 transition : empty
787 {
788 tran = STM_HL;
789 }
790 | _TRAN '(' _IDENTIFIER ')'
791 {
792 if(!strcmp($3,"uu"))
793 tran = STM_HH;
794 else if(!strcmp($3,"ud"))
795 tran = STM_HL;
796 else if(!strcmp($3,"du"))
797 tran = STM_LH;
798 else if(!strcmp($3,"dd"))
799 tran = STM_LL;
800 else
801 tran = STM_HL;
802 }
803 ;
804
805 /*****************************************************************************/
806 /* FCT model */
807 /*****************************************************************************/
808
809 fctmodel : _FCT '(' file function instance localname number ')'
810 {
811 $$ = STM_MOD_MODFCT;
812 }
813 ;
814
815 file : _FILE '(' _IDENTIFIER ')'
816 {
817 stmmodel_fct_file = sensitive_namealloc($3); mbkfree($3);
818 }
819 | empty
820 {
821 stmmodel_fct_file = NULL;
822 }
823 ;
824
825 localname : _LOCALNAME '(' _IDENTIFIER ')'
826 {
827 stmmodel_fct_localname = namealloc($3); mbkfree($3);
828 }
829 | empty
830 {
831 stmmodel_fct_localname = NULL;
832 }
833 ;
834
835 instance : _INSTANCE '(' _IDENTIFIER ')'
836 {
837 stmmodel_fct_ins = namealloc($3); mbkfree($3);
838 }
839 | empty
840 {
841 stmmodel_fct_ins = NULL;
842 }
843 ;
844
845 function : _FUNCTION '(' _IDENTIFIER param_list ')'
846 {
847 stmmodel_fct_fct = (APICallFunc *)mbkalloc(sizeof(APICallFunc));
848 stmmodel_fct_fct->NAME=sensitive_namealloc($3); mbkfree($3);
849 stmmodel_fct_fct->ARGS=$4;
850 }
851 | empty
852 {
853 stmmodel_fct_fct = NULL;
854 }
855 ;
856
857 param_list : param_list param
858 {
859 $$ = append($1, $2);
860 }
861 | empty
862 {
863 $$ = NULL;
864 }
865 ;
866
867 param : _NUMBER
868 {
869 if (strchr($1.t_float_string,'.')!=NULL)
870 $$=APIAddDoubleTARG(NULL, "?", $1.t_float);
871 else
872 $$=APIAddIntTARG(NULL, "?", atoi($1.t_float_string));
873 }
874 | _ECHAR
875 {
876 $$ = APIAddCharTARG(NULL, "?", $1);
877 }
878 ;
879
880 number : _SIM_MODEL '(' _NUMBER ')'
881 {
882 sim_model_number = $3.t_float;
883 }
884 | empty
885 {
886 sim_model_number = -1;
887 }
888 ;
889
890 /*****************************************************************************/
891 /* TBL model */
892 /*****************************************************************************/
893
894 tbltype : _SPLINE
895 {
896 $$ = STM_MOD_MODTBL;
897 }
898 | _CST
899 {
900 $$ = STM_MOD_MODTBL;
901 }
902 ;
903
904 tblmodel : tbltype '(' axis axis data ')'
905 {
906 stmmodel_xchain = $3.CHAIN;
907 stmmodel_xtype = $3.TYPE;
908 stmmodel_ychain = $4.CHAIN;
909 stmmodel_ytype = $4.TYPE;
910 stmmodel_xydata = $5.CHAIN;
911 stmmodel_dimension = $5.DIM;
912 $$ = $1;
913 }
914 | tbltype '(' axis data ')'
915 {
916 stmmodel_xchain = $3.CHAIN;
917 stmmodel_xtype = $3.TYPE;
918 stmmodel_ychain = NULL;
919 stmmodel_ytype = STM_NOTYPE;
920 stmmodel_xydata = $4.CHAIN;
921 stmmodel_dimension = $4.DIM;
922 $$ = $1;
923 }
924 | tbltype '(' data ')'
925 {
926 stmmodel_xchain = NULL;
927 stmmodel_xtype = STM_NOTYPE;
928 stmmodel_ychain = NULL;
929 stmmodel_ytype = STM_NOTYPE;
930 stmmodel_xydata = $3.CHAIN;
931 stmmodel_dimension = $3.DIM;
932 $$ = $1;
933 }
934 ;
935
936 axis : axistype '(' val val val_list ')'
937 {
938 if (STM_PRELOAD=='Y') {
939 $$.CHAIN = NULL;
940 $$.TYPE = STM_NOTYPE;
941 }
942 else {
943 stmmodel_ptfl = (float*)mbkalloc (sizeof (float));
944 *stmmodel_ptfl = $4.t_float;
945 $$.CHAIN = addchain ($5, stmmodel_ptfl);
946 stmmodel_ptfl = (float*)mbkalloc (sizeof (float));
947 *stmmodel_ptfl = $3.t_float;
948 $$.CHAIN = addchain ($$.CHAIN, stmmodel_ptfl);
949 $$.TYPE = $1;
950 }
951 }
952 ;
953
954 axistype : _INPUT_SLEW_AXIS
955 {
956 $$ = STM_INPUT_SLEW;
957 }
958 | _CLOCK_SLEW_AXIS
959 {
960 $$ = STM_CLOCK_SLEW;
961 }
962 | _SLEW_AXIS
963 {
964 $$ = STM_INPUT_SLEW;
965 }
966 | _LOAD_AXIS
967 {
968 $$ = STM_LOAD;
969 }
970 ;
971
972 val_list : empty
973 {
974 $$ = NULL;
975 }
976 | val val_list
977 {
978 if (STM_PRELOAD=='Y')
979 $$ = NULL;
980 else {
981 stmmodel_ptfl = (float*)mbkalloc (sizeof (float));
982 *stmmodel_ptfl = $1.t_float;
983 $$ = addchain ($2, stmmodel_ptfl);
984 }
985 }
986 ;
987
988 data : _DATA '(' modeldata ')'
989 {
990 $$ = $3;
991 }
992 ;
993
994 modeldata : val
995 {
996 if (STM_PRELOAD == 'Y') {
997 $$.CHAIN = NULL;
998 $$.DIM = STM_NODIM;
999 }
1000 else {
1001 stmmodel_ptfl = (float*)mbkalloc (sizeof(float));
1002 *stmmodel_ptfl = $1.t_float;
1003 $$.CHAIN = addchain (NULL, stmmodel_ptfl);
1004 $$.DIM = STM_CONST;
1005 }
1006 }
1007 | array1D
1008 {
1009 $$.CHAIN = $1;
1010 if (STM_PRELOAD=='Y')
1011 $$.DIM = STM_NODIM;
1012 else
1013 $$.DIM = STM_1D;
1014 }
1015 | array2D
1016 {
1017 $$.CHAIN = $1;
1018 if (STM_PRELOAD=='Y')
1019 $$.DIM = STM_NODIM;
1020 else
1021 $$.DIM = STM_2D;
1022 }
1023 ;
1024
1025 array2D : array1D array1D array1D_list
1026 {
1027 if (STM_PRELOAD=='Y')
1028 $$ = NULL;
1029 else {
1030 $$ = addchain ($3, $2);
1031 $$ = addchain ($$, $1);
1032 }
1033 }
1034 ;
1035
1036 array1D : '(' val val val_list ')'
1037 {
1038 if (STM_PRELOAD=='Y')
1039 $$ = NULL;
1040 else {
1041 stmmodel_ptfl = (float*)mbkalloc (sizeof (float));
1042 *stmmodel_ptfl = $3.t_float;
1043 $$ = addchain ($4, stmmodel_ptfl);
1044 stmmodel_ptfl = (float*)mbkalloc (sizeof(float));
1045 *stmmodel_ptfl = $2.t_float;
1046 $$ = addchain ($$, stmmodel_ptfl);
1047 }
1048 }
1049 ;
1050
1051 array1D_list: empty
1052 {
1053 $$ = NULL;
1054 }
1055 | array1D array1D_list
1056 {
1057 if (STM_PRELOAD == 'Y')
1058 $$ = NULL;
1059 else
1060 $$ = addchain ($2, $1);
1061 }
1062 ;
1063
1064 /*****************************************************************************/
1065 /* SCM model */
1066 /*****************************************************************************/
1067
1068 scmtype : _SCM_DUAL
1069 {
1070 $$ = STM_MOD_MODSCM | STM_MODSCM_DUAL;
1071 stmmodel_d = 0;
1072 }
1073 | _SCM_GOOD
1074 {
1075 $$ = STM_MOD_MODSCM | STM_MODSCM_GOOD;
1076 stmmodel_d = 0;
1077 stmmodel_i = 0;
1078 stmmodel_0 = 0;
1079 stmmodel_n = 0;
1080
1081 }
1082 | _SCM_FALSE
1083 {
1084 $$ = STM_MOD_MODSCM | STM_MODSCM_FALSE;
1085 stmmodel_f = 0;
1086 stmmodel_i = 0;
1087 stmmodel_0 = 0;
1088 stmmodel_n = 0;
1089 }
1090 | _SCM_PATH
1091 {
1092 $$ = STM_MOD_MODSCM | STM_MODSCM_PATH;
1093 stmmodel_p = 0;
1094 stmmodel_i = 0;
1095 stmmodel_0 = 0;
1096 stmmodel_n = 0;
1097 }
1098 | _SCM_CST
1099 {
1100 $$ = STM_MOD_MODSCM | STM_MODSCM_CST;
1101 stmmodel_c = 0;
1102 }
1103 ;
1104
1105 scmmodel : scmtype '(' params ')'
1106 ;
1107
1108 params : dualparams
1109 | goodparams
1110 | falseparams
1111 | pathparams
1112 | cstparams
1113 ;
1114
1115 /* cst */
1116
1117 cstparams : _CST '(' '(' _DELAY _SLEW ')'
1118 '(' val val ')' ')'
1119 {
1120 if (STM_PRELOAD=='Y') {
1121 stmmodel_c_params[STM_CST_DELAY] = 0;
1122 stmmodel_c_params[STM_CST_SLEW] = 0;
1123 stmmodel_c = 0;
1124 }
1125 else {
1126 stmmodel_c_params[STM_CST_DELAY] = $8.t_float;
1127 stmmodel_c_params[STM_CST_SLEW] = $9.t_float;
1128 stmmodel_c = 1;
1129 }
1130 }
1131 ;
1132
1133 /* dual */
1134
1135 dualparams : _DUAL '(' '(' _PCONF0 _PCONF1 _CAPAI _CAPAI0 _CAPAI1 _CAPAI2 _CAPAI3 _VT0 _VT0C _IRAP _VDDIN _VT _THRESHOLD _IMAX _AN _BN _VDDMAX _RSAT _RLIN _DRC _RBR _CBR _INPUT_THR _RINT _VINT _CHALF _RCONF _KF _KR _QINIT ')'
1136 '(' val val val val val val val val val val val val val val val val val val val val val val val val val val val val val val ')' ')'
1137 {
1138 if (STM_PRELOAD=='Y') {
1139 stmmodel_d_params[STM_PCONF0] = 0;
1140 stmmodel_d_params[STM_PCONF1] = 0;
1141 stmmodel_d_params[STM_CAPAI] = 0;
1142 stmmodel_d_params[STM_CAPAI0] = 0;
1143 stmmodel_d_params[STM_CAPAI1] = 0;
1144 stmmodel_d_params[STM_CAPAI2] = 0;
1145 stmmodel_d_params[STM_CAPAI3] = 0;
1146 stmmodel_d_params[STM_VT0] = 0;
1147 stmmodel_d_params[STM_VT0C] = 0;
1148 stmmodel_d_params[STM_IRAP] = 0;
1149 stmmodel_d_params[STM_VDDIN] = 0;
1150 stmmodel_d_params[STM_VT] = 0;
1151 stmmodel_d_params[STM_THRESHOLD] = 0;
1152 stmmodel_d_params[STM_IMAX] = 0;
1153 stmmodel_d_params[STM_AN] = 0;
1154 stmmodel_d_params[STM_BN] = 0;
1155 stmmodel_d_params[STM_VDDMAX] = 0;
1156 stmmodel_d_params[STM_RSAT] = 0;
1157 stmmodel_d_params[STM_RLIN] = 0;
1158 stmmodel_d_params[STM_DRC] = 0;
1159 stmmodel_d_params[STM_RBR] = 0;
1160 stmmodel_d_params[STM_CBR] = 0;
1161 stmmodel_d_params[STM_INPUT_THR] = 0;
1162 stmmodel_d_params[STM_RINT] = 0;
1163 stmmodel_d_params[STM_VINT] = 0;
1164 stmmodel_d_params[STM_CHALF] = 0;
1165 stmmodel_d_params[STM_RCONF] = 0;
1166 stmmodel_d_params[STM_KF] = 0;
1167 stmmodel_d_params[STM_KRT] = 0;
1168 stmmodel_d_params[STM_QINIT] = 0;
1169 stmmodel_d_params[STM_CAPAO] = stmmodel_d_params[STM_CAPAI];
1170 stmmodel_d = 0;
1171 }
1172 else {
1173 stmmodel_d_params[STM_PCONF0] = $36.t_float;
1174 stmmodel_d_params[STM_PCONF1] = $37.t_float;
1175 stmmodel_d_params[STM_CAPAI] = $38.t_float;
1176 stmmodel_d_params[STM_CAPAI0] = $39.t_float;
1177 stmmodel_d_params[STM_CAPAI1] = $40.t_float;
1178 stmmodel_d_params[STM_CAPAI2] = $41.t_float;
1179 stmmodel_d_params[STM_CAPAI3] = $42.t_float;
1180 stmmodel_d_params[STM_VT0] = $43.t_float;
1181 stmmodel_d_params[STM_VT0C] = $44.t_float;
1182 stmmodel_d_params[STM_IRAP] = $45.t_float;
1183 stmmodel_d_params[STM_VDDIN] = $46.t_float;
1184 stmmodel_d_params[STM_VT] = $47.t_float;
1185 stmmodel_d_params[STM_THRESHOLD] = $48.t_float;
1186 stmmodel_d_params[STM_IMAX] = $49.t_float;
1187 stmmodel_d_params[STM_AN] = $50.t_float;
1188 stmmodel_d_params[STM_BN] = $51.t_float;
1189 stmmodel_d_params[STM_VDDMAX] = $52.t_float;
1190 stmmodel_d_params[STM_RSAT] = $53.t_float;
1191 stmmodel_d_params[STM_RLIN] = $54.t_float;
1192 stmmodel_d_params[STM_DRC] = $55.t_float;
1193 stmmodel_d_params[STM_RBR] = $56.t_float;
1194 stmmodel_d_params[STM_CBR] = $57.t_float;
1195 stmmodel_d_params[STM_INPUT_THR] = $58.t_float;
1196 stmmodel_d_params[STM_RINT] = $59.t_float;
1197 stmmodel_d_params[STM_VINT] = $60.t_float;
1198 stmmodel_d_params[STM_CHALF] = $61.t_float;
1199 stmmodel_d_params[STM_RCONF] = $62.t_float;
1200 stmmodel_d_params[STM_KF] = $63.t_float;
1201 stmmodel_d_params[STM_KRT] = $64.t_float;
1202 stmmodel_d_params[STM_QINIT] = $65.t_float;
1203 stmmodel_d_params[STM_CAPAO] = stmmodel_d_params[STM_CAPAI];
1204 stmmodel_d = 1;
1205 }
1206 }
1207 | _DUAL '(' '(' _PCONF0 _PCONF1 _CAPAI _IRAP _VDDIN _VT _THRESHOLD _IMAX _AN _BN _VDDMAX _RSAT _RLIN _DRC _RBR _CBR _INPUT_THR _RINT _VINT _CHALF _RCONF _KF _KR _QINIT ')'
1208 '(' val val val val val val val val val val val val val val val val val val val val val val val val ')' ')'
1209 {
1210 if (STM_PRELOAD=='Y') {
1211 stmmodel_d_params[STM_PCONF0] = 0;
1212 stmmodel_d_params[STM_PCONF1] = 0;
1213 stmmodel_d_params[STM_CAPAI] = 0;
1214 stmmodel_d_params[STM_CAPAI0] = 0;
1215 stmmodel_d_params[STM_CAPAI1] = 0;
1216 stmmodel_d_params[STM_CAPAI2] = 0;
1217 stmmodel_d_params[STM_CAPAI3] = 0;
1218 stmmodel_d_params[STM_VT0] = 0;
1219 stmmodel_d_params[STM_VT0C] = 0;
1220 stmmodel_d_params[STM_IRAP] = 0;
1221 stmmodel_d_params[STM_VDDIN] = 0;
1222 stmmodel_d_params[STM_VT] = 0;
1223 stmmodel_d_params[STM_THRESHOLD] = 0;
1224 stmmodel_d_params[STM_IMAX] = 0;
1225 stmmodel_d_params[STM_AN] = 0;
1226 stmmodel_d_params[STM_BN] = 0;
1227 stmmodel_d_params[STM_VDDMAX] = 0;
1228 stmmodel_d_params[STM_RSAT] = 0;
1229 stmmodel_d_params[STM_RLIN] = 0;
1230 stmmodel_d_params[STM_DRC] = 0;
1231 stmmodel_d_params[STM_RBR] = 0;
1232 stmmodel_d_params[STM_CBR] = 0;
1233 stmmodel_d_params[STM_INPUT_THR] = 0;
1234 stmmodel_d_params[STM_RINT] = 0;
1235 stmmodel_d_params[STM_VINT] = 0;
1236 stmmodel_d_params[STM_CHALF] = 0;
1237 stmmodel_d_params[STM_RCONF] = 0;
1238 stmmodel_d_params[STM_KF] = 0;
1239 stmmodel_d_params[STM_KRT] = 0;
1240 stmmodel_d_params[STM_QINIT] = 0;
1241 stmmodel_d_params[STM_CAPAO] = stmmodel_d_params[STM_CAPAI];
1242 stmmodel_d = 0;
1243 }
1244 else {
1245 stmmodel_d_params[STM_PCONF0] = $30.t_float;
1246 stmmodel_d_params[STM_PCONF1] = $31.t_float;
1247 stmmodel_d_params[STM_CAPAI] = $32.t_float;
1248 stmmodel_d_params[STM_CAPAI0] = $32.t_float;
1249 stmmodel_d_params[STM_CAPAI1] = $32.t_float;
1250 stmmodel_d_params[STM_CAPAI2] = $32.t_float;
1251 stmmodel_d_params[STM_CAPAI3] = $32.t_float;
1252 stmmodel_d_params[STM_VT0] = $35.t_float;
1253 stmmodel_d_params[STM_VT0C] = $40.t_float-$35.t_float;
1254 stmmodel_d_params[STM_IRAP] = $33.t_float;
1255 stmmodel_d_params[STM_VDDIN] = $34.t_float;
1256 stmmodel_d_params[STM_VT] = $35.t_float;
1257 stmmodel_d_params[STM_THRESHOLD] = $36.t_float;
1258 stmmodel_d_params[STM_IMAX] = $37.t_float;
1259 stmmodel_d_params[STM_AN] = $38.t_float;
1260 stmmodel_d_params[STM_BN] = $39.t_float;
1261 stmmodel_d_params[STM_VDDMAX] = $40.t_float;
1262 stmmodel_d_params[STM_RSAT] = $41.t_float;
1263 stmmodel_d_params[STM_RLIN] = $42.t_float;
1264 stmmodel_d_params[STM_DRC] = $43.t_float;
1265 stmmodel_d_params[STM_RBR] = $44.t_float;
1266 stmmodel_d_params[STM_CBR] = $45.t_float;
1267 stmmodel_d_params[STM_INPUT_THR] = $46.t_float;
1268 stmmodel_d_params[STM_RINT] = $47.t_float;
1269 stmmodel_d_params[STM_VINT] = $48.t_float;
1270 stmmodel_d_params[STM_CHALF] = $49.t_float;
1271 stmmodel_d_params[STM_RCONF] = $50.t_float;
1272 stmmodel_d_params[STM_KF] = $51.t_float;
1273 stmmodel_d_params[STM_KRT] = $52.t_float;
1274 stmmodel_d_params[STM_QINIT] = $53.t_float;
1275 stmmodel_d_params[STM_CAPAO] = stmmodel_d_params[STM_CAPAI];
1276 stmmodel_d = 1;
1277 }
1278 }
1279
1280 ;
1281
1282 /* good */
1283
1284 goodparams : link0p linkips linknp dualparams
1285 ;
1286
1287 /* false */
1288
1289 falseparams : link0p linkips linknp falselink
1290 ;
1291
1292 /* path */
1293
1294 pathparams : link0p linkips pathlink
1295 ;
1296
1297 links : '(' val ')'
1298 {
1299 if (STM_PRELOAD=='Y') {
1300 stmmodel_i_params[STM_NB_I_LINKS] = 0;
1301 stmmodel_index = 0;
1302 stmmodel_i = 0;
1303 }
1304 else {
1305 stmmodel_i_params[STM_NB_I_LINKS] = $2.t_float;
1306 stmmodel_index = 1;
1307 stmmodel_i = 1;
1308 }
1309 }
1310 ;
1311
1312 link0p : _LINK_OUT '(' '(' _CI _CF _K3 _K4 _K5 ')' '(' val val val val val ')' ')'
1313 {
1314 if (STM_PRELOAD=='Y') {
1315 stmmodel_0_params[STM_CI_0] = 0;
1316 stmmodel_0_params[STM_CF_0] = 0;
1317 stmmodel_0_params[STM_K3_0] = 0;
1318 stmmodel_0_params[STM_K4_0] = 0;
1319 stmmodel_0_params[STM_K5_0] = 0;
1320 stmmodel_0 = 0;
1321 }
1322 else {
1323 stmmodel_0_params[STM_CI_0] = $11.t_float;
1324 stmmodel_0_params[STM_CF_0] = $12.t_float;
1325 stmmodel_0_params[STM_K3_0] = $13.t_float;
1326 stmmodel_0_params[STM_K4_0] = $14.t_float;
1327 stmmodel_0_params[STM_K5_0] = $15.t_float;
1328 stmmodel_0 = 1;
1329 }
1330 }
1331 ;
1332
1333 linkips : _LINK_PASS '(' links '(' _CI _CF _ACTI _BCTI _K3 _K4 _K5 ')' linkip_list ')'
1334 | empty
1335 ;
1336
1337 linkip_list : linkip_list linkip
1338 | linkip
1339 ;
1340
1341 linkip : '(' val val val val val val val')'
1342 {
1343 if (STM_PRELOAD=='Y'){
1344 stmmodel_i_params[stmmodel_index + STM_CI_I] = 0;
1345 stmmodel_i_params[stmmodel_index + STM_CF_I] = 0;
1346 stmmodel_i_params[stmmodel_index + STM_ACTI_I] = 0;
1347 stmmodel_i_params[stmmodel_index + STM_BCTI_I] = 0;
1348 stmmodel_i_params[stmmodel_index + STM_K3_I] = 0;
1349 stmmodel_i_params[stmmodel_index + STM_K4_I] = 0;
1350 stmmodel_i_params[stmmodel_index + STM_K5_I] = 0;
1351 stmmodel_index = 0;
1352 }
1353 else {
1354 stmmodel_i_params[stmmodel_index + STM_CI_I] = $2.t_float;
1355 stmmodel_i_params[stmmodel_index + STM_CF_I] = $3.t_float;
1356 stmmodel_i_params[stmmodel_index + STM_ACTI_I] = $4.t_float;
1357 stmmodel_i_params[stmmodel_index + STM_BCTI_I] = $5.t_float;
1358 stmmodel_i_params[stmmodel_index + STM_K3_I] = $6.t_float;
1359 stmmodel_i_params[stmmodel_index + STM_K4_I] = $7.t_float;
1360 stmmodel_i_params[stmmodel_index + STM_K5_I] = $8.t_float;
1361 stmmodel_index += STM_NB_LINK_I_PARAMS;
1362 }
1363 }
1364 ;
1365
1366 linknp : _LINK_DUAL '(' '(' _CI _CF _ACTI _BCTI ')' '(' val val val val ')' ')'
1367 {
1368 if (STM_PRELOAD=='Y') {
1369 stmmodel_n_params[STM_CI_N] = 0;
1370 stmmodel_n_params[STM_CF_N] = 0;
1371 stmmodel_n_params[STM_ACTI_N] = 0;
1372 stmmodel_n_params[STM_BCTI_N] = 0;
1373 stmmodel_n = 0;
1374 }
1375 else {
1376 stmmodel_n_params[STM_CI_N] = $10.t_float;
1377 stmmodel_n_params[STM_CF_N] = $11.t_float;
1378 stmmodel_n_params[STM_ACTI_N] = $12.t_float;
1379 stmmodel_n_params[STM_BCTI_N] = $13.t_float;
1380 stmmodel_n = 1;
1381 }
1382 }
1383 | empty
1384 ;
1385
1386 /* falselink */
1387
1388 falselink : _FALSE '(' '(' _PCONF0 _PCONF1 _RTOT _KF _VDDMAX _DRC ')' '(' val val val val val val ')' ')'
1389 {
1390 if (STM_PRELOAD=='Y') {
1391 stmmodel_f_params[STM_PCONF0_F] = 0;
1392 stmmodel_f_params[STM_PCONF1_F] = 0;
1393 stmmodel_f_params[STM_RTOT_F] = 0;
1394 stmmodel_f_params[STM_K_F] = 0;
1395 stmmodel_f_params[STM_VDDMAX_F] = 0;
1396 stmmodel_f_params[STM_DRC_F] = 0;
1397 stmmodel_f = 0;
1398 }
1399 else {
1400 stmmodel_f_params[STM_PCONF0_F] = $12.t_float;
1401 stmmodel_f_params[STM_PCONF1_F] = $13.t_float;
1402 stmmodel_f_params[STM_RTOT_F] = $14.t_float;
1403 stmmodel_f_params[STM_K_F] = $15.t_float;
1404 stmmodel_f_params[STM_VDDMAX_F] = $16.t_float;
1405 stmmodel_f_params[STM_DRC_F] = $17.t_float;
1406 stmmodel_f = 1;
1407 }
1408 }
1409 | _FALSE '(' '(' _PCONF0 _PCONF1 _RTOT _KF _VDDMAX _DRC _VF_INPUT ')' '(' val val val val val val val ')' ')'
1410 {
1411 if (STM_PRELOAD=='Y') {
1412 stmmodel_f_params[STM_PCONF0_F] = 0;
1413 stmmodel_f_params[STM_PCONF1_F] = 0;
1414 stmmodel_f_params[STM_RTOT_F] = 0;
1415 stmmodel_f_params[STM_K_F] = 0;
1416 stmmodel_f_params[STM_VDDMAX_F] = 0;
1417 stmmodel_f_params[STM_DRC_F] = 0;
1418 stmmodel_f_params[STM_VF_INPUT_F] = 0;
1419 stmmodel_f = 0;
1420 }
1421 else {
1422 stmmodel_f_params[STM_PCONF0_F] = $13.t_float;
1423 stmmodel_f_params[STM_PCONF1_F] = $14.t_float;
1424 stmmodel_f_params[STM_RTOT_F] = $15.t_float;
1425 stmmodel_f_params[STM_K_F] = $16.t_float;
1426 stmmodel_f_params[STM_VDDMAX_F] = $17.t_float;
1427 stmmodel_f_params[STM_DRC_F] = $18.t_float;
1428 stmmodel_f_params[STM_VF_INPUT_F] = $19.t_float;
1429 stmmodel_f = 1;
1430 }
1431 }
1432 ;
1433
1434 /* pathlink */
1435
1436 pathlink : _PATH '(' '(' _PCONF0 _VDDMAX ')' '(' val val ')' ')'
1437 {
1438 if (STM_PRELOAD == 'Y') {
1439 stmmodel_p_params[STM_PCONF0_F] = 0;
1440 stmmodel_p_params[STM_VDDMAX_P] = 0;
1441 stmmodel_p = 0;
1442 }
1443 else {
1444 stmmodel_p_params[STM_PCONF0_F] = $8.t_float;
1445 stmmodel_p_params[STM_VDDMAX_P] = $9.t_float;
1446 stmmodel_p = 1;
1447 }
1448 }
1449 | _PATH '(' '(' _PCONF0 _VDDMAX _VF_INPUT ')' '(' val val val ')' ')'
1450 {
1451 if (STM_PRELOAD == 'Y') {
1452 stmmodel_p_params[STM_PCONF0_F] = 0;
1453 stmmodel_p_params[STM_VDDMAX_P] = 0;
1454 stmmodel_p = 0;
1455 }
1456 else {
1457 stmmodel_p_params[STM_PCONF0_F] = $9.t_float;
1458 stmmodel_p_params[STM_VDDMAX_P] = $10.t_float;
1459 stmmodel_p = 1;
1460 }
1461 }
1462 ;
1463
1464 /*****************************************************************************/
1465 /* IV model */
1466 /*****************************************************************************/
1467
1468 ivmodel : _IV '(' nbve nbvs voltageve voltagevs current conflict input initial ')'
1469 {
1470 $$=STM_MOD_MODIV;
1471 }
1472 ;
1473
1474 nbve : _NVE '(' val ')'
1475 {
1476 if (STM_PRELOAD=='Y')
1477 stmmodel_iv_nve = 0;
1478 else
1479 stmmodel_iv_nve = atoi( $3.t_float_string );
1480 }
1481 ;
1482
1483 nbvs : _NVS '(' val ')'
1484 {
1485 if (STM_PRELOAD=='Y')
1486 stmmodel_iv_nvs = 0;
1487 else
1488 stmmodel_iv_nvs = atoi( $3.t_float_string );
1489 }
1490 ;
1491
1492 voltageve : _VE array1D
1493 {
1494 stmmodel_iv_tabve = $2;
1495 }
1496 ;
1497
1498 voltagevs : _VS array1D
1499 {
1500 stmmodel_iv_tabvs = $2;
1501 }
1502 ;
1503
1504 current : _CURRENT '(' array2D ')'
1505 {
1506 stmmodel_iv_tabiv = $3;
1507 }
1508 ;
1509
1510 conflict : _CONFLICT '(' val val val val ')'
1511 {
1512 if (STM_PRELOAD=='Y') {
1513 stmmodel_iv_conf[0]=0;
1514 stmmodel_iv_conf[1]=0;
1515 stmmodel_iv_conf[2]=0;
1516 stmmodel_iv_conf[3]=0;
1517 }
1518 else {
1519 stmmodel_iv_conf[0]=$3.t_float;
1520 stmmodel_iv_conf[1]=$4.t_float;
1521 stmmodel_iv_conf[2]=$5.t_float;
1522 stmmodel_iv_conf[3]=$6.t_float;
1523 }
1524 }
1525 ;
1526
1527 input : _INPUT '(' val val val val ')'
1528 {
1529 if (STM_PRELOAD=='Y') {
1530 stmmodel_iv_input[0]=0;
1531 stmmodel_iv_input[1]=0;
1532 stmmodel_iv_input[2]=0;
1533 stmmodel_iv_input[3]=0;
1534 }
1535 else {
1536 stmmodel_iv_input[0]=$3.t_float;
1537 stmmodel_iv_input[1]=$4.t_float;
1538 stmmodel_iv_input[2]=$5.t_float;
1539 stmmodel_iv_input[3]=$6.t_float;
1540 }
1541 }
1542 ;
1543
1544 initial : _INITIAL '(' val ')'
1545 {
1546 if (STM_PRELOAD=='Y')
1547 stmmodel_iv_init[0]=0;
1548 else
1549 stmmodel_iv_init[0]=$3.t_float;
1550 }
1551 ;
1552
1553 /*****************************************************************************/
1554 /* PLN model */
1555 /*****************************************************************************/
1556
1557 plnmodel : _SPDM '(' varparams_list ordersparams coefsparams ')'
1558 {
1559 if (STM_PRELOAD=='Y') {
1560 stmmodel_nb_var = 0;
1561 stmmodel_deg_index = 0;
1562 stmmodel_var_index = 0;
1563 stmmodel_coeftab_index = 0;
1564 stmmodel_coefdef_index = 0;
1565 stmmodel_coefdef_nb = 0;
1566 stmmodel_coefdef_mask = STM_COEF_DEFMASK;
1567 }
1568 else {
1569 stmmodel_nb_var = stmmodel_deg_index;
1570 stmmodel_deg_index = 0;
1571 stmmodel_var_index = 0;
1572 stmmodel_coeftab_index = 0;
1573 stmmodel_coefdef_index = 0;
1574 stmmodel_coefdef_nb = 0;
1575 stmmodel_coefdef_mask = STM_COEF_DEFMASK;
1576 }
1577 $$ = STM_MOD_MODPLN;
1578 }
1579 ;
1580
1581 /* varparams */
1582
1583 varparams_list : empty
1584 | varparams_list varparams
1585 ;
1586
1587 varparams : axistype _VARTHMIN '(' val ')' _VARTHMAX '(' val ')'
1588 {
1589 if (STM_PRELOAD=='Y') {
1590 stmmodel_var_params[stmmodel_var_index] = NULL;
1591 stmmodel_var_params[stmmodel_var_index]->TYPE = $1;
1592 stmmodel_var_params[stmmodel_var_index]->THMIN = 0;
1593 stmmodel_var_params[stmmodel_var_index]->THMAX = 0;
1594 stmmodel_var_index=0;
1595 }
1596 else {
1597 stmmodel_var_params[stmmodel_var_index] = (timing_varpolynom*)mbkalloc (sizeof (struct timing_varpolynom));
1598 stmmodel_var_params[stmmodel_var_index]->TYPE = $1;
1599 stmmodel_var_params[stmmodel_var_index]->THMIN = $4.t_float;
1600 stmmodel_var_params[stmmodel_var_index]->THMAX = $8.t_float;
1601 stmmodel_var_index++;
1602 }
1603 }
1604 ;
1605
1606
1607 /* orders */
1608
1609 orders_list : orders_list orders_i
1610 | orders_i
1611 ;
1612
1613 orders_i : val
1614 {
1615 if (STM_PRELOAD=='Y') {
1616 stmmodel_deg_params[stmmodel_deg_index] = 0;
1617 stmmodel_deg_index=0;
1618 }
1619 else {
1620 stmmodel_deg_params[stmmodel_deg_index] = $1.t_float;
1621 stmmodel_deg_index++;
1622 }
1623 }
1624 ;
1625
1626 ordersparams : _ORDERS '(' orders_list ')'
1627 ;
1628
1629 /* coefs */
1630
1631 coefs_list : coefs_list coefs_i
1632 | coefs_i
1633 ;
1634
1635 coefs_i : val
1636 {
1637 if (STM_PRELOAD=='Y') {
1638 stmmodel_coefdef_nb = 0;
1639 stmmodel_coeftab_params[stmmodel_coeftab_index] = 0;
1640 stmmodel_coeftab_index = 0;
1641 stmmodel_coefdef_params[stmmodel_coefdef_index] = 0;
1642 stmmodel_coefdef_mask = 0;
1643 stmmodel_coefdef_index = 0;
1644 }
1645 else {
1646 stmmodel_coefdef_nb++;
1647 if($1.t_float){
1648 stmmodel_coeftab_params[stmmodel_coeftab_index] = $1.t_float;
1649 stmmodel_coeftab_index ++;
1650 stmmodel_coefdef_params[stmmodel_coefdef_index] = stmmodel_coefdef_params[stmmodel_coefdef_index] | stmmodel_coefdef_mask;
1651 }
1652 stmmodel_coefdef_mask = stmmodel_coefdef_mask << 1;
1653 if(!((stmmodel_coefdef_nb) % (sizeof(long) * 8))){
1654 stmmodel_coefdef_index++;
1655 stmmodel_coefdef_mask = STM_COEF_DEFMASK;
1656 }
1657 }
1658 }
1659 ;
1660
1661 coefsparams : _COEFS '(' coefs_list ')'
1662 ;
1663
1664 /*****************************************************************************/
1665 /* NOISE model */
1666 /*****************************************************************************/
1667
1668 noisemodel : _NOISE_SCR '(' val val ')'
1669 {
1670 if (STM_PRELOAD=='Y')
1671 vnoise_model = STM_NOISE_NULL;
1672 else {
1673 vnoise_model = STM_NOISE_SCR;
1674 vnoise_scr = $3.t_float;
1675 vnoise_invth = $4.t_float;
1676 }
1677 }
1678 | _NOISE_SCR '(' val ')'
1679 {
1680 if (STM_PRELOAD=='Y')
1681 vnoise_model = STM_NOISE_NULL;
1682 else {
1683 vnoise_model = STM_NOISE_SCR;
1684 vnoise_scr = $3.t_float;
1685 vnoise_invth = vdd/2;
1686 }
1687 }
1688 | empty
1689 {
1690 vnoise_model = STM_NOISE_NULL;
1691 }
1692 ;
1693
1694 /*****************************************************************************/
1695 /* ENERGY model */
1696 /*****************************************************************************/
1697 eparams : '(' _PCONF0 _PCONF1 ')'
1698 '(' val val ')'
1699 {
1700 stmmodel_e_params [STM_EPCONF0] = $6.t_float;
1701 stmmodel_e_params [STM_EPCONF1] = $7.t_float;
1702 stmmodel_e = 1;
1703 }
1704 ;
1705
1706 energyparamsmodel : _ENERGY_MODEL
1707 {
1708 stmmodel_e = 0;
1709 }
1710 '(' eparams ')'
1711 {
1712 $$ = STM_ENERGY_PARAMS;
1713 }
1714 ;
1715
1716 energytbltype : _ENERGY_TABLE
1717 {
1718 $$ = STM_ENERGY_TABLE;
1719 }
1720 | _ENERGY_CONST
1721 {
1722 $$ = STM_ENERGY_TABLE;
1723 }
1724 ;
1725
1726 energytblmodel : energytbltype '(' axis axis data ')'
1727 {
1728 stmmodel_energy_xchain = $3.CHAIN;
1729 stmmodel_energy_xtype = $3.TYPE;
1730 stmmodel_energy_ychain = $4.CHAIN;
1731 stmmodel_energy_ytype = $4.TYPE;
1732 stmmodel_energy_xydata = $5.CHAIN;
1733 stmmodel_energy_dimension = $5.DIM;
1734 $$ = $1;
1735 }
1736 | energytbltype '(' axis data ')'
1737 {
1738 stmmodel_energy_xchain = $3.CHAIN;
1739 stmmodel_energy_xtype = $3.TYPE;
1740 stmmodel_energy_ychain = NULL;
1741 stmmodel_energy_ytype = STM_NOTYPE;
1742 stmmodel_energy_xydata = $4.CHAIN;
1743 stmmodel_energy_dimension = $4.DIM;
1744 $$ = $1;
1745 }
1746 | energytbltype '(' data ')'
1747 {
1748 stmmodel_energy_xchain = NULL;
1749 stmmodel_energy_xtype = STM_NOTYPE;
1750 stmmodel_energy_ychain = NULL;
1751 stmmodel_energy_ytype = STM_NOTYPE;
1752 stmmodel_energy_xydata = $3.CHAIN;
1753 stmmodel_energy_dimension = $3.DIM;
1754 $$ = $1;
1755 }
1756 ;
1757
1758 energymodel : energytblmodel
1759 {
1760 stmmodel_energy_model_type = $1;
1761 }
1762 | energyparamsmodel
1763 {
1764 stmmodel_energy_model_type = $1;
1765 }
1766 | empty
1767 {
1768 stmmodel_energy_model_type = STM_ENERGY_NULL;
1769 }
1770 ;
1771
1772 /*****************************************************************************/
1773
1774
1775 modelname : _NAME '(' _IDENTIFIER ')'
1776 {
1777 $$ = namealloc($3); mbkfree($3);
1778 }
1779 ;
1780
1781 val : _NUMBER
1782 {
1783 $$ = $1;
1784 }
1785 | _ENUMBER
1786 {
1787 $$ = $1;
1788 }
1789 | _UNKNOWN
1790 {
1791 $$.t_float = STM_UNKNOWN;
1792 strcpy($$.t_float_string,"");
1793 }
1794 ;
1795
1796 empty : /* empty */
1797 ;
1798
1799 %%
1800
1801 int yyerror ()
1802 {
1803 avt_errmsg (STM_ERRMSG, "001", AVT_FATAL, STM_FILE, STM_LINE);
1804 return 1;
1805 }
1806