1 /*------------------------------------------------------------\
2 |                                                             |
3 | This file is part of the Alliance CAD System Copyright      |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 |                                                             |
6 | Home page      : http://www-asim.lip6.fr/alliance/          |
7 | E-mail         : mailto:alliance-users@asim.lip6.fr       |
8 |                                                             |
9 | This progam is  free software; you can redistribute it      |
10 | and/or modify it under the  terms of the GNU Library General|
11 | Public License as published by the Free Software Foundation |
12 | either version 2 of the License, or (at your option) any    |
13 | later version.                                              |
14 |                                                             |
15 | Alliance VLSI  CAD System  is distributed  in the hope that |
16 | it  will be useful, but WITHOUT  ANY WARRANTY;              |
17 | without even the  implied warranty of MERCHANTABILITY or    |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General       |
19 | Public License for more details.                            |
20 |                                                             |
21 | You should have received a copy  of the GNU General Public  |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc.,        |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                     |
25 |                                                             |
26 \------------------------------------------------------------*/
27 /*------------------------------------------------------------\
28 |                                                             |
29 | Tool    :                     Bdd                           |
30 |                                                             |
31 | File    :                   bddlog.c                        |
32 |                                                             |
33 | Date    :                   03.12.96                        |
34 |                                                             |
35 | Author  :               Jacomme Ludovic                     |
36 |                                                             |
37 \------------------------------------------------------------*/
38 /*------------------------------------------------------------\
39 |                                                             |
40 |                         Include Files                       |
41 |                                                             |
42 \------------------------------------------------------------*/
43 
44 # include "mut.h"
45 # include "aut.h"
46 # include "abl.h"
47 # include "bdd.h"
48 
49 # include <stdio.h>
50 # include <string.h>
51 # include "bddlog.h"
52 # include "bdderror.h"
53 
54 /*------------------------------------------------------------\
55 |                                                             |
56 |                           Constants                         |
57 |                                                             |
58 \------------------------------------------------------------*/
59 /*------------------------------------------------------------\
60 |                                                             |
61 |                            Types                            |
62 |                                                             |
63 \------------------------------------------------------------*/
64 /*------------------------------------------------------------\
65 |                                                             |
66 |                          Variables                          |
67 |                                                             |
68 \------------------------------------------------------------*/
69 /*------------------------------------------------------------\
70 |                                                             |
71 |                          Functions                          |
72 |                                                             |
73 \------------------------------------------------------------*/
74 /*------------------------------------------------------------\
75 |                                                             |
76 |                         Get Functions                       |
77 |                                                             |
78 \------------------------------------------------------------*/
79 /*------------------------------------------------------------\
80 |                                                             |
81 |                         Get Bdd Node One                    |
82 |                                                             |
83 \------------------------------------------------------------*/
84 
getlogbddnodeone()85 bddnode *getlogbddnodeone()
86 {
87   return( BddLocalSystem->ONE );
88 }
89 
90 /*------------------------------------------------------------\
91 |                                                             |
92 |                         Get Bdd Node Zero                   |
93 |                                                             |
94 \------------------------------------------------------------*/
95 
getlogbddnodezero()96 bddnode *getlogbddnodezero()
97 {
98   return( BddLocalSystem->ZERO );
99 }
100 
101 /*------------------------------------------------------------\
102 |                                                             |
103 |                         Get Bdd Node Term                   |
104 |                                                             |
105 \------------------------------------------------------------*/
106 
getlogbddnodeterm(Index)107 bddnode *getlogbddnodeterm( Index )
108 
109   bddindex Index;
110 {
111   if ( Index < BddLocalSystem->NUMBER_INDEX )
112   {
113     return( getbddvarnodebyindex( (bddsystem *)0, Index ) );
114   }
115 
116   return( addbddvarfirst( (bddsystem *)0 ) );
117 }
118 
119 /*------------------------------------------------------------\
120 |                                                             |
121 |                         Get Bdd Node Not                    |
122 |                                                             |
123 \------------------------------------------------------------*/
124 
getlogbddnodenot(BddNode)125 bddnode *getlogbddnodenot( BddNode )
126 
127   bddnode *BddNode;
128 {
129   return( applybddnodenot( (bddsystem *)0, BddNode ) );
130 }
131 
132 /*------------------------------------------------------------\
133 |                                                             |
134 |                        Apply Bdd Node                       |
135 |                                                             |
136 \------------------------------------------------------------*/
137 
applylogbddnode(Oper,BddNode1,BddNode2)138 bddnode *applylogbddnode( Oper, BddNode1, BddNode2 )
139 
140   long     Oper;
141   bddnode *BddNode1;
142   bddnode *BddNode2;
143 {
144   return( applybddnode( (bddsystem *)0, Oper, BddNode1, BddNode2 ) );
145 }
146 
147 /*------------------------------------------------------------\
148 |                                                             |
149 |                        Convert Bdd Node                     |
150 |                                                             |
151 \------------------------------------------------------------*/
152 
convertlogbddnode(BddCircuit,BddNode)153 ablexpr *convertlogbddnode( BddCircuit, BddNode )
154 
155   bddcircuit *BddCircuit;
156   bddnode    *BddNode;
157 {
158   return( convertbddnodeabl( (bddsystem *)0, BddCircuit->NAME_IN,
159                              (bddindex  *)0, BddNode ) );
160 }
161 
162 /*------------------------------------------------------------\
163 |                                                             |
164 |                        Add Bdd Circuit Input                |
165 |                                                             |
166 \------------------------------------------------------------*/
167 
addlogbddcircuitin(BddCircuit,Name)168 short addlogbddcircuitin( BddCircuit, Name )
169 
170   bddcircuit *BddCircuit;
171   char       *Name;
172 {
173   bddnode *BddNode;
174 
175   BddNode = addbddcircuitin( BddCircuit, Name, 0, BDD_IN_MODE_LAST );
176 
177   if ( BddNode == (bddnode *)0 )
178   {
179     return( 0 );
180   }
181 
182   return( BddNode->INDEX );
183 }
184 
185