Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / cbh / cbh_main.c
1 /****************************************************************************/
2 /* */
3 /* Chaine de CAO & VLSI AVERTEC */
4 /* */
5 /* Produit : CBH Version 1.00 */
6 /* Fichier : cbh_seq.c */
7 /* */
8 /* (c) copyright 2001 AVERTEC */
9 /* Tous droits reserves */
10 /* */
11 /* Auteur(s) : Anthony LESTER */
12 /* */
13 /****************************************************************************/
14
15 #include MUT_H
16 #include LOG_H
17 #include BEH_H
18 #include BHL_H
19 #include BEF_H
20 #include BVL_H
21 #include CBH_H
22 #include AVT_H
23
24 // this file is not to date
25
26 static void
27 usage(char *progname)
28 {
29 avt_errmsg(CBH_ERRMSG,"002",AVT_FATAL,progname);
30 // fprintf(stderr, "%s needs a file as argument\n", progname);
31 // EXIT(1);
32 }
33
34 int
35 main(int argc, char *argv[])
36 {
37 lofig_list *ptlofig;
38 befig_list *ptcellbefig;
39 beout_list *ptbeout;
40 bebus_list *ptbebus;
41 cbhseq *ptcbhseq;
42 cbhcomb *ptcbhcomb;
43 char buffer[1024];
44
45 #ifdef MACOS
46 argc = ccommand(&argv);
47 initmacenv(argv[0]);
48 #endif
49
50 avtenv();
51
52 mbkenv();
53 fclenv();
54
55 if (argc != 2) usage("cbhtest");
56 ptcellbefig = loadbefig(NULL, argv[1], BVL_KEEPAUX);
57 initializeBdd(0);
58 ptcbhseq = cbh_getseqfunc(ptcellbefig, CBH_LIB_MODE);
59 if (ptcbhseq != NULL) {
60 switch (ptcbhseq->SEQTYPE) {
61 case CBH_LATCH:
62 printf("\tLATCH:\n");
63 break;
64 case CBH_FLIPFLOP:
65 printf("\tFLIP-FLOP:\n");
66 break;
67 case CBH_UNKNOWN:
68 printf("\tUNKNOWN:\n");
69 break;
70 }
71 if (ptcbhseq->NAME != NULL) printf("\t\tNAME = %s\n", ptcbhseq->NAME);
72 if (ptcbhseq->NEGNAME != NULL) printf("\t\tNEGNAME = %s\n", ptcbhseq->NEGNAME);
73 if (ptcbhseq->PIN != NULL) printf("\t\tPIN = %s\n", ptcbhseq->PIN);
74 if (ptcbhseq->NEGPIN != NULL) printf("\t\tNEGPIN = %s\n", ptcbhseq->NEGPIN);
75 printf("\t\tCLOCK = ");
76 cbh_writeabl(stdout, ptcbhseq->CLOCK);
77 printf("\n");
78 printf("\t\tSLAVECLOCK = ");
79 cbh_writeabl(stdout, ptcbhseq->SLAVECLOCK);
80 printf("\n");
81 printf("\t\tDATA = ");
82 cbh_writeabl(stdout, ptcbhseq->DATA);
83 printf("\n");
84 printf("\t\tRESET = ");
85 cbh_writeabl(stdout, ptcbhseq->RESET);
86 printf("\n");
87 printf("\t\tSET = ");
88 cbh_writeabl(stdout, ptcbhseq->SET);
89 printf("\n");
90 printf("\t\tRSCONF = ");
91 cbh_writeabl(stdout, ptcbhseq->RSCONF);
92 printf("\n");
93 printf("\t\tRSCONFNEG = ");
94 cbh_writeabl(stdout, ptcbhseq->RSCONFNEG);
95 printf("\n");
96 printf("\n");
97 }
98 for (ptbeout = ptcellbefig->BEOUT; ptbeout; ptbeout = ptbeout->NEXT) {
99 ptcbhcomb = cbh_getcombfunc(ptcellbefig, ptcbhseq, ptbeout->NAME);
100 if (ptcbhcomb != NULL) {
101 printf("\t%s: ",ptbeout->NAME);
102 cbh_writeabl(stdout, ptcbhcomb->FUNCTION);
103 printf("\n");
104 }
105 }
106 for (ptbebus = ptcellbefig->BEBUS; ptbebus; ptbebus = ptbebus->NEXT) {
107 ptcbhcomb = cbh_getcombfunc(ptcellbefig, ptcbhseq, ptbebus->NAME);
108 if (ptcbhcomb != NULL) {
109 printf("\t%s: \n",ptbebus->NAME);
110 printf("\t\tFUNCTION = ");
111 cbh_writeabl(stdout, ptcbhcomb->FUNCTION);
112 printf("\n");
113 printf("\t\tHZFUNC = ");
114 cbh_writeabl(stdout, ptcbhcomb->HZFUNC);
115 printf("\n");
116 printf("\t\tCONFLICT = ");
117 cbh_writeabl(stdout, ptcbhcomb->CONFLICT);
118 printf("\n");
119 printf("\n");
120 }
121 }
122 sprintf(buffer, "cbh_%s", ptcellbefig->NAME);
123 ptcellbefig->NAME = namealloc(buffer);
124 savebefig(ptcellbefig, 0);
125
126 EXIT(0);
127 }