summaryrefslogtreecommitdiffstats
path: root/src/aig/hop
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2009-02-15 08:01:00 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2009-02-15 08:01:00 -0800
commit0871bffae307e0553e0c5186336189e8b55cf6a6 (patch)
tree4571d1563fe33a53a57fea1c35fb668b9d33265f /src/aig/hop
parentf936cc0680c98ffe51b3a1716c996072d5dbf76c (diff)
downloadabc-0871bffae307e0553e0c5186336189e8b55cf6a6.tar.gz
abc-0871bffae307e0553e0c5186336189e8b55cf6a6.tar.bz2
abc-0871bffae307e0553e0c5186336189e8b55cf6a6.zip
Version abc90215
Diffstat (limited to 'src/aig/hop')
-rw-r--r--src/aig/hop/cudd2.h8
-rw-r--r--src/aig/hop/hop.h34
-rw-r--r--src/aig/hop/hopDfs.c8
-rw-r--r--src/aig/hop/hopMan.c12
-rw-r--r--src/aig/hop/hopMem.c6
-rw-r--r--src/aig/hop/hopObj.c2
-rw-r--r--src/aig/hop/hopTable.c6
-rw-r--r--src/aig/hop/hopUtil.c24
8 files changed, 48 insertions, 52 deletions
diff --git a/src/aig/hop/cudd2.h b/src/aig/hop/cudd2.h
index 69711c11..27359b3f 100644
--- a/src/aig/hop/cudd2.h
+++ b/src/aig/hop/cudd2.h
@@ -21,10 +21,6 @@
#ifndef __CUDD2_H__
#define __CUDD2_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
// HA: Added for printing messages
#ifndef MSG
#define MSG(msg) (printf("%s = \n",(msg)));
@@ -38,6 +34,10 @@ extern "C" {
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+extern "C" {
+#endif
+
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/aig/hop/hop.h b/src/aig/hop/hop.h
index 6ffc4eac..1e58e825 100644
--- a/src/aig/hop/hop.h
+++ b/src/aig/hop/hop.h
@@ -21,10 +21,6 @@
#ifndef __HOP_H__
#define __HOP_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
@@ -41,6 +37,10 @@ extern "C" {
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+extern "C" {
+#endif
+
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
@@ -102,7 +102,7 @@ struct Hop_Man_t_
// memory management
Vec_Ptr_t * vChunks; // allocated memory pieces
Vec_Ptr_t * vPages; // memory pages used by nodes
- Hop_Obj_t * pListFree; // the list of free nodes
+ Hop_Obj_t * pListFree; // the list of ABC_FREE nodes
// timing statistics
int time1;
int time2;
@@ -115,10 +115,6 @@ struct Hop_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 Hop_BitWordNum( int nBits ) { return (nBits>>5) + ((nBits&31) > 0); }
static inline int Hop_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); }
static inline int Hop_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (1<<((i) & 31))) > 0; }
@@ -127,10 +123,10 @@ static inline void Hop_InfoXorBit( unsigned * p, int i ) { p[(i)>>5] ^=
static inline int Hop_Base2Log( unsigned n ) { int r; assert( n >= 0 ); if ( n < 2 ) return n; for ( r = 0, n--; n; n >>= 1, r++ ); return r; }
static inline int Hop_Base10Log( unsigned n ) { int r; assert( n >= 0 ); if ( n < 2 ) return n; for ( r = 0, n--; n; n /= 10, r++ ); return r; }
-static inline Hop_Obj_t * Hop_Regular( Hop_Obj_t * p ) { return (Hop_Obj_t *)((PORT_PTRUINT_T)(p) & ~01); }
-static inline Hop_Obj_t * Hop_Not( Hop_Obj_t * p ) { return (Hop_Obj_t *)((PORT_PTRUINT_T)(p) ^ 01); }
-static inline Hop_Obj_t * Hop_NotCond( Hop_Obj_t * p, int c ) { return (Hop_Obj_t *)((PORT_PTRUINT_T)(p) ^ (c)); }
-static inline int Hop_IsComplement( Hop_Obj_t * p ) { return (int)((PORT_PTRUINT_T)(p) & 01); }
+static inline Hop_Obj_t * Hop_Regular( Hop_Obj_t * p ) { return (Hop_Obj_t *)((ABC_PTRUINT_T)(p) & ~01); }
+static inline Hop_Obj_t * Hop_Not( Hop_Obj_t * p ) { return (Hop_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); }
+static inline Hop_Obj_t * Hop_NotCond( Hop_Obj_t * p, int c ) { return (Hop_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); }
+static inline int Hop_IsComplement( Hop_Obj_t * p ) { return (int)((ABC_PTRUINT_T)(p) & 01); }
static inline Hop_Obj_t * Hop_ManConst0( Hop_Man_t * p ) { return Hop_Not(p->pConst1); }
static inline Hop_Obj_t * Hop_ManConst1( Hop_Man_t * p ) { return p->pConst1; }
@@ -169,13 +165,13 @@ static inline int Hop_ObjIsMarkA( Hop_Obj_t * pObj ) { return pObj-
static inline void Hop_ObjSetMarkA( Hop_Obj_t * pObj ) { pObj->fMarkA = 1; }
static inline void Hop_ObjClearMarkA( Hop_Obj_t * pObj ) { pObj->fMarkA = 0; }
-static inline void Hop_ObjSetTravId( Hop_Obj_t * pObj, int TravId ) { pObj->pData = (void *)(PORT_PTRINT_T)TravId; }
-static inline void Hop_ObjSetTravIdCurrent( Hop_Man_t * p, Hop_Obj_t * pObj ) { pObj->pData = (void *)(PORT_PTRINT_T)p->nTravIds; }
-static inline void Hop_ObjSetTravIdPrevious( Hop_Man_t * p, Hop_Obj_t * pObj ) { pObj->pData = (void *)(PORT_PTRINT_T)(p->nTravIds - 1); }
-static inline int Hop_ObjIsTravIdCurrent( Hop_Man_t * p, Hop_Obj_t * pObj ) { return (int)((int)(PORT_PTRINT_T)pObj->pData == p->nTravIds); }
-static inline int Hop_ObjIsTravIdPrevious( Hop_Man_t * p, Hop_Obj_t * pObj ) { return (int)((int)(PORT_PTRINT_T)pObj->pData == p->nTravIds - 1); }
+static inline void Hop_ObjSetTravId( Hop_Obj_t * pObj, int TravId ) { pObj->pData = (void *)(ABC_PTRINT_T)TravId; }
+static inline void Hop_ObjSetTravIdCurrent( Hop_Man_t * p, Hop_Obj_t * pObj ) { pObj->pData = (void *)(ABC_PTRINT_T)p->nTravIds; }
+static inline void Hop_ObjSetTravIdPrevious( Hop_Man_t * p, Hop_Obj_t * pObj ) { pObj->pData = (void *)(ABC_PTRINT_T)(p->nTravIds - 1); }
+static inline int Hop_ObjIsTravIdCurrent( Hop_Man_t * p, Hop_Obj_t * pObj ) { return (int)((int)(ABC_PTRINT_T)pObj->pData == p->nTravIds); }
+static inline int Hop_ObjIsTravIdPrevious( Hop_Man_t * p, Hop_Obj_t * pObj ) { return (int)((int)(ABC_PTRINT_T)pObj->pData == p->nTravIds - 1); }
-static inline int Hop_ObjTravId( Hop_Obj_t * pObj ) { return (int)(PORT_PTRINT_T)pObj->pData; }
+static inline int Hop_ObjTravId( Hop_Obj_t * pObj ) { return (int)(ABC_PTRINT_T)pObj->pData; }
static inline int Hop_ObjPhase( Hop_Obj_t * pObj ) { return pObj->fPhase; }
static inline int Hop_ObjRefs( Hop_Obj_t * pObj ) { return pObj->nRefs; }
static inline void Hop_ObjRef( Hop_Obj_t * pObj ) { pObj->nRefs++; }
diff --git a/src/aig/hop/hopDfs.c b/src/aig/hop/hopDfs.c
index bf196aea..3dd8793c 100644
--- a/src/aig/hop/hopDfs.c
+++ b/src/aig/hop/hopDfs.c
@@ -123,15 +123,15 @@ int Hop_ManCountLevels( Hop_Man_t * p )
vNodes = Hop_ManDfs( p );
Vec_PtrForEachEntry( vNodes, pObj, i )
{
- Level0 = (int)(PORT_PTRUINT_T)Hop_ObjFanin0(pObj)->pData;
- Level1 = (int)(PORT_PTRUINT_T)Hop_ObjFanin1(pObj)->pData;
- pObj->pData = (void *)(PORT_PTRUINT_T)(1 + Hop_ObjIsExor(pObj) + AIG_MAX(Level0, Level1));
+ Level0 = (int)(ABC_PTRUINT_T)Hop_ObjFanin0(pObj)->pData;
+ Level1 = (int)(ABC_PTRUINT_T)Hop_ObjFanin1(pObj)->pData;
+ pObj->pData = (void *)(ABC_PTRUINT_T)(1 + Hop_ObjIsExor(pObj) + AIG_MAX(Level0, Level1));
}
Vec_PtrFree( vNodes );
// get levels of the POs
LevelsMax = 0;
Hop_ManForEachPo( p, pObj, i )
- LevelsMax = AIG_MAX( LevelsMax, (int)(PORT_PTRUINT_T)Hop_ObjFanin0(pObj)->pData );
+ LevelsMax = AIG_MAX( LevelsMax, (int)(ABC_PTRUINT_T)Hop_ObjFanin0(pObj)->pData );
return LevelsMax;
}
diff --git a/src/aig/hop/hopMan.c b/src/aig/hop/hopMan.c
index 99f5d316..bf38a780 100644
--- a/src/aig/hop/hopMan.c
+++ b/src/aig/hop/hopMan.c
@@ -43,7 +43,7 @@ Hop_Man_t * Hop_ManStart()
{
Hop_Man_t * p;
// start the manager
- p = ALLOC( Hop_Man_t, 1 );
+ p = ABC_ALLOC( Hop_Man_t, 1 );
memset( p, 0, sizeof(Hop_Man_t) );
// perform initializations
p->nTravIds = 1;
@@ -62,7 +62,7 @@ Hop_Man_t * Hop_ManStart()
// start the table
// p->nTableSize = 107;
p->nTableSize = 10007;
- p->pTable = ALLOC( Hop_Obj_t *, p->nTableSize );
+ p->pTable = ABC_ALLOC( Hop_Obj_t *, p->nTableSize );
memset( p->pTable, 0, sizeof(Hop_Obj_t *) * p->nTableSize );
return p;
}
@@ -92,15 +92,15 @@ void Hop_ManStop( Hop_Man_t * p )
Hop_ManForEachNode( p, pObj, i )
assert( !pObj->fMarkA && !pObj->fMarkB );
// print time
- if ( p->time1 ) { PRT( "time1", p->time1 ); }
- if ( p->time2 ) { PRT( "time2", p->time2 ); }
+ if ( p->time1 ) { ABC_PRT( "time1", p->time1 ); }
+ if ( p->time2 ) { ABC_PRT( "time2", p->time2 ); }
// Hop_TableProfile( p );
if ( p->vChunks ) Hop_ManStopMemory( p );
if ( p->vPis ) Vec_PtrFree( p->vPis );
if ( p->vPos ) Vec_PtrFree( p->vPos );
if ( p->vObjs ) Vec_PtrFree( p->vObjs );
- free( p->pTable );
- free( p );
+ ABC_FREE( p->pTable );
+ ABC_FREE( p );
}
/**Function*************************************************************
diff --git a/src/aig/hop/hopMem.c b/src/aig/hop/hopMem.c
index 60f89d53..c6d05865 100644
--- a/src/aig/hop/hopMem.c
+++ b/src/aig/hop/hopMem.c
@@ -65,7 +65,7 @@ void Hop_ManStopMemory( Hop_Man_t * p )
void * pMemory;
int i;
Vec_PtrForEachEntry( p->vChunks, pMemory, i )
- free( pMemory );
+ ABC_FREE( pMemory );
Vec_PtrFree( p->vChunks );
Vec_PtrFree( p->vPages );
p->pListFree = NULL;
@@ -92,10 +92,10 @@ void Hop_ManAddMemory( Hop_Man_t * p )
// assert( (Hop_ManObjNum(p) & IVY_PAGE_MASK) == 0 );
// allocate new memory page
nBytes = sizeof(Hop_Obj_t) * (1<<IVY_PAGE_SIZE) + 64;
- pMemory = ALLOC( char, nBytes );
+ pMemory = ABC_ALLOC( char, nBytes );
Vec_PtrPush( p->vChunks, pMemory );
// align memory at the 32-byte boundary
- pMemory = pMemory + 64 - (((int)(PORT_PTRUINT_T)pMemory) & 63);
+ pMemory = pMemory + 64 - (((int)(ABC_PTRUINT_T)pMemory) & 63);
// remember the manager in the first entry
Vec_PtrPush( p->vPages, pMemory );
// break the memory down into nodes
diff --git a/src/aig/hop/hopObj.c b/src/aig/hop/hopObj.c
index f173248f..eccf58b8 100644
--- a/src/aig/hop/hopObj.c
+++ b/src/aig/hop/hopObj.c
@@ -193,7 +193,7 @@ void Hop_ObjDelete( Hop_Man_t * p, Hop_Obj_t * pObj )
// remove PIs/POs from the arrays
if ( Hop_ObjIsPi(pObj) )
Vec_PtrRemove( p->vPis, pObj );
- // free the node
+ // ABC_FREE the node
Hop_ManRecycleMemory( p, pObj );
}
diff --git a/src/aig/hop/hopTable.c b/src/aig/hop/hopTable.c
index 76390054..cfc6add0 100644
--- a/src/aig/hop/hopTable.c
+++ b/src/aig/hop/hopTable.c
@@ -172,7 +172,7 @@ clk = clock();
nTableSizeOld = p->nTableSize;
// get the new table
p->nTableSize = Cudd_PrimeAig( 2 * Hop_ManNodeNum(p) );
- p->pTable = ALLOC( Hop_Obj_t *, p->nTableSize );
+ p->pTable = ABC_ALLOC( Hop_Obj_t *, p->nTableSize );
memset( p->pTable, 0, sizeof(Hop_Obj_t *) * p->nTableSize );
// rehash the entries from the old table
Counter = 0;
@@ -190,9 +190,9 @@ clk = clock();
nEntries = Hop_ManNodeNum(p);
assert( Counter == nEntries );
// printf( "Increasing the structural table size from %6d to %6d. ", nTableSizeOld, p->nTableSize );
-// PRT( "Time", clock() - clk );
+// ABC_PRT( "Time", clock() - clk );
// replace the table and the parameters
- free( pTableOld );
+ ABC_FREE( pTableOld );
}
/**Function********************************************************************
diff --git a/src/aig/hop/hopUtil.c b/src/aig/hop/hopUtil.c
index d9dbbcaa..d541ab99 100644
--- a/src/aig/hop/hopUtil.c
+++ b/src/aig/hop/hopUtil.c
@@ -516,13 +516,13 @@ void Hop_ManDumpBlif( Hop_Man_t * p, char * pFileName )
// collect nodes in the DFS order
vNodes = Hop_ManDfs( p );
// assign IDs to objects
- Hop_ManConst1(p)->pData = (void *)(PORT_PTRUINT_T)Counter++;
+ Hop_ManConst1(p)->pData = (void *)(ABC_PTRUINT_T)Counter++;
Hop_ManForEachPi( p, pObj, i )
- pObj->pData = (void *)(PORT_PTRUINT_T)Counter++;
+ pObj->pData = (void *)(ABC_PTRUINT_T)Counter++;
Hop_ManForEachPo( p, pObj, i )
- pObj->pData = (void *)(PORT_PTRUINT_T)Counter++;
+ pObj->pData = (void *)(ABC_PTRUINT_T)Counter++;
Vec_PtrForEachEntry( vNodes, pObj, i )
- pObj->pData = (void *)(PORT_PTRUINT_T)Counter++;
+ pObj->pData = (void *)(ABC_PTRUINT_T)Counter++;
nDigits = Hop_Base10Log( Counter );
// write the file
pFile = fopen( pFileName, "w" );
@@ -532,34 +532,34 @@ void Hop_ManDumpBlif( Hop_Man_t * p, char * pFileName )
// write PIs
fprintf( pFile, ".inputs" );
Hop_ManForEachPi( p, pObj, i )
- fprintf( pFile, " n%0*d", nDigits, (int)(PORT_PTRUINT_T)pObj->pData );
+ fprintf( pFile, " n%0*d", nDigits, (int)(ABC_PTRUINT_T)pObj->pData );
fprintf( pFile, "\n" );
// write POs
fprintf( pFile, ".outputs" );
Hop_ManForEachPo( p, pObj, i )
- fprintf( pFile, " n%0*d", nDigits, (int)(PORT_PTRUINT_T)pObj->pData );
+ fprintf( pFile, " n%0*d", nDigits, (int)(ABC_PTRUINT_T)pObj->pData );
fprintf( pFile, "\n" );
// write nodes
Vec_PtrForEachEntry( vNodes, pObj, i )
{
fprintf( pFile, ".names n%0*d n%0*d n%0*d\n",
- nDigits, (int)(PORT_PTRUINT_T)Hop_ObjFanin0(pObj)->pData,
- nDigits, (int)(PORT_PTRUINT_T)Hop_ObjFanin1(pObj)->pData,
- nDigits, (int)(PORT_PTRUINT_T)pObj->pData );
+ nDigits, (int)(ABC_PTRUINT_T)Hop_ObjFanin0(pObj)->pData,
+ nDigits, (int)(ABC_PTRUINT_T)Hop_ObjFanin1(pObj)->pData,
+ nDigits, (int)(ABC_PTRUINT_T)pObj->pData );
fprintf( pFile, "%d%d 1\n", !Hop_ObjFaninC0(pObj), !Hop_ObjFaninC1(pObj) );
}
// write POs
Hop_ManForEachPo( p, pObj, i )
{
fprintf( pFile, ".names n%0*d n%0*d\n",
- nDigits, (int)(PORT_PTRUINT_T)Hop_ObjFanin0(pObj)->pData,
- nDigits, (int)(PORT_PTRUINT_T)pObj->pData );
+ nDigits, (int)(ABC_PTRUINT_T)Hop_ObjFanin0(pObj)->pData,
+ nDigits, (int)(ABC_PTRUINT_T)pObj->pData );
fprintf( pFile, "%d 1\n", !Hop_ObjFaninC0(pObj) );
if ( Hop_ObjIsConst1(Hop_ObjFanin0(pObj)) )
pConst1 = Hop_ManConst1(p);
}
if ( pConst1 )
- fprintf( pFile, ".names n%0*d\n 1\n", nDigits, (int)(PORT_PTRUINT_T)pConst1->pData );
+ fprintf( pFile, ".names n%0*d\n 1\n", nDigits, (int)(ABC_PTRUINT_T)pConst1->pData );
fprintf( pFile, ".end\n\n" );
fclose( pFile );
Vec_PtrFree( vNodes );