Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / efg / efg_ext_fig.c
1 /****************************************************************************/
2 /* */
3 /* Chaine de CAO & VLSI Avertec */
4 /* */
5 /* Fichier : efg_ext_fig.c */
6 /* */
7 /* (c) copyright 1991-2003 Avertec */
8 /* Tous droits reserves */
9 /* Support : contact@avertec.com */
10 /* */
11 /* Auteur(s) : Marc KUOCH */
12 /* */
13 /****************************************************************************/
14 /* Extraction d'une lofig concernant un chemin */
15 /****************************************************************************/
16 #include "efg.h"
17
18 char EFG_CALC_EQUI_CAPA = EFG_OUT_NONE; /* a passer en param de extract_fig */
19 int EFG_TRS_INDEX = 0;
20 char *EFG_SET_FIG_NAME=NULL;
21
22 /*****************************************************************************\
23 function efg_env ()
24
25 \*****************************************************************************/
26 void efg_env ( void )
27 {
28 static int done=0;
29 char *env;
30
31 EFG_TRS_INDEX = 0;
32
33 switch ( SIM_OUTLOAD ) {
34 case SIM_NO_OUTLOAD : EFG_CALC_EQUI_CAPA = EFG_OUT_NONE;
35 break;
36 case SIM_DYNAMIC_OUTLOAD : EFG_CALC_EQUI_CAPA = EFG_OUT_CAPA;
37 break;
38 case SIM_TRANSISTOR_OUTLOAD : EFG_CALC_EQUI_CAPA = EFG_OUT_TRANSISTOR;
39 break;
40 default : EFG_CALC_EQUI_CAPA = EFG_OUT_TRANSISTOR;
41 break;
42 }
43 }
44
45 /*****************************************************************************\
46 function efg_threat_alim ()
47
48 \*****************************************************************************/
49 void efg_threat_alim ( lofig_list *lofig, lofig_list *fig_ext,cnsfig_list *cnsfig )
50 {
51 losig_list *losig;
52
53 for(losig = lofig->LOSIG ; losig != NULL ; losig = losig->NEXT)
54 {
55 if( ( mbk_LosigIsVDD (losig) ) )
56 {
57 if(getptype(losig->USER,EFG_SIG_VDD) == NULL)
58 {
59 losig->USER = addptype(losig->USER,EFG_SIG_VDD,NULL) ;
60 if(getptype(losig->USER,EFG_SIG_ALIM) == NULL)
61 losig->USER = addptype(losig->USER,EFG_SIG_ALIM,NULL) ;
62 if (cnsfig) efg_addlosig (fig_ext,losig,1);
63 }
64 }
65 if( ( mbk_LosigIsVSS(losig) ) )
66 {
67 if(getptype(losig->USER,EFG_SIG_VSS) == NULL)
68 {
69 losig->USER = addptype(losig->USER,EFG_SIG_VSS,NULL) ;
70 if(getptype(losig->USER,EFG_SIG_ALIM) == NULL)
71 losig->USER = addptype(losig->USER,EFG_SIG_ALIM,NULL) ;
72 if (cnsfig) efg_addlosig (fig_ext,losig,1);
73 }
74 }
75 }
76 lofigchain (fig_ext);
77 }
78
79 /*****************************************************************************\
80 function efg_report_extcon ()
81
82 \*****************************************************************************/
83
84 static locon_list *choose_best_node_for_connector(losig_list *sig, int out)
85 {
86 ptype_list *ptype;
87 chain_list *chain;
88 locon_list *con, *bestcon=NULL;
89
90 ptype = getptype ( sig->USER, LOFIGCHAIN );
91 for ( chain = (chain_list *)ptype->DATA ; chain ; chain=chain->NEXT )
92 {
93 con = (locon_list *)chain->DATA;
94 if ( con->PNODE )
95 {
96 if (bestcon==NULL) bestcon=con;
97 if (out)
98 {
99 if (con->TYPE=='E' || (con->TYPE=='T' && con->NAME==MBK_GRID_NAME)) bestcon=con;
100 }
101 else
102 {
103 if (con->TYPE=='E' || (con->TYPE=='T' && (con->NAME==MBK_DRAIN_NAME || con->NAME==MBK_SOURCE_NAME))) bestcon=con;
104 }
105 if (bestcon->TYPE=='E') break;
106 }
107 }
108
109 return bestcon;
110 }
111
112
113 void efg_report_extcon ( lofig_list *fig_ext, spisig_list *spisig)
114 {
115 int con2ext = 1;
116 int need_lofigchain = 0, haslonode;
117 ptype_list *ptype;
118 chain_list *chain;
119 lotrs_list *lotrs,*trs;
120 losig_list *grid;
121 locon_list *locon,*con;
122 losig_list *sig;
123 char *signame;
124 spisig_list *scanspisig;
125 long nodenum, rcxnode;
126
127 // report any possible flotting gate in the interface...
128 for (locon = fig_ext->LOCON ; locon ; locon=locon->NEXT)
129 if (locon->SIG->TYPE != 'E')
130 locon->SIG->TYPE = 'E';
131
132 for (lotrs = (fig_ext)->LOTRS ; lotrs ; lotrs=lotrs->NEXT) {
133 grid = lotrs->GRID->SIG;
134
135 if ( grid->TYPE == 'I' ) {
136 ptype = getptype ( grid->USER, LOFIGCHAIN );
137 con2ext = 1;
138 for ( chain = (chain_list *)ptype->DATA ; chain ; chain=chain->NEXT ) {
139 locon = (locon_list *)chain->DATA;
140 if ( locon->TYPE == 'T' ) {
141 trs = (lotrs_list*)locon->ROOT;
142 if ( trs->FLAGS != EFG_BLOCK_TRS && locon != trs->GRID ) {
143 con2ext = 0;
144 break;
145 }
146 }
147 }
148 if ( con2ext ) {
149 need_lofigchain = 1;
150 locon = addlocon ( (fig_ext), efg_getlosigname (grid), grid, 'I' );
151 locon->SIG->TYPE = 'E';
152 if ( lotrs->GRID->PNODE )
153 locon->PNODE = dupnumlst(lotrs->GRID->PNODE);
154 }
155 }
156 }
157
158 for( scanspisig = spisig ; scanspisig ; scanspisig = scanspisig->NEXT ) {
159 if((scanspisig->START || scanspisig->END) && scanspisig->START!=scanspisig->END ) {
160 sig = efg_GetDestSigBySpiSig( scanspisig );
161 signame = efg_getlosigname ( sig );
162 if ( (locon=efg_get_locon ( fig_ext,signame ))==NULL ) {
163 sig->TYPE = 'E';
164 need_lofigchain = 1;
165 locon = addlocon (fig_ext,signame,sig,'O');
166 nodenum=-1;
167 if (scanspisig->END) rcxnode=scanspisig->OUTCONRC_NODE;
168 else rcxnode=scanspisig->INCONRC_NODE;
169
170 efg_checkvalidnode(scanspisig->DESTSIG, rcxnode, &haslonode);
171
172 if (haslonode) nodenum=rcxnode;
173 else if ((con=choose_best_node_for_connector(efg_GetSrcSigBySpiSig(scanspisig), scanspisig->START?0:1))!=NULL && con->PNODE!=NULL)
174 nodenum=con->PNODE->DATA;
175
176 if (nodenum!=-1)
177 locon->PNODE = addnum(NULL, nodenum);
178 /*
179 ptype = getptype ( sig->USER, LOFIGCHAIN );
180 for ( chain = (chain_list *)ptype->DATA ; chain ; chain=chain->NEXT ) {
181 con = (locon_list *)chain->DATA;
182 if ( con->PNODE ) {
183 locon->PNODE = (num_list*)dupnumlst((chain_list*)con->PNODE);
184 break;
185 }
186 }
187 */
188 } else {
189 // correct locon pnode
190 if (scanspisig->END) rcxnode=scanspisig->OUTCONRC_NODE;
191 else rcxnode=scanspisig->INCONRC_NODE;
192
193 efg_checkvalidnode(scanspisig->DESTSIG, rcxnode, &haslonode);
194
195 if (haslonode)
196 {
197 freenum(locon->PNODE);
198 locon->PNODE = addnum(NULL, rcxnode);
199 }
200 }
201 }
202 }
203
204 if ( need_lofigchain ) lofigchain (fig_ext);
205 }
206
207 spisig_list *efg_AddLatchLoopFeebackCone(lofig_list *lofig, cnsfig_list *cnsfig, spisig_list *origspisig)
208 {
209 spisig_list *spisig;
210 edge_list *ptinedge ;
211 ptype_list dummy, *crade=NULL, *pt;
212 cone_list *cone;
213 int err;
214 chain_list *path;
215
216 if (cnsfig==NULL || lofig==NULL) return origspisig;
217
218 dummy.NEXT=NULL;
219
220 for(cone = cnsfig->CONE ; cone != NULL ; cone = cone->NEXT)
221 {
222 if ((cone->TYPE & CNS_LATCH) == CNS_LATCH)
223 {
224 spisig = efg_GetSpiSig ( origspisig, cone->NAME );
225 if (spisig!=NULL && !spisig->START)
226 {
227 for (ptinedge = cone->INCONE; ptinedge; ptinedge = ptinedge->NEXT)
228 {
229 if ((ptinedge->TYPE & CNS_FEEDBACK) != 0 || (ptinedge->TYPE & CNS_MEMSYM) != 0)
230 {
231 if (efg_GetSpiSig ( origspisig, ptinedge->UEDGE.CONE->NAME )==NULL)
232 {
233 for (pt=crade; pt!=NULL && pt->DATA!=ptinedge->UEDGE.CONE->NAME; pt=pt->NEXT);
234 if (pt==NULL) crade=addptype(crade, (long)spisig, ptinedge->UEDGE.CONE);
235 }
236 }
237 }
238 }
239 }
240 }
241
242 for (pt=crade; pt!=NULL; pt=pt->NEXT)
243 {
244 char *cmd=NULL, cmddir=0;
245 spisig=(spisig_list *)pt->TYPE;
246 cone=(cone_list *)pt->DATA;
247 if ((cone->TYPE & CNS_MEMSYM)!=0) cmd=spisig->LATCHCMD, cmddir=spisig->LATCHCMDDIR;
248 path=efg_AddPathEvent(NULL, cone->NAME, spisig->EVENT==(long)EFG_SIG_SET_RISE?EFG_FALL:EFG_RISE,0,spisig->MINDATE+1, -1, -1, -1, cmd, cmddir, spisig->NAME);
249 origspisig=efg_BuildSpiSigList (lofig,path,origspisig,0,&err,0);
250 spisig->USER=addptype(spisig->USER, EFG_SPISIG_LOOP_SPISIG, origspisig);
251 origspisig->USER=addptype(origspisig->USER, EFG_SPISIG_LOOP_SPISIG, spisig);
252 efg_FreePathEvent(path);
253 origspisig->NUM=-1;
254 }
255 freeptype(crade);
256 return origspisig;
257 }
258
259 /*****************************************************************************\
260 function efg_extract_fig()
261
262 drive le spice des signaux du .inf
263 \*****************************************************************************/
264 static int checkprechargememsym(cone_list *cone, char *input, cone_list **other)
265 {
266 edge_list *ptinedge;
267 int res=0;
268 *other=NULL;
269 if ((cone->TYPE & CNS_MEMSYM)==0 || V_BOOL_TAB[__CPE_PRECHARGED_MEMSYM].VALUE==0) return 0;
270 for (ptinedge = cone->INCONE; ptinedge; ptinedge = ptinedge->NEXT) {
271 if ((ptinedge->TYPE & CNS_EXT) == 0)
272 {
273 if (input!=NULL && !mbk_casestrcmp(ptinedge->UEDGE.CONE->NAME,input))
274 if ((ptinedge->TYPE & CNS_COMMAND)!=0) res=1;
275 if ((ptinedge->TYPE & CNS_MEMSYM)!=0) *other=ptinedge->UEDGE.CONE;
276 }
277 }
278 return res;
279 }
280
281 chain_list *efg_getcone_onpath (spisig_list *hdspisig,cnsfig_list *cnsfig )
282 {
283 spisig_list *spis;
284 cone_list *cone, *other;
285 chain_list *hdchain=NULL;
286 gsp_cone_info *ci, *other_ci;
287
288 for ( spis = hdspisig ; spis ; spis=spis->NEXT ) {
289 if ( (cone = getcone(cnsfig, 0, mbk_devect (spis->critic_NAME,"[","]"))) ) {
290 spis->CONE=cone;
291 if (!getptype (spis->SRCSIG->USER,EFG_SIG2CONE ))
292 spis->SRCSIG->USER = addptype (spis->SRCSIG->USER,EFG_SIG2CONE,cone);
293
294 ci=gsp_create_cone_info(cone);
295 ci->Date=spis->NUM;
296 ci->MinDate=spis->MINDATE;
297 ci->cmd=spis->LATCHCMD;
298 ci->cmd_state=spis->LATCHCMDDIR;
299 if (checkprechargememsym(cone, spis->PREVIOUS, &other))
300 ci->precharged=1;
301 if (other!=NULL && (other_ci=gsp_get_cone_info(other))!=NULL)
302 {
303 if (other_ci->precharged) ci->precharged=1;
304 else if (ci->precharged) other_ci->precharged=1;
305 }
306 if (!efg_test_signal_flags(spis->SRCSIG, EFG_SIG_SET_OUTPATH))
307 {
308 if (spis->EVENT==(long)EFG_SIG_SET_RISE) ci->BeforeTransitionState=0, ci->AfterTransitionState=1;
309 else ci->BeforeTransitionState=1, ci->AfterTransitionState=0;
310 }
311 hdchain = addchain(hdchain,cone);
312 }
313 else {
314 if (!(spis->START && spis->SRCSIG->TYPE=='E'))
315 {
316 avt_errmsg(EFG_ERRMSG, "001", AVT_FATAL, spis->critic_NAME);
317 exit(0);
318 }
319 else hdchain = addchain(hdchain,NULL);
320 }
321 }
322
323 return hdchain;
324 }
325
326
327 /*****************************************************************************\
328 function efg_extract_fig()
329
330 drive le spice des signaux du .inf
331 \*****************************************************************************/
332 char *efg_get_fig_name(lofig_list *lf, char *buf)
333 {
334 if (EFG_SET_FIG_NAME==NULL)
335 sprintf (buf,"%s_ext",lf->NAME);
336 else
337 strcpy(buf, EFG_SET_FIG_NAME);
338 return buf;
339 }
340 void efg_extract_fig (lofig_list *lofig,
341 lofig_list **fig_ext,
342 cnsfig_list *cnsfig,
343 spisig_list *spisig,
344 chain_list **chaincone,
345 chain_list **chaininstance,
346 chain_list *loins2drv, // usr instance to drv
347 chain_list *lotrs2drv , // usr lotrs to drv
348 chain_list *locon2drv, // usr external locon 2 drv
349 chain_list *losig2drv, // usr losig to drv
350 chain_list *cone_onpath, // accelerate search of cone
351 chain_list *usrlist, // pathsig list from user
352 int markfig // allow to obtain patterns
353 )
354 {
355 loins_list *loins ;
356 char buf[2048] ;
357 char *newfigname;
358 efg_fullsiglist* fullsiglist = NULL;
359 chain_list *chain;
360 ptype_list *ptype;
361 spisig_list *spis;
362 int create_local_onpath, err;
363
364 if (!lofig || (!spisig && !usrlist)) return;
365
366 efg_env ();
367
368 if (spisig == NULL)
369 {
370 spisig = efg_BuildSpiSigList (lofig,usrlist,NULL,1,&err,0);
371 spisig = efg_AddLatchLoopFeebackCone(lofig, cnsfig, spisig);
372 }
373
374 if(*fig_ext == NULL)
375 {
376 /* init */
377 efg_get_fig_name(lofig, buf);
378
379 newfigname = namealloc (buf);
380 *fig_ext = addlofig (newfigname);
381
382 efg_createcontext ();
383 efg_setsrcfig2context ( lofig );
384 efg_setdestfig2context ( *fig_ext );
385 efg_setspisig2context ( spisig );
386
387 if (chaincone != NULL) *chaincone = NULL;
388 if (chaininstance != NULL) *chaininstance = NULL;
389 }
390
391
392 /*****************************************************************************/
393 /* positionne les alimentations sur les signaux d'alims */
394 /*****************************************************************************/
395 efg_threat_alim ( lofig, *fig_ext, cnsfig );
396 if ( !efg_get_vdd_on_destfig () ) {
397 avt_errmsg(EFG_ERRMSG, "002", AVT_ERROR);
398 //fprintf (stderr,"[EFG ERR] can't get vdd\n");
399 efg_FreeMarksOnExtFig (*fig_ext);
400 efg_FreeMarksOnFig (lofig);
401 efg_freecontext ();
402 if (*fig_ext != NULL) dellofig ((*fig_ext)->NAME);
403 *fig_ext = NULL;
404 return;
405 }
406 if ( !efg_get_vss_on_destfig () ) {
407 avt_errmsg(EFG_ERRMSG, "003", AVT_ERROR);
408 //fprintf (stderr,"[EFG ERR] can't get vss\n");
409 efg_FreeMarksOnExtFig (*fig_ext);
410 efg_FreeMarksOnFig (lofig);
411 efg_freecontext ();
412 if (*fig_ext != NULL) dellofig ((*fig_ext)->NAME);
413 *fig_ext = NULL;
414 return;
415 }
416
417 create_local_onpath = 0 ;
418 if ( !cone_onpath ) {
419 create_local_onpath = 1 ;
420 cone_onpath = efg_getcone_onpath (spisig,cnsfig );
421 if (cone_onpath && cone_onpath->DATA==NULL)
422 cone_onpath=delchain(cone_onpath,cone_onpath);
423 }
424
425
426 /*****************************************************************************/
427 /* ouverture du fichier */
428 /*****************************************************************************/
429 if (cnsfig != NULL)
430 {
431 if (spisig!=NULL && spisig->START && spisig->END)
432 {
433 efg_addlosig(*fig_ext, spisig->SRCSIG, 1);
434 spisig->SRCSIG->USER = addptype (spisig->SRCSIG->USER, EFG_SIG_DRV, (void *)1);
435 }
436
437 efg_MarkCnsfig (lofig,*fig_ext,cnsfig,chaincone,
438 chaininstance,cone_onpath);
439 }
440 /*****************************************************************************\
441
442 Construction de la figure extraite a deux niveaux de hierarchie :
443
444 le top level qui instancie les cellules de base
445
446 \*****************************************************************************/
447 if (lofig->LOINS != NULL && !cnsfig) {
448 fullsiglist = efg_buildhierfullsig ( lofig->NAME, 1, NULL, 1);
449 efg_buildlofig ( fullsiglist );
450 efg_set_path_info ( fullsiglist );
451 for (loins = (*fig_ext)->LOINS ; loins ; loins = loins->NEXT)
452 efg_set_loins_rc_node (loins);
453 if (chaininstance != NULL)
454 *chaininstance = efg_get_loins_on_path ();
455 efg_freechainfullsig( fullsiglist );
456 }
457
458 /*****************************************************************************\
459
460 Traitement des objets (instances, transistors) a rajouter
461
462 \*****************************************************************************/
463 for (chain = loins2drv ; chain ; chain=chain->NEXT)
464 efg_addloins (*fig_ext,(loins_list*)chain->DATA,0);
465 for (chain = lotrs2drv ; chain ; chain=chain->NEXT) {
466 efg_addlotrs (*fig_ext,(lotrs_list*)chain->DATA,1);
467 efg_set_node_in_out_lotrs ((lotrs_list*)chain->DATA);
468 }
469 for (chain = locon2drv ; chain ; chain=chain->NEXT) {
470 int exist = 0;
471 chain_list *lofigchain=NULL,*chaincon;
472 losig_list *sig;
473 locon_list *newlocon,
474 *loconx,
475 *con = (locon_list*)chain->DATA;
476
477 for (loconx = (*fig_ext)->LOCON ; loconx ; loconx=loconx->NEXT) {
478 if (efg_getlosigname (loconx->SIG) == efg_getlosigname (con->SIG))
479 exist = 1;
480 }
481 if ( !exist ) {
482 sig = efg_addlosig (*fig_ext,con->SIG,1);
483 newlocon = addlocon (*fig_ext,con->NAME,sig,con->DIRECTION);
484 if (con->SIG->PRCN && con->SIG->PRCN->PWIRE) {
485 ptype = getptype (con->SIG->USER,LOFIGCHAIN);
486 if ( ptype )
487 lofigchain = (chain_list*)ptype->DATA;
488 for (chaincon = lofigchain ; chaincon ; chaincon=chaincon->NEXT) {
489 locon_list *conx = (locon_list*)chaincon->DATA;
490 if (conx->PNODE != NULL) {
491 newlocon->PNODE = dupnumlst(conx->PNODE);
492 break;
493 }
494 }
495 }
496 sig->TYPE = 'E';
497 newlocon->TYPE = 'E';
498 }
499 }
500 for (chain = losig2drv ; chain ; chain=chain->NEXT) {
501 chain_list *chainc;
502 losig_list *sig = (losig_list *)chain->DATA;
503
504 if ( (ptype = getptype (sig->USER,LOFIGCHAIN)) )
505 for (chainc = (chain_list *)ptype->DATA ; chainc ; chainc=chainc->NEXT) {
506 locon_list *con = (locon_list *)chainc->DATA;
507 if (con->TYPE == 'T' || con->TYPE == 'I')
508 efg_add_lotrs_capa (*fig_ext,con,1);
509 }
510 }
511
512
513 lofigchain (*fig_ext);
514
515 efg_report_extcon ( *fig_ext, spisig);
516
517 if (!markfig) {
518 efg_FreeMarksOnExtFig (*fig_ext);
519 efg_FreeMarksOnFig (lofig);
520 efg_freecontext ();
521 }
522 if ( V_STR_TAB[__EFG_SIG_ALIAS].VALUE )
523 efg_update_spisigname (spisig);
524 if ( avt_getlibloglevel(LOGEFG) > 0 ) {
525 for ( spis = spisig ; spis ; spis=spis->NEXT ) {
526 avt_log(LOGEFG,2,"SpiSig %s number %d\n",spis->NAME,spis->NUM);
527 if ( spis->INCONRC)
528 avt_log(LOGEFG,2," -> INCONRC = %s\n",spis->INCONRC);
529 if ( spis->OUTCONRC )
530 avt_log(LOGEFG,2," -> OUTCONRC = %s\n",spis->OUTCONRC);
531 }
532 }
533
534 if( create_local_onpath ) {
535 freechain( cone_onpath );
536 cone_onpath = NULL ;
537 }
538 efg_correct_rc_nodes_based_on_rcx(spisig);
539 }
540
541 /*****************************************************************************/
542 /* */
543 /* FUNCTION : efg_UpdateSigPtype */
544 /* */
545 /* Marque hierarchiquement les signaux des cellules. */
546 /* */
547 /* reporte egalement le nom le plus significatif du signal : le + haut nivo */
548 /* */
549 /*****************************************************************************/
550 void efg_UpdateSigPtype (lofig,loconname,insname,context,num,slope,
551 sigend)
552 lofig_list *lofig;
553 char *loconname;
554 char *insname;
555 char *context;
556 int num;
557 char slope;
558 char sigend;
559 {
560 ptype_list *ptype;
561 chain_list *chain;
562 loins_list *loins;
563 locon_list *locon;
564 losig_list *losig;
565 char *name;
566 char buf[1024];
567
568 if (!lofig) return;
569 for (locon = lofig->LOCON ; locon ; locon = locon->NEXT) {
570 if (locon->NAME == loconname) {
571 losig = locon->SIG;
572 if (lofig->LOTRS != NULL) {
573 if (context != NULL) {
574 sprintf(buf,"%s%c%s",context,SEPAR,insname);
575 context = namealloc(buf);
576 efg_SetSigDrive (losig,num,slope,num==0?'Y':'N',sigend,'N',context,0);
577 }
578 }
579 ptype = getptype(locon->SIG->USER,LOFIGCHAIN);
580 if (ptype != NULL) {
581 for (chain = (chain_list*)ptype->DATA ; chain ;
582 chain = chain->NEXT) {
583 locon_list *locon = (locon_list*)chain->DATA;
584 if (locon->TYPE == 'I') {
585 loins = (loins_list*)locon->ROOT;
586 if (context != NULL)
587 sprintf(buf,"%s%c%s",context,SEPAR,insname);
588 else
589 sprintf(buf,"%s",loins->INSNAME);
590 name = namealloc(buf);
591 /* pour marquer les sig des instances egalement */
592 efg_SetSigDrive (locon->SIG,num,slope,num==0?'Y':'N',sigend,'N',name,0);
593 efg_UpdateSigPtype(
594 getloadedlofig(loins->FIGNAME),
595 locon->NAME,loins->INSNAME,name,
596 num,slope,sigend);
597 }
598 }
599 }
600 }
601 }
602 }
603
604 /*****************************************************************************/
605 /* */
606 /* FUNCTION : efg_SetSigDrive */
607 /* */
608 /* Marque les signaux du .inf */
609 /* */
610 /*****************************************************************************/
611 void efg_updateflag(losig_list *ls, int set, long mask)
612 {
613 ptype_list *pt;
614 if ((pt=getptype(ls->USER,EFG_SIG_DRV)) != NULL)
615 {
616 if (set)
617 pt->DATA=(void *)(((long)pt->DATA) | mask);
618 else
619 pt->DATA=(void *)(((long)pt->DATA) & ~mask);
620 }
621 }
622
623 void efg_SetSigDrive (losig_list *losig,int num, char slope,char sigstart,char sigend, char sigclk, char *insname, long flags)
624 {
625 long front;
626
627 if (slope == 'U')
628 front = (long)EFG_SIG_SET_RISE;
629 else
630 front = (long)EFG_SIG_SET_FALL;
631
632 if (getptype(losig->USER,EFG_SIG_DRV) == NULL) {
633 losig->USER = addptype(losig->USER,
634 EFG_SIG_DRV,
635 (void *)flags);
636 }
637 /* garde la compatibilite avec analyse a plat de la figure */
638 if (getptype (losig->USER,EFG_SIG_SET) == NULL) {
639 losig->USER = addptype (losig->USER,
640 EFG_SIG_SET,
641 (void*)front);
642 }
643
644 if ( sigclk =='Y' && getptype(losig->USER,EFG_SIG_CLK) == NULL) {
645 losig->USER = addptype (losig->USER,
646 EFG_SIG_CLK,
647 (void*)front);
648 }
649
650 /*------------- Numero du signal dans le .inf ----------------*/
651 losig->USER = efg_SetHierPtype (losig->USER,
652 EFG_SIG_SET_NUM,
653 (void*)insname,
654 num,
655 NULL);
656
657 /*------------- Info concernant le front du sig --------------*/
658 losig->USER = efg_SetHierPtype (losig->USER,
659 EFG_SIG_SET_HIER,
660 (void*)insname,
661 front,
662 NULL);
663 if (sigstart == 'Y') {
664 losig->USER = efg_SetHierPtype (losig->USER,
665 EFG_SIG_BEG_HIER,
666 (void*)insname,
667 front,
668 NULL);
669 /* garde la compatibilite avec analyse a plat de la figure */
670 if (getptype (losig->USER,EFG_SIG_BEG) == NULL) {
671 losig->USER = addptype (losig->USER,
672 EFG_SIG_BEG,
673 (void*)front);
674 }
675 }
676
677 if (sigend == 'Y') {
678 losig->USER = efg_SetHierPtype (losig->USER,
679 EFG_SIG_END_HIER,
680 (void*)insname,
681 front,
682 NULL);
683 /* garde la compatibilite avec analyse a plat de la figure */
684 if (getptype (losig->USER,EFG_SIG_END) == NULL) {
685 losig->USER = addptype (losig->USER,
686 EFG_SIG_END,
687 (void*)front);
688 }
689 }
690 }
691
692 /*****************************************************************************/
693 /* */
694 /* FUNCTION : efg_BuildPathSig */
695 /* */
696 /* Construit la liste des signaux presents sur le chemin a sensibiliser */
697 /* */
698 /* <=> equivalent a l'utilisation du .inf */
699 /* */
700 /* La fonction cree une list_list comme lors du traitement classique de */
701 /* tas lors de la lecture du .inf. */
702 /* */
703 /*****************************************************************************/
704 list_list *efg_BuildPathSig (pathlist,signame,slope)
705 list_list *pathlist;
706 char *signame;
707 char slope;
708 {
709 list_list *newlist = NULL;
710 list_list *list;
711 ptype_list *user;
712 char *left;
713 char *shortsigname;
714
715 signame = namealloc (signame);
716 leftunconcatname (signame,&left,&shortsigname);
717 if (slope == 'U')
718 user = addptype (NULL,INF_UP,shortsigname);
719 else if (slope == 'D')
720 user = addptype (NULL,INF_DOWN,shortsigname);
721 else
722 return pathlist;
723
724 newlist = mbkalloc(sizeof(struct list)) ;
725 newlist->NEXT = NULL;
726 newlist->DATA = shortsigname;
727 newlist->TYPE = INF_LL_PATHSIGS;
728 newlist->USER = user ;
729
730 if (pathlist != NULL) {
731 for (list = pathlist ; list->NEXT ; list = list->NEXT);
732 list->NEXT = newlist;
733 }
734 else
735 pathlist = newlist;
736
737 return pathlist;
738 }
739
740 /*****************************************************************************/
741 /* */
742 /* FUNCTION : efg_FreePathList */
743 /* */
744 /*****************************************************************************/
745 void efg_FreePathList (pathlist)
746 list_list *pathlist;
747 {
748 list_list *list;
749
750 while (pathlist != NULL) {
751 list = pathlist;
752 pathlist = pathlist->NEXT;
753 freeptype (list->USER);
754 mbkfree(list);
755 }
756 }
757
758 /*****************************************************************************/
759 /* */
760 /* FUNCTION : efg_FreeMarksOnExtFig */
761 /* */
762 /* Supprime tous les marquages de la figure extraite. */
763 /* */
764 /*****************************************************************************/
765 void efg_FreeMarksOnExtFig (lofig_list *fig_ext)
766 {
767 efg_DelHierSigPtype (fig_ext);
768 }
769
770 /*****************************************************************************/
771 /* */
772 /* FUNCTION : efg_FreeMarksOnExtFig */
773 /* */
774 /* Supprime tous les marquages de la figure extraite. */
775 /* */
776 /*****************************************************************************/
777 void efg_FreeMarksOnFig (lofig_list *fig)
778 {
779 efg_DelHierSigPtype (fig);
780 }
781
782 /*****************************************************************************/
783 /* */
784 /* FUNCTION : efg_con_is_on_path */
785 /* */
786 /* retourne 'Y' si le cone est dans la liste, 'N' sinon */
787 /* */
788 /*****************************************************************************/
789 char efg_con_is_on_path (chain_list *cone_onpath,cone_list *cone)
790 {
791 chain_list *chain;
792 char res = 'N';
793
794 for (chain = cone_onpath ; chain ; chain = chain->NEXT) {
795 if ((cone_list*)chain->DATA == cone) {
796 res = 'Y';
797 break;
798 }
799 }
800 return res;
801 }
802
803 /*****************************************************************************\
804 FUNCTION : efg_add_instance
805 \*****************************************************************************/
806 void efg_add_instance (chain_list *chaincone,chain_list **chaininstance)
807 {
808 cone_list *cone;
809 ptype_list *ptype,*sigbeg,*sigend;
810 chain_list *chainc,*chain;
811 losig_list *losig;
812 loins_list *loins;
813 locon_list *locon;
814 char *context;
815
816 if (!chaincone) return;
817 for (chainc = chaincone ; chainc ; chainc=chainc->NEXT) {
818 sigbeg = sigend = NULL;
819 cone = (cone_list *)chainc->DATA;
820 if (!cone || !(losig = efg_getlosigcone (cone)))
821 return;
822 sigbeg = getptype (losig->USER,EFG_SIG_BEG);
823 sigend = getptype (losig->USER,EFG_SIG_END);
824 ptype = getptype (losig->USER,LOFIGCHAIN);
825 for (chain = (chain_list*)ptype->DATA ; chain ; chain=chain->NEXT) {
826 locon = (locon_list*)chain->DATA;
827 if (locon->TYPE == 'I') {
828 loins = (loins_list*)locon->ROOT;
829 if ((context = efg_get_ins_ctxt (loins))) {
830 if (efg_is_loins_to_copy (loins) && efg_loins_is2analyse (context)) {
831 efg_addloins (EFGCONTEXT->DESTFIG,loins,0);
832 if (chaininstance != NULL && !sigbeg && !sigend)
833 *chaininstance = addchain (*chaininstance,loins);
834 }
835 }
836 }
837 }
838 }
839 }
840
841 /*****************************************************************************\
842 FUNC : efg_report_rc_lotrs
843 \*****************************************************************************/
844 void efg_report_rc_lotrs ( lofig_list *fig_ext,locon_list *con )
845 {
846 ptype_list *ptype;
847 spisig_list *spisig;
848 lotrs_list *corresplotrs,*lotrs;
849
850 lotrs = (lotrs_list*)con->ROOT;
851 ptype = getptype (lotrs->USER,EFG_CORRESP);
852 if ( !ptype ) return;
853 corresplotrs = (lotrs_list*)ptype->DATA;
854
855 if ( con == lotrs->GRID ) {
856 if (getptype (lotrs->GRID->SIG->USER,EFG_SIG_DRV) &&
857 efg_is_wire_on_sig (lotrs->GRID->SIG) == 1 &&
858 (spisig = efg_GetSpiSig (EFGCONTEXT->SPISIG,efg_getlosigname(lotrs->GRID->SIG))) != NULL) {
859 if (lotrs->GRID->PNODE &&
860 !efg_is_conname_ext (fig_ext,lotrs->GRID->SIG,lotrs->GRID->PNODE->DATA) ) {
861 efg_SetSpiSigLoconRc (spisig, concatname(corresplotrs->TRNAME,lotrs->GRID->NAME), 'O',lotrs);
862 }
863 // to avoid shift result if incorrect rc network is detected
864 if (lotrs->GRID->PNODE && !efg_GetSpiSigLoconRc(spisig,'O') )
865 efg_SetSpiSigLoconRc (spisig, concatname(corresplotrs->TRNAME,lotrs->GRID->NAME),'O',lotrs);
866 }
867
868 }
869 else if ( con == lotrs->DRAIN) {
870 if (getptype (lotrs->DRAIN->SIG->USER,EFG_SIG_DRV) &&
871 efg_is_wire_on_sig (lotrs->DRAIN->SIG) == 1 &&
872 (spisig = efg_GetSpiSig (EFGCONTEXT->SPISIG,efg_getlosigname(lotrs->DRAIN->SIG))) != NULL) {
873 if (lotrs->DRAIN->PNODE &&
874 !efg_is_conname_ext (fig_ext,lotrs->DRAIN->SIG,lotrs->DRAIN->PNODE->DATA) ) {
875 efg_SetSpiSigLoconRc (spisig, concatname(corresplotrs->TRNAME,lotrs->DRAIN->NAME),'I',lotrs);
876 if ( !efg_GetSpiSigLoconRc(spisig,'I') )
877 efg_SetSpiSigLoconRc (spisig, concatname(corresplotrs->TRNAME,lotrs->DRAIN->NAME),'I',lotrs);
878 }
879 // to avoid shift result if incorrect rc network is detected
880 if (lotrs->DRAIN->PNODE && !efg_GetSpiSigLoconRc(spisig,'I') )
881 efg_SetSpiSigLoconRc (spisig, concatname(corresplotrs->TRNAME,lotrs->DRAIN->NAME),'I',lotrs);
882 }
883 }
884 else {
885 if (getptype (lotrs->SOURCE->SIG->USER,EFG_SIG_DRV) &&
886 efg_is_wire_on_sig (lotrs->SOURCE->SIG) == 1 &&
887 (spisig = efg_GetSpiSig (EFGCONTEXT->SPISIG,efg_getlosigname(lotrs->SOURCE->SIG))) != NULL) {
888 if (lotrs->SOURCE->PNODE &&
889 !efg_is_conname_ext (fig_ext,lotrs->SOURCE->SIG,lotrs->SOURCE->PNODE->DATA) ) {
890 efg_SetSpiSigLoconRc (spisig, concatname(corresplotrs->TRNAME,lotrs->SOURCE->NAME),'I',lotrs);
891 }
892 // to avoid shift result if incorrect rc network is detected
893 if ( lotrs->SOURCE->PNODE && !efg_GetSpiSigLoconRc(spisig,'I') )
894 efg_SetSpiSigLoconRc (spisig, concatname(corresplotrs->TRNAME,lotrs->SOURCE->NAME),'I',lotrs);
895 }
896 }
897 }
898
899 /*****************************************************************************\
900
901 FUNCTION : efg_addlotrs_conefct
902
903 3 possiblilities :
904
905 - add a fonctionnal trs
906 - add a non fonctionnal trs
907 - add an equivalent capa
908
909 \*****************************************************************************/
910 void efg_addlotrs_conefct (lofig_list *fig_ext, lotrs_list *lotrs,
911 locon_list *con, int index, int cone_is_fct)
912 {
913 if ( cone_is_fct )
914 efg_addlotrs (fig_ext,lotrs,index);
915 else
916 efg_add_lotrs_capa (fig_ext,con,index);
917 }
918
919 /*****************************************************************************/
920 /* */
921 /* FUNCTION : efg_MarkCnsfig */
922 /* */
923 /* Analyse la cnsfig par rapport au chemin a sensibilier */
924 /* */
925 /*****************************************************************************/
926
927 #define TEMPMARKEFGPARALLEL 0xfab80916
928
929 static void efg_mark_parallel_path(chain_list *conelist)
930 {
931 cone_list *cn, *cn0, *ptinputcone;
932 edge_list *ptinedge;
933 int tog=0;
934 losig_list *ls;
935 chain_list *res;
936 while (conelist!=NULL)
937 {
938 cn=(cone_list *)conelist->DATA;
939
940 for (ptinedge = cn->INCONE; ptinedge; ptinedge = ptinedge->NEXT)
941 {
942 if ((ptinedge->TYPE & CNS_VDD) != 0) continue;
943 if ((ptinedge->TYPE & CNS_VSS) != 0) continue;
944 if ((ptinedge->TYPE & CNS_BLEEDER) != 0) continue;
945 if ((ptinedge->TYPE & CNS_EXT) != 0) continue;
946
947 ptinputcone = ptinedge->UEDGE.CONE;
948 ls = efg_getlosigcone(ptinputcone) ;
949 res=NULL;
950 if (getptype(ls->USER,EFG_SIG_SET)==NULL && (ls=gsp_FindSimpleCorrelationForToBeStuckConnectors(ptinputcone, 0, 10, &tog,1,&res))!=NULL)
951 {
952 res=addchain(res, ptinputcone);
953 while (res!=NULL)
954 {
955 cn0=(cone_list *)res->DATA;
956 if (getptype(cn0->USER, TEMPMARKEFGPARALLEL)==NULL)
957 {
958 avt_log(LOGEFG,2,"Parallel path ('%s' -> '%s') : cone '%s' added to spicedeck\n",getsigname(ls), cn->NAME, cn0->NAME);
959 cn0->USER=addptype(cn0->USER, TEMPMARKEFGPARALLEL, 0);
960 }
961 res=delchain(res,res);
962 }
963 }
964 }
965 conelist=conelist->NEXT;
966 }
967 }
968
969 void efg_MarkCnsfig (lofig_list *lofig,lofig_list *fig_ext,cnsfig_list *cnsfig,
970 chain_list **chaincone, chain_list **chaininstance,
971 chain_list *cone_onpath)
972 {
973 lotrs_list *lotrs, *swlotrs ;
974 locon_list *locon ;
975 losig_list *losig, *srcsig,*nxtsig ;
976 cone_list *cone ;
977 branch_list *branch[3] ;
978 link_list *link ;
979 int i, cone_is_fct ;
980 char flag ;
981 spisig_list *spisig;
982 ptype_list *ptype, *pt;
983 chain_list *chain;
984 chain_list *headlotrs, *stop;
985 locon_list *othercon;
986
987 if((cnsfig != NULL) && (fig_ext != NULL))
988 {
989 for ( locon = lofig->LOCON ; locon ; locon = locon->NEXT)
990 {
991 if ( getptype (locon->SIG->USER,EFG_SIG_DRV) )
992 efg_addlocon (fig_ext,locon,1);
993 }
994
995 efg_mark_parallel_path(cone_onpath);
996
997 // 1ere passe pour rajoute EFG_SIG_DRV pour tous les signaux des cones sur chemin
998 for(cone = cnsfig->CONE ; cone != NULL ; cone = cone->NEXT)
999 {
1000 losig = efg_getlosigcone(cone) ;
1001 if (getptype(cone->USER, TEMPMARKEFGPARALLEL)==NULL && (cone_onpath != NULL ) &&
1002 (efg_con_is_on_path (cone_onpath,cone) == 'N'))
1003 continue;
1004 cone_is_fct = 0;
1005 if (getptype(cone->USER, TEMPMARKEFGPARALLEL)!=NULL)
1006 cone_is_fct=1;
1007 else if ( getptype(losig->USER,EFG_SIG_SET))
1008 cone_is_fct = efg_cone_is_fonctionnal (cone,0);
1009 if (cone_is_fct)
1010 {
1011 branch[0] = cone->BRVDD ;
1012 branch[1] = cone->BRVSS ;
1013 branch[2] = cone->BREXT ;
1014
1015 for(i = 0 ; i < 3 ; i++)
1016 {
1017 for(; branch[i] != NULL ; branch[i] = branch[i]->NEXT)
1018 {
1019 for(link = branch[i]->LINK ; link != NULL ; link = link->NEXT)
1020 {
1021 if((link->TYPE & (CNS_IN | CNS_INOUT)) == 0)
1022 {
1023 lotrs = link->ULINK.LOTRS ;
1024 headlotrs = addchain( NULL, lotrs );
1025 ptype = getptype( lotrs->USER, CNS_SWITCH ) ;
1026 if( ptype ) {
1027 headlotrs = addchain( headlotrs, ptype->DATA );
1028 }
1029 for( chain = headlotrs ; chain ; chain = chain->NEXT ) {
1030 lotrs = (lotrs_list*)chain->DATA ;
1031 if((getptype(lotrs->SOURCE->SIG->USER,EFG_SIG_DRV) == NULL) &&
1032 (getptype(lotrs->SOURCE->SIG->USER,EFG_SIG_ALIM) == NULL)) {
1033 lotrs->SOURCE->SIG->USER = addptype (lotrs->SOURCE->SIG->USER,
1034 EFG_SIG_DRV,
1035 NULL);
1036 avt_log(LOGEFG,2,"Sig %s marked as EFG_SIG_DRV\n",efg_getlosigname(lotrs->SOURCE->SIG));
1037 }
1038 if((getptype(lotrs->DRAIN->SIG->USER,EFG_SIG_DRV) == NULL) &&
1039 (getptype(lotrs->DRAIN->SIG->USER,EFG_SIG_ALIM) == NULL)) {
1040 lotrs->DRAIN->SIG->USER = addptype (lotrs->DRAIN->SIG->USER,
1041 EFG_SIG_DRV,
1042 NULL);
1043 avt_log(LOGEFG,2,"Sig %s marked as EFG_SIG_DRV\n",efg_getlosigname(lotrs->DRAIN->SIG));
1044 }
1045 if((getptype(lotrs->GRID->SIG->USER,EFG_SIG_DRV) == NULL) &&
1046 (getptype(lotrs->GRID->SIG->USER,EFG_SIG_ALIM) == NULL)) {
1047 lotrs->GRID->SIG->USER = addptype (lotrs->GRID->SIG->USER,
1048 EFG_SIG_DRV,
1049 NULL);
1050 avt_log(LOGEFG,2,"Sig %s marked as EFG_SIG_DRV\n",efg_getlosigname(lotrs->GRID->SIG));
1051 }
1052 }
1053 freechain(headlotrs);
1054 }
1055 }
1056 }
1057 }
1058 }
1059 }
1060 stop=cone_onpath;
1061 // rajoute les transistors dans la figure extraite
1062 for(cone = cnsfig->CONE ; cone != NULL ; cone = cone->NEXT)
1063 {
1064 losig = efg_getlosigcone(cone) ;
1065 if ( losig && !getptype (losig->USER,EFG_SIG2CONE ))
1066 losig->USER = addptype (losig->USER,EFG_SIG2CONE,cone);
1067 if (getptype(cone->USER, TEMPMARKEFGPARALLEL)==NULL && (cone_onpath != NULL ) &&
1068 (efg_con_is_on_path (cone_onpath,cone) == 'N'))
1069 continue;
1070 flag = 'N' ;
1071 cone_is_fct = 0;
1072 if (getptype(cone->USER, TEMPMARKEFGPARALLEL)!=NULL)
1073 cone_is_fct =1;
1074 else if ( getptype(losig->USER,EFG_SIG_SET) )
1075 cone_is_fct = efg_cone_is_fonctionnal (cone,0);
1076 branch[0] = cone->BRVDD ;
1077 branch[1] = cone->BRVSS ;
1078 branch[2] = cone->BREXT ;
1079
1080 spisig = efg_GetSpiSig ( EFGCONTEXT->SPISIG, cone->NAME );
1081
1082 for(i = 0 ; i < 3 ; i++)
1083 {
1084 for(; branch[i] != NULL ; branch[i] = branch[i]->NEXT)
1085 {
1086 for(link = branch[i]->LINK ; link != NULL ; link = link->NEXT)
1087 {
1088 if((link->TYPE & (CNS_IN | CNS_INOUT)) == 0)
1089 {
1090 lotrs = link->ULINK.LOTRS ;
1091 headlotrs = addchain( NULL, lotrs );
1092 swlotrs=NULL;
1093 ptype = getptype( lotrs->USER, CNS_SWITCH ) ;
1094 if( ptype ) {
1095 swlotrs=(lotrs_list *)ptype->DATA;
1096 headlotrs = addchain( headlotrs, swlotrs);
1097 }
1098
1099 if ((ptype=getptype(lotrs->USER, MBK_TRANS_PARALLEL))!=NULL) {
1100 for (chain=(chain_list *)ptype->DATA; chain!=NULL; chain=chain->NEXT)
1101 if (chain->DATA!=lotrs) headlotrs = addchain( headlotrs, chain->DATA);
1102 }
1103 if (swlotrs!=NULL && (ptype=getptype(swlotrs->USER, MBK_TRANS_PARALLEL))!=NULL) {
1104 for (chain=(chain_list *)ptype->DATA; chain!=NULL; chain=chain->NEXT)
1105 if (chain->DATA!=swlotrs) headlotrs = addchain( headlotrs, chain->DATA);
1106 }
1107
1108 for( chain = headlotrs ; chain ; chain = chain->NEXT ) {
1109 lotrs = (lotrs_list*)chain->DATA ;
1110
1111 if ( cone_is_fct ) efg_addlotrs (fig_ext,lotrs,1);
1112 if((getptype(lotrs->DRAIN->SIG->USER,EFG_SIG_DRV) != NULL) &&
1113 (getptype(lotrs->DRAIN->SIG->USER,EFG_SIG_ALIM) == NULL)) {
1114 flag = 'Y' ;
1115 //efg_addlotrs_conefct (fig_ext, lotrs, lotrs->DRAIN, 1, cone_is_fct);
1116 efg_add_lotrs_capa (fig_ext,lotrs->DRAIN,1);
1117 }
1118 if((getptype(lotrs->SOURCE->SIG->USER,EFG_SIG_DRV) != NULL) &&
1119 (getptype(lotrs->SOURCE->SIG->USER,EFG_SIG_ALIM) == NULL)) {
1120 //efg_addlotrs_conefct (fig_ext, lotrs, lotrs->SOURCE, 1, cone_is_fct);
1121 efg_add_lotrs_capa (fig_ext,lotrs->SOURCE,1);
1122 flag = 'Y' ;
1123 }
1124 if((getptype(lotrs->GRID->SIG->USER,EFG_SIG_DRV) != NULL) &&
1125 (getptype(lotrs->GRID->SIG->USER,EFG_SIG_ALIM) == NULL)) {
1126 flag = 'Y' ;
1127 //efg_addlotrs_conefct (fig_ext, lotrs, lotrs->GRID, 1, cone_is_fct);
1128 efg_add_lotrs_capa (fig_ext,lotrs->GRID,1);
1129 }
1130 }
1131 freechain( headlotrs );
1132 }
1133 else
1134 {
1135 locon = link->ULINK.LOCON ;
1136 if((getptype(locon->SIG->USER,EFG_SIG_DRV) != NULL) &&
1137 (getptype(locon->SIG->USER,EFG_SIG_ALIM) == NULL))
1138 flag = 'Y' ;
1139 }
1140 }
1141 }
1142 }
1143 if(flag == 'Y')
1144 {
1145 if (getptype(cone->USER, TEMPMARKEFGPARALLEL)!=NULL)
1146 {
1147 EFGCONTEXT->ALLADDEDCONES=addchain(EFGCONTEXT->ALLADDEDCONES, cone);
1148 avt_log(LOGEFG,2,"Cone %s ADDED (//)\n",cone->NAME);
1149 cone_onpath=addchain(cone_onpath, cone);
1150 }
1151 else if (getptype(losig->USER,EFG_SIG_SET) != NULL)
1152 {
1153 if (spisig!=NULL && spisig->NUM==-1) {
1154 *chaincone = addchain(*chaincone,cone) ;
1155 avt_log(LOGEFG,2,"Cone %s ADDED (out of path feedback loop)\n",cone->NAME);
1156 EFGCONTEXT->ALLADDEDCONES=addchain(EFGCONTEXT->ALLADDEDCONES, cone);
1157 }
1158 else if (chaincone != NULL && !getptype (losig->USER,EFG_SIG_BEG) )
1159 {
1160 if ( cone_is_fct )
1161 {
1162 *chaincone = addchain(*chaincone,cone) ;
1163 avt_log(LOGEFG,2,"Cone %s ADDED\n",cone->NAME);
1164 EFGCONTEXT->ALLADDEDCONES=addchain(EFGCONTEXT->ALLADDEDCONES, cone);
1165 }
1166 }
1167 }
1168 if(getptype(losig->USER,EFG_SIG_CONE) == NULL)
1169 losig->USER = addptype(losig->USER,EFG_SIG_CONE,NULL) ;
1170 }
1171
1172 if ( getptype (cone->USER, EFG_CONE_FCT) )
1173 cone->USER = delptype ( cone->USER, EFG_CONE_FCT );
1174 }
1175
1176 // report RC in (Drain/Source) and RC out (Gate) on Spisig
1177 for ( chain = cone_onpath ; chain ; chain=chain->NEXT )
1178 {
1179 cone = (cone_list *)chain->DATA;
1180
1181 branch[0] = cone->BRVDD ;
1182 branch[1] = cone->BRVSS ;
1183 branch[2] = cone->BREXT ;
1184
1185 for(i = 0 ; i < 3 ; i++)
1186 {
1187 for(; branch[i] != NULL ; branch[i] = branch[i]->NEXT)
1188 {
1189 for(link = branch[i]->LINK ; link != NULL ; link = link->NEXT)
1190 {
1191 if((link->TYPE & (CNS_IN | CNS_INOUT)) == 0)
1192 {
1193 lotrs = link->ULINK.LOTRS ;
1194 if((getptype(lotrs->GRID->SIG->USER,EFG_SIG_SET) != NULL) &&
1195 (getptype(lotrs->GRID->SIG->USER,EFG_SIG_ALIM) == NULL)) {
1196 efg_report_rc_lotrs ( fig_ext,lotrs->GRID);
1197 }
1198 if((getptype(lotrs->DRAIN->SIG->USER,EFG_SIG_SET) != NULL) &&
1199 (getptype(lotrs->DRAIN->SIG->USER,EFG_SIG_ALIM) == NULL)) {
1200 efg_report_rc_lotrs ( fig_ext,lotrs->DRAIN);
1201 }
1202 if((getptype(lotrs->SOURCE->SIG->USER,EFG_SIG_SET) != NULL) &&
1203 (getptype(lotrs->SOURCE->SIG->USER,EFG_SIG_ALIM) == NULL)) {
1204 efg_report_rc_lotrs ( fig_ext,lotrs->SOURCE);
1205 }
1206 }
1207 }
1208 }
1209 }
1210 }
1211
1212 while (cone_onpath!=stop) cone_onpath=delchain(cone_onpath, cone_onpath);
1213
1214 // zinaps: ptype non liberes correctement a cause de la recursivite
1215 // dans la fonction qui les positionnent o_O
1216 for(cone = cnsfig->CONE ; cone != NULL ; cone = cone->NEXT)
1217 {
1218 if ( getptype (cone->USER, EFG_CONE_FCT) )
1219 cone->USER = delptype ( cone->USER, EFG_CONE_FCT );
1220 }
1221 //
1222 if (chaincone != NULL && *chaincone != NULL && lofig->LOINS!=NULL)
1223 {
1224 efg_set_ins_ctxt (lofig,lofig->NAME);
1225 efg_add_instance (*chaincone,chaininstance);
1226 }
1227
1228 lofigchain( fig_ext );
1229 for (losig = fig_ext->LOSIG ; losig ; losig=nxtsig)
1230 {
1231 locon=NULL;
1232 nxtsig =losig->NEXT;
1233 srcsig = efg_get_org_sig ( losig );
1234 if (srcsig!=NULL && (ptype=getptype(srcsig->USER, EFG_SIG_DRV))!=NULL && ptype->DATA==NULL)
1235 {
1236 ptype = getptype ( losig->USER, LOFIGCHAIN);
1237 if ( !ptype->DATA || !((chain_list*)ptype->DATA)->NEXT ) {
1238 if ((chain = (chain_list*)ptype->DATA))
1239 locon = (locon_list*)(chain->DATA);
1240 if ( losig != efg_get_vss_on_destfig () && losig != efg_get_vdd_on_destfig () )
1241 if ( !locon || (locon && locon->TYPE != 'T' )) {
1242 avt_log(LOGEFG,2,"Sig %s deleted...\n",efg_getlosigname(losig));
1243 efg_dellosig( fig_ext, losig );
1244 if ( locon ) {
1245 avt_log(LOGEFG,2,"locon %s deleted...\n",locon->NAME);
1246 dellocon (fig_ext,locon->NAME);
1247 }
1248 continue;
1249 }
1250 }
1251 }
1252
1253 if ( !srcsig ) continue;
1254 if ( efg_SigIsAlim (srcsig) == 'Y' ) continue;
1255 ptype = getptype ( srcsig->USER, LOFIGCHAIN);
1256
1257 for ( chain = (chain_list *)ptype->DATA ; chain ; chain=chain->NEXT )
1258 efg_add_lotrs_capa (fig_ext,(locon_list*)chain->DATA,1);
1259 }
1260
1261 efg_rebuild_ctc( fig_ext );
1262 }
1263 for ( locon = fig_ext->LOCON ; locon ; locon=othercon) {
1264 othercon=locon->NEXT;
1265
1266 ptype = getptype ( locon->SIG->USER, LOFIGCHAIN);
1267 if ( locon->SIG != efg_get_vss_on_destfig () && locon->SIG != efg_get_vdd_on_destfig () )
1268 if ( !ptype->DATA || !((chain_list*)ptype->DATA)->NEXT ) {
1269 avt_log(LOGEFG,2,"Sig %s and Con %s deleted...\n",
1270 efg_getlosigname(locon->SIG),locon->NAME);
1271 efg_dellosig (fig_ext,locon->SIG);
1272 dellocon (fig_ext,locon->NAME);
1273 }
1274 }
1275 }
1276
1277 void efg_dellosig( lofig_list *lofig, losig_list *losig )
1278 {
1279 ptype_list *ptype ;
1280 losig_list *sigsrc ;
1281
1282 ptype = getptype( losig->USER,EFG_CORRESP);
1283 if( ptype ) {
1284 sigsrc = (losig_list*)ptype->DATA ;
1285 losig->USER = delptype( losig->USER,EFG_CORRESP);
1286 ptype = getptype( sigsrc->USER, EFG_CORRESP);
1287 if( ptype ) {
1288 sigsrc->USER = delptype( sigsrc->USER,EFG_CORRESP);
1289 }
1290 }
1291 dellosig( lofig, losig->INDEX );
1292 }