summaryrefslogtreecommitdiffstats
path: root/src/aig/hop
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-07-16 16:06:21 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2013-07-16 16:06:21 -0700
commit5f97612951b9547a23c64e2a669cd459dae0beda (patch)
tree9552d966c6e461584fbb599ef5e17fecf2545c9b /src/aig/hop
parente731d3b1f4fa1a1be528c5e1868409c1b19aedf7 (diff)
downloadabc-5f97612951b9547a23c64e2a669cd459dae0beda.tar.gz
abc-5f97612951b9547a23c64e2a669cd459dae0beda.tar.bz2
abc-5f97612951b9547a23c64e2a669cd459dae0beda.zip
Imporvements to 'eliminate'.
Diffstat (limited to 'src/aig/hop')
-rw-r--r--src/aig/hop/hop.h3
-rw-r--r--src/aig/hop/hopTruth.c47
2 files changed, 49 insertions, 1 deletions
diff --git a/src/aig/hop/hop.h b/src/aig/hop/hop.h
index 7d9be165..e63ea3e0 100644
--- a/src/aig/hop/hop.h
+++ b/src/aig/hop/hop.h
@@ -326,7 +326,8 @@ extern void Hop_TableDelete( Hop_Man_t * p, Hop_Obj_t * pObj );
extern int Hop_TableCountEntries( Hop_Man_t * p );
extern void Hop_TableProfile( Hop_Man_t * p );
/*=== hopTruth.c ========================================================*/
-unsigned * Hop_ManConvertAigToTruth( Hop_Man_t * p, Hop_Obj_t * pRoot, int nVars, Vec_Int_t * vTruth, int fMsbFirst );
+extern unsigned * Hop_ManConvertAigToTruth( Hop_Man_t * p, Hop_Obj_t * pRoot, int nVars, Vec_Int_t * vTruth, int fMsbFirst );
+extern word Hop_ManComputeTruth6( Hop_Man_t * p, Hop_Obj_t * pObj, int nVars );
/*=== hopUtil.c =========================================================*/
extern void Hop_ManIncrementTravId( Hop_Man_t * p );
extern void Hop_ManCleanData( Hop_Man_t * p );
diff --git a/src/aig/hop/hopTruth.c b/src/aig/hop/hopTruth.c
index 0b674225..bbb0e052 100644
--- a/src/aig/hop/hopTruth.c
+++ b/src/aig/hop/hopTruth.c
@@ -218,6 +218,53 @@ unsigned * Hop_ManConvertAigToTruth( Hop_Man_t * p, Hop_Obj_t * pRoot, int nVars
return pTruth;
}
+
+/**Function*************************************************************
+
+ Synopsis [Compute truth table.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static word Truth[8] =
+{
+ ABC_CONST(0xAAAAAAAAAAAAAAAA),
+ ABC_CONST(0xCCCCCCCCCCCCCCCC),
+ ABC_CONST(0xF0F0F0F0F0F0F0F0),
+ ABC_CONST(0xFF00FF00FF00FF00),
+ ABC_CONST(0xFFFF0000FFFF0000),
+ ABC_CONST(0xFFFFFFFF00000000),
+ ABC_CONST(0x0000000000000000),
+ ABC_CONST(0xFFFFFFFFFFFFFFFF)
+};
+word Hop_ManComputeTruth6_rec( Hop_Man_t * p, Hop_Obj_t * pObj )
+{
+ word Truth0, Truth1;
+ if ( Hop_ObjIsPi(pObj) )
+ return Truth[pObj->iData];
+ assert( Hop_ObjIsNode(pObj) );
+ Truth0 = Hop_ManComputeTruth6_rec( p, Hop_ObjFanin0(pObj) );
+ Truth1 = Hop_ManComputeTruth6_rec( p, Hop_ObjFanin1(pObj) );
+ Truth0 = Hop_ObjFaninC0(pObj) ? ~Truth0 : Truth0;
+ Truth1 = Hop_ObjFaninC1(pObj) ? ~Truth1 : Truth1;
+ return Truth0 & Truth1;
+}
+word Hop_ManComputeTruth6( Hop_Man_t * p, Hop_Obj_t * pObj, int nVars )
+{
+ word Truth;
+ int i;
+ if ( Hop_ObjIsConst1( Hop_Regular(pObj) ) )
+ return Hop_IsComplement(pObj) ? 0 : ~(word)0;
+ for ( i = 0; i < nVars; i++ )
+ Hop_ManPi( p, i )->iData = i;
+ Truth = Hop_ManComputeTruth6_rec( p, Hop_Regular(pObj) );
+ return Hop_IsComplement(pObj) ? ~Truth : Truth;
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////