Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / yagle / yagle / yag_cellbeh.c
1 /****************************************************************************/
2 /* */
3 /* Chaine de CAO & VLSI Alliance */
4 /* */
5 /* Produit : YAGLE v3.50 */
6 /* Fichier : yag_cellbeh.c */
7 /* */
8 /* (c) copyright 1995 Laboratoire MASI equipe CAO & VLSI */
9 /* Tous droits reserves */
10 /* Support : e-mail alliance-support@asim.lip6.fr */
11 /* */
12 /* Auteur(s) : Anthony LESTER le : 10/11/1995 */
13 /* */
14 /* Modifie par : le : ../../.... */
15 /* Modifie par : le : ../../.... */
16 /* Modifie par : le : ../../.... */
17 /* */
18 /****************************************************************************/
19
20 #include "yag_headers.h"
21
22 befig_list *
23 yagBuildBefigMSSC(name, D_sig, D_cone, D, CK, S, R, NR, reg, Q, QN, fall_edge, conelist)
24 char *name;
25 losig_list *D_sig;
26 cone_list *D_cone;
27 char *D, *CK, *S, *R, *NR;
28 char *reg;
29 char *Q, *QN;
30 int fall_edge;
31 chain_list *conelist;
32 {
33 befig_list *ptbefig;
34 cone_list *ptdrivecone;
35 biabl_list *ptbiabl = NULL;
36 chain_list *value;
37 chain_list *condition;
38 chain_list *trigger;
39 ptype_list *ptuser;
40 char label[16];
41 char extname[YAGBUFSIZE];
42 char *lclname;
43 char *drivename;
44 cone_list *regcone = NULL;
45 cone_list *outputcone = NULL;
46 chain_list *delaycones = NULL;
47
48 if (conelist != NULL && YAG_CONTEXT->YAG_TAS_TIMING != YAG_NO_TIMING) {
49 regcone = (cone_list *)yagGetChainInd(conelist, 4);
50 outputcone = (cone_list *)yagGetChainInd(conelist, 5);
51 delaycones = addchain(NULL, yagGetChainInd(conelist, 3));
52 delaycones = addchain(delaycones, yagGetChainInd(conelist, 2));
53 }
54
55 ptbefig = beh_addbefig(NULL, name);
56
57 if (D_sig != NULL) {
58 ptuser = getptype(D_sig->USER, YAG_CONE_PTYPE);
59 if (ptuser != NULL ) ptdrivecone = (cone_list *)ptuser->DATA;
60 if (ptuser == NULL || (ptdrivecone->TYPE & YAG_TEMPCONE) != 0) {
61 yagAddGlueCone(D_sig, D_cone);
62 }
63 }
64
65 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, D, 'I', 'B');
66 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, D);
67
68 if (delaycones != NULL) {
69 sprintf(extname, "%s_tasdelay", D);
70 drivename = namealloc(extname);
71 ptbefig->BEAUX = beh_addbeaux(ptbefig->BEAUX, drivename, createAtom(D), (pNode)yagMakeBequadConeList(delaycones), 0);
72 }
73 else drivename = D;
74
75 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
76 value = createAtom(drivename);
77 condition = createExpr(AND);
78 if (fall_edge) addQExpr(condition, notExpr(createAtom(CK)));
79 else addQExpr(condition, createAtom(CK));
80 trigger = createExpr(STABLE);
81 addQExpr(trigger, createAtom(CK));
82 addQExpr(condition, notExpr(trigger));
83 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
84
85 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, CK, 'I', 'B');
86 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, CK);
87
88 sprintf(extname, "%s'delayed", CK);
89 lclname = namealloc(extname);
90 ptbefig->BEDLY = beh_addbeaux(ptbefig->BEDLY, lclname, createAtom(CK), NULL, 0);
91 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, lclname);
92
93 if (S != NULL) {
94 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, S, 'I', 'B');
95 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, S);
96 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
97 value = createAtom("'0'");
98 condition = createAtom(S);
99 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
100 if (ptbiabl->NEXT != NULL) ptbiabl->NEXT->FLAG |= BEH_CND_PRECEDE;
101 }
102 if (R != NULL) {
103 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, R, 'I', 'B');
104 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, R);
105 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
106 value = createAtom("'1'");
107 condition = createAtom(R);
108 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
109 if (ptbiabl->NEXT != NULL) ptbiabl->NEXT->FLAG |= BEH_CND_PRECEDE;
110 }
111 if (NR != NULL) {
112 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, NR, 'I', 'B');
113 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, NR);
114 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
115 value = createAtom("'1'");
116 condition = notExpr(createAtom(NR));
117 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
118 if (ptbiabl->NEXT != NULL) ptbiabl->NEXT->FLAG |= BEH_CND_PRECEDE;
119 }
120
121 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, Q, 'O', 'B');
122 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, Q, createAtom(reg), NULL, 0);
123 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, QN, 'O', 'B');
124 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, QN, notExpr(createAtom(reg)), (pNode)yagMakeBequadCone(outputcone), 0);
125 ptbefig->BEREG = beh_addbereg(ptbefig->BEREG, reg, ptbiabl, yagMakeBinode(ptbiabl, regcone),0);
126 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, reg);
127
128 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vdd", 'I', 'B');
129 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vss", 'I', 'B');
130
131 return ptbefig;
132 }
133
134 befig_list *
135 yagBuildBefigMSDIFF(name, D, W, reg, Q, QN, conelist)
136 char *name;
137 char *D, *W;
138 char *reg;
139 char *Q, *QN;
140 chain_list *conelist;
141 {
142 befig_list *ptbefig;
143 biabl_list *ptbiabl = NULL;
144 chain_list *value, *condition, *trigger;
145 char label[16];
146 char extname[YAGBUFSIZE];
147 char *lclname;
148 char *drivename;
149 cone_list *regcone = NULL;
150 cone_list *outputcone = NULL;
151 chain_list *delaycones = NULL;
152
153 ptbefig = beh_addbefig(NULL, name);
154
155 if (conelist != NULL && YAG_CONTEXT->YAG_TAS_TIMING != YAG_NO_TIMING) {
156 regcone = (cone_list *)yagGetChainInd(conelist, 5);
157 outputcone = (cone_list *)yagGetChainInd(conelist, 6);
158 delaycones = addchain(NULL, yagGetChainInd(conelist, 4));
159 delaycones = addchain(delaycones, yagGetChainInd(conelist, 3));
160 }
161
162 if (delaycones != NULL) {
163 sprintf(extname, "%s_tasdelay", D);
164 drivename = namealloc(extname);
165 ptbefig->BEAUX = beh_addbeaux(ptbefig->BEAUX, drivename, createAtom(D), (pNode)yagMakeBequadConeList(delaycones), 0);
166 }
167 else drivename = D;
168
169 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
170 value = createAtom(drivename);
171 condition = createExpr(AND);
172 addQExpr(condition, notExpr(createAtom(W)));
173 trigger = createExpr(STABLE);
174 addQExpr(trigger, createAtom(W));
175 addQExpr(condition, notExpr(trigger));
176 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
177
178 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, W, 'I', 'B');
179 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, W);
180
181 sprintf(extname, "%s'delayed", W);
182 lclname = namealloc(extname);
183 ptbefig->BEDLY = beh_addbeaux(ptbefig->BEDLY, lclname, createAtom(W), NULL, 0);
184 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, lclname);
185
186 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, D, 'I', 'B');
187 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, D);
188
189 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, Q, 'O', 'B');
190 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, Q, createAtom(reg), NULL, 0);
191 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, QN, 'O', 'B');
192 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, QN, notExpr(createAtom(reg)), (pNode)yagMakeBequadCone(outputcone), 0);
193 ptbefig->BEREG = beh_addbereg(ptbefig->BEREG, reg, ptbiabl, yagMakeBinode(ptbiabl, regcone),0);
194 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, reg);
195
196 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vdd", 'I', 'B');
197 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vss", 'I', 'B');
198
199 return ptbefig;
200 }
201
202 befig_list *
203 yagBuildBefigMSSX(name, D, CK, reg, Q, fall_edge, conelist)
204 char *name;
205 char *D, *CK;
206 char *reg;
207 char *Q;
208 int fall_edge;
209 chain_list *conelist;
210 {
211 befig_list *ptbefig;
212 biabl_list *ptbiabl = NULL;
213 chain_list *value;
214 chain_list *condition;
215 chain_list *trigger;
216 char label[16];
217 char extname[YAGBUFSIZE];
218 char *lclname;
219 char *drivename;
220 cone_list *regcone = NULL;
221 cone_list *outputcone = NULL;
222 chain_list *delaycones = NULL;
223
224 ptbefig = beh_addbefig(NULL, name);
225
226 if (conelist != NULL && YAG_CONTEXT->YAG_TAS_TIMING != YAG_NO_TIMING) {
227 regcone = (cone_list *)yagGetChainInd(conelist, 4);
228 outputcone = (cone_list *)yagGetChainInd(conelist, 5);
229 delaycones = addchain(NULL, yagGetChainInd(conelist, 2));
230 }
231
232 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, D, 'I', 'B');
233 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, D);
234
235 if (delaycones != NULL) {
236 sprintf(extname, "%s_tasdelay", D);
237 drivename = namealloc(extname);
238 ptbefig->BEAUX = beh_addbeaux(ptbefig->BEAUX, drivename, createAtom(D), (pNode)yagMakeBequadConeList(delaycones), 0);
239 }
240 else drivename = D;
241
242 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
243 value = notExpr(createAtom(drivename));
244 condition = createExpr(AND);
245 if (fall_edge) addQExpr(condition, notExpr(createAtom(CK)));
246 else addQExpr(condition, createAtom(CK));
247 trigger = createExpr(STABLE);
248 addQExpr(trigger, createAtom(CK));
249 addQExpr(condition, notExpr(trigger));
250 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
251
252 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, CK, 'I', 'B');
253 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, CK);
254
255 sprintf(extname, "%s'delayed", CK);
256 lclname = namealloc(extname);
257 ptbefig->BEDLY = beh_addbeaux(ptbefig->BEDLY, lclname, createAtom(CK), NULL, 0);
258 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, lclname);
259
260 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, Q, 'O', 'B');
261 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, Q, createAtom(reg), (pNode)yagMakeBequadCone(outputcone), 0);
262 ptbefig->BEREG = beh_addbereg(ptbefig->BEREG, reg, ptbiabl, yagMakeBinode(ptbiabl, regcone),0);
263 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, reg);
264
265 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vdd", 'I', 'B');
266 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vss", 'I', 'B');
267
268 return ptbefig;
269 }
270
271 befig_list *
272 yagBuildBefigFFT2(name, D_sig, D_cone, D, CPN, LD, RE, reg, Q, QN, conelist)
273 char *name;
274 losig_list *D_sig;
275 cone_list *D_cone;
276 char *D, *CPN, *LD, *RE;
277 char *reg;
278 char *Q, *QN;
279 chain_list *conelist;
280 {
281 befig_list *ptbefig;
282 cone_list *ptdrivecone;
283 biabl_list *ptbiabl = NULL;
284 chain_list *value, *condition, *trigger;
285 ptype_list *ptuser;
286 char label[16];
287 char extname[YAGBUFSIZE];
288 char *lclname;
289 cone_list *regcone = NULL;
290 cone_list *outputcone = NULL;
291 chain_list *delaycones = NULL;
292
293 ptbefig = beh_addbefig(NULL, name);
294
295 if (conelist != NULL && YAG_CONTEXT->YAG_TAS_TIMING != YAG_NO_TIMING) {
296 regcone = (cone_list *)yagGetChainInd(conelist, 7);
297 outputcone = (cone_list *)yagGetChainInd(conelist, 8);
298 delaycones = addchain(NULL, yagGetChainInd(conelist, 5));
299 }
300
301 if (D_sig != NULL) {
302 ptuser = getptype(D_sig->USER, YAG_CONE_PTYPE);
303 if (ptuser != NULL) ptdrivecone = (cone_list *)ptuser->DATA;
304 if (ptuser == NULL || (ptdrivecone->TYPE & YAG_TEMPCONE) != 0) {
305 yagAddGlueCone(D_sig, D_cone);
306 }
307 }
308
309 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, name, 'I', 'B');
310 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, name);
311
312 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
313 value = createAtom(Q);
314 condition = createExpr(AND);
315 /* addQExpr(condition, notExpr(createAtom(LD)));
316 addQExpr(condition, createAtom(RE));*/
317 addQExpr(condition, notExpr(createAtom(CPN)));
318 trigger = createExpr(STABLE);
319 addQExpr(trigger, createAtom(CPN));
320 addQExpr(condition, notExpr(trigger));
321 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
322
323 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
324 value = createAtom("'1'");
325 condition = createExpr(AND);
326 addQExpr(condition, notExpr(createAtom(LD)));
327 addQExpr(condition, notExpr(createAtom(RE)));
328 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
329 if (ptbiabl->NEXT != NULL) ptbiabl->NEXT->FLAG |= BEH_CND_PRECEDE;
330
331 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
332 value = notExpr(createAtom(D));
333 condition = createAtom(LD);
334 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
335 if (ptbiabl->NEXT != NULL) ptbiabl->NEXT->FLAG |= BEH_CND_PRECEDE;
336
337 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, CPN, 'I', 'B');
338 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, CPN);
339
340 sprintf(extname, "%s'delayed", CPN);
341 lclname = namealloc(extname);
342 ptbefig->BEDLY = beh_addbeaux(ptbefig->BEDLY, lclname, createAtom(CPN), NULL, 0);
343 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, lclname);
344
345 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, LD, 'I', 'B');
346 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, LD);
347 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, RE, 'I', 'B');
348 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, RE);
349 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, Q, 'O', 'B');
350 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, Q, notExpr(createAtom(reg)), (pNode)yagMakeBequadCone(outputcone), 0);
351 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, QN, 'O', 'B');
352 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, QN, createAtom(reg), NULL, 0);
353 ptbefig->BEREG = beh_addbereg(ptbefig->BEREG, reg, ptbiabl, yagMakeBinode(ptbiabl, regcone),0);
354 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, reg);
355
356 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vdd", 'I', 'B');
357 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vss", 'I', 'B');
358
359 return ptbefig;
360 }
361
362 befig_list *
363 yagBuildBefigFD2R(name, D_sig, D_cone, D, CPN, RE, reg, Q, QN, conelist)
364 char *name;
365 losig_list *D_sig;
366 cone_list *D_cone;
367 char *D, *CPN, *RE;
368 char *reg;
369 char *Q, *QN;
370 chain_list *conelist;
371 {
372 befig_list *ptbefig;
373 cone_list *ptdrivecone;
374 biabl_list *ptbiabl = NULL;
375 chain_list *value, *condition, *trigger;
376 ptype_list *ptuser;
377 char label[16];
378 char extname[YAGBUFSIZE];
379 char *lclname;
380 cone_list *regcone = NULL;
381 cone_list *outputcone = NULL;
382 chain_list *delaycones = NULL;
383
384 ptbefig = beh_addbefig(NULL, name);
385
386 if (conelist != NULL && YAG_CONTEXT->YAG_TAS_TIMING != YAG_NO_TIMING) {
387 regcone = (cone_list *)yagGetChainInd(conelist, 3);
388 outputcone = (cone_list *)yagGetChainInd(conelist, 4);
389 delaycones = addchain(NULL, yagGetChainInd(conelist, 1));
390 }
391
392 if (D_sig != NULL) {
393 ptuser = getptype(D_sig->USER, YAG_CONE_PTYPE);
394 if (ptuser != NULL) ptdrivecone = (cone_list *)ptuser->DATA;
395 if (ptuser == NULL || (ptdrivecone->TYPE & YAG_TEMPCONE) != 0) {
396 yagAddGlueCone(D_sig, D_cone);
397 }
398 }
399
400 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, D, 'I', 'B');
401 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, D);
402
403 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
404 value = notExpr(createAtom(D));
405 condition = createExpr(AND);
406 /* addQExpr(condition, createAtom(RE));*/
407 addQExpr(condition, notExpr(createAtom(CPN)));
408 trigger = createExpr(STABLE);
409 addQExpr(trigger, createAtom(CPN));
410 addQExpr(condition, notExpr(trigger));
411 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
412
413 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
414 value = createAtom("'1'");
415 condition = notExpr(createAtom(RE));
416 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
417 if (ptbiabl->NEXT != NULL) ptbiabl->NEXT->FLAG |= BEH_CND_PRECEDE;
418
419 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, CPN, 'I', 'B');
420 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, CPN);
421
422 sprintf(extname, "%s'delayed", CPN);
423 lclname = namealloc(extname);
424 ptbefig->BEDLY = beh_addbeaux(ptbefig->BEDLY, lclname, createAtom(CPN), NULL, 0);
425 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, lclname);
426
427 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, RE, 'I', 'B');
428 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, RE);
429 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, Q, 'O', 'B');
430 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, Q, notExpr(createAtom(reg)), (pNode)yagMakeBequadCone(outputcone), 0);
431 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, QN, 'O', 'B');
432 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, QN, createAtom(reg), NULL, 0);
433 ptbefig->BEREG = beh_addbereg(ptbefig->BEREG, reg, ptbiabl, yagMakeBinode(ptbiabl, regcone),0);
434
435 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vdd", 'I', 'B');
436 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vss", 'I', 'B');
437
438 return ptbefig;
439 }
440
441 befig_list *
442 yagBuildBefigFD2S(name, D_sig, D_cone, D, CPN, RE, reg, Q, QN, conelist)
443 char *name;
444 losig_list *D_sig;
445 cone_list *D_cone;
446 char *D, *CPN, *RE;
447 char *reg;
448 char *Q, *QN;
449 chain_list *conelist;
450 {
451 befig_list *ptbefig;
452 cone_list *ptdrivecone;
453 biabl_list *ptbiabl = NULL;
454 chain_list *value, *condition, *trigger;
455 ptype_list *ptuser;
456 char label[16];
457 char extname[YAGBUFSIZE];
458 char *lclname;
459 cone_list *regcone = NULL;
460 cone_list *outputcone = NULL;
461 chain_list *delaycones = NULL;
462
463 ptbefig = beh_addbefig(NULL, name);
464
465 if (conelist != NULL && YAG_CONTEXT->YAG_TAS_TIMING != YAG_NO_TIMING) {
466 regcone = (cone_list *)yagGetChainInd(conelist, 3);
467 outputcone = (cone_list *)yagGetChainInd(conelist, 4);
468 delaycones = addchain(NULL, yagGetChainInd(conelist, 1));
469 }
470
471 if (D_sig != NULL) {
472 ptuser = getptype(D_sig->USER, YAG_CONE_PTYPE);
473 if (ptuser != NULL) ptdrivecone = (cone_list *)ptuser->DATA;
474 if (ptuser == NULL || (ptdrivecone->TYPE & YAG_TEMPCONE) != 0) {
475 yagAddGlueCone(D_sig, D_cone);
476 }
477 }
478
479 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, D, 'I', 'B');
480 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, D);
481
482 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
483 value = notExpr(createAtom(D));
484 condition = createExpr(AND);
485 /* addQExpr(condition, createAtom(RE));*/
486 addQExpr(condition, notExpr(createAtom(CPN)));
487 trigger = createExpr(STABLE);
488 addQExpr(trigger, createAtom(CPN));
489 addQExpr(condition, notExpr(trigger));
490 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
491
492 sprintf(label, "lb%d", YAG_CONTEXT->YAG_BIABL_INDEX++);
493 value = createAtom("'0'");
494 condition = notExpr(createAtom(RE));
495 ptbiabl = beh_addbiabl(ptbiabl, label, condition, value);
496 if (ptbiabl->NEXT != NULL) ptbiabl->NEXT->FLAG |= BEH_CND_PRECEDE;
497
498 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, CPN, 'I', 'B');
499 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, CPN);
500
501 sprintf(extname, "%s'delayed", CPN);
502 lclname = namealloc(extname);
503 ptbefig->BEDLY = beh_addbeaux(ptbefig->BEDLY, lclname, createAtom(CPN), NULL, 0);
504 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, lclname);
505
506 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, RE, 'I', 'B');
507 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, RE);
508 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, Q, 'O', 'B');
509 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, Q, notExpr(createAtom(reg)), (pNode)yagMakeBequadCone(outputcone), 0);
510 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, QN, 'O', 'B');
511 ptbefig->BEOUT = beh_addbeout(ptbefig->BEOUT, QN, createAtom(reg), NULL, 0);
512 ptbefig->BEREG = beh_addbereg(ptbefig->BEREG, reg, ptbiabl, yagMakeBinode(ptbiabl, regcone),0);
513 ptbefig->BERIN = beh_addberin(ptbefig->BERIN, reg);
514
515 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vdd", 'I', 'B');
516 ptbefig->BEPOR = beh_addbepor(ptbefig->BEPOR, "vss", 'I', 'B');
517
518 return ptbefig;
519 }
520