Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / tas / zen / zen_main.c
1 /****************************************************************************/
2 /* */
3 /* Chaine de CAO & VLSI AVERTEC */
4 /* */
5 /* Produit : zen */
6 /* Fichier : zen_main.c */
7 /* */
8 /* (c) copyright 2002 AVERTEC */
9 /* Tous droits reserves */
10 /* */
11 /* Auteur(s) : Stephane Picault */
12 /* Antony PINTO */
13 /* */
14 /****************************************************************************/
15
16 #include "zen_main.h"
17 //#include <sys/types.h>
18 //#include <sys/stat.h>
19 //#include <fcntl.h>
20 #include EQT_H
21
22 struct stat *st;
23 /****************************************************************************/
24 /*{{{ zen_the_question() */
25 /* */
26 /* */
27 /****************************************************************************/
28 void zen_the_question(ZenFig)
29 zenfig_list *ZenFig;
30 {
31 fprintf(stderr,"\x1B[1m");
32 switch (zen_algo1(ZenFig))
33 {
34 case 0 : fprintf(stdout,"ALGO 1 -> FALSE\n"); break;
35 default: fprintf(stdout,"ALGO 1 -> TRUE\n") ; break;
36 }
37 fprintf(stderr,"\x1B[0m");
38 }
39
40
41 /*}}}************************************************************************/
42 /*{{{ zen_decOpt() */
43 /* */
44 /* */
45 /****************************************************************************/
46 void zen_decOpt(opt)
47 char *opt;
48 {
49 switch (opt[0])
50 {
51 case 'f' : ZEN_FAST = 1 ; break;
52 case 'l' : ZEN_LEVEL = atoi(opt+1) ; break;
53 }
54 }
55
56 /*}}}************************************************************************/
57 /*{{{ zen_getOpt() */
58 /* */
59 /* */
60 /****************************************************************************/
61 void zen_getOpt(argc,argv,chip,inf)
62 int argc;
63 char **argv;
64 char **chip;
65 char **inf;
66 {
67 int i;
68
69 for (i=argc;i>1;i--)
70 if (argv[i-1][0]=='-') zen_decOpt(argv[i-1]+1);
71 else if (!*inf)
72 {
73 *inf = argv[i-1];
74 *chip = *inf;
75 }
76 else *chip = argv[i-1];
77 }
78
79 /****************************************************************************/
80 /*}}} */
81 /*{{{ main Fonction */
82 /* */
83 /****************************************************************************/
84 int main(argc,argv)
85 int argc;
86 char **argv;
87 {
88 zenfig_list *ZenFig;
89 befig_list *BeFigure;
90 char *BeNameFile = NULL;
91 char *PaNameFile = NULL;
92 // char buf[256];
93 // FILE *file;
94 ptype_list *path;
95 // char *top;
96 // int i;
97 // char key[8];
98
99 // pCircuit cct;
100 // chain_list *abl;
101 // chain_list *abl2;
102 // pNode bdd;
103 // pNode bdd2;
104
105 #ifdef AVERTEC
106 avtenv() ;
107 #endif
108 mbkenv ();
109
110 zen_getOpt(argc,argv,&BeNameFile,&PaNameFile);
111
112 if (getenv("ZEN_TRACE_MODE")) ZEN_TRACEMODE = 1;
113 if (argc==1) ZEN_ERROR(3,NULL);
114
115 zen_setDelay(70);
116
117 initializeBdd(LARGE_BDD);
118
119 BeFigure = loadbefig(NULL,BeNameFile,BVL_TRACE|BVL_KEEPAUX);
120
121 if (!beh_chkbefig(BeFigure,0))
122 {
123 // on cree les dependances in>>out (berin) liste des sorties qui dependent
124 // des entrees
125 beh_depend(BeFigure);
126 // on construit tous les bdds pour chaque expression
127 zen_makbehbdd(BeFigure);
128 }
129 // st = mbkalloc(sizeof(struct stat));
130 ZEN_TRACE(0,"loaded");
131 // while (1)
132 // {
133 // fgets(key,8,stdin);
134 // fread(key,1,1,stdin);
135 // if (key[0]=='q') EXIT(1);
136 // if (getch()=='q') EXIT(1);
137 // if ((file=fopen(PaNameFile,"r")))
138 // {
139 // sleep(2);
140 // stat("/users/disk01/antony/dev/test/zen/file.inf",st);
141 // if (st->st_size!=0){
142 // fclose(file);
143 path = zen_loadPath(PaNameFile);
144 // if (path)
145 // {
146 zen_remplacebebux(BeFigure);
147 zen_remplacebebus(BeFigure);
148
149 ZenFig = zen_createzenfig(BeFigure,path);
150 zen_the_question(ZenFig);
151 zen_freezenfig(ZenFig);
152 // unlink(PaNameFile);
153 // }}
154 // }
155 // }
156 beh_frebefig(BeFigure);
157 EXIT(0);
158 }