1 | /* |
---|
2 | |
---|
3 | Copyright (c) 1992, 1993 |
---|
4 | Regents of the University of California |
---|
5 | All rights reserved. |
---|
6 | |
---|
7 | Use and copying of this software and preparation of derivative works |
---|
8 | based upon this software are permitted. However, any distribution of |
---|
9 | this software or derivative works must include the above copyright |
---|
10 | notice. |
---|
11 | |
---|
12 | This software is made available AS IS, and neither the Electronics |
---|
13 | Research Laboratory or the Universify of California make any |
---|
14 | warranty about the software, its performance or its conformity to |
---|
15 | any specification. |
---|
16 | |
---|
17 | Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU |
---|
18 | 10/92 |
---|
19 | 10/93 |
---|
20 | |
---|
21 | $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_nonblock.c,v 1.2 2009/03/09 20:25:58 fabio Exp $ |
---|
22 | |
---|
23 | |
---|
24 | */ |
---|
25 | |
---|
26 | #include <stdio.h> |
---|
27 | #include <math.h> |
---|
28 | #include "util.h" |
---|
29 | #include "array.h" |
---|
30 | #include "list.h" |
---|
31 | #include "st.h" |
---|
32 | #include "set.h" |
---|
33 | #include "graph.h" |
---|
34 | #include "vl_types.h" |
---|
35 | #include "vl_defs.h" |
---|
36 | #include "vlr_int.h" |
---|
37 | #include "vl_fg_defs.h" |
---|
38 | #include "vl_create.h" |
---|
39 | #include "vl_write.h" |
---|
40 | #include "vl_write_util.h" |
---|
41 | #include "vl_vardecl.h" |
---|
42 | #include "vl_edgedetector.h" |
---|
43 | #include "vl_nonblock.h" |
---|
44 | #include "vl_fg_defs.h" |
---|
45 | #include "vl_fg_types.h" |
---|
46 | #include "vl_flowgraph.h" |
---|
47 | |
---|
48 | extern int vlTimedSystem; |
---|
49 | extern int set_notation; |
---|
50 | extern int decomposeTable; |
---|
51 | extern int deadlock_semantic; |
---|
52 | extern int rst_ckt; |
---|
53 | extern lsList ctrl_list, rst_ctrl_list; |
---|
54 | |
---|
55 | static void write_nblock_set_connect ARGS((FILE *file, |
---|
56 | vl_id_range *id_sym, |
---|
57 | char *latch_name, |
---|
58 | vl_term *ripple_ctrl, |
---|
59 | vl_term *ripple_set, |
---|
60 | vl_term *procedural_ctrl, |
---|
61 | vl_term *procedural_term, |
---|
62 | vl_term *result)); |
---|
63 | |
---|
64 | void put_nblock_scalar_simple_table(FILE *file, char *dc, |
---|
65 | vl_id_range *id_sym, |
---|
66 | int non_block_wire, |
---|
67 | char *latch_name, |
---|
68 | vl_term *out_term, |
---|
69 | int n_entries, |
---|
70 | int lo, int hi, |
---|
71 | lsList ripple, |
---|
72 | vl_term *procedural_ctrl, |
---|
73 | vl_term *procedural_term) |
---|
74 | { |
---|
75 | int ith_var; |
---|
76 | vl_term *ctrl_term; |
---|
77 | lsGen lgen; |
---|
78 | lsHandle handle; |
---|
79 | syndrome_expr *se; |
---|
80 | int table_width; |
---|
81 | |
---|
82 | table_width = lsLength((!rst_ckt)?ctrl_list:rst_ctrl_list) + |
---|
83 | lsLength((!rst_ckt)?id_sym->syndrome_expr_list: |
---|
84 | id_sym->rst_syndrome_expr_list); |
---|
85 | if (table_width < decomposeTable) { |
---|
86 | |
---|
87 | |
---|
88 | if (vlTimedSystem && !rst_ckt) { |
---|
89 | fprintf(file, ".names %s ", FG_LC_PS); |
---|
90 | } else |
---|
91 | fprintf(file, ".names "); |
---|
92 | for (lgen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list), ith_var=0; |
---|
93 | lsNext(lgen,(lsGeneric*)&ctrl_term,&handle)!=LS_NOMORE; |
---|
94 | ith_var++) { |
---|
95 | if (!dc[ith_var]) |
---|
96 | fprintf(file, "%s ", ctrl_term->name->name); |
---|
97 | } |
---|
98 | (void)lsFinish(lgen); |
---|
99 | for (lgen=lsStart((!rst_ckt)? |
---|
100 | id_sym->syndrome_expr_list: |
---|
101 | id_sym->rst_syndrome_expr_list); |
---|
102 | lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) { |
---|
103 | fprintf(file, "%s ", se->expr->name->name); |
---|
104 | } |
---|
105 | (void)lsFinish(lgen); |
---|
106 | if (!non_block_wire && !rst_ckt) fprintf(file, "%s ", latch_name); |
---|
107 | fprintf(file, "%s\n", out_term->name->name); |
---|
108 | |
---|
109 | |
---|
110 | if (set_notation && !(deadlock_semantic && non_block_wire)) { |
---|
111 | if (non_block_wire || rst_ckt) |
---|
112 | fprintf(file,"%s -\n",HSIS_DEFAULT); |
---|
113 | else |
---|
114 | fprintf(file, "%s %s%s\n", |
---|
115 | HSIS_DEFAULT, HSIS_EQUAL, latch_name); |
---|
116 | } |
---|
117 | if ((id_sym->flags & MVar) && set_notation) { |
---|
118 | put_nblock_mout_transition(file, non_block_wire, n_entries, |
---|
119 | id_sym, lo, hi, lo, dc, |
---|
120 | latch_name); |
---|
121 | } else { |
---|
122 | put_nblock_transition(file, non_block_wire, n_entries, |
---|
123 | id_sym, lo, hi, lo, dc, ripple); |
---|
124 | } |
---|
125 | } else { |
---|
126 | |
---|
127 | vl_term *ripple_ctrl, *ripple_set, *ectrl; |
---|
128 | vl_term *new_set; |
---|
129 | lsList syndromeExprList, worklist, local_accumulator; |
---|
130 | syndrome_expr *se_next; |
---|
131 | int duplicate_item; |
---|
132 | |
---|
133 | ripple_ctrl = NIL(vl_term); |
---|
134 | ripple_set = NIL(vl_term); |
---|
135 | syndromeExprList = (!rst_ckt)? |
---|
136 | id_sym->syndrome_expr_list: |
---|
137 | id_sym->rst_syndrome_expr_list; |
---|
138 | worklist = lsCopy(syndromeExprList, 0); |
---|
139 | |
---|
140 | for (lgen=lsStart(worklist); |
---|
141 | lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) { |
---|
142 | ectrl = write_entry_control(file, |
---|
143 | (!rst_ckt)?ctrl_list:rst_ctrl_list, |
---|
144 | se->syndrome, se->pre_cond, se->fg_id); |
---|
145 | |
---|
146 | local_accumulator = lsCreate(); |
---|
147 | lsNewEnd(local_accumulator, (lsGeneric)se, 0); |
---|
148 | if (lsLength(worklist) > 1) { |
---|
149 | duplicate_item = 1; |
---|
150 | while (lsNext(lgen, (lsGeneric*)&se_next, &handle)!= |
---|
151 | LS_NOMORE |
---|
152 | && duplicate_item) { |
---|
153 | if (strcmp(se->syndrome, se_next->syndrome)) { |
---|
154 | duplicate_item = 0; |
---|
155 | lsPrev(lgen, (lsGeneric*)&se_next, &handle); |
---|
156 | lsPrev(lgen, (lsGeneric*)&se_next, &handle); |
---|
157 | } else { |
---|
158 | lsNewEnd(local_accumulator, (lsGeneric)se_next, 0); |
---|
159 | } |
---|
160 | } |
---|
161 | } |
---|
162 | new_set = write_nond_set(file, id_sym, local_accumulator); |
---|
163 | ripple_ctrl = write_set_accumulate(file, id_sym, |
---|
164 | ectrl, ripple_ctrl, |
---|
165 | new_set, &ripple_set); |
---|
166 | |
---|
167 | lsDestroy(local_accumulator, 0); |
---|
168 | |
---|
169 | } |
---|
170 | |
---|
171 | write_nblock_set_connect(file, id_sym, latch_name, |
---|
172 | ripple_ctrl, ripple_set, |
---|
173 | procedural_ctrl, procedural_term, |
---|
174 | out_term); |
---|
175 | lsFinish(lgen); |
---|
176 | lsDestroy(worklist, 0); |
---|
177 | } |
---|
178 | } |
---|
179 | |
---|
180 | |
---|
181 | void put_nblock_scalar_array_table(FILE *file, |
---|
182 | char *dc, |
---|
183 | vl_id_range *id_sym, |
---|
184 | int non_block_wire, |
---|
185 | char *latch_name, |
---|
186 | vl_term *out_term, |
---|
187 | int n_entries, |
---|
188 | int lo, int hi, |
---|
189 | lsList ripple) |
---|
190 | { |
---|
191 | int ith_var; |
---|
192 | vl_term *ctrl_term; |
---|
193 | lsGen lgen; |
---|
194 | lsHandle handle; |
---|
195 | syndrome_expr *se; |
---|
196 | int idx_lo, idx_hi, idx; |
---|
197 | |
---|
198 | idx_lo = vl_eval_expr(id_sym->range->left); |
---|
199 | if (id_sym->range->right) |
---|
200 | idx_hi = vl_eval_expr(id_sym->range->right); |
---|
201 | else |
---|
202 | idx_hi = idx_lo; |
---|
203 | |
---|
204 | for (idx=idx_lo; idx<=idx_hi; idx++) { |
---|
205 | |
---|
206 | if (vlTimedSystem && !rst_ckt) { |
---|
207 | fprintf(file, ".names %s ", FG_LC_PS); |
---|
208 | } else |
---|
209 | fprintf(file, ".names "); |
---|
210 | for (lgen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list), ith_var=0; |
---|
211 | lsNext(lgen,(lsGeneric*)&ctrl_term,&handle)!= |
---|
212 | LS_NOMORE; |
---|
213 | ith_var++) { |
---|
214 | if (!dc[ith_var]) |
---|
215 | fprintf(file, "%s ", ctrl_term->name->name); |
---|
216 | } |
---|
217 | (void)lsFinish(lgen); |
---|
218 | for (lgen=lsStart((!rst_ckt)? |
---|
219 | id_sym->syndrome_expr_list: |
---|
220 | id_sym->rst_syndrome_expr_list); |
---|
221 | lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) { |
---|
222 | fprintf(file, "%s%s%d%s ", se->expr->name->name, |
---|
223 | SEP_LARRAY, idx, SEP_RARRAY); |
---|
224 | } |
---|
225 | (void)lsFinish(lgen); |
---|
226 | if (!non_block_wire && !rst_ckt) |
---|
227 | fprintf(file,"%s%s%d%s ", latch_name, SEP_LARRAY, idx, SEP_RARRAY); |
---|
228 | fprintf(file, "%s%s%d%s\n", out_term->name->name, |
---|
229 | SEP_LARRAY, idx, SEP_RARRAY); |
---|
230 | |
---|
231 | |
---|
232 | if (set_notation && !(deadlock_semantic && non_block_wire)) { |
---|
233 | if (non_block_wire || rst_ckt) |
---|
234 | fprintf (file, "%s -\n", HSIS_DEFAULT); |
---|
235 | else |
---|
236 | fprintf(file, "%s %s %s%s%d%s\n", HSIS_DEFAULT, |
---|
237 | HSIS_EQUAL, latch_name, SEP_LARRAY, idx, SEP_RARRAY); |
---|
238 | } |
---|
239 | if ((id_sym->flags & MVar) && set_notation) |
---|
240 | put_nblock_mout_transition(file, |
---|
241 | non_block_wire, n_entries, |
---|
242 | id_sym, lo, hi, lo, dc, |
---|
243 | latch_name); |
---|
244 | else |
---|
245 | put_nblock_transition(file, non_block_wire, n_entries, |
---|
246 | id_sym, lo, hi, lo, dc, ripple); |
---|
247 | } |
---|
248 | } |
---|
249 | |
---|
250 | |
---|
251 | void put_nblock_vector_table(FILE *file, |
---|
252 | char *dc, |
---|
253 | vl_id_range *id_sym, |
---|
254 | int non_block_wire, |
---|
255 | char *latch_name, |
---|
256 | vl_term *out_term, |
---|
257 | int n_entries, |
---|
258 | int lo, int hi, |
---|
259 | lsList *ripple, |
---|
260 | vl_term *procedural_ctrl, |
---|
261 | vl_term *procedural_term) |
---|
262 | { |
---|
263 | int ith_var; |
---|
264 | vl_term *ctrl_term; |
---|
265 | lsGen lgen; |
---|
266 | lsHandle handle; |
---|
267 | syndrome_expr *se; |
---|
268 | lsGen rgen; |
---|
269 | lsHandle rhandle; |
---|
270 | int l; |
---|
271 | char *equ; |
---|
272 | lsList old_ripple; |
---|
273 | int table_width; |
---|
274 | |
---|
275 | if (set_notation) { |
---|
276 | |
---|
277 | table_width = |
---|
278 | lsLength((!rst_ckt)?ctrl_list:rst_ctrl_list) + |
---|
279 | lsLength((!rst_ckt)?id_sym->syndrome_expr_list: |
---|
280 | id_sym->rst_syndrome_expr_list); |
---|
281 | if (table_width < decomposeTable) { |
---|
282 | |
---|
283 | |
---|
284 | if (vlTimedSystem && !rst_ckt) { |
---|
285 | fprintf(file, ".names %s ", FG_LC_PS); |
---|
286 | } else |
---|
287 | fprintf(file, ".names "); |
---|
288 | for (lgen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list), |
---|
289 | ith_var=0; |
---|
290 | lsNext(lgen,(lsGeneric*)&ctrl_term,&handle)!=LS_NOMORE; |
---|
291 | ith_var++) { |
---|
292 | if (!dc[ith_var]) |
---|
293 | fprintf(file, "%s ", ctrl_term->name->name); |
---|
294 | } |
---|
295 | (void)lsFinish(lgen); |
---|
296 | |
---|
297 | for (l=lo; l<=hi; l++) { |
---|
298 | for (lgen=lsStart((!rst_ckt)? |
---|
299 | id_sym->syndrome_expr_list: |
---|
300 | id_sym->rst_syndrome_expr_list); |
---|
301 | lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) { |
---|
302 | fprintf(file, "%s%s%d%s ", |
---|
303 | se->expr->name->name, |
---|
304 | SEP_LBITSELECT, l, SEP_RBITSELECT); |
---|
305 | } |
---|
306 | (void)lsFinish(lgen); |
---|
307 | } |
---|
308 | |
---|
309 | for (l=lo; l<=hi; l++) { |
---|
310 | if (!non_block_wire && !rst_ckt) |
---|
311 | fprintf(file, "%s%s%d%s ", |
---|
312 | latch_name, |
---|
313 | SEP_LBITSELECT, l, SEP_RBITSELECT); |
---|
314 | } |
---|
315 | fprintf(file, "%s ", HSIS_ARROW); |
---|
316 | for (l=lo; l<=hi; l++) { |
---|
317 | fprintf(file, "%s%s%d%s ", |
---|
318 | out_term->name->name, |
---|
319 | SEP_LBITSELECT, l, SEP_RBITSELECT); |
---|
320 | } |
---|
321 | fprintf(file, "\n"); |
---|
322 | |
---|
323 | |
---|
324 | if (set_notation && !(deadlock_semantic && non_block_wire)) { |
---|
325 | if (non_block_wire || rst_ckt) { |
---|
326 | fprintf(file, "%s ", HSIS_DEFAULT); |
---|
327 | for (l=lo; l<=hi; l++) fprintf(file, "- "); |
---|
328 | fprintf(file, "\n"); |
---|
329 | } else { |
---|
330 | fprintf(file, "%s ", HSIS_DEFAULT); |
---|
331 | for (l=lo; l<=hi;l++) |
---|
332 | fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL, latch_name, |
---|
333 | SEP_LBITSELECT, l, SEP_RBITSELECT); |
---|
334 | fprintf(file, "\n"); |
---|
335 | } |
---|
336 | } |
---|
337 | put_nblock_mout_transition(file, non_block_wire, n_entries, |
---|
338 | id_sym, lo, hi, l, dc, latch_name); |
---|
339 | } else { |
---|
340 | |
---|
341 | vl_term *ripple_ctrl, *ripple_set, *ectrl; |
---|
342 | vl_term *new_set; |
---|
343 | lsList syndromeExprList, worklist, local_accumulator; |
---|
344 | syndrome_expr *se_next; |
---|
345 | int duplicate_item; |
---|
346 | |
---|
347 | ripple_ctrl = NIL(vl_term); |
---|
348 | ripple_set = NIL(vl_term); |
---|
349 | syndromeExprList = (!rst_ckt)? |
---|
350 | id_sym->syndrome_expr_list: |
---|
351 | id_sym->rst_syndrome_expr_list; |
---|
352 | worklist = lsCopy(syndromeExprList, 0); |
---|
353 | |
---|
354 | for (lgen=lsStart(worklist); |
---|
355 | lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) { |
---|
356 | ectrl = write_entry_control(file, |
---|
357 | (!rst_ckt)?ctrl_list:rst_ctrl_list, |
---|
358 | se->syndrome, se->pre_cond, |
---|
359 | se->fg_id); |
---|
360 | |
---|
361 | local_accumulator = lsCreate(); |
---|
362 | lsNewEnd(local_accumulator, (lsGeneric)se, 0); |
---|
363 | if (lsLength(worklist) > 1) { |
---|
364 | duplicate_item = 1; |
---|
365 | while (lsNext(lgen, (lsGeneric*)&se_next, &handle)!= |
---|
366 | LS_NOMORE |
---|
367 | && duplicate_item) { |
---|
368 | if (strcmp(se->syndrome, se_next->syndrome)) { |
---|
369 | duplicate_item = 0; |
---|
370 | lsPrev(lgen, (lsGeneric*)&se_next, &handle); |
---|
371 | lsPrev(lgen, (lsGeneric*)&se_next, &handle); |
---|
372 | } else { |
---|
373 | lsNewEnd(local_accumulator, (lsGeneric)se_next, 0); |
---|
374 | } |
---|
375 | } |
---|
376 | } |
---|
377 | new_set = write_nond_set(file, id_sym, local_accumulator); |
---|
378 | ripple_ctrl = write_set_accumulate(file, id_sym, |
---|
379 | ectrl, ripple_ctrl, |
---|
380 | new_set, &ripple_set); |
---|
381 | |
---|
382 | lsDestroy(local_accumulator, 0); |
---|
383 | |
---|
384 | } |
---|
385 | |
---|
386 | write_nblock_set_connect(file, id_sym, latch_name, |
---|
387 | ripple_ctrl, ripple_set, |
---|
388 | procedural_ctrl, procedural_term, |
---|
389 | out_term); |
---|
390 | lsFinish(lgen); |
---|
391 | lsDestroy(worklist, 0); |
---|
392 | } |
---|
393 | } else { |
---|
394 | |
---|
395 | table_width = |
---|
396 | lsLength((!rst_ckt)?ctrl_list:rst_ctrl_list) + |
---|
397 | lsLength((!rst_ckt)?id_sym->syndrome_expr_list: |
---|
398 | id_sym->rst_syndrome_expr_list); |
---|
399 | if (table_width < decomposeTable) { |
---|
400 | for (l=lo; l<=hi; l++) { |
---|
401 | |
---|
402 | |
---|
403 | fprintf(file, ".names "); |
---|
404 | for (lgen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list), |
---|
405 | ith_var=0; |
---|
406 | lsNext(lgen,(lsGeneric*)&ctrl_term,&handle)!= |
---|
407 | LS_NOMORE; |
---|
408 | ith_var++) { |
---|
409 | if (!dc[ith_var]) |
---|
410 | fprintf(file, "%s ", ctrl_term->name->name); |
---|
411 | } |
---|
412 | (void)lsFinish(lgen); |
---|
413 | |
---|
414 | if (*ripple) { |
---|
415 | for (rgen=lsStart(*ripple); |
---|
416 | lsNext(rgen,(lsGeneric*)&equ,&rhandle)!= |
---|
417 | LS_NOMORE;) { |
---|
418 | fprintf(file, "%s ", equ); |
---|
419 | } |
---|
420 | lsFinish(rgen); |
---|
421 | } |
---|
422 | |
---|
423 | for (lgen=lsStart((!rst_ckt)? |
---|
424 | id_sym->syndrome_expr_list: |
---|
425 | id_sym->rst_syndrome_expr_list); |
---|
426 | lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) { |
---|
427 | fprintf(file, "%s%s%d%s ", |
---|
428 | se->expr->name->name, |
---|
429 | SEP_LBITSELECT, l, SEP_RBITSELECT); |
---|
430 | } |
---|
431 | (void)lsFinish(lgen); |
---|
432 | if (!non_block_wire && !rst_ckt) |
---|
433 | fprintf(file, "%s%s%d%s ", |
---|
434 | latch_name, |
---|
435 | SEP_LBITSELECT, l, SEP_RBITSELECT); |
---|
436 | fprintf(file, "%s%s%d%s\n", |
---|
437 | out_term->name->name, |
---|
438 | SEP_LBITSELECT, l, SEP_RBITSELECT); |
---|
439 | |
---|
440 | |
---|
441 | if (set_notation && !(deadlock_semantic && non_block_wire)) { |
---|
442 | if (non_block_wire || rst_ckt) |
---|
443 | fprintf(file, "%s -\n", HSIS_DEFAULT); |
---|
444 | else |
---|
445 | fprintf(file, "%s %s%s%s%d%s\n", HSIS_DEFAULT, |
---|
446 | HSIS_EQUAL, latch_name, |
---|
447 | SEP_LBITSELECT, l, SEP_RBITSELECT); |
---|
448 | } |
---|
449 | put_nblock_transition(file, non_block_wire, n_entries, |
---|
450 | id_sym, lo, hi, l, dc, *ripple); |
---|
451 | |
---|
452 | |
---|
453 | old_ripple = *ripple; |
---|
454 | if (l<hi) { |
---|
455 | *ripple = lsCreate(); |
---|
456 | for (lgen=lsStart((!rst_ckt)? |
---|
457 | id_sym->syndrome_expr_list: |
---|
458 | id_sym->rst_syndrome_expr_list), |
---|
459 | rgen = (old_ripple)?lsStart(old_ripple):(lsGen)0; |
---|
460 | lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;){ |
---|
461 | char focus_out[MAXSTRLEN], focus_tmp[MAXSTRLEN]; |
---|
462 | char tmp[MAXSTRLEN], intermediate[MAXSTRLEN]; |
---|
463 | |
---|
464 | sprintf(focus_out, "%s%s%d%s", |
---|
465 | se->expr->name->name, |
---|
466 | SEP_LBITSELECT, l, SEP_RBITSELECT); |
---|
467 | sprintf(focus_tmp, "%s%s%d%s", |
---|
468 | out_term->name->name, |
---|
469 | SEP_LBITSELECT, l, SEP_RBITSELECT); |
---|
470 | sprintf(tmp, "%s", new_termname()); |
---|
471 | vl_write_bop(file, BxnorExpr, |
---|
472 | focus_out, focus_tmp, NIL(char), |
---|
473 | tmp, 1); |
---|
474 | if (rgen) { |
---|
475 | lsNext(rgen,(lsGeneric*)&equ,&rhandle); |
---|
476 | sprintf(intermediate, "%s", new_termname()); |
---|
477 | vl_write_bop(file, BandExpr, |
---|
478 | tmp, equ, NIL(char), |
---|
479 | intermediate, 1); |
---|
480 | } else { |
---|
481 | sprintf(intermediate, "%s", tmp); |
---|
482 | } |
---|
483 | lsNewEnd(*ripple,(lsGeneric)vlStrdup(intermediate),0); |
---|
484 | } |
---|
485 | lsFinish(lgen); |
---|
486 | } |
---|
487 | |
---|
488 | |
---|
489 | if (old_ripple) { |
---|
490 | lsGen rgen; |
---|
491 | lsHandle rhandle; |
---|
492 | |
---|
493 | for (rgen=lsStart(old_ripple); |
---|
494 | lsNext(rgen,(lsGeneric*)&equ,&rhandle)!= |
---|
495 | LS_NOMORE;) |
---|
496 | free(equ); |
---|
497 | lsFinish(rgen); |
---|
498 | lsDestroy(old_ripple,0); |
---|
499 | } |
---|
500 | } |
---|
501 | } else { |
---|
502 | |
---|
503 | vl_term *ripple_ctrl, *ripple_set, *ectrl; |
---|
504 | vl_term *new_set; |
---|
505 | lsList syndromeExprList, worklist, local_accumulator; |
---|
506 | syndrome_expr *se_next; |
---|
507 | int duplicate_item; |
---|
508 | |
---|
509 | ripple_ctrl = NIL(vl_term); |
---|
510 | ripple_set = NIL(vl_term); |
---|
511 | syndromeExprList = (!rst_ckt)? |
---|
512 | id_sym->syndrome_expr_list: |
---|
513 | id_sym->rst_syndrome_expr_list; |
---|
514 | worklist = lsCopy(syndromeExprList, 0); |
---|
515 | |
---|
516 | for (lgen=lsStart(worklist); |
---|
517 | lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) { |
---|
518 | ectrl = write_entry_control(file, |
---|
519 | (!rst_ckt)?ctrl_list:rst_ctrl_list, |
---|
520 | se->syndrome, se->pre_cond, |
---|
521 | se->fg_id); |
---|
522 | |
---|
523 | local_accumulator = lsCreate(); |
---|
524 | lsNewEnd(local_accumulator, (lsGeneric)se, 0); |
---|
525 | if (lsLength(worklist) > 1) { |
---|
526 | duplicate_item = 1; |
---|
527 | while (lsNext(lgen, (lsGeneric*)&se_next, &handle)!= |
---|
528 | LS_NOMORE |
---|
529 | && duplicate_item) { |
---|
530 | if (strcmp(se->syndrome, se_next->syndrome)) { |
---|
531 | duplicate_item = 0; |
---|
532 | lsPrev(lgen, (lsGeneric*)&se_next, &handle); |
---|
533 | lsPrev(lgen, (lsGeneric*)&se_next, &handle); |
---|
534 | } else { |
---|
535 | lsNewEnd(local_accumulator, (lsGeneric)se_next, 0); |
---|
536 | } |
---|
537 | } |
---|
538 | } |
---|
539 | new_set = write_nond_set(file, id_sym, local_accumulator); |
---|
540 | ripple_ctrl = write_set_accumulate(file, id_sym, |
---|
541 | ectrl, ripple_ctrl, |
---|
542 | new_set, &ripple_set); |
---|
543 | |
---|
544 | lsDestroy(local_accumulator, 0); |
---|
545 | |
---|
546 | } |
---|
547 | |
---|
548 | write_nblock_set_connect(file, id_sym, latch_name, |
---|
549 | ripple_ctrl, ripple_set, |
---|
550 | procedural_ctrl, procedural_term, |
---|
551 | out_term); |
---|
552 | lsFinish(lgen); |
---|
553 | lsDestroy(worklist, 0); |
---|
554 | } |
---|
555 | } |
---|
556 | } |
---|
557 | |
---|
558 | |
---|
559 | |
---|
560 | void decompose_nblock_transition(file, non_block_wire, n_entries, |
---|
561 | id_sym, idx_lo, idx_hi, cur, dc, ripple) |
---|
562 | FILE *file; |
---|
563 | int non_block_wire; |
---|
564 | int n_entries; |
---|
565 | vl_id_range *id_sym; |
---|
566 | int idx_lo, idx_hi, cur; |
---|
567 | char *dc; |
---|
568 | lsList ripple; |
---|
569 | { |
---|
570 | lsGen lgen; |
---|
571 | lsList comp; |
---|
572 | lsHandle handle; |
---|
573 | int lo, hi; |
---|
574 | int i, j, k; |
---|
575 | char *syndrome; |
---|
576 | syndrome_expr *se; |
---|
577 | lsList domain=(lsList)0; |
---|
578 | lsGen enum_gen; |
---|
579 | lsHandle enum_handle; |
---|
580 | vl_enumerator *enum_elt; |
---|
581 | |
---|
582 | for (lgen=lsStart((!rst_ckt)? |
---|
583 | id_sym->syndrome_expr_list: |
---|
584 | id_sym->rst_syndrome_expr_list), |
---|
585 | i=0; |
---|
586 | lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE; i++) { |
---|
587 | if (!(id_sym->flags & MVar)) { |
---|
588 | lo=0; hi=1; |
---|
589 | } else { |
---|
590 | get_hilo(id_sym, &hi, &lo); |
---|
591 | } |
---|
592 | |
---|
593 | if (id_sym->id_type) |
---|
594 | domain = id_sym->id_type->specifier->u.enum_type->domain_list; |
---|
595 | |
---|
596 | if (!(id_sym->flags & MVar)) { |
---|
597 | |
---|
598 | for (k=lo; k<=hi; k++) { |
---|
599 | put_entry(file, se->syndrome, dc, 1); |
---|
600 | |
---|
601 | if (ripple) { |
---|
602 | for (j=0; j<i; j++) fprintf(file, "- "); |
---|
603 | fprintf(file, "%d ", 1); j++; |
---|
604 | for (; j<n_entries; j++) fprintf(file, "- "); |
---|
605 | } |
---|
606 | |
---|
607 | for (j=0; j<i; j++) fprintf(file, "- "); |
---|
608 | fprintf(file, "%d ", k); j++; |
---|
609 | for (; j<n_entries; j++) fprintf(file, "- "); |
---|
610 | fprintf(file, "%s%d\n", (non_block_wire||rst_ckt)?"":"- ", k); |
---|
611 | } |
---|
612 | } else { |
---|
613 | for (enum_gen=lsStart(domain); |
---|
614 | lsNext(enum_gen, |
---|
615 | (lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) { |
---|
616 | put_entry(file, se->syndrome, dc, 1); |
---|
617 | |
---|
618 | if (ripple) { |
---|
619 | for (j=0; j<i; j++) fprintf(file, "- "); |
---|
620 | fprintf(file, "%d ", 1); j++; |
---|
621 | for (; j<n_entries; j++) fprintf(file, "- "); |
---|
622 | } |
---|
623 | |
---|
624 | for (j=0; j<i; j++) fprintf(file, "- "); |
---|
625 | fprintf(file, "%s ", enum_elt->name); j++; |
---|
626 | for (; j<n_entries; j++) fprintf(file, "- "); |
---|
627 | fprintf(file, "%s%s\n", |
---|
628 | (non_block_wire||rst_ckt)?"":"- ", enum_elt->name); |
---|
629 | } |
---|
630 | lsFinish(enum_gen); |
---|
631 | } |
---|
632 | } |
---|
633 | lsFinish(lgen); |
---|
634 | |
---|
635 | |
---|
636 | if (!set_notation && !(deadlock_semantic && non_block_wire)) { |
---|
637 | comp = put_guard_zero(file, (!rst_ckt)?id_sym->syndrome_expr_list: |
---|
638 | id_sym->rst_syndrome_expr_list); |
---|
639 | if (!(id_sym->flags & MVar)) { |
---|
640 | for (lgen=lsStart(comp); |
---|
641 | lsNext(lgen,&syndrome,&handle)!=LS_NOMORE;) { |
---|
642 | if (!(id_sym->flags & MVar)) { |
---|
643 | lo=0; hi=1; |
---|
644 | } |
---|
645 | for (k=lo; k<=hi; k++) { |
---|
646 | put_entry(file, syndrome, dc, 1); |
---|
647 | for (j=0; j<n_entries*((ripple)?2:1); j++) |
---|
648 | fprintf(file, "- "); |
---|
649 | if (non_block_wire || rst_ckt) |
---|
650 | fprintf(file, "%d\n", k); |
---|
651 | else |
---|
652 | fprintf(file, "%d %d\n", k, k); |
---|
653 | } |
---|
654 | } |
---|
655 | lsFinish(lgen); |
---|
656 | } else { |
---|
657 | for (lgen=lsStart(comp); |
---|
658 | lsNext(lgen,&syndrome,&handle)!=LS_NOMORE;) { |
---|
659 | if (!(id_sym->flags & MVar)) { |
---|
660 | lo=0; hi=1; |
---|
661 | } |
---|
662 | for (enum_gen=lsStart(domain); |
---|
663 | lsNext(enum_gen, |
---|
664 | (lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) { |
---|
665 | put_entry(file, syndrome, dc, 1); |
---|
666 | for (j=0; j<n_entries*((ripple)?2:1); j++) |
---|
667 | fprintf(file, "- "); |
---|
668 | if (non_block_wire || rst_ckt) |
---|
669 | fprintf(file, "%s\n", enum_elt->name); |
---|
670 | else |
---|
671 | fprintf(file, "%s %s\n", |
---|
672 | enum_elt->name, enum_elt->name); |
---|
673 | } |
---|
674 | lsFinish(enum_gen); |
---|
675 | } |
---|
676 | lsFinish(lgen); |
---|
677 | } |
---|
678 | } |
---|
679 | |
---|
680 | idx_lo = idx_lo; |
---|
681 | idx_hi = idx_hi; |
---|
682 | cur = cur; |
---|
683 | } |
---|
684 | |
---|
685 | |
---|
686 | void decompose_nblock_mout_transition(file, non_block_wire, n_entries, id_sym, |
---|
687 | idx_lo, idx_hi, cur, dc, latch_name) |
---|
688 | FILE *file; |
---|
689 | int non_block_wire; |
---|
690 | int n_entries; |
---|
691 | vl_id_range *id_sym; |
---|
692 | int idx_lo, idx_hi, cur; |
---|
693 | char *dc; |
---|
694 | char *latch_name; |
---|
695 | { |
---|
696 | lsGen lgen; |
---|
697 | lsList comp; |
---|
698 | lsHandle handle; |
---|
699 | int lo, hi; |
---|
700 | int i, j, k; |
---|
701 | char *syndrome; |
---|
702 | syndrome_expr *se; |
---|
703 | |
---|
704 | for (lgen=lsStart((!rst_ckt)? |
---|
705 | id_sym->syndrome_expr_list: |
---|
706 | id_sym->rst_syndrome_expr_list), |
---|
707 | i=0; |
---|
708 | lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE; i++) { |
---|
709 | if (!(id_sym->flags & MVar)) { |
---|
710 | lo=0; hi=1; |
---|
711 | } else { |
---|
712 | get_hilo(id_sym, &hi, &lo); |
---|
713 | } |
---|
714 | |
---|
715 | put_entry(file, se->syndrome, dc, 1); |
---|
716 | |
---|
717 | for (j=0; j<n_entries; j++) |
---|
718 | if (idx_lo == 0 && idx_hi == -1) |
---|
719 | fprintf(file, "- "); |
---|
720 | else |
---|
721 | for (k=idx_lo; k<=idx_hi; k++) fprintf(file, "- "); |
---|
722 | if (!(non_block_wire||rst_ckt)) { |
---|
723 | if (idx_lo == 0 && idx_hi == -1) |
---|
724 | fprintf(file, "- "); |
---|
725 | else |
---|
726 | for (k=idx_lo; k<=idx_hi; k++) |
---|
727 | fprintf(file, "- "); |
---|
728 | } |
---|
729 | if (id_sym->flags & MVar || (idx_lo==0 && idx_hi==-1)) { |
---|
730 | fprintf(file, "%s%s\n", HSIS_EQUAL, se->expr->name->name); |
---|
731 | } else { |
---|
732 | for (k=idx_lo; k<=idx_hi; k++) { |
---|
733 | fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL, |
---|
734 | se->expr->name->name, |
---|
735 | SEP_LBITSELECT, k, SEP_RBITSELECT); |
---|
736 | } |
---|
737 | fprintf(file, "\n"); |
---|
738 | } |
---|
739 | } |
---|
740 | lsFinish(lgen); |
---|
741 | |
---|
742 | |
---|
743 | if (!set_notation && !(deadlock_semantic && non_block_wire)) { |
---|
744 | comp = put_guard_zero(file, (!rst_ckt)?id_sym->syndrome_expr_list: |
---|
745 | id_sym->rst_syndrome_expr_list); |
---|
746 | for (lgen=lsStart(comp); |
---|
747 | lsNext(lgen,&syndrome,&handle)!=LS_NOMORE;) { |
---|
748 | |
---|
749 | put_entry(file, syndrome, dc, 1); |
---|
750 | for (j=0; j<n_entries; j++) |
---|
751 | if (idx_lo == 0 && idx_hi == -1) |
---|
752 | fprintf(file, "- "); |
---|
753 | else |
---|
754 | for (k=idx_lo; k<=idx_hi; k++) fprintf(file, "- "); |
---|
755 | if (!(non_block_wire || rst_ckt)) { |
---|
756 | if (idx_lo == 0 && idx_hi == -1) |
---|
757 | fprintf(file, "- "); |
---|
758 | else |
---|
759 | for (k=idx_lo; k<=idx_hi; k++) |
---|
760 | fprintf(file, "- "); |
---|
761 | } |
---|
762 | if (id_sym->flags & MVar || (idx_lo==0 && idx_hi==-1)) { |
---|
763 | if (!(non_block_wire || rst_ckt)) |
---|
764 | fprintf(file, "%s%s\n", HSIS_EQUAL, latch_name); |
---|
765 | else |
---|
766 | fprintf(file, "-\n"); |
---|
767 | } else { |
---|
768 | if (!(non_block_wire || rst_ckt)) |
---|
769 | for (k=idx_lo; k<=idx_hi; k++) { |
---|
770 | fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL, |
---|
771 | latch_name, SEP_LBITSELECT, k, SEP_RBITSELECT); |
---|
772 | } |
---|
773 | else |
---|
774 | fprintf(file,"-"); |
---|
775 | fprintf(file, "\n"); |
---|
776 | } |
---|
777 | } |
---|
778 | |
---|
779 | lsFinish(lgen); |
---|
780 | } |
---|
781 | |
---|
782 | |
---|
783 | cur = cur; |
---|
784 | } |
---|
785 | |
---|
786 | |
---|
787 | vl_term *write_entry_control(file, ctrl_list, syndrome, pre_cond, fg_id) |
---|
788 | FILE *file; |
---|
789 | lsList ctrl_list; |
---|
790 | char *syndrome; |
---|
791 | st_table *pre_cond; |
---|
792 | int fg_id; |
---|
793 | { |
---|
794 | lsGen gen; |
---|
795 | lsHandle handle; |
---|
796 | vl_term *ctrl_i; |
---|
797 | vl_term *retval; |
---|
798 | unsigned int i; |
---|
799 | int care_length, j, k; |
---|
800 | |
---|
801 | retval = new_term(NIL(vl_range), 0, -1); |
---|
802 | |
---|
803 | if (vlTimedSystem && !rst_ckt) |
---|
804 | fprintf(file, ".names %s%06x ", FG_LC_PS, fg_id); |
---|
805 | else |
---|
806 | fprintf(file, ".names "); |
---|
807 | care_length = 0; |
---|
808 | for (gen=lsStart(ctrl_list), i=0; |
---|
809 | lsNext(gen,(lsGeneric*)&ctrl_i,&handle)!=LS_NOMORE; |
---|
810 | i++) { |
---|
811 | if (syndrome[i] != '-') { |
---|
812 | fprintf(file, "%s ", ctrl_i->name->name); |
---|
813 | care_length++; |
---|
814 | } |
---|
815 | } |
---|
816 | lsFinish(gen); |
---|
817 | fprintf(file, "%s\n", retval->name->name); |
---|
818 | |
---|
819 | if (set_notation) { |
---|
820 | fprintf(file, "%s 0\n", HSIS_DEFAULT); |
---|
821 | if (vlTimedSystem && !rst_ckt) |
---|
822 | fg_put_loc_context(file, pre_cond, NIL(char)); |
---|
823 | fprintf(file, " "); |
---|
824 | for (i=0; i<strlen(syndrome); i++) { |
---|
825 | if (syndrome[i] != '-') { |
---|
826 | fprintf(file, "%c ", syndrome[i]); |
---|
827 | } |
---|
828 | } |
---|
829 | fprintf(file, "1\n"); |
---|
830 | } else { |
---|
831 | for (i=0, k=0; i<strlen(syndrome); i++) { |
---|
832 | if (syndrome[i] != '-') { |
---|
833 | for (j=0; j<care_length; j++) { |
---|
834 | if (k==j) { |
---|
835 | fprintf(file, "%c ", (syndrome[i]=='1')?'0':'1'); |
---|
836 | } else { |
---|
837 | fprintf(file, "- "); |
---|
838 | } |
---|
839 | } |
---|
840 | k++; |
---|
841 | fprintf(file, "0\n"); |
---|
842 | } |
---|
843 | } |
---|
844 | |
---|
845 | for (i=0; i<strlen(syndrome); i++) { |
---|
846 | if (syndrome[i] != '-') { |
---|
847 | fprintf(file, "%c ", syndrome[i]); |
---|
848 | } |
---|
849 | } |
---|
850 | fprintf(file, "1\n"); |
---|
851 | } |
---|
852 | |
---|
853 | return retval; |
---|
854 | } |
---|
855 | |
---|
856 | |
---|
857 | vl_term *write_nond_set(file, id_sym, list_syndrome) |
---|
858 | FILE *file; |
---|
859 | vl_id_range *id_sym; |
---|
860 | lsList list_syndrome; |
---|
861 | { |
---|
862 | syndrome_expr *se; |
---|
863 | lsGen gen; |
---|
864 | lsHandle handle; |
---|
865 | vl_term *retval; |
---|
866 | int hi, lo; |
---|
867 | int i, j, k; |
---|
868 | int bit_idx; |
---|
869 | lsGen ctrl_gen; |
---|
870 | lsHandle ctrl_handle; |
---|
871 | lsList ripple=(lsList)0, old_ripple=(lsList)0; |
---|
872 | lsGen old_gen; |
---|
873 | lsHandle old_handle; |
---|
874 | char *equ; |
---|
875 | |
---|
876 | get_hilo(id_sym, &hi, &lo); |
---|
877 | retval = typed_new_term(id_sym->id_type, id_sym->range, lo, hi); |
---|
878 | retval->flag |= (id_sym->flags & MVar)?MVar:0; |
---|
879 | retval->name->unintType = id_sym->unintType; |
---|
880 | write_var_decl(file, retval); |
---|
881 | |
---|
882 | if (id_sym->flags & MVar) { |
---|
883 | fprintf(file, ".names "); |
---|
884 | for (gen=lsStart(list_syndrome); |
---|
885 | lsNext(gen, (lsGeneric*)&se, &handle) != LS_NOMORE; ) { |
---|
886 | fprintf(file, "%s ", se->expr->name->name); |
---|
887 | } |
---|
888 | lsFinish(gen); |
---|
889 | fprintf(file, "%s\n", retval->name->name); |
---|
890 | |
---|
891 | if (set_notation) { |
---|
892 | for (gen=lsStart(list_syndrome); |
---|
893 | lsNext(gen, (lsGeneric*)&se, &handle) != LS_NOMORE; ) { |
---|
894 | for (i=0; i<lsLength(list_syndrome); i++) { |
---|
895 | fprintf(file, "- "); |
---|
896 | } |
---|
897 | fprintf(file, "%s%s\n", HSIS_EQUAL, se->expr->name->name); |
---|
898 | } |
---|
899 | } else { |
---|
900 | lsList domain; |
---|
901 | lsGen enum_gen; |
---|
902 | lsHandle enum_handle; |
---|
903 | vl_enumerator *enum_elt; |
---|
904 | domain = id_sym->id_type->specifier->u.enum_type->domain_list; |
---|
905 | for (gen=lsStart(list_syndrome), i=0; |
---|
906 | lsNext(gen, (lsGeneric*)&se, &handle) != LS_NOMORE; i++) { |
---|
907 | for (enum_gen=lsStart(domain); |
---|
908 | lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!= |
---|
909 | LS_NOMORE;) { |
---|
910 | for (k=0; k<lsLength(list_syndrome); k++) { |
---|
911 | if (i==k) |
---|
912 | fprintf(file, "%s ", enum_elt->name); |
---|
913 | else |
---|
914 | fprintf(file, "- "); |
---|
915 | } |
---|
916 | fprintf(file, "%s\n", enum_elt->name); |
---|
917 | } |
---|
918 | lsFinish(enum_gen); |
---|
919 | } |
---|
920 | lsFinish(gen); |
---|
921 | } |
---|
922 | } else { |
---|
923 | if (lo > hi) { |
---|
924 | |
---|
925 | fprintf(file, ".names "); |
---|
926 | for (gen=lsStart(list_syndrome); |
---|
927 | lsNext(gen, (lsGeneric*)&se, &handle) != LS_NOMORE; ) { |
---|
928 | fprintf(file, "%s ", se->expr->name->name); |
---|
929 | } |
---|
930 | lsFinish(gen); |
---|
931 | fprintf(file, "%s\n", retval->name->name); |
---|
932 | |
---|
933 | if (set_notation) { |
---|
934 | for (gen=lsStart(list_syndrome); |
---|
935 | lsNext(gen, (lsGeneric*)&se, &handle) != |
---|
936 | LS_NOMORE; ) { |
---|
937 | for (i=0; i<lsLength(list_syndrome); i++) { |
---|
938 | fprintf(file, "- "); |
---|
939 | } |
---|
940 | fprintf(file, "%s%s\n", |
---|
941 | HSIS_EQUAL, se->expr->name->name); |
---|
942 | } |
---|
943 | } else { |
---|
944 | for (gen=lsStart(list_syndrome), i=0; |
---|
945 | lsNext(gen, (lsGeneric*)&se, &handle) != |
---|
946 | LS_NOMORE; i++) { |
---|
947 | for (j=0; j<=1; j++) { |
---|
948 | for (k=0; k<lsLength(list_syndrome); k++) { |
---|
949 | if (i==k) |
---|
950 | fprintf(file, "%d ", j); |
---|
951 | else |
---|
952 | fprintf(file, "- "); |
---|
953 | } |
---|
954 | fprintf(file, "%d\n", j); |
---|
955 | } |
---|
956 | } |
---|
957 | lsFinish(gen); |
---|
958 | } |
---|
959 | } else { |
---|
960 | |
---|
961 | if (set_notation) { |
---|
962 | |
---|
963 | fprintf(file, ".names "); |
---|
964 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
965 | for (gen=lsStart(list_syndrome); |
---|
966 | lsNext(gen, (lsGeneric*)&se, &handle) != |
---|
967 | LS_NOMORE;) { |
---|
968 | fprintf(file, "%s%s%d%s ", se->expr->name->name, |
---|
969 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
970 | |
---|
971 | |
---|
972 | } |
---|
973 | lsFinish(gen); |
---|
974 | } |
---|
975 | fprintf(file, "%s ", HSIS_ARROW); |
---|
976 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
977 | fprintf(file, "%s%s%d%s ", retval->name->name, |
---|
978 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
979 | } |
---|
980 | fprintf(file, "\n"); |
---|
981 | |
---|
982 | |
---|
983 | for (gen=lsStart(list_syndrome); |
---|
984 | lsNext(gen, (lsGeneric*)&se, &handle)!=LS_NOMORE; ) { |
---|
985 | for (i=0; i<lsLength(list_syndrome); i++) { |
---|
986 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
987 | fprintf(file, "- "); |
---|
988 | } |
---|
989 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
990 | fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL, |
---|
991 | se->expr->name->name, |
---|
992 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
993 | fprintf(file, "\n"); |
---|
994 | } |
---|
995 | } else { |
---|
996 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
997 | if (bit_idx==lo) { |
---|
998 | fprintf(file, ".names "); |
---|
999 | for (gen=lsStart(list_syndrome); |
---|
1000 | lsNext(gen, (lsGeneric*)&se, &handle) != |
---|
1001 | LS_NOMORE;) { |
---|
1002 | fprintf(file, "%s%s%d%s ", |
---|
1003 | se->expr->name->name, |
---|
1004 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1005 | } |
---|
1006 | lsFinish(gen); |
---|
1007 | fprintf(file, "%s%s%d%s\n", retval->name->name, |
---|
1008 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1009 | |
---|
1010 | for (gen=lsStart(list_syndrome), i=0; |
---|
1011 | lsNext(gen,(lsGeneric*)&se,&handle) != |
---|
1012 | LS_NOMORE; |
---|
1013 | i++) { |
---|
1014 | for (j=0; j<=1; j++) { |
---|
1015 | for (k=0; k<lsLength(list_syndrome); k++) { |
---|
1016 | if (i==k) |
---|
1017 | fprintf(file, "%d ", j); |
---|
1018 | else |
---|
1019 | fprintf(file, "- "); |
---|
1020 | } |
---|
1021 | fprintf(file, "%d\n", j); |
---|
1022 | } |
---|
1023 | } |
---|
1024 | lsFinish(gen); |
---|
1025 | } else { |
---|
1026 | fprintf(file, ".names "); |
---|
1027 | for (gen=lsStart(list_syndrome), |
---|
1028 | ctrl_gen=lsStart(ripple); |
---|
1029 | lsNext(gen, (lsGeneric*)&se, &handle) != |
---|
1030 | LS_NOMORE;) { |
---|
1031 | lsNext(ctrl_gen,(lsGeneric*)&equ,&ctrl_handle); |
---|
1032 | fprintf(file, "%s %s%s%d%s ", equ, |
---|
1033 | se->expr->name->name, |
---|
1034 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1035 | } |
---|
1036 | lsFinish(gen); |
---|
1037 | fprintf(file, "%s%s%d%s\n", retval->name->name, |
---|
1038 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1039 | |
---|
1040 | for (gen=lsStart(list_syndrome), i=0; |
---|
1041 | lsNext(gen,(lsGeneric*)&se,&handle) != |
---|
1042 | LS_NOMORE; |
---|
1043 | i++) { |
---|
1044 | for (j=0; j<=1; j++) { |
---|
1045 | for (k=0; k<lsLength(list_syndrome); k++) { |
---|
1046 | if (i==k) |
---|
1047 | fprintf(file, "1 %d ", j); |
---|
1048 | else |
---|
1049 | fprintf(file, "- - "); |
---|
1050 | } |
---|
1051 | fprintf(file, "%d\n", j); |
---|
1052 | } |
---|
1053 | } |
---|
1054 | lsFinish(gen); |
---|
1055 | } |
---|
1056 | |
---|
1057 | old_ripple = ripple; |
---|
1058 | if (bit_idx < hi) { |
---|
1059 | ripple = lsCreate(); |
---|
1060 | for (gen=lsStart(list_syndrome), |
---|
1061 | old_gen=(old_ripple)? |
---|
1062 | lsStart(old_ripple):(lsGen)0; |
---|
1063 | lsNext(gen,(lsGeneric*)&se, &handle)!= |
---|
1064 | LS_NOMORE;){ |
---|
1065 | char focus_out[MAXSTRLEN],focus_tmp[MAXSTRLEN]; |
---|
1066 | char tmp[MAXSTRLEN], intermediate[MAXSTRLEN]; |
---|
1067 | sprintf(focus_out, "%s%s%d%s", |
---|
1068 | se->expr->name->name, |
---|
1069 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1070 | sprintf(focus_tmp, "%s%s%d%s", |
---|
1071 | retval->name->name, |
---|
1072 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1073 | sprintf(tmp, "%s", new_termname()); |
---|
1074 | vl_write_bop(file, BxnorExpr, |
---|
1075 | focus_out, focus_tmp, NIL(char), |
---|
1076 | tmp, 1); |
---|
1077 | if (old_gen) { |
---|
1078 | lsNext(old_gen,(lsGeneric*)&equ, |
---|
1079 | &old_handle); |
---|
1080 | sprintf(intermediate,"%s",new_termname()); |
---|
1081 | vl_write_bop(file, BandExpr, tmp, equ, |
---|
1082 | NIL(char), intermediate, 1); |
---|
1083 | } else { |
---|
1084 | sprintf(intermediate,"%s",tmp); |
---|
1085 | } |
---|
1086 | lsNewEnd(ripple, |
---|
1087 | (lsGeneric)vlStrdup(intermediate),0); |
---|
1088 | } |
---|
1089 | lsFinish(gen); |
---|
1090 | lsFinish(old_gen); |
---|
1091 | } |
---|
1092 | |
---|
1093 | if (old_ripple) { |
---|
1094 | for (gen=lsStart(old_ripple); |
---|
1095 | lsNext(gen,(lsGeneric*)&equ,&handle)!= |
---|
1096 | LS_NOMORE;) |
---|
1097 | free(equ); |
---|
1098 | lsFinish(gen); |
---|
1099 | lsDestroy(old_ripple,0); |
---|
1100 | } |
---|
1101 | } |
---|
1102 | } |
---|
1103 | } |
---|
1104 | } |
---|
1105 | |
---|
1106 | return retval; |
---|
1107 | } |
---|
1108 | |
---|
1109 | |
---|
1110 | vl_term *write_set_accumulate(file, id_sym, local_ctrl, ripple_ctrl, |
---|
1111 | local_set, ripple_set) |
---|
1112 | FILE *file; |
---|
1113 | vl_id_range *id_sym; |
---|
1114 | vl_term *local_ctrl; |
---|
1115 | vl_term *ripple_ctrl; |
---|
1116 | vl_term *local_set; |
---|
1117 | vl_term **ripple_set; |
---|
1118 | { |
---|
1119 | vl_term *retval, *ripple_out_set; |
---|
1120 | int lo, hi; |
---|
1121 | int bit_idx; |
---|
1122 | int i; |
---|
1123 | |
---|
1124 | get_hilo(id_sym, &hi, &lo); |
---|
1125 | retval = new_term(NIL(vl_range), 0, -1); |
---|
1126 | ripple_out_set = typed_new_term(id_sym->id_type, id_sym->range, lo, hi); |
---|
1127 | ripple_out_set->flag |= (id_sym->flags & MVar)?MVar:0; |
---|
1128 | ripple_out_set->name->unintType = id_sym->unintType; |
---|
1129 | write_var_decl(file, ripple_out_set); |
---|
1130 | |
---|
1131 | if (id_sym->flags & MVar) { |
---|
1132 | if (set_notation) { |
---|
1133 | if (ripple_ctrl) { |
---|
1134 | |
---|
1135 | |
---|
1136 | fprintf(file, ".names %s %s %s %s %s\n", |
---|
1137 | local_ctrl->name->name, ripple_ctrl->name->name, |
---|
1138 | local_set->name->name, (*ripple_set)->name->name, |
---|
1139 | ripple_out_set->name->name); |
---|
1140 | fprintf(file, ".def -\n"); |
---|
1141 | fprintf(file, "1 - - - %s%s\n", |
---|
1142 | HSIS_EQUAL,local_set->name->name); |
---|
1143 | fprintf(file, "- 1 - - %s%s\n", |
---|
1144 | HSIS_EQUAL, (*ripple_set)->name->name); |
---|
1145 | |
---|
1146 | |
---|
1147 | vl_write_bop(file, BorExpr, |
---|
1148 | local_ctrl->name->name, |
---|
1149 | ripple_ctrl->name->name, |
---|
1150 | NIL(char), retval->name->name, 1); |
---|
1151 | } else { |
---|
1152 | |
---|
1153 | |
---|
1154 | fprintf(file, ".names %s %s %s\n", |
---|
1155 | local_ctrl->name->name, local_set->name->name, |
---|
1156 | ripple_out_set->name->name); |
---|
1157 | fprintf(file, ".def -\n"); |
---|
1158 | fprintf(file, "1 - %s%s\n", |
---|
1159 | HSIS_EQUAL,local_set->name->name); |
---|
1160 | |
---|
1161 | |
---|
1162 | vl_write_bin_connect(file, local_ctrl, retval, 0); |
---|
1163 | } |
---|
1164 | } else { |
---|
1165 | lsList domain; |
---|
1166 | lsGen enum_gen; |
---|
1167 | lsHandle enum_handle; |
---|
1168 | vl_enumerator *enum_elt; |
---|
1169 | |
---|
1170 | domain = id_sym->id_type->specifier->u.enum_type->domain_list; |
---|
1171 | if (ripple_ctrl) { |
---|
1172 | |
---|
1173 | |
---|
1174 | fprintf(file, ".names %s %s %s %s %s\n", |
---|
1175 | local_ctrl->name->name, ripple_ctrl->name->name, |
---|
1176 | local_set->name->name, (*ripple_set)->name->name, |
---|
1177 | ripple_out_set->name->name); |
---|
1178 | for (enum_gen=lsStart(domain); |
---|
1179 | lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!= |
---|
1180 | LS_NOMORE;) |
---|
1181 | fprintf(file, "1 - %s - %s\n", |
---|
1182 | enum_elt->name, enum_elt->name); |
---|
1183 | lsFinish(enum_gen); |
---|
1184 | for (enum_gen=lsStart(domain); |
---|
1185 | lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!= |
---|
1186 | LS_NOMORE;) |
---|
1187 | fprintf(file, "- 1 - %s %s\n", |
---|
1188 | enum_elt->name, enum_elt->name); |
---|
1189 | lsFinish(enum_gen); |
---|
1190 | fprintf(file, "0 0 - - -\n"); |
---|
1191 | |
---|
1192 | |
---|
1193 | vl_write_bop(file, BorExpr, |
---|
1194 | local_ctrl->name->name, |
---|
1195 | ripple_ctrl->name->name, |
---|
1196 | NIL(char), retval->name->name, 1); |
---|
1197 | } else { |
---|
1198 | |
---|
1199 | |
---|
1200 | fprintf(file, ".names %s %s %s\n", |
---|
1201 | local_ctrl->name->name, local_set->name->name, |
---|
1202 | ripple_out_set->name->name); |
---|
1203 | for (enum_gen=lsStart(domain); |
---|
1204 | lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!= |
---|
1205 | LS_NOMORE;) |
---|
1206 | fprintf(file, "1 %s %s\n", |
---|
1207 | enum_elt->name, enum_elt->name); |
---|
1208 | lsFinish(enum_gen); |
---|
1209 | fprintf(file, "0 - -\n"); |
---|
1210 | |
---|
1211 | |
---|
1212 | vl_write_bin_connect(file, local_ctrl, retval, 0); |
---|
1213 | } |
---|
1214 | } |
---|
1215 | } else { |
---|
1216 | if (lo > hi) { |
---|
1217 | |
---|
1218 | if (set_notation) { |
---|
1219 | if (ripple_ctrl) { |
---|
1220 | |
---|
1221 | |
---|
1222 | fprintf(file, ".names %s %s %s %s %s\n", |
---|
1223 | local_ctrl->name->name, |
---|
1224 | ripple_ctrl->name->name, |
---|
1225 | local_set->name->name, |
---|
1226 | (*ripple_set)->name->name, |
---|
1227 | ripple_out_set->name->name); |
---|
1228 | fprintf(file, ".def -\n"); |
---|
1229 | fprintf(file, "1 - - - %s%s\n", |
---|
1230 | HSIS_EQUAL,local_set->name->name); |
---|
1231 | fprintf(file, "- 1 - - %s%s\n", |
---|
1232 | HSIS_EQUAL, (*ripple_set)->name->name); |
---|
1233 | |
---|
1234 | |
---|
1235 | vl_write_bop(file, BorExpr, |
---|
1236 | local_ctrl->name->name, |
---|
1237 | ripple_ctrl->name->name, |
---|
1238 | NIL(char), retval->name->name, 1); |
---|
1239 | } else { |
---|
1240 | |
---|
1241 | |
---|
1242 | fprintf(file, ".names %s %s %s\n", |
---|
1243 | local_ctrl->name->name, local_set->name->name, |
---|
1244 | ripple_out_set->name->name); |
---|
1245 | fprintf(file, ".def -\n"); |
---|
1246 | fprintf(file, "1 - %s%s\n", |
---|
1247 | HSIS_EQUAL,local_set->name->name); |
---|
1248 | |
---|
1249 | |
---|
1250 | vl_write_bin_connect(file, local_ctrl, retval, 0); |
---|
1251 | } |
---|
1252 | } else { |
---|
1253 | if (ripple_ctrl) { |
---|
1254 | |
---|
1255 | |
---|
1256 | fprintf(file, ".names %s %s %s %s %s\n", |
---|
1257 | local_ctrl->name->name, |
---|
1258 | ripple_ctrl->name->name, |
---|
1259 | local_set->name->name, |
---|
1260 | (*ripple_set)->name->name, |
---|
1261 | ripple_out_set->name->name); |
---|
1262 | for (i=0; i<=1; i++) |
---|
1263 | fprintf(file, "1 - %d - %d\n", i, i); |
---|
1264 | for (i=0; i<=1; i++) |
---|
1265 | fprintf(file, "- 1 - %d %d\n", i, i); |
---|
1266 | fprintf(file, "0 0 - - -\n"); |
---|
1267 | |
---|
1268 | |
---|
1269 | vl_write_bop(file, BorExpr, |
---|
1270 | local_ctrl->name->name, |
---|
1271 | ripple_ctrl->name->name, |
---|
1272 | NIL(char), retval->name->name, 1); |
---|
1273 | } else { |
---|
1274 | |
---|
1275 | |
---|
1276 | fprintf(file, ".names %s %s %s\n", |
---|
1277 | local_ctrl->name->name, local_set->name->name, |
---|
1278 | ripple_out_set->name->name); |
---|
1279 | for (i=0; i<=1; i++) fprintf(file, "1 %d %d\n", i, i); |
---|
1280 | fprintf(file, "0 - -\n"); |
---|
1281 | |
---|
1282 | |
---|
1283 | vl_write_bin_connect(file, local_ctrl, retval, 0); |
---|
1284 | } |
---|
1285 | } |
---|
1286 | } else { |
---|
1287 | |
---|
1288 | if (set_notation) { |
---|
1289 | if (ripple_ctrl) { |
---|
1290 | |
---|
1291 | |
---|
1292 | fprintf(file, ".names %s %s ", |
---|
1293 | local_ctrl->name->name, |
---|
1294 | ripple_ctrl->name->name); |
---|
1295 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
1296 | fprintf(file, "%s%s%d%s %s%s%d%s ", |
---|
1297 | local_set->name->name, |
---|
1298 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT, |
---|
1299 | (*ripple_set)->name->name, |
---|
1300 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1301 | fprintf(file, "%s ", HSIS_ARROW); |
---|
1302 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
1303 | fprintf(file, "%s%s%d%s ", |
---|
1304 | ripple_out_set->name->name, |
---|
1305 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1306 | fprintf(file, "\n"); |
---|
1307 | fprintf(file, ".def "); |
---|
1308 | for (bit_idx=lo;bit_idx<=hi;bit_idx++) |
---|
1309 | fprintf(file, "- "); |
---|
1310 | fprintf(file, "\n"); |
---|
1311 | fprintf(file, "1 - "); |
---|
1312 | for (bit_idx=lo;bit_idx<=hi;bit_idx++) |
---|
1313 | fprintf(file, "- - "); |
---|
1314 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
1315 | fprintf(file, "%s%s%s%d%s ",HSIS_EQUAL, |
---|
1316 | local_set->name->name, |
---|
1317 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1318 | fprintf(file, "\n"); |
---|
1319 | fprintf(file, "- 1 "); |
---|
1320 | for (bit_idx=lo;bit_idx<=hi;bit_idx++) |
---|
1321 | fprintf(file, "- - "); |
---|
1322 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
1323 | fprintf(file,"%s%s%s%d%s ",HSIS_EQUAL, |
---|
1324 | (*ripple_set)->name->name, |
---|
1325 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1326 | fprintf(file, "\n"); |
---|
1327 | |
---|
1328 | |
---|
1329 | vl_write_bop(file, BorExpr, |
---|
1330 | local_ctrl->name->name, |
---|
1331 | ripple_ctrl->name->name, |
---|
1332 | NIL(char), retval->name->name, 1); |
---|
1333 | } else { |
---|
1334 | |
---|
1335 | |
---|
1336 | fprintf(file, ".names %s ", local_ctrl->name->name); |
---|
1337 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
1338 | fprintf(file, "%s%s%d%s ", |
---|
1339 | local_set->name->name, |
---|
1340 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1341 | fprintf(file, "%s ", HSIS_ARROW); |
---|
1342 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
1343 | fprintf(file, "%s%s%d%s ", |
---|
1344 | ripple_out_set->name->name, |
---|
1345 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1346 | fprintf(file, "\n"); |
---|
1347 | fprintf(file, ".def "); |
---|
1348 | for (bit_idx=lo;bit_idx<=hi;bit_idx++) |
---|
1349 | fprintf(file, "- "); |
---|
1350 | fprintf(file, "\n"); |
---|
1351 | fprintf(file, "1 "); |
---|
1352 | for (bit_idx=lo;bit_idx<=hi;bit_idx++) |
---|
1353 | fprintf(file, "- "); |
---|
1354 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
1355 | fprintf(file, "%s%s%s%d%s ",HSIS_EQUAL, |
---|
1356 | local_set->name->name, |
---|
1357 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1358 | fprintf(file, "\n"); |
---|
1359 | |
---|
1360 | |
---|
1361 | vl_write_bit_connect(file, local_ctrl->name->name, |
---|
1362 | retval->name->name, 0); |
---|
1363 | } |
---|
1364 | } else { |
---|
1365 | |
---|
1366 | if (ripple_ctrl) { |
---|
1367 | char *(equ[2]); |
---|
1368 | equ[0] = NIL(char); |
---|
1369 | equ[1] = NIL(char); |
---|
1370 | |
---|
1371 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1372 | if (bit_idx==lo) { |
---|
1373 | fprintf(file,".names %s %s %s%s%d%s %s%s%d%s %s%s%d%s\n", |
---|
1374 | local_ctrl->name->name, |
---|
1375 | ripple_ctrl->name->name, |
---|
1376 | local_set->name->name, |
---|
1377 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT, |
---|
1378 | (*ripple_set)->name->name, |
---|
1379 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT, |
---|
1380 | ripple_out_set->name->name, |
---|
1381 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1382 | for (i=0; i<=1; i++) |
---|
1383 | fprintf(file, "1 - %d - %d\n", i, i); |
---|
1384 | for (i=0; i<=1; i++) |
---|
1385 | fprintf(file, "- 1 - %d %d\n", i, i); |
---|
1386 | fprintf(file, "0 0 - - -\n"); |
---|
1387 | } else { |
---|
1388 | fprintf(file,".names %s %s %s %s%s%d%s %s %s%s%d%s %s%s%d%s\n", |
---|
1389 | local_ctrl->name->name, |
---|
1390 | ripple_ctrl->name->name, |
---|
1391 | equ[0], local_set->name->name, |
---|
1392 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT, |
---|
1393 | equ[1], (*ripple_set)->name->name, |
---|
1394 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT, |
---|
1395 | ripple_out_set->name->name, |
---|
1396 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1397 | for (i=0; i<=1; i++) |
---|
1398 | fprintf(file, "1 - 1 %d - - %d\n", i, i); |
---|
1399 | for (i=0; i<=1; i++) |
---|
1400 | fprintf(file, "- 1 - - 1 %d %d\n", i, i); |
---|
1401 | fprintf(file, "0 0 - - - - -\n"); |
---|
1402 | } |
---|
1403 | |
---|
1404 | if (bit_idx < hi) { |
---|
1405 | char focus_out[MAXSTRLEN],focus_tmp[MAXSTRLEN]; |
---|
1406 | char tmp[MAXSTRLEN], intermediate[MAXSTRLEN]; |
---|
1407 | sprintf(focus_out, "%s%s%d%s", |
---|
1408 | local_set->name->name, |
---|
1409 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1410 | sprintf(focus_tmp, "%s%s%d%s", |
---|
1411 | ripple_out_set->name->name, |
---|
1412 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1413 | sprintf(tmp, "%s", new_termname()); |
---|
1414 | vl_write_bop(file, BxnorExpr, |
---|
1415 | focus_out, focus_tmp, |
---|
1416 | NIL(char), tmp, 1); |
---|
1417 | |
---|
1418 | if (equ[0]) { |
---|
1419 | sprintf(intermediate, "%s",new_termname()); |
---|
1420 | vl_write_bop(file, BandExpr, tmp, equ[0], |
---|
1421 | NIL(char), intermediate, 1); |
---|
1422 | vl_chk_free(equ[0]); |
---|
1423 | } else { |
---|
1424 | sprintf(intermediate, "%s", tmp); |
---|
1425 | } |
---|
1426 | equ[0] = vlStrdup(intermediate); |
---|
1427 | |
---|
1428 | sprintf(focus_out, "%s%s%d%s", |
---|
1429 | (*ripple_set)->name->name, |
---|
1430 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1431 | sprintf(focus_tmp, "%s%s%d%s", |
---|
1432 | ripple_out_set->name->name, |
---|
1433 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1434 | sprintf(tmp, "%s", new_termname()); |
---|
1435 | vl_write_bop(file, BxnorExpr, |
---|
1436 | focus_out, focus_tmp, |
---|
1437 | NIL(char), tmp, 1); |
---|
1438 | |
---|
1439 | if (equ[1]) { |
---|
1440 | sprintf(intermediate, "%s",new_termname()); |
---|
1441 | vl_write_bop(file, BandExpr, tmp, equ[1], |
---|
1442 | NIL(char), intermediate, 1); |
---|
1443 | vl_chk_free(equ[1]); |
---|
1444 | } else { |
---|
1445 | sprintf(intermediate, "%s", tmp); |
---|
1446 | } |
---|
1447 | equ[1] = vlStrdup(intermediate); |
---|
1448 | } |
---|
1449 | } |
---|
1450 | |
---|
1451 | vl_write_bop(file, BorExpr, |
---|
1452 | local_ctrl->name->name, |
---|
1453 | ripple_ctrl->name->name, |
---|
1454 | NIL(char), retval->name->name, 1); |
---|
1455 | } else { |
---|
1456 | |
---|
1457 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1458 | fprintf(file, ".names %s %s%s%d%s %s%s%d%s\n", |
---|
1459 | local_ctrl->name->name, |
---|
1460 | local_set->name->name, |
---|
1461 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT, |
---|
1462 | ripple_out_set->name->name, |
---|
1463 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1464 | for (i=0; i<=1; i++) |
---|
1465 | fprintf(file, "1 %d %d\n", i, i); |
---|
1466 | fprintf(file, "0 - -\n"); |
---|
1467 | } |
---|
1468 | |
---|
1469 | vl_write_bin_connect(file, local_ctrl, retval, 0); |
---|
1470 | } |
---|
1471 | } |
---|
1472 | } |
---|
1473 | } |
---|
1474 | |
---|
1475 | if (*ripple_set) vl_free_term(*ripple_set); |
---|
1476 | *ripple_set = ripple_out_set; |
---|
1477 | return retval; |
---|
1478 | } |
---|
1479 | |
---|
1480 | |
---|
1481 | static void write_nblock_set_connect(FILE *file, |
---|
1482 | vl_id_range *id_sym, |
---|
1483 | char *latch_name, |
---|
1484 | vl_term *ripple_ctrl, |
---|
1485 | vl_term *ripple_set, |
---|
1486 | vl_term *procedural_ctrl, |
---|
1487 | vl_term *procedural_term, |
---|
1488 | vl_term *result) |
---|
1489 | { |
---|
1490 | int hi, lo; |
---|
1491 | int bit_idx; |
---|
1492 | int i; |
---|
1493 | |
---|
1494 | get_hilo(id_sym, &hi, &lo); |
---|
1495 | |
---|
1496 | if (id_sym->flags & MVar) { |
---|
1497 | if (set_notation) { |
---|
1498 | if (procedural_ctrl) { |
---|
1499 | |
---|
1500 | fprintf(file, ".names %s %s %s %s %s %s\n", |
---|
1501 | ripple_ctrl->name->name, ripple_set->name->name, |
---|
1502 | procedural_ctrl->name->name, |
---|
1503 | procedural_term->name->name, |
---|
1504 | (id_sym->flags & RegVar) ? latch_name : "", |
---|
1505 | result->name->name); |
---|
1506 | fprintf(file, "1 - - - %s %s%s\n", |
---|
1507 | (id_sym->flags & RegVar) ? "-" : "", |
---|
1508 | HSIS_EQUAL, ripple_set->name->name); |
---|
1509 | fprintf(file, "0 - 1 - %s %s%s\n", |
---|
1510 | (id_sym->flags & RegVar) ? "-" : "", |
---|
1511 | HSIS_EQUAL, procedural_term->name->name); |
---|
1512 | if (id_sym->flags & RegVar) |
---|
1513 | fprintf(file,"0 - 0 - - %s%s\n",HSIS_EQUAL,latch_name); |
---|
1514 | else if (!deadlock_semantic) |
---|
1515 | fprintf(file,"0 - 0 - -\n"); |
---|
1516 | } else { |
---|
1517 | fprintf(file, ".names %s %s %s %s\n", |
---|
1518 | ripple_ctrl->name->name, ripple_set->name->name, |
---|
1519 | (id_sym->flags & RegVar) ? latch_name : "", |
---|
1520 | result->name->name); |
---|
1521 | fprintf(file, "1 - %s %s%s\n", |
---|
1522 | (id_sym->flags & RegVar) ? "-" : "", |
---|
1523 | HSIS_EQUAL, ripple_set->name->name); |
---|
1524 | if (id_sym->flags & RegVar) |
---|
1525 | fprintf(file, "0 - - %s%s\n", HSIS_EQUAL, latch_name); |
---|
1526 | else if (!deadlock_semantic) |
---|
1527 | fprintf(file, "0 - -\n"); |
---|
1528 | } |
---|
1529 | } else { |
---|
1530 | lsList domain; |
---|
1531 | lsGen enum_gen; |
---|
1532 | lsHandle enum_handle; |
---|
1533 | vl_enumerator *enum_elt; |
---|
1534 | |
---|
1535 | if (procedural_ctrl) { |
---|
1536 | |
---|
1537 | domain = id_sym->id_type->specifier->u.enum_type->domain_list; |
---|
1538 | fprintf(file, ".names %s %s %s %s %s %s\n", |
---|
1539 | ripple_ctrl->name->name, ripple_set->name->name, |
---|
1540 | procedural_ctrl->name->name, procedural_term->name->name, |
---|
1541 | (id_sym->flags & RegVar) ? latch_name : "", |
---|
1542 | result->name->name); |
---|
1543 | |
---|
1544 | |
---|
1545 | for (enum_gen=lsStart(domain); |
---|
1546 | lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!= |
---|
1547 | LS_NOMORE;) |
---|
1548 | fprintf(file, "1 %s - - %s %s\n", enum_elt->name, |
---|
1549 | (id_sym->flags & RegVar) ? "-":"", |
---|
1550 | enum_elt->name); |
---|
1551 | lsFinish(enum_gen); |
---|
1552 | for (enum_gen=lsStart(domain); |
---|
1553 | lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!= |
---|
1554 | LS_NOMORE;) |
---|
1555 | fprintf(file, "0 - 1 %s %s %s\n", enum_elt->name, |
---|
1556 | (id_sym->flags & RegVar) ? "-":"", |
---|
1557 | enum_elt->name); |
---|
1558 | lsFinish(enum_gen); |
---|
1559 | if (id_sym->flags & RegVar) { |
---|
1560 | for (enum_gen=lsStart(domain); |
---|
1561 | lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!= |
---|
1562 | LS_NOMORE;) |
---|
1563 | fprintf(file, "0 - 0 - %s %s\n", |
---|
1564 | enum_elt->name, enum_elt->name); |
---|
1565 | lsFinish(enum_gen); |
---|
1566 | } else if (!deadlock_semantic) |
---|
1567 | fprintf(file, "0 - 0 - -\n"); |
---|
1568 | } else { |
---|
1569 | |
---|
1570 | domain = id_sym->id_type->specifier->u.enum_type->domain_list; |
---|
1571 | fprintf(file, ".names %s %s %s %s\n", |
---|
1572 | ripple_ctrl->name->name, ripple_set->name->name, |
---|
1573 | (id_sym->flags & RegVar) ? latch_name : "", |
---|
1574 | result->name->name); |
---|
1575 | |
---|
1576 | |
---|
1577 | for (enum_gen=lsStart(domain); |
---|
1578 | lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!= |
---|
1579 | LS_NOMORE;) |
---|
1580 | fprintf(file, "1 %s %s %s\n", enum_elt->name, |
---|
1581 | (id_sym->flags & RegVar) ? "-":"", |
---|
1582 | enum_elt->name); |
---|
1583 | lsFinish(enum_gen); |
---|
1584 | if (id_sym->flags & RegVar) { |
---|
1585 | for (enum_gen=lsStart(domain); |
---|
1586 | lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!= |
---|
1587 | LS_NOMORE;) |
---|
1588 | fprintf(file, "0 - %s %s\n", |
---|
1589 | enum_elt->name, enum_elt->name); |
---|
1590 | lsFinish(enum_gen); |
---|
1591 | } else if (!deadlock_semantic) |
---|
1592 | fprintf(file, "0 - -\n"); |
---|
1593 | } |
---|
1594 | } |
---|
1595 | } else { |
---|
1596 | if (lo > hi) { |
---|
1597 | |
---|
1598 | if (set_notation) { |
---|
1599 | if (procedural_ctrl) { |
---|
1600 | fprintf(file, ".names %s %s %s %s %s %s\n", |
---|
1601 | ripple_ctrl->name->name, ripple_set->name->name, |
---|
1602 | procedural_ctrl->name->name, |
---|
1603 | procedural_term->name->name, |
---|
1604 | (id_sym->flags & RegVar) ? latch_name:"", |
---|
1605 | result->name->name); |
---|
1606 | fprintf(file, "1 - - - %s %s%s\n", |
---|
1607 | (id_sym->flags & RegVar) ? "-":"", |
---|
1608 | HSIS_EQUAL, ripple_set->name->name); |
---|
1609 | fprintf(file, "0 - 1 - %s %s%s\n", |
---|
1610 | (id_sym->flags & RegVar) ? "-":"", |
---|
1611 | HSIS_EQUAL, procedural_term->name->name); |
---|
1612 | if (id_sym->flags & RegVar) |
---|
1613 | fprintf(file, "0 - 0 - - %s%s\n", |
---|
1614 | HSIS_EQUAL, latch_name); |
---|
1615 | else if (!deadlock_semantic) |
---|
1616 | fprintf(file, "0 - 0 - -\n"); |
---|
1617 | } else { |
---|
1618 | fprintf(file, ".names %s %s %s %s\n", |
---|
1619 | ripple_ctrl->name->name, ripple_set->name->name, |
---|
1620 | (id_sym->flags & RegVar) ? latch_name:"", |
---|
1621 | result->name->name); |
---|
1622 | fprintf(file, "1 - %s %s%s\n", |
---|
1623 | (id_sym->flags & RegVar) ? "-":"", |
---|
1624 | HSIS_EQUAL, ripple_set->name->name); |
---|
1625 | if (id_sym->flags & RegVar) |
---|
1626 | fprintf(file, "0 - - %s%s\n", HSIS_EQUAL, latch_name); |
---|
1627 | else if (!deadlock_semantic) |
---|
1628 | fprintf(file, "0 - -\n"); |
---|
1629 | } |
---|
1630 | } else { |
---|
1631 | if (procedural_ctrl) { |
---|
1632 | fprintf(file, ".names %s %s %s %s %s %s\n", |
---|
1633 | ripple_ctrl->name->name, ripple_set->name->name, |
---|
1634 | procedural_ctrl->name->name, |
---|
1635 | procedural_term->name->name, |
---|
1636 | (id_sym->flags & RegVar) ? latch_name:"", |
---|
1637 | result->name->name); |
---|
1638 | for (i=0; i<=1; i++) |
---|
1639 | fprintf(file, "1 %d - - %s %d\n", |
---|
1640 | i, (id_sym->flags & RegVar) ? "-":"", i); |
---|
1641 | for (i=0; i<=1; i++) |
---|
1642 | fprintf(file, "0 - 1 %d %s %d\n", |
---|
1643 | i, (id_sym->flags & RegVar) ? "-":"", i); |
---|
1644 | if (id_sym->flags & RegVar) |
---|
1645 | for (i=0; i<=1; i++) |
---|
1646 | fprintf(file, "0 - 0 - %d %d\n", i, i); |
---|
1647 | else if (!deadlock_semantic) fprintf(file, "0 - 0 - -\n"); |
---|
1648 | } else { |
---|
1649 | fprintf(file, ".names %s %s %s %s\n", |
---|
1650 | ripple_ctrl->name->name, ripple_set->name->name, |
---|
1651 | (id_sym->flags & RegVar) ? latch_name:"", |
---|
1652 | result->name->name); |
---|
1653 | for (i=0; i<=1; i++) |
---|
1654 | fprintf(file, "1 %d %s %d\n", |
---|
1655 | i, (id_sym->flags & RegVar) ? "-":"", i); |
---|
1656 | if (id_sym->flags & RegVar) |
---|
1657 | for (i=0; i<=1; i++) fprintf(file, "0 - %d %d\n", i,i); |
---|
1658 | else if (!deadlock_semantic) fprintf(file, "0 - -\n"); |
---|
1659 | } |
---|
1660 | } |
---|
1661 | } else { |
---|
1662 | |
---|
1663 | if (set_notation) { |
---|
1664 | if (procedural_ctrl) { |
---|
1665 | |
---|
1666 | fprintf(file, ".names %s ", ripple_ctrl->name->name); |
---|
1667 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1668 | fprintf(file, "%s%s%d%s ", ripple_set->name->name, |
---|
1669 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1670 | } |
---|
1671 | fprintf(file, "%s ", procedural_ctrl->name->name); |
---|
1672 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1673 | fprintf(file, "%s%s%d%s ", procedural_term->name->name, |
---|
1674 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1675 | } |
---|
1676 | if (id_sym->flags & RegVar) { |
---|
1677 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
1678 | fprintf(file, "%s%s%d%s ", latch_name, |
---|
1679 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1680 | } |
---|
1681 | fprintf(file, "%s ", HSIS_ARROW); |
---|
1682 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1683 | fprintf(file, "%s%s%d%s ", result->name->name, |
---|
1684 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1685 | } |
---|
1686 | fprintf(file, "\n"); |
---|
1687 | |
---|
1688 | if (!(id_sym->flags & RegVar) && !deadlock_semantic) { |
---|
1689 | fprintf(file, "%s ", HSIS_DEFAULT); |
---|
1690 | for (bit_idx=lo;bit_idx<=hi;bit_idx++) |
---|
1691 | fprintf(file, "- "); |
---|
1692 | fprintf(file, "\n"); |
---|
1693 | } |
---|
1694 | |
---|
1695 | fprintf(file, "1 "); |
---|
1696 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1697 | fprintf(file, "- "); |
---|
1698 | } |
---|
1699 | fprintf(file, "- "); |
---|
1700 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1701 | fprintf(file, "- "); |
---|
1702 | } |
---|
1703 | if (id_sym->flags & RegVar) |
---|
1704 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1705 | fprintf(file, "- "); |
---|
1706 | } |
---|
1707 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1708 | fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL, |
---|
1709 | ripple_set->name->name, |
---|
1710 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1711 | } |
---|
1712 | fprintf(file, "\n"); |
---|
1713 | |
---|
1714 | fprintf(file, "0 "); |
---|
1715 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1716 | fprintf(file, "- "); |
---|
1717 | } |
---|
1718 | fprintf(file, "1 "); |
---|
1719 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1720 | fprintf(file, "- "); |
---|
1721 | } |
---|
1722 | if (id_sym->flags & RegVar) |
---|
1723 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1724 | fprintf(file, "- "); |
---|
1725 | } |
---|
1726 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1727 | fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL, |
---|
1728 | procedural_term->name->name, |
---|
1729 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1730 | } |
---|
1731 | fprintf(file, "\n"); |
---|
1732 | |
---|
1733 | if (!deadlock_semantic) { |
---|
1734 | if (id_sym->flags & RegVar) { |
---|
1735 | fprintf(file, "0 "); |
---|
1736 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1737 | fprintf(file, "- "); |
---|
1738 | } |
---|
1739 | fprintf(file, "0 "); |
---|
1740 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1741 | fprintf(file, "- "); |
---|
1742 | } |
---|
1743 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1744 | fprintf(file, "- "); |
---|
1745 | } |
---|
1746 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1747 | fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL, |
---|
1748 | latch_name, |
---|
1749 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1750 | } |
---|
1751 | fprintf(file, "\n"); |
---|
1752 | } |
---|
1753 | } |
---|
1754 | } else { |
---|
1755 | |
---|
1756 | fprintf(file, ".names %s ", ripple_ctrl->name->name); |
---|
1757 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1758 | fprintf(file, "%s%s%d%s ", ripple_set->name->name, |
---|
1759 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1760 | } |
---|
1761 | if (id_sym->flags & RegVar) { |
---|
1762 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) |
---|
1763 | fprintf(file, "%s%s%d%s ", |
---|
1764 | latch_name, |
---|
1765 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1766 | } |
---|
1767 | fprintf(file, "%s ", HSIS_ARROW); |
---|
1768 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1769 | fprintf(file, "%s%s%d%s ", result->name->name, |
---|
1770 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1771 | } |
---|
1772 | fprintf(file, "\n"); |
---|
1773 | |
---|
1774 | if (!(id_sym->flags & RegVar) && !deadlock_semantic) { |
---|
1775 | fprintf(file, "%s ", HSIS_DEFAULT); |
---|
1776 | for (bit_idx=lo;bit_idx<=hi;bit_idx++) |
---|
1777 | fprintf(file, "- "); |
---|
1778 | fprintf(file, "\n"); |
---|
1779 | } |
---|
1780 | |
---|
1781 | fprintf(file, "1 "); |
---|
1782 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1783 | fprintf(file, "- "); |
---|
1784 | } |
---|
1785 | if (id_sym->flags & RegVar) |
---|
1786 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1787 | fprintf(file, "- "); |
---|
1788 | } |
---|
1789 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1790 | fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL, |
---|
1791 | ripple_set->name->name, |
---|
1792 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1793 | } |
---|
1794 | fprintf(file, "\n"); |
---|
1795 | |
---|
1796 | if (!deadlock_semantic) { |
---|
1797 | if (id_sym->flags & RegVar) { |
---|
1798 | fprintf(file, "0 "); |
---|
1799 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1800 | fprintf(file, "- "); |
---|
1801 | } |
---|
1802 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1803 | fprintf(file, "- "); |
---|
1804 | } |
---|
1805 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1806 | fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL, |
---|
1807 | latch_name, |
---|
1808 | SEP_LBITSELECT,bit_idx,SEP_RBITSELECT); |
---|
1809 | } |
---|
1810 | fprintf(file, "\n"); |
---|
1811 | } |
---|
1812 | } |
---|
1813 | } |
---|
1814 | } else { |
---|
1815 | if (procedural_ctrl) { |
---|
1816 | if (id_sym->flags & RegVar) { |
---|
1817 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1818 | fprintf(file, ".names %s %s%s%d%s %s %s%s%d%s %s%s%d%s %s%s%d%s\n", |
---|
1819 | ripple_ctrl->name->name, |
---|
1820 | ripple_set->name->name, |
---|
1821 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT, |
---|
1822 | procedural_ctrl->name->name, |
---|
1823 | procedural_term->name->name, |
---|
1824 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT, |
---|
1825 | latch_name, |
---|
1826 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT, |
---|
1827 | result->name->name, |
---|
1828 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1829 | for (i=0; i<=1; i++) |
---|
1830 | fprintf(file, "1 %d - - - %d\n", i, i); |
---|
1831 | for (i=0; i<=1; i++) |
---|
1832 | fprintf(file, "0 - 1 %d - %d\n", i, i); |
---|
1833 | if (!deadlock_semantic) |
---|
1834 | for (i=0; i<=1; i++) |
---|
1835 | fprintf(file, "0 - 0 - %d %d\n", i, i); |
---|
1836 | } |
---|
1837 | } else { |
---|
1838 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1839 | fprintf(file, |
---|
1840 | ".names %s %s%s%d%s %s %s%s%d%s %s%s%d%s\n", |
---|
1841 | ripple_ctrl->name->name, |
---|
1842 | ripple_set->name->name, |
---|
1843 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT, |
---|
1844 | procedural_ctrl->name->name, |
---|
1845 | procedural_term->name->name, |
---|
1846 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT, |
---|
1847 | result->name->name, |
---|
1848 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1849 | for (i=0; i<=1; i++) |
---|
1850 | fprintf(file, "1 %d - - %d\n", i, i); |
---|
1851 | for (i=0; i<=1; i++) |
---|
1852 | fprintf(file, "0 - 1 %d %d\n", i, i); |
---|
1853 | if (!deadlock_semantic) |
---|
1854 | fprintf(file, "0 - - - -\n"); |
---|
1855 | } |
---|
1856 | } |
---|
1857 | } else { |
---|
1858 | if (id_sym->flags & RegVar) { |
---|
1859 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1860 | fprintf(file, |
---|
1861 | ".names %s %s%s%d%s %s%s%d%s %s%s%d%s\n", |
---|
1862 | ripple_ctrl->name->name, |
---|
1863 | ripple_set->name->name, |
---|
1864 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT, |
---|
1865 | latch_name, |
---|
1866 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT, |
---|
1867 | result->name->name, |
---|
1868 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1869 | for (i=0; i<=1; i++) |
---|
1870 | fprintf(file, "1 %d - %d\n", i, i); |
---|
1871 | if (!deadlock_semantic) |
---|
1872 | for (i=0; i<=1; i++) |
---|
1873 | fprintf(file, "0 - %d %d\n", i, i); |
---|
1874 | } |
---|
1875 | } else { |
---|
1876 | for (bit_idx=lo; bit_idx<=hi; bit_idx++) { |
---|
1877 | fprintf(file, |
---|
1878 | ".names %s %s%s%d%s %s%s%d%s\n", |
---|
1879 | ripple_ctrl->name->name, |
---|
1880 | ripple_set->name->name, |
---|
1881 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT, |
---|
1882 | result->name->name, |
---|
1883 | SEP_LBITSELECT, bit_idx, SEP_RBITSELECT); |
---|
1884 | for (i=0; i<=1; i++) |
---|
1885 | fprintf(file, "1 %d %d\n", i, i); |
---|
1886 | if (!deadlock_semantic) fprintf(file, "0 - -\n"); |
---|
1887 | } |
---|
1888 | } |
---|
1889 | } |
---|
1890 | } |
---|
1891 | } |
---|
1892 | } |
---|
1893 | } |
---|