1 /****************************************************************************/
3 /* Chaine de CAO & VLSI Avertec */
5 /* Fichier : gsp_util.c */
7 /* (c) copyright 1991-2003 Avertec */
8 /* Tous droits reserves */
9 /* Support : contact@avertec.com */
11 /* Auteur(s) : Marc KUOCH */
13 /****************************************************************************/
14 /* simulation spice d'un chemin */
15 /****************************************************************************/
18 /*****************************************************************************/
20 /* FUNCTION : gsp_deltopname */
22 /* del top level name */
24 /*****************************************************************************/
26 void gsp_deltopname (ptype_list
*cst
)
31 if (gsp_is_pat_indpd (cst
) == 'Y')
33 for (ptype
= cst
; ptype
; ptype
= ptype
->NEXT
) {
34 if (ptype
->TYPE
== GSP_STUCK_INDPD
) continue;
36 leftunconcatname((char*)ptype
->DATA
,&left
,&right
);
42 /*****************************************************************************/
44 /* FUNCTION : gsp_classlosig */
46 /* Fonction qui met la losig contenant le signal le + tardif */
47 /* dans la tete d'une chaine list */
49 /*****************************************************************************/
50 chain_list
*gsp_classlosig (headchain
, losig2class
)
51 chain_list
*headchain
;
52 losig_list
*losig2class
;
56 chain_list
*prev
=NULL
;
58 if ( headchain
&& ((losig_list
*)headchain
->DATA
!= losig2class
) ) {
59 for (chain
= headchain
; chain
; chain
= chain
->NEXT
) {
60 losig
= (losig_list
*)chain
->DATA
;
61 if (losig
== losig2class
) {
63 prev
->NEXT
= chain
->NEXT
;
64 chain
->NEXT
= headchain
;
75 /*****************************************************************************/
77 /* FUNCTION : gsp_GetLoconIn () */
79 /* Trouve l entree la plus tardive sur une instance */
80 /* Retourne egalement une ptype_list si plusieurs entrees connues attaquent */
83 /*****************************************************************************/
84 locon_list
*gsp_GetLoconIn(loins
,listptype
,slope
)
86 ptype_list
*listptype
;
91 locon_list
*loconin
= NULL
;
92 chain_list
*chainmarksig
= NULL
;
96 char direction
,*loins_context
;
100 if (loins
== NULL
) return NULL
;
101 if ((lofig
= getloadedlofig(loins
->FIGNAME
)) == NULL
)
104 for (locon
= loins
->LOCON
; locon
; locon
= locon
->NEXT
) {
105 direction
= locon
->DIRECTION
;
106 if (direction
== 'X')
107 direction
= (efg_FindLocon (lofig
,locon
->NAME
))->DIRECTION
;
108 if ((direction
== 'I') || (direction
== 'B') || (direction
== 'T')) {
109 if ((ptype
= getptype(locon
->SIG
->USER
,EFG_SIG_SET
)) != NULL
) {
110 chainmarksig
= addchain (chainmarksig
,(void*)locon
);
112 *slope
= (long)ptype
->DATA
;
116 if (chainmarksig
== NULL
)
118 else if (chainmarksig
->NEXT
== NULL
)
119 loconin
= (locon_list
*)chainmarksig
->DATA
;
121 /* repere le sig le + tardif */
122 loins_context
= loins
->INSNAME
;
123 for (chain
= chainmarksig
; chain
; chain
= chain
->NEXT
) {
124 locon
= (locon_list
*)chain
->DATA
;
125 if ((ptype
= getptype(locon
->SIG
->USER
,EFG_SIG_SET_NUM
)) != NULL
) {
126 hash
= (ht
*)ptype
->DATA
;
127 num
= gethtitem(hash
,(void*)(loins_context
));
128 if ((num
!= EMPTYHT
) && ((int)num
> maxnum
)) {
134 listptype
= gsp_FillPtypelistCst(chainmarksig
,loconin
);
136 freechain(chainmarksig
);
140 /*****************************************************************************/
142 /* FUNCTION : gsp_GetLoconOut () */
144 /* Trouve la transition sur le connecteur de sortie */
146 /*****************************************************************************/
147 locon_list
*gsp_GetLoconOut(loins
,slope
)
153 locon_list
*loconout
= NULL
;
157 if (loins
== NULL
) return NULL
;
158 if ((lofig
= getloadedlofig(loins
->FIGNAME
)) == NULL
)
161 for (locon
= loins
->LOCON
; locon
; locon
= locon
->NEXT
) {
162 direction
= locon
->DIRECTION
;
163 if (direction
== 'X')
164 direction
= (efg_FindLocon (lofig
,locon
->NAME
))->DIRECTION
;
165 if ((direction
== 'O') || (direction
== 'B') ||
166 (direction
== 'Z') || (direction
== 'T')) {
167 if ((ptype
= getptype(locon
->SIG
->USER
,EFG_SIG_SET
)) != NULL
) {
170 *slope
= (long)ptype
->DATA
;
177 /*****************************************************************************/
179 /* FUNCTION : gsp_GetTransition() */
181 /* Obtient la transition entre deux connecteurs */
183 /*****************************************************************************/
184 long gsp_GetTransition(loconin
,loconout
)
186 locon_list
*loconout
;
193 if ((ptype
= getptype(loconin
->SIG
->USER
,EFG_SIG_SET
)) != NULL
) {
194 if (ptype
->DATA
== EFG_SIG_SET_RISE
)
199 if ((ptype
= getptype(loconout
->SIG
->USER
,EFG_SIG_SET
)) != NULL
) {
200 if (ptype
->DATA
== EFG_SIG_SET_RISE
)
205 if (infront
== 'U') {
207 trans
= CBH_TRANS_UU
;
209 trans
= CBH_TRANS_UD
;
213 trans
= CBH_TRANS_DU
;
215 trans
= CBH_TRANS_DD
;
220 /*****************************************************************************/
222 /* FUNCTION : gsp_FreeMarksOnCnsfig */
224 /*****************************************************************************/
225 gsp_cone_info
*gsp_get_cone_info(cone_list
*cone
)
228 if ((pt
=getptype (cone
->USER
,GSP_CONE_NUMBER
)) != NULL
)
229 return (gsp_cone_info
*)pt
->DATA
;
233 void gsp_delete_cone_info(cone_list
*cone
)
237 if ((pt
=getptype (cone
->USER
,GSP_CONE_NUMBER
)) != NULL
)
240 cone
->USER
=delptype(cone
->USER
,GSP_CONE_NUMBER
);
244 gsp_cone_info
*gsp_create_cone_info(cone_list
*cone
)
248 if ((pt
=getptype (cone
->USER
,GSP_CONE_NUMBER
)) == NULL
)
250 ci
=(gsp_cone_info
*)mbkalloc(sizeof(gsp_cone_info
));
251 cone
->USER
=addptype(cone
->USER
,GSP_CONE_NUMBER
, ci
);
252 ci
->Date
=ci
->MinDate
=-1;
253 ci
->BeforeTransitionState
=ci
->AfterTransitionState
=-1;
261 ci
=(gsp_cone_info
*)pt
->DATA
;
265 void gsp_FreeMarksOnCnsfig (cnsfig_list
*cnsfig
)
270 for (cone
= cnsfig
->CONE
; cone
; cone
=cone
->NEXT
)
272 gsp_delete_cone_info(cone
);
276 void gsp_FreeMarksOnCnsfigFromChainCone (chain_list
*cl
)
282 cone
= (cone_list
*)cl
->DATA
;
283 gsp_delete_cone_info(cone
);