summaryrefslogtreecommitdiffstats
path: root/src/aig/hop
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2007-03-17 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2007-03-17 08:01:00 -0700
commitdd5531caf916d526551049b59151990adaef575d (patch)
tree8520c4dee3ec65f1bd3c44104f4d80ff9df0caab /src/aig/hop
parent2696cf05e568f7a928f32b01534d106bf626ef8a (diff)
downloadabc-dd5531caf916d526551049b59151990adaef575d.tar.gz
abc-dd5531caf916d526551049b59151990adaef575d.tar.bz2
abc-dd5531caf916d526551049b59151990adaef575d.zip
Version abc70317
Diffstat (limited to 'src/aig/hop')
-rw-r--r--src/aig/hop/hop.h10
-rw-r--r--src/aig/hop/hopMan.c18
-rw-r--r--src/aig/hop/hopObj.c11
3 files changed, 21 insertions, 18 deletions
diff --git a/src/aig/hop/hop.h b/src/aig/hop/hop.h
index 34124599..44f5ac8e 100644
--- a/src/aig/hop/hop.h
+++ b/src/aig/hop/hop.h
@@ -81,7 +81,7 @@ struct Hop_Man_t_
// AIG nodes
Vec_Ptr_t * vPis; // the array of PIs
Vec_Ptr_t * vPos; // the array of POs
- Vec_Ptr_t * vNodes; // the array of all nodes (optional)
+ Vec_Ptr_t * vObjs; // the array of all nodes (optional)
Hop_Obj_t * pConst1; // the constant 1 node
Hop_Obj_t Ghost; // the ghost node
// AIG node counters
@@ -131,6 +131,8 @@ static inline Hop_Obj_t * Hop_ManConst0( Hop_Man_t * p ) { return Hop_N
static inline Hop_Obj_t * Hop_ManConst1( Hop_Man_t * p ) { return p->pConst1; }
static inline Hop_Obj_t * Hop_ManGhost( Hop_Man_t * p ) { return &p->Ghost; }
static inline Hop_Obj_t * Hop_ManPi( Hop_Man_t * p, int i ) { return (Hop_Obj_t *)Vec_PtrEntry(p->vPis, i); }
+static inline Hop_Obj_t * Hop_ManPo( Hop_Man_t * p, int i ) { return (Hop_Obj_t *)Vec_PtrEntry(p->vPos, i); }
+static inline Hop_Obj_t * Hop_ManObj( Hop_Man_t * p, int i ) { return p->vObjs ? (Hop_Obj_t *)Vec_PtrEntry(p->vObjs, i) : NULL; }
static inline Hop_Edge_t Hop_EdgeCreate( int Id, int fCompl ) { return (Id << 1) | fCompl; }
static inline int Hop_EdgeId( Hop_Edge_t Edge ) { return Edge >> 1; }
@@ -223,10 +225,10 @@ static inline Hop_Obj_t * Hop_ManFetchMemory( Hop_Man_t * p )
pTemp = p->pListFree;
p->pListFree = *((Hop_Obj_t **)pTemp);
memset( pTemp, 0, sizeof(Hop_Obj_t) );
- if ( p->vNodes )
+ if ( p->vObjs )
{
- assert( p->nCreated == Vec_PtrSize(p->vNodes) );
- Vec_PtrPush( p->vNodes, pTemp );
+ assert( p->nCreated == Vec_PtrSize(p->vObjs) );
+ Vec_PtrPush( p->vObjs, pTemp );
}
pTemp->Id = p->nCreated++;
return pTemp;
diff --git a/src/aig/hop/hopMan.c b/src/aig/hop/hopMan.c
index 4fa52fbd..b7858564 100644
--- a/src/aig/hop/hopMan.c
+++ b/src/aig/hop/hopMan.c
@@ -94,10 +94,10 @@ void Hop_ManStop( Hop_Man_t * p )
if ( p->time1 ) { PRT( "time1", p->time1 ); }
if ( p->time2 ) { 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->vNodes ) Vec_PtrFree( p->vNodes );
+ 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 );
}
@@ -115,20 +115,20 @@ void Hop_ManStop( Hop_Man_t * p )
***********************************************************************/
int Hop_ManCleanup( Hop_Man_t * p )
{
- Vec_Ptr_t * vNodes;
+ Vec_Ptr_t * vObjs;
Hop_Obj_t * pNode;
int i, nNodesOld;
assert( p->fRefCount );
nNodesOld = Hop_ManNodeNum(p);
// collect roots of dangling nodes
- vNodes = Vec_PtrAlloc( 100 );
+ vObjs = Vec_PtrAlloc( 100 );
Hop_ManForEachNode( p, pNode, i )
if ( Hop_ObjRefs(pNode) == 0 )
- Vec_PtrPush( vNodes, pNode );
+ Vec_PtrPush( vObjs, pNode );
// recursively remove dangling nodes
- Vec_PtrForEachEntry( vNodes, pNode, i )
+ Vec_PtrForEachEntry( vObjs, pNode, i )
Hop_ObjDelete_rec( p, pNode );
- Vec_PtrFree( vNodes );
+ Vec_PtrFree( vObjs );
return nNodesOld - Hop_ManNodeNum(p);
}
diff --git a/src/aig/hop/hopObj.c b/src/aig/hop/hopObj.c
index c4430abd..c8e70dd3 100644
--- a/src/aig/hop/hopObj.c
+++ b/src/aig/hop/hopObj.c
@@ -73,7 +73,7 @@ Hop_Obj_t * Hop_ObjCreatePo( Hop_Man_t * p, Hop_Obj_t * pDriver )
else
pObj->nRefs = Hop_ObjLevel( Hop_Regular(pDriver) );
// set the phase
-// pObj->fPhase = Hop_ObjFaninPhase(pDriver);
+ pObj->fPhase = Hop_ObjFaninPhase(pDriver);
// update node counters of the manager
p->nObjs[AIG_PO]++;
return pObj;
@@ -136,7 +136,7 @@ void Hop_ObjConnect( Hop_Man_t * p, Hop_Obj_t * pObj, Hop_Obj_t * pFan0, Hop_Obj
else
pObj->nRefs = Hop_ObjLevelNew( pObj );
// set the phase
-// pObj->fPhase = Hop_ObjFaninPhase(pFan0) & Hop_ObjFaninPhase(pFan1);
+ pObj->fPhase = Hop_ObjFaninPhase(pFan0) & Hop_ObjFaninPhase(pFan1);
// add the node to the structural hash table
Hop_TableInsert( p, pObj );
}
@@ -236,9 +236,10 @@ void Hop_ObjDelete_rec( Hop_Man_t * p, Hop_Obj_t * pObj )
***********************************************************************/
Hop_Obj_t * Hop_ObjRepr( Hop_Obj_t * pObj )
{
- if ( Hop_Regular(pObj)->pData == NULL )
- return Hop_Regular(pObj);
- return Hop_ObjRepr( Hop_Regular(pObj)->pData );
+ assert( !Hop_IsComplement(pObj) );
+ if ( pObj->pData == NULL || pObj->pData == pObj )
+ return pObj;
+ return Hop_ObjRepr( pObj->pData );
}
/**Function*************************************************************