1 /******************************************************************************/
3 /* Chaine de CAO & VLSI AVERTEC */
5 /* Produit: STM Version 1.00 */
8 /* (c) copyright 2000 AVERTEC */
9 /* Tous droits reserves */
11 /* Auteur(s): Gilles Augustins */
13 /******************************************************************************/
16 #define API_HIDE_TOKENS
21 /******************************************************************************/
23 /******************************************************************************/
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;
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;
104 /******************************************************************************/
105 /* function declarations */
106 /******************************************************************************/
117 char t_float_string[128];
120 struct chain *t_pchain;
188 %token _CLOCK_SLEW_AXIS
190 %token <t_struct3> _ENUMBER
191 %token <t_pchar> _IDENTIFIER
192 %token _INPUT_SLEW_AXIS
195 %token <t_struct3> _NUMBER
229 %token <t_char> _ECHAR
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
257 %type <t_pchain> voltageve
258 %type <t_pchain> voltagevs
259 %type <t_pchain> current
260 %type <t_long> ivmodel
269 model : _MODEL '(' modelname tmodel ')'
272 switch ($4 & STM_MOD_TYPEMASK) {
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;
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));
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 ) {
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 );
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) {
309 if (stmmodel_nx > 0 || stmmodel_ny > 0)
310 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
312 stm_modtbl_setconst (stmmodel_model->UMODEL.TABLE, *(float*)stmmodel_xydata->DATA);
313 mbkfree((float*)stmmodel_xydata->DATA);
314 freechain (stmmodel_xydata);
318 if (stmmodel_nx > 0 && stmmodel_ny > 0)
319 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
328 if (stmmodel_nx == 0 || stmmodel_ny == 0)
329 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
337 freechain (stmmodel_xydata);
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);
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) {
355 if (stmmodel_energy_nx > 0 || stmmodel_energy_ny > 0)
356 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
364 if (stmmodel_energy_nx > 0 && stmmodel_energy_ny > 0)
365 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
374 if (stmmodel_energy_nx == 0 || stmmodel_energy_ny == 0)
375 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
383 freechain (stmmodel_energy_xydata);
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);
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);
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;
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));
425 switch( vnoise_model ) {
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 );
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);
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);
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);
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);
459 stmmodel_c_p = stmmodel_c ? stmmodel_c_params : NULL;
460 stmmodel_model->UMODEL.SCM = stm_modscm_cst_create (stmmodel_c_p);
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);
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) {
477 if (stmmodel_energy_nx > 0 || stmmodel_energy_ny > 0)
478 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
486 if (stmmodel_energy_nx > 0 && stmmodel_energy_ny > 0)
487 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
496 if (stmmodel_energy_nx == 0 || stmmodel_energy_ny == 0)
497 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
505 freechain (stmmodel_energy_xydata);
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);
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;
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));
539 switch( vnoise_model ) {
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 );
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);
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);
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) {
566 if (stmmodel_energy_nx > 0 || stmmodel_energy_ny > 0)
567 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
575 if (stmmodel_energy_nx > 0 && stmmodel_energy_ny > 0)
576 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
585 if (stmmodel_energy_nx == 0 || stmmodel_energy_ny == 0)
586 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
594 freechain (stmmodel_energy_xydata);
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);
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;
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));
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);
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;
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));
653 stmmodel_model->UMODEL.IV = stm_modiv_alloc( stmmodel_iv_nve, stmmodel_iv_nvs );
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));
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));
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)));
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] );
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 );
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 );
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) );
684 freechain( stmmodel_iv_tabiv );
686 switch( vnoise_model ) {
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 );
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);
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) {
707 if (stmmodel_energy_nx > 0 || stmmodel_energy_ny > 0)
708 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
716 if (stmmodel_energy_nx > 0 && stmmodel_energy_ny > 0)
717 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
726 if (stmmodel_energy_nx == 0 || stmmodel_energy_ny == 0)
727 avt_errmsg (STM_ERRMSG, "000", AVT_ERROR, $3);
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);
735 freechain (stmmodel_energy_xydata);
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);
753 tmodel : thresholds tblmodel noisemodel energymodel
757 | thresholds scmmodel noisemodel energymodel
761 | thresholds plnmodel noisemodel energymodel
765 | thresholds fctmodel
769 | thresholds ivmodel noisemodel energymodel
775 thresholds : _VTH '(' val ')' _VDD '(' val ')' _VT '(' val ')' _VF '(' val ')' transition
777 if ((STM_CACHE==NULL)||(STM_PRELOAD == 'Y')) {
790 | _TRAN '(' _IDENTIFIER ')'
794 else if(!strcmp($3,"ud"))
796 else if(!strcmp($3,"du"))
798 else if(!strcmp($3,"dd"))
805 /*****************************************************************************/
807 /*****************************************************************************/
809 fctmodel : _FCT '(' file function instance localname number ')'
815 file : _FILE '(' _IDENTIFIER ')'
817 stmmodel_fct_file = sensitive_namealloc($3); mbkfree($3);
821 stmmodel_fct_file = NULL;
825 localname : _LOCALNAME '(' _IDENTIFIER ')'
827 stmmodel_fct_localname = namealloc($3); mbkfree($3);
831 stmmodel_fct_localname = NULL;
835 instance : _INSTANCE '(' _IDENTIFIER ')'
837 stmmodel_fct_ins = namealloc($3); mbkfree($3);
841 stmmodel_fct_ins = NULL;
845 function : _FUNCTION '(' _IDENTIFIER param_list ')'
847 stmmodel_fct_fct = (APICallFunc *)mbkalloc(sizeof(APICallFunc));
848 stmmodel_fct_fct->NAME=sensitive_namealloc($3); mbkfree($3);
849 stmmodel_fct_fct->ARGS=$4;
853 stmmodel_fct_fct = NULL;
857 param_list : param_list param
869 if (strchr($1.t_float_string,'.')!=NULL)
870 $$=APIAddDoubleTARG(NULL, "?", $1.t_float);
872 $$=APIAddIntTARG(NULL, "?", atoi($1.t_float_string));
876 $$ = APIAddCharTARG(NULL, "?", $1);
880 number : _SIM_MODEL '(' _NUMBER ')'
882 sim_model_number = $3.t_float;
886 sim_model_number = -1;
890 /*****************************************************************************/
892 /*****************************************************************************/
904 tblmodel : tbltype '(' axis axis data ')'
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;
914 | tbltype '(' axis data ')'
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;
924 | tbltype '(' data ')'
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;
936 axis : axistype '(' val val val_list ')'
938 if (STM_PRELOAD=='Y') {
940 $$.TYPE = STM_NOTYPE;
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);
954 axistype : _INPUT_SLEW_AXIS
978 if (STM_PRELOAD=='Y')
981 stmmodel_ptfl = (float*)mbkalloc (sizeof (float));
982 *stmmodel_ptfl = $1.t_float;
983 $$ = addchain ($2, stmmodel_ptfl);
988 data : _DATA '(' modeldata ')'
996 if (STM_PRELOAD == 'Y') {
1001 stmmodel_ptfl = (float*)mbkalloc (sizeof(float));
1002 *stmmodel_ptfl = $1.t_float;
1003 $$.CHAIN = addchain (NULL, stmmodel_ptfl);
1010 if (STM_PRELOAD=='Y')
1018 if (STM_PRELOAD=='Y')
1025 array2D : array1D array1D array1D_list
1027 if (STM_PRELOAD=='Y')
1030 $$ = addchain ($3, $2);
1031 $$ = addchain ($$, $1);
1036 array1D : '(' val val val_list ')'
1038 if (STM_PRELOAD=='Y')
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);
1055 | array1D array1D_list
1057 if (STM_PRELOAD == 'Y')
1060 $$ = addchain ($2, $1);
1064 /*****************************************************************************/
1066 /*****************************************************************************/
1070 $$ = STM_MOD_MODSCM | STM_MODSCM_DUAL;
1075 $$ = STM_MOD_MODSCM | STM_MODSCM_GOOD;
1084 $$ = STM_MOD_MODSCM | STM_MODSCM_FALSE;
1092 $$ = STM_MOD_MODSCM | STM_MODSCM_PATH;
1100 $$ = STM_MOD_MODSCM | STM_MODSCM_CST;
1105 scmmodel : scmtype '(' params ')'
1117 cstparams : _CST '(' '(' _DELAY _SLEW ')'
1120 if (STM_PRELOAD=='Y') {
1121 stmmodel_c_params[STM_CST_DELAY] = 0;
1122 stmmodel_c_params[STM_CST_SLEW] = 0;
1126 stmmodel_c_params[STM_CST_DELAY] = $8.t_float;
1127 stmmodel_c_params[STM_CST_SLEW] = $9.t_float;
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 ')' ')'
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];
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];
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 ')' ')'
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];
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];
1284 goodparams : link0p linkips linknp dualparams
1289 falseparams : link0p linkips linknp falselink
1294 pathparams : link0p linkips pathlink
1299 if (STM_PRELOAD=='Y') {
1300 stmmodel_i_params[STM_NB_I_LINKS] = 0;
1305 stmmodel_i_params[STM_NB_I_LINKS] = $2.t_float;
1312 link0p : _LINK_OUT '(' '(' _CI _CF _K3 _K4 _K5 ')' '(' val val val val val ')' ')'
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;
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;
1333 linkips : _LINK_PASS '(' links '(' _CI _CF _ACTI _BCTI _K3 _K4 _K5 ')' linkip_list ')'
1337 linkip_list : linkip_list linkip
1341 linkip : '(' val val val val val val val')'
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;
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;
1366 linknp : _LINK_DUAL '(' '(' _CI _CF _ACTI _BCTI ')' '(' val val val val ')' ')'
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;
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;
1388 falselink : _FALSE '(' '(' _PCONF0 _PCONF1 _RTOT _KF _VDDMAX _DRC ')' '(' val val val val val val ')' ')'
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;
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;
1409 | _FALSE '(' '(' _PCONF0 _PCONF1 _RTOT _KF _VDDMAX _DRC _VF_INPUT ')' '(' val val val val val val val ')' ')'
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;
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;
1436 pathlink : _PATH '(' '(' _PCONF0 _VDDMAX ')' '(' val val ')' ')'
1438 if (STM_PRELOAD == 'Y') {
1439 stmmodel_p_params[STM_PCONF0_F] = 0;
1440 stmmodel_p_params[STM_VDDMAX_P] = 0;
1444 stmmodel_p_params[STM_PCONF0_F] = $8.t_float;
1445 stmmodel_p_params[STM_VDDMAX_P] = $9.t_float;
1449 | _PATH '(' '(' _PCONF0 _VDDMAX _VF_INPUT ')' '(' val val val ')' ')'
1451 if (STM_PRELOAD == 'Y') {
1452 stmmodel_p_params[STM_PCONF0_F] = 0;
1453 stmmodel_p_params[STM_VDDMAX_P] = 0;
1457 stmmodel_p_params[STM_PCONF0_F] = $9.t_float;
1458 stmmodel_p_params[STM_VDDMAX_P] = $10.t_float;
1464 /*****************************************************************************/
1466 /*****************************************************************************/
1468 ivmodel : _IV '(' nbve nbvs voltageve voltagevs current conflict input initial ')'
1474 nbve : _NVE '(' val ')'
1476 if (STM_PRELOAD=='Y')
1477 stmmodel_iv_nve = 0;
1479 stmmodel_iv_nve = atoi( $3.t_float_string );
1483 nbvs : _NVS '(' val ')'
1485 if (STM_PRELOAD=='Y')
1486 stmmodel_iv_nvs = 0;
1488 stmmodel_iv_nvs = atoi( $3.t_float_string );
1492 voltageve : _VE array1D
1494 stmmodel_iv_tabve = $2;
1498 voltagevs : _VS array1D
1500 stmmodel_iv_tabvs = $2;
1504 current : _CURRENT '(' array2D ')'
1506 stmmodel_iv_tabiv = $3;
1510 conflict : _CONFLICT '(' val val val val ')'
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;
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;
1527 input : _INPUT '(' val val val val ')'
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;
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;
1544 initial : _INITIAL '(' val ')'
1546 if (STM_PRELOAD=='Y')
1547 stmmodel_iv_init[0]=0;
1549 stmmodel_iv_init[0]=$3.t_float;
1553 /*****************************************************************************/
1555 /*****************************************************************************/
1557 plnmodel : _SPDM '(' varparams_list ordersparams coefsparams ')'
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;
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;
1577 $$ = STM_MOD_MODPLN;
1583 varparams_list : empty
1584 | varparams_list varparams
1587 varparams : axistype _VARTHMIN '(' val ')' _VARTHMAX '(' val ')'
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;
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++;
1609 orders_list : orders_list orders_i
1615 if (STM_PRELOAD=='Y') {
1616 stmmodel_deg_params[stmmodel_deg_index] = 0;
1617 stmmodel_deg_index=0;
1620 stmmodel_deg_params[stmmodel_deg_index] = $1.t_float;
1621 stmmodel_deg_index++;
1626 ordersparams : _ORDERS '(' orders_list ')'
1631 coefs_list : coefs_list coefs_i
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;
1646 stmmodel_coefdef_nb++;
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;
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;
1661 coefsparams : _COEFS '(' coefs_list ')'
1664 /*****************************************************************************/
1666 /*****************************************************************************/
1668 noisemodel : _NOISE_SCR '(' val val ')'
1670 if (STM_PRELOAD=='Y')
1671 vnoise_model = STM_NOISE_NULL;
1673 vnoise_model = STM_NOISE_SCR;
1674 vnoise_scr = $3.t_float;
1675 vnoise_invth = $4.t_float;
1678 | _NOISE_SCR '(' val ')'
1680 if (STM_PRELOAD=='Y')
1681 vnoise_model = STM_NOISE_NULL;
1683 vnoise_model = STM_NOISE_SCR;
1684 vnoise_scr = $3.t_float;
1685 vnoise_invth = vdd/2;
1690 vnoise_model = STM_NOISE_NULL;
1694 /*****************************************************************************/
1696 /*****************************************************************************/
1697 eparams : '(' _PCONF0 _PCONF1 ')'
1700 stmmodel_e_params [STM_EPCONF0] = $6.t_float;
1701 stmmodel_e_params [STM_EPCONF1] = $7.t_float;
1706 energyparamsmodel : _ENERGY_MODEL
1712 $$ = STM_ENERGY_PARAMS;
1716 energytbltype : _ENERGY_TABLE
1718 $$ = STM_ENERGY_TABLE;
1722 $$ = STM_ENERGY_TABLE;
1726 energytblmodel : energytbltype '(' axis axis data ')'
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;
1736 | energytbltype '(' axis data ')'
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;
1746 | energytbltype '(' data ')'
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;
1758 energymodel : energytblmodel
1760 stmmodel_energy_model_type = $1;
1764 stmmodel_energy_model_type = $1;
1768 stmmodel_energy_model_type = STM_ENERGY_NULL;
1772 /*****************************************************************************/
1775 modelname : _NAME '(' _IDENTIFIER ')'
1777 $$ = namealloc($3); mbkfree($3);
1791 $$.t_float = STM_UNKNOWN;
1792 strcpy($$.t_float_string,"");
1803 avt_errmsg (STM_ERRMSG, "001", AVT_FATAL, STM_FILE, STM_LINE);