summaryrefslogtreecommitdiffstats
path: root/src/temp/aig
diff options
context:
space:
mode:
Diffstat (limited to 'src/temp/aig')
-rw-r--r--src/temp/aig/aig.h17
-rw-r--r--src/temp/aig/aigBalance.c2
-rw-r--r--src/temp/aig/cudd2.c20
-rw-r--r--src/temp/aig/cudd2.h6
4 files changed, 39 insertions, 6 deletions
diff --git a/src/temp/aig/aig.h b/src/temp/aig/aig.h
index fbf234ac..0dfc3f11 100644
--- a/src/temp/aig/aig.h
+++ b/src/temp/aig/aig.h
@@ -30,6 +30,11 @@ extern "C" {
////////////////////////////////////////////////////////////////////////
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <time.h>
+
#include "vec.h"
////////////////////////////////////////////////////////////////////////
@@ -104,16 +109,20 @@ struct Aig_Man_t_
#define AIG_MIN(a,b) (((a) < (b))? (a) : (b))
#define AIG_MAX(a,b) (((a) > (b))? (a) : (b))
+#ifndef PRT
+#define PRT(a,t) printf("%s = ", (a)); printf("%6.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC))
+#endif
+
static inline int Aig_BitWordNum( int nBits ) { return (nBits>>5) + ((nBits&31) > 0); }
static inline int Aig_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); }
static inline int Aig_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (1<<((i) & 31))) > 0; }
static inline void Aig_InfoSetBit( unsigned * p, int i ) { p[(i)>>5] |= (1<<((i) & 31)); }
static inline void Aig_InfoXorBit( unsigned * p, int i ) { p[(i)>>5] ^= (1<<((i) & 31)); }
-static inline Aig_Obj_t * Aig_Regular( Aig_Obj_t * p ) { return (Aig_Obj_t *)((unsigned)(p) & ~01); }
-static inline Aig_Obj_t * Aig_Not( Aig_Obj_t * p ) { return (Aig_Obj_t *)((unsigned)(p) ^ 01); }
-static inline Aig_Obj_t * Aig_NotCond( Aig_Obj_t * p, int c ) { return (Aig_Obj_t *)((unsigned)(p) ^ (c)); }
-static inline int Aig_IsComplement( Aig_Obj_t * p ) { return (int )(((unsigned)p) & 01); }
+static inline Aig_Obj_t * Aig_Regular( Aig_Obj_t * p ) { return (Aig_Obj_t *)((unsigned long)(p) & ~01); }
+static inline Aig_Obj_t * Aig_Not( Aig_Obj_t * p ) { return (Aig_Obj_t *)((unsigned long)(p) ^ 01); }
+static inline Aig_Obj_t * Aig_NotCond( Aig_Obj_t * p, int c ) { return (Aig_Obj_t *)((unsigned long)(p) ^ (c)); }
+static inline int Aig_IsComplement( Aig_Obj_t * p ) { return (int )(((unsigned long)p) & 01); }
static inline Aig_Obj_t * Aig_ManConst0( Aig_Man_t * p ) { return Aig_Not(p->pConst1); }
static inline Aig_Obj_t * Aig_ManConst1( Aig_Man_t * p ) { return p->pConst1; }
diff --git a/src/temp/aig/aigBalance.c b/src/temp/aig/aigBalance.c
index 1abc672d..8806b654 100644
--- a/src/temp/aig/aigBalance.c
+++ b/src/temp/aig/aigBalance.c
@@ -17,7 +17,7 @@
Revision [$Id: aigBalance.c,v 1.00 2006/05/11 00:00:00 alanmi Exp $]
***********************************************************************/
-
+
#include "aig.h"
////////////////////////////////////////////////////////////////////////
diff --git a/src/temp/aig/cudd2.c b/src/temp/aig/cudd2.c
index 95663420..3cc38260 100644
--- a/src/temp/aig/cudd2.c
+++ b/src/temp/aig/cudd2.c
@@ -53,7 +53,9 @@ static Aig_CuddMan_t * s_pCuddMan = NULL;
void Cudd2_Init( unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory, void * pCudd )
{
int v;
- assert( s_pCuddMan == NULL );
+ // start the BDD-to-AIG manager when the first BDD manager is allocated
+ if ( s_pCuddMan != NULL )
+ return;
s_pCuddMan = ALLOC( Aig_CuddMan_t, 1 );
s_pCuddMan->pAig = Aig_ManStart();
s_pCuddMan->pTable = st_init_table( st_ptrcmp, st_ptrhash );
@@ -127,6 +129,22 @@ static void Cudd2_SetArg( Aig_Obj_t * pNode, void * pResult )
/**Function*************************************************************
+ Synopsis [Registers constant 1 node.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Cudd2_bddOne( void * pCudd, void * pResult )
+{
+ Cudd2_SetArg( Aig_ManConst1(s_pCuddMan->pAig), pResult );
+}
+
+/**Function*************************************************************
+
Synopsis [Adds elementary variable.]
Description []
diff --git a/src/temp/aig/cudd2.h b/src/temp/aig/cudd2.h
index 800ee33f..69711c11 100644
--- a/src/temp/aig/cudd2.h
+++ b/src/temp/aig/cudd2.h
@@ -25,6 +25,11 @@
extern "C" {
#endif
+// HA: Added for printing messages
+#ifndef MSG
+#define MSG(msg) (printf("%s = \n",(msg)));
+#endif
+
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
@@ -52,6 +57,7 @@ extern "C" {
extern void Cudd2_Init ( unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory, void * pCudd );
extern void Cudd2_Quit ( void * pCudd );
+extern void Cudd2_bddOne ( void * pCudd, void * pResult );
extern void Cudd2_bddIthVar ( void * pCudd, int iVar, void * pResult );
extern void Cudd2_bddAnd ( void * pCudd, void * pArg0, void * pArg1, void * pResult );
extern void Cudd2_bddOr ( void * pCudd, void * pArg0, void * pArg1, void * pResult );