1 /****************************************************************************/
3 /* Chaine de CAO & VLSI AVERTEC */
5 /* Produit : AVERTEC global tools */
6 /* Fichier : ttv_API_util.c */
8 /* © copyright 2004 AVERTEC */
9 /* Tous droits reserves */
11 /* Auteur(s) : Antony PINTO */
13 /****************************************************************************/
18 #include <sys/types.h>
33 #define API_USE_REAL_TYPES
34 #include "ttv_API_LOCAL.h"
36 #include "ttv_API_util.h"
38 /****************************************************************************/
40 /****************************************************************************/
43 /* Compare 2 ttv path */
45 /****************************************************************************/
47 isSameNode(ttvcritic_list
*x
, ttvcritic_list
*y
)
49 return (!strcmp(x
->NAME
,y
->NAME
) &&
50 (x
->SLOPE
== y
->SLOPE
) &&
51 (x
->DELAY
== y
->DELAY
) &&
52 (x
->TYPE
== y
->TYPE
) &&
53 (x
->SNODE
== y
->SNODE
));
56 /*}}}************************************************************************/
57 /*{{{ pathIsInside() */
59 /* detect if a pth is included onto a longer path */
61 /****************************************************************************/
63 pathIsInside(ttvpath_list
* sp
,ttvpath_list
*lp
)
66 ttvcritic_list
*sc
, *lc
;
73 x
= ttv_GetPathDetail(sp
);
74 y
= ttv_GetPathDetail(lp
);
77 for ( ; y
; y
= y
->NEXT
)
80 if (!strcmp(lc
->NAME
,sc
->NAME
))
85 for ( ; x
&& y
&& res
; x
= x
->NEXT
, y
= y
->NEXT
)
87 res
= isSameNode(x
->DATA
,y
->DATA
);
88 //if (!res) printf("differences\n");
100 /*}}}************************************************************************/
101 /*{{{ ttv_RemoveIncludedSmallerPath() */
103 /* remove included path */
105 /****************************************************************************/
107 ttv_RemoveIncludedSmallerPath(chain_list
*lpl
, chain_list
*spl
)
109 chain_list
*x
, *y
, hd
, *prev
;
116 for (x
= prev
->NEXT
; x
; )
119 for (y
= lpl
; y
; y
= y
->NEXT
)
120 if ((res
= pathIsInside(x
->DATA
,y
->DATA
)))
137 /*}}}************************************************************************/
139 cnsfig_list
*ttvutil_cnsload(char *figname
, inffig_list
*ifl
)
143 if ((cf
=getloadedcnsfig(figname
))==NULL
)
146 where
=filepath (figname
,"cns");
149 avt_log(LOGFILEACCESS
, 0, "Loading Cone netlist \"%s\"\n", where
);
150 //avt_error("library", -1, AVT_INFO, "loading CNS '¤2%s¤.'\n", where);
151 cf
=getcnsfig(figname
, NULL
);
152 cns_addmultivoltage(ifl
, cf
);
158 char ttv_getUorD(char dir
)
160 if (tolower(dir
) == 'u' || tolower(dir
) == 'r') return 'u';
161 else if (tolower(dir
) == 'd' || tolower(dir
) == 'f') return 'd';
165 int ttv_DirectionToIndex(char dir
)
167 if (tolower(dir
) == 'u' || tolower(dir
) == 'r') return TTVAPI_UP
;
168 else if (tolower(dir
) == 'd' || tolower(dir
) == 'f') return TTVAPI_DN
;
169 else if (dir
== '?') return TTVAPI_EITHER
;
173 void ttv_DirectionStringToIndices(char *dir
, int *a
, int *b
)
175 *a
= ttv_DirectionToIndex(dir
[0]);
176 *b
= ttv_DirectionToIndex(dir
[1]);
179 int ttv_DirectionStringToIndicesHZ(char *dir
)
183 if (tolower(dir
[2])=='z') return TTV_API_ONLY_HZ
;
184 else if (tolower(dir
[2])=='/') return TTV_API_ONLY_NOTHZ
;