source: vis_dev/vl2mv-2.3/src/parser/vl_resolution.c @ 18

Last change on this file since 18 was 18, checked in by cecile, 13 years ago

vl2mv added

File size: 17.8 KB
Line 
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_resolution.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 "vl_types.h"
34#include "vl_defs.h"
35#include "vlr_int.h"
36#include "vl_fg_defs.h"
37#include "vl_create.h"
38#include "vl_write.h"
39#include "vl_write_util.h"
40#include "vl_vardecl.h"
41
42extern int set_notation;
43extern int smartEvent;
44extern vl_desc *mod_list;
45extern int noBus;
46
47FILE *null_file;
48
49
50void create_mvar_nondeterminism(FILE *file,
51                                st_table *resultant_vars,
52                                char *var_name,
53                                vl_id_range *id_sym,
54                                int lo, int hi,
55                                array_t *controls,
56                                array_t *vars_array)
57{
58    vl_term *nond_out, *ctrl_i;
59    char buf[MAXSTRLEN], buf_new[MAXSTRLEN], buf_old[MAXSTRLEN], *cp, *t;
60    var_info *cur_var;
61    st_table *vars;
62    int i, j, k;
63    int idx, idx_lo, idx_hi;
64    lsList domain;
65    lsGen enum_gen;
66    lsHandle enum_handle;
67    vl_enumerator *enum_elt;
68    array_t *val_array;
69
70    nond_out = new_term(id_sym->range, lo, hi);
71    nond_out->flag |= MVar;
72    nond_out->term_type = id_sym->id_type;
73    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
74    write_var_decl(file, nond_out);
75
76
77    st_insert(resultant_vars, var_name,
78              (char*)create_var_info(vl_copy_id_range(id_sym), nond_out));
79    st_lookup(resultant_vars, var_name, (char**)&cur_var);
80    cur_var->extra = (void*)controls;
81
82    if (id_sym->range) {
83        idx_lo = vl_eval_expr(id_sym->range->left);
84        if (id_sym->range->right)
85            idx_hi = vl_eval_expr(id_sym->range->right);
86        else
87            idx_hi = idx_lo;
88    } else {
89        idx_lo = idx_hi = 0;
90    }
91
92    for (idx=idx_lo; idx<=idx_hi; idx++) {
93        int control_is_tautology;
94
95        control_is_tautology = 0;
96
97        val_array = array_alloc(char*, 0);
98
99        cp = buf; *cp = '\0';
100        cp = strappend(cp, ".names ");
101        for (i=0; i<array_n(controls); i++) {
102            char tmp_buf[MAXSTRLEN];
103            ctrl_i = array_fetch(vl_term*, controls, i);
104            if (ctrl_i) {
105                if (ctrl_i->flag & TautologyTrue)
106                    control_is_tautology = 1;
107
108                vars = array_fetch(st_table*, vars_array, i);
109                st_lookup(vars, var_name, (char**)&cur_var);
110                cp = strappendS(cp, ctrl_i->name->name);
111                if (id_sym->range) {
112                    sprintf(tmp_buf, "%s%s%d%s",
113                            cur_var->current_terminal->name->name,
114                            SEP_LARRAY, idx, SEP_RARRAY);
115                } else {
116                    sprintf(tmp_buf, "%s",
117                            cur_var->current_terminal->name->name);
118                }
119                cp = strappendS(cp, tmp_buf);
120                array_insert_last(char*, val_array, vlStrdup(tmp_buf));
121            } else {
122
123                t = WRT_BLIF_MV_DC(null_file,
124                                   id_sym->id_type->specifier->
125                                       u.enum_type->domain_list);
126                array_insert_last(char*, val_array, vlStrdup(t));
127            }
128        }
129
130        if (!control_is_tautology) {
131
132            strcpy(buf_old, id_sym->name);
133            strip_char(buf_old, SEP_LATCH);
134            if (id_sym->range) {
135                sprintf(buf_new, "%s%s%d%s",
136                        buf_old, SEP_LARRAY, idx, SEP_RARRAY);
137            } else {
138                strcpy(buf_new, buf_old);
139            }
140            cp = strappendS(cp, buf_new);
141        }
142
143        if (id_sym->range) {
144            sprintf(buf_new, "%s%s%d%s",
145                    nond_out->name->name, SEP_LARRAY, idx, SEP_RARRAY);
146            cp = strappendS(cp, buf_new);
147        } else {
148            strcpy(buf_new, nond_out->name->name);
149            cp = strappendS(cp, buf_new);
150        }
151
152        fprintf(file, "%s\n", buf);
153
154        if (control_is_tautology ||
155            ((id_sym->flags & EventVar) && smartEvent)) {
156            vl_enumerator *enum_elt;
157
158            lsFirstItem(id_sym->id_type->specifier->u.enum_type->domain_list,
159                        (lsGeneric*)&enum_elt, 0);
160            fprintf(file, "%s %s\n", HSIS_DEFAULT, enum_elt->name);
161        }
162
163        if (set_notation) {
164
165            for (i=0; i<array_n(controls); i++) {
166                ctrl_i = array_fetch(vl_term*, controls, i);
167                if (ctrl_i) {
168                    for (k=0; k<i; k++) {
169                        ctrl_i = array_fetch(vl_term*, controls, k);
170                        if (ctrl_i) fprintf(file,"- - ");
171                    }
172                    fprintf(file, "1 - ");
173                    for (k=i+1; k<array_n(controls); k++) {
174                        ctrl_i = array_fetch(vl_term*, controls, k);
175                        if (ctrl_i) fprintf(file, "- - ");
176                    }
177                    if (!control_is_tautology)
178                        fprintf(file, "- %s%s\n",
179                                HSIS_EQUAL,
180                                array_fetch(char*, val_array, i));
181                    else
182                        fprintf(file, "%s%s\n",
183                                HSIS_EQUAL,
184                                array_fetch(char*, val_array, i));
185                }
186            }
187
188
189            if (!control_is_tautology) {
190                for (j=0; j<array_n(controls); j++) {
191                    ctrl_i = array_fetch(vl_term*, controls, j);
192                    if (ctrl_i) fprintf(file, "0 - ");
193                }
194                if (id_sym->range) {
195                    char id_buf[MAXSTRLEN];
196                    sprintf(id_buf, "%s%s%d%s",
197                            id_sym->name, SEP_LARRAY, idx, SEP_RARRAY);
198                    fprintf(file, "- %s%s\n", HSIS_EQUAL, id_buf);
199                } else {
200                    fprintf(file, "- %s%s\n", HSIS_EQUAL, id_sym->name);
201                }
202            }
203
204            for (i=0; i<array_n(val_array); i++)
205                vl_chk_free(array_fetch(char*, val_array, i));
206        } else {
207
208            for (i=0; i<array_n(controls); i++) {
209                for (enum_gen=lsStart(domain);
210                     lsNext(enum_gen,
211                            (lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) {
212                    ctrl_i = array_fetch(vl_term*, controls, i);
213                    if (ctrl_i) {
214                        for (k=0; k<i; k++) {
215                            ctrl_i = array_fetch(vl_term*, controls, k);
216                            if (ctrl_i) fprintf(file,"- - ");
217                        }
218                        fprintf(file, "1 %s ", enum_elt->name);
219                        for (k=i+1; k<array_n(controls); k++) {
220                            ctrl_i = array_fetch(vl_term*, controls, k);
221                            if (ctrl_i) fprintf(file, "- - ");
222                        }
223                        fprintf(file, "- %s\n", enum_elt->name);
224                    }
225                }
226                lsFinish(enum_gen);
227            }
228
229            for (enum_gen=lsStart(domain);
230                 lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
231                     LS_NOMORE;) {
232                for (j=0; j<array_n(controls); j++) {
233                    ctrl_i = array_fetch(vl_term*, controls, j);
234                    if (ctrl_i) fprintf(file, "0 - ");
235                }
236                fprintf(file, "%s %s\n", enum_elt->name, enum_elt->name);
237            }
238            lsFinish(enum_gen);
239        }
240        array_free(val_array);
241    }
242}
243
244
245void create_bin_scalar_nondeterminism(FILE *file,
246                                      st_table *resultant_vars,
247                                      char *var_name,
248                                      vl_id_range *id_sym,
249                                      array_t *controls,
250                                      array_t *vars_array)
251{
252    vl_term *nond_out, *ctrl_i;
253    char buf[MAXSTRLEN], buf_new[MAXSTRLEN], buf_old[MAXSTRLEN], *cp;
254    var_info *cur_var;
255    st_table *vars;
256    int i, j, k;
257    int idx, idx_lo, idx_hi;
258
259    nond_out = new_term(NIL(vl_range), 0, -1);
260
261    st_insert(resultant_vars, var_name,
262              (char*)create_var_info(vl_copy_id_range(id_sym), nond_out));
263    st_lookup(resultant_vars, var_name, (char**)&cur_var);
264    nond_out->name->range = id_sym->range;
265    nond_out->name->unintType = id_sym->unintType;
266    cur_var->extra = (void*)controls;
267
268    if (id_sym->range) {
269        idx_lo = vl_eval_expr(id_sym->range->left);
270        if (id_sym->range->right)
271            idx_hi = vl_eval_expr(id_sym->range->right);
272        else
273            idx_hi = idx_lo;
274    } else {
275        idx_lo = idx_hi = 0;
276    }
277
278    write_var_decl(file, nond_out);
279
280    for (idx=idx_lo; idx<=idx_hi; idx++) {
281        int control_is_tautology;
282
283        control_is_tautology = 0;
284
285        cp = buf; *cp = '\0';
286        cp = strappend(cp, ".names ");
287        for (i=0; i<array_n(controls); i++) {
288            char tmp_buf[MAXSTRLEN];
289            ctrl_i = array_fetch(vl_term*, controls, i);
290            if (ctrl_i) {
291                if (!(ctrl_i->flag & ConflictFalse)) {
292                    if (ctrl_i->flag & TautologyTrue)
293                        control_is_tautology = 1;
294
295                    vars = array_fetch(st_table*, vars_array, i);
296                    st_lookup(vars, var_name, (char**)&cur_var);
297                    cp = strappendS(cp, ctrl_i->name->name);
298                    if (id_sym->range) {
299                        sprintf(tmp_buf, "%s%s%d%s",
300                                cur_var->current_terminal->name->name,
301                                SEP_LARRAY, idx, SEP_RARRAY);
302                        cp = strappendS(cp, tmp_buf);
303                    } else {
304                        sprintf(tmp_buf, "%s",
305                                cur_var->current_terminal->name->name);
306                        cp = strappendS(cp, tmp_buf);
307                    }
308                }
309            } else {
310
311                cp = cp;
312
313            }
314        }
315
316        if (!control_is_tautology &&
317            (!(id_sym->flags & EventVar) || !smartEvent)) {
318            strcpy(buf_old, id_sym->name);
319            strip_char(buf_old, SEP_LATCH);
320            if (id_sym->range) {
321                sprintf(buf_new, "%s%s%d%s",
322                        buf_old, SEP_LARRAY, idx, SEP_RARRAY);
323                cp = strappendS(cp, buf_new);
324            } else {
325                strcpy(buf_new, buf_old);
326                cp = strappendS(cp, buf_new);
327            }
328        }
329
330        if (id_sym->range) {
331            sprintf(buf_new, "%s%s%d%s",
332                    nond_out->name->name,
333                    SEP_LARRAY, idx, SEP_RARRAY);
334            cp = strappendS(cp, buf_new);
335        } else {
336            strcpy(buf_new, nond_out->name->name);
337            cp = strappendS(cp, buf_new);
338        }
339
340        fprintf(file, "%s\n", buf);
341
342        if (control_is_tautology ||
343            ((id_sym->flags & EventVar) && smartEvent)) {
344            fprintf(file, "%s %d\n", HSIS_DEFAULT, 0);
345        }
346
347
348        for (i=0; i<array_n(controls); i++) {
349            ctrl_i = array_fetch(vl_term*, controls, i);
350            if (ctrl_i) {
351                if (!(ctrl_i->flag & ConflictFalse)) {
352
353                    for (j=0; j<= 1; j++) {
354                        for (k=0; k<i; k++) {
355                            ctrl_i = array_fetch(vl_term*, controls, k);
356                            if (ctrl_i)
357                                fprintf(file,"- - ");
358                        }
359                        fprintf(file, "1 %d ", j);
360                        for (k=i+1; k<array_n(controls); k++) {
361                            ctrl_i = array_fetch(vl_term*, controls, k);
362                            if (ctrl_i)
363                                fprintf(file, "- - ");
364                        }
365                        if (!control_is_tautology &&
366                            (!(id_sym->flags & EventVar) ||
367                             !smartEvent))
368                            fprintf(file, "- %d\n", j);
369                        else
370                            fprintf(file, "%d\n", j);
371                    }
372                }
373            }
374        }
375
376        if (!control_is_tautology) {
377            if (!(id_sym->flags & EventVar) || !smartEvent) {
378
379                for (i=0; i<=1; i++) {
380                    for (j=0; j<array_n(controls); j++) {
381                        ctrl_i = array_fetch(vl_term*, controls, j);
382                        if (ctrl_i)
383                            fprintf(file, "0 - ");
384                    }
385                    fprintf(file, "%d %d\n", i, i);
386                }
387            } else {
388
389                for (j=0; j<array_n(controls); j++) {
390                    ctrl_i = array_fetch(vl_term*, controls, j);
391                    if (ctrl_i) fprintf(file, "0 - ");
392                }
393                fprintf(file, "%d\n", 0);
394            }
395        }
396    }
397}
398
399
400void create_bin_vector_nondeterminism(FILE *file,
401                                      st_table *resultant_vars,
402                                      char *var_name,
403                                      vl_id_range *id_sym,
404                                      int lo, int hi,
405                                      array_t *controls,
406                                      array_t *vars_array)
407{
408    vl_term *nond_out, *ctrl_i;
409    char buf[MAXSTRLEN];
410    char buf_tmp[MAXSTRLEN];
411    char *cp;
412    var_info *cur_var;
413    st_table *vars;
414    int h, i, j, k;
415    int idx, idx_lo, idx_hi;
416    char ctrl_terms_buf[MAXSTRLEN], *ctrl_terms_cp;
417    char val_terms_buf[MAXSTRLEN], *val_terms_cp;
418
419    nond_out = new_term(id_sym->range, lo, hi);
420    write_var_decl(file, nond_out);
421
422    st_insert(resultant_vars, vlStrdup(var_name),
423              (char*)create_var_info(vl_copy_id_range(id_sym), nond_out));
424    st_lookup(resultant_vars, var_name, (char**)&cur_var);
425    cur_var->extra = (void*)controls;
426
427    if (id_sym->range) {
428        idx_lo = vl_eval_expr(id_sym->range->left);
429        if (id_sym->range->right)
430            idx_hi = vl_eval_expr(id_sym->range->right);
431        else
432            idx_hi = idx_lo;
433    } else {
434        idx_lo = idx_hi = 0;
435    }
436
437    for (idx=idx_lo; idx<=idx_hi; idx++) {
438        if (set_notation && !(array_n(controls) <= 1 && noBus)) {
439            char buf_ctrl[MAXSTRLEN], buf_var[MAXSTRLEN];
440            int control_is_tautology;
441
442            control_is_tautology = 0;
443
444            cp = buf; *cp = '\0';
445            ctrl_terms_cp = ctrl_terms_buf;  *ctrl_terms_cp = '\0';
446            val_terms_cp = val_terms_buf;  *val_terms_cp = '\0';
447            cp = strappend(cp, ".names ");
448            for (i=0; i<array_n(controls); i++) {
449                ctrl_i = array_fetch(vl_term*, controls, i);
450                if (ctrl_i) {
451                    if (!(ctrl_i->flag & ConflictFalse)) {
452                        if (ctrl_i->flag & TautologyTrue)
453                            control_is_tautology = 1;
454
455                        vars = array_fetch(st_table*, vars_array, i);
456                        st_lookup(vars, var_name, (char**)&cur_var);
457                        sprintf(buf_ctrl, "%s", ctrl_i->name->name);
458
459                        cp = strappendS(cp, buf_ctrl);
460                        ctrl_terms_cp =
461                            strappendS(ctrl_terms_cp, buf_ctrl);
462                        for (h=lo; h<=hi; h++) {
463                            if (!id_sym->range) {
464                                sprintf(buf_var, "%s%s%d%s",
465                                        cur_var->current_terminal->
466                                        name->name,
467                                        SEP_LBITSELECT, h, SEP_RBITSELECT);
468                            } else {
469                                sprintf(buf_var, "%s%s%d%s%s%d%s",
470                                        cur_var->current_terminal->
471                                        name->name,
472                                        SEP_LARRAY, idx, SEP_RARRAY,
473                                        SEP_LBITSELECT, h, SEP_RBITSELECT);
474                            }
475                            cp = strappendS(cp, buf_var);
476                        }
477                    }
478                } else {
479
480                    cp = cp;
481
482                }
483            }
484
485            if (!control_is_tautology) {
486                for (h=lo; h<=hi; h++) {
487                    if (id_sym->range) {
488                        sprintf(buf_tmp, "%s%s%d%s%s%d%s",
489                                strip_char(vlStrdup(id_sym->name),SEP_LATCH),
490                                SEP_LARRAY, idx, SEP_RARRAY,
491                                SEP_LBITSELECT, h, SEP_RBITSELECT);
492                    } else {
493                        sprintf(buf_tmp, "%s%s%d%s",
494                                strip_char(vlStrdup(id_sym->name),SEP_LATCH),
495                                SEP_LBITSELECT, h, SEP_RBITSELECT);
496                    }
497                    cp = strappendS(cp, buf_tmp);
498                }
499            }
500
501            cp = strappendS(cp, HSIS_ARROW);
502            for (h=lo; h<=hi; h++) {
503                if (id_sym->range) {
504                    sprintf(buf_tmp, "%s%s%d%s%s%d%s",
505                            nond_out->name->name,
506                            SEP_LARRAY, idx, SEP_RARRAY,
507                            SEP_LBITSELECT, h, SEP_RBITSELECT);
508                } else {
509                    sprintf(buf_tmp, "%s%s%d%s",
510                            nond_out->name->name,
511                            SEP_LBITSELECT, h, SEP_RBITSELECT);
512                }
513                cp = strappendS(cp, buf_tmp);
514            }
515            fprintf(file, "%s\n", buf);
516
517            if (control_is_tautology ||
518                ((id_sym->flags & EventVar) && smartEvent)) {
519                fprintf(file, "%s", HSIS_DEFAULT);
520                for (h=lo; h<=hi; h++)
521                    fprintf(file, " %d", 0);
522                fprintf(file, "\n");
523            }
524
525            for (i=0; i<array_n(controls); i++) {
526                ctrl_i = array_fetch(vl_term*, controls, i);
527                if (ctrl_i) {
528                    if (!(ctrl_i->flag & ConflictFalse)) {
529                        for (k=0; k<i; k++) {
530                            ctrl_i = array_fetch(vl_term*,controls,k);
531                            if (ctrl_i) {
532                                fprintf(file,"- ");
533                                for (h=lo; h<=hi; h++) fprintf(file,"- ");
534                            }
535                        }
536                        fprintf(file, "1 ");
537                        for (h=lo; h<=hi; h++) fprintf(file, "- ");
538                        for (k=i+1; k<array_n(controls); k++) {
539                            ctrl_i = array_fetch(vl_term*,controls,k);
540                            if (ctrl_i) {
541                                if (!(ctrl_i->flag & ConflictFalse)) {
542                                    fprintf(file,"- ");
543                                    for (h=lo; h<=hi; h++)
544                                        fprintf(file,"- ");
545                                }
546                            }
547                        }
548
549                        if (!control_is_tautology) {
550                            for (h=lo; h<=hi; h++) fprintf(file, "- ");
551                        }
552
553                        for (h=lo; h<=hi; h++) {
554                            vars = array_fetch(st_table*, vars_array, i);
555                            st_lookup(vars, var_name, (char**)&cur_var);
556                            if (!id_sym->range) {
557                                sprintf(buf_var, "%s%s%d%s",
558                                        cur_var->current_terminal->
559                                        name->name,
560                                        SEP_LBITSELECT, h, SEP_RBITSELECT);
561                            } else {
562                                sprintf(buf_var, "%s%s%d%s%s%d%s",
563                                        cur_var->current_terminal->
564                                        name->name,
565                                        SEP_LARRAY, idx, SEP_RARRAY,
566                                        SEP_LBITSELECT, h, SEP_RBITSELECT);
567                            }
568                            fprintf(file, "%s%s ", HSIS_EQUAL, buf_var);
569                        }
570                        fprintf(file, "\n");
571                    }
572                }
573            }
574
575            if (!control_is_tautology) {
576                for (j=0; j<array_n(controls); j++) {
577                    ctrl_i = array_fetch(vl_term*, controls, j);
578                    if (ctrl_i) {
579                        if (!(ctrl_i->flag & ConflictFalse)) {
580                            fprintf(file, "0 ");
581                            for (h=lo; h<=hi; h++) fprintf(file, "- ");
582                        }
583                    }
584                }
585
586                for (h=lo; h<=hi; h++) fprintf(file, "- ");
587                for (h=lo; h<=hi; h++) {
588                    if (!id_sym->range) {
589                        sprintf(buf_var, "%s%s%d%s",
590                                strip_char(vlStrdup(id_sym->name),SEP_LATCH),
591                                SEP_LBITSELECT, h, SEP_RBITSELECT);
592                    } else {
593                        sprintf(buf_var, "%s%s%d%s%s%d%s",
594                                strip_char(vlStrdup(id_sym->name),SEP_LATCH),
595                                SEP_LARRAY, idx, SEP_RARRAY,
596                                SEP_LBITSELECT, h, SEP_RBITSELECT);
597                    }
598                    fprintf(file, "%s%s ", HSIS_EQUAL, buf_var);
599                }
600                fprintf(file, "\n");
601            }
602        } else {
603            for (h=lo; h<=hi; h++) {
604
605                cp = buf; *cp = '\0';
606                cp = strappend(cp, ".names ");
607                for (i=0; i<array_n(controls); i++) {
608                    ctrl_i = array_fetch(vl_term*, controls, i);
609                    if (ctrl_i) {
610                        if (!(ctrl_i->flag & ConflictFalse)) {
611                            char buf_ctrl[MAXSTRLEN], buf_var[MAXSTRLEN];
612
613                            vars = array_fetch(st_table*, vars_array, i);
614                            st_lookup(vars, var_name, (char**)&cur_var);
615                            sprintf(buf_ctrl, "%s", ctrl_i->name->name);
616
617                            if (!id_sym->range) {
618                                sprintf(buf_var, "%s%s%d%s",
619                                        cur_var->current_terminal->
620                                        name->name,
621                                        SEP_LBITSELECT, h, SEP_RBITSELECT);
622                            } else {
623                                sprintf(buf_var, "%s%s%d%s%s%d%s",
624                                        cur_var->current_terminal->
625                                        name->name,
626                                        SEP_LARRAY, idx, SEP_RARRAY,
627                                        SEP_LBITSELECT, h, SEP_RBITSELECT);
628                            }
629                            cp = strappendS(cp, buf_ctrl);
630                            cp = strappendS(cp, buf_var);
631                        }
632                    } else {
633
634                        cp = cp;
635
636                    }
637                }
638                if (id_sym->range) {
639                    sprintf(buf_tmp, "%s%s%d%s%s%d%s %s%s%d%s%s%d%s",
640                            strip_char(vlStrdup(id_sym->name),SEP_LATCH),
641                            SEP_LARRAY, idx, SEP_RARRAY,
642                            SEP_LBITSELECT, h, SEP_RBITSELECT,
643                            nond_out->name->name,
644                            SEP_LARRAY, idx, SEP_RARRAY,
645                            SEP_LBITSELECT, h, SEP_RBITSELECT);
646                } else {
647                    sprintf(buf_tmp, "%s%s%d%s %s%s%d%s",
648                            strip_char(vlStrdup(id_sym->name),SEP_LATCH),
649                            SEP_LBITSELECT, h, SEP_RBITSELECT,
650                            nond_out->name->name,
651                            SEP_LBITSELECT, h, SEP_RBITSELECT);
652                }
653                cp = strappendS(cp, buf_tmp);
654                fprintf(file, "%s\n", buf);
655
656                for (i=0; i<array_n(controls); i++) {
657                    ctrl_i = array_fetch(vl_term*, controls, i);
658                    if (ctrl_i) {
659                        if (!(ctrl_i->flag & ConflictFalse)) {
660                            for (j=0; j<= 1; j++) {
661                                for (k=0; k<i; k++) {
662                                    ctrl_i =
663                                        array_fetch(vl_term*,controls,k);
664                                    if (ctrl_i)
665                                        if (!(ctrl_i->flag&ConflictFalse))
666                                            fprintf(file,"- - ");
667                                }
668                                fprintf(file, "1 %d ", j);
669                                for (k=i+1; k<array_n(controls); k++) {
670                                    ctrl_i =
671                                        array_fetch(vl_term*,controls,k);
672                                    if (ctrl_i)
673                                        if (!(ctrl_i->flag&ConflictFalse))
674                                            fprintf(file, "- - ");
675                                }
676                                fprintf(file, "- %d\n", j);
677                            }
678                        }
679                    }
680                }
681
682                for (i=0; i<=1; i++) {
683                    for (j=0; j<array_n(controls); j++) {
684                        ctrl_i = array_fetch(vl_term*, controls, j);
685                        if (ctrl_i)
686                            if (!(ctrl_i->flag & ConflictFalse))
687                                fprintf(file, "0 - ");
688                    }
689                    fprintf(file, "%d %d\n", i, i);
690                }
691            }
692        }
693    }
694}
Note: See TracBrowser for help on using the repository browser.