diff options
author | Bruno Schmitt <bruno@oschmitt.com> | 2016-05-11 19:41:31 -0300 |
---|---|---|
committer | Bruno Schmitt <bruno@oschmitt.com> | 2016-05-11 19:41:31 -0300 |
commit | 3cf495c83197f838580a6efd25e9d5a68e871fa6 (patch) | |
tree | 5e0dfd49da6764d829f9e43a0f6dbc746bb92007 /src/base/pla | |
parent | 8745fa8163d94ffd90590cc052eb39bd5a866bff (diff) | |
download | abc-3cf495c83197f838580a6efd25e9d5a68e871fa6.tar.gz abc-3cf495c83197f838580a6efd25e9d5a68e871fa6.tar.bz2 abc-3cf495c83197f838580a6efd25e9d5a68e871fa6.zip |
Add a new module which implements the fast extract with cube hashing (fxch) algorithm.
Removes old partial implementation of this algorithm from the "pla" module.
Diffstat (limited to 'src/base/pla')
-rw-r--r-- | src/base/pla/module.make | 3 | ||||
-rw-r--r-- | src/base/pla/pla.h | 62 | ||||
-rw-r--r-- | src/base/pla/plaCom.c | 7 |
3 files changed, 34 insertions, 38 deletions
diff --git a/src/base/pla/module.make b/src/base/pla/module.make index b34d30d0..a552b27f 100644 --- a/src/base/pla/module.make +++ b/src/base/pla/module.make @@ -1,8 +1,7 @@ SRC += src/base/pla/plaCom.c \ src/base/pla/plaHash.c \ - src/base/pla/plaFxch.c \ src/base/pla/plaMan.c \ src/base/pla/plaMerge.c \ src/base/pla/plaSimple.c \ src/base/pla/plaRead.c \ - src/base/pla/plaWrite.c + src/base/pla/plaWrite.c diff --git a/src/base/pla/pla.h b/src/base/pla/pla.h index 2806df2f..2df1d096 100644 --- a/src/base/pla/pla.h +++ b/src/base/pla/pla.h @@ -9,7 +9,7 @@ Synopsis [Scalable SOP transformations.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - March 18, 2015.] @@ -34,7 +34,7 @@ /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// -ABC_NAMESPACE_HEADER_START +ABC_NAMESPACE_HEADER_START #define MASK55 ABC_CONST(0x5555555555555555) @@ -43,25 +43,25 @@ ABC_NAMESPACE_HEADER_START //////////////////////////////////////////////////////////////////////// // file types -typedef enum { - PLA_FILE_FD = 0, - PLA_FILE_F, - PLA_FILE_FR, - PLA_FILE_FDR, - PLA_FILE_NONE -} Pla_File_t; +typedef enum { + PLA_FILE_FD = 0, + PLA_FILE_F, + PLA_FILE_FR, + PLA_FILE_FDR, + PLA_FILE_NONE +} Pla_File_t; // literal types -typedef enum { - PLA_LIT_DASH = 0, - PLA_LIT_ZERO, - PLA_LIT_ONE, - PLA_LIT_FULL -} Pla_Lit_t; +typedef enum { + PLA_LIT_DASH = 0, + PLA_LIT_ZERO, + PLA_LIT_ONE, + PLA_LIT_FULL +} Pla_Lit_t; typedef struct Pla_Man_t_ Pla_Man_t; -struct Pla_Man_t_ +struct Pla_Man_t_ { char * pName; // model name char * pSpec; // input file @@ -112,17 +112,17 @@ static inline void Pla_CubeXorLit( word * p, int i, Pla_Lit_t d ) { p[i>>5] ^ //////////////////////////////////////////////////////////////////////// #define Pla_ForEachCubeIn( p, pCube, i ) \ - for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeIn(p, i)), 1); i++ ) + for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeIn(p, i)), 1); i++ ) #define Pla_ForEachCubeInStart( p, pCube, i, Start ) \ - for ( i = Start; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeIn(p, i)), 1); i++ ) + for ( i = Start; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeIn(p, i)), 1); i++ ) #define Pla_ForEachCubeOut( p, pCube, i ) \ - for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeOut(p, i)), 1); i++ ) + for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeOut(p, i)), 1); i++ ) #define Pla_ForEachCubeInOut( p, pCubeIn, pCubeOut, i ) \ - for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCubeIn) = Pla_CubeIn(p, i)), 1) && (((pCubeOut) = Pla_CubeOut(p, i)), 1); i++ ) + for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCubeIn) = Pla_CubeIn(p, i)), 1) && (((pCubeOut) = Pla_CubeOut(p, i)), 1); i++ ) #define Pla_CubeForEachLit( nVars, pCube, Lit, i ) \ - for ( i = 0; (i < nVars) && (((Lit) = Pla_CubeGetLit(pCube, i)), 1); i++ ) + for ( i = 0; (i < nVars) && (((Lit) = Pla_CubeGetLit(pCube, i)), 1); i++ ) #define Pla_CubeForEachLitIn( p, pCube, Lit, i ) \ Pla_CubeForEachLit( Pla_ManInNum(p), pCube, Lit, i ) #define Pla_CubeForEachLitOut( p, pCube, Lit, i ) \ @@ -138,7 +138,7 @@ static inline void Pla_CubeXorLit( word * p, int i, Pla_Lit_t d ) { p[i>>5] ^ Synopsis [Checks if cubes are distance-1.] Description [] - + SideEffects [] SeeAlso [] @@ -175,7 +175,7 @@ static inline int Pla_CubesAreConsensus( word * p, word * q, int nWords, int * p if ( fFound ) return 0; // check if the number of 1s is one, which means exactly one opposite literal (0/1) but may have other diffs (-/0 or -/1) - Test = ((p[c] ^ q[c]) & ((p[c] ^ q[c]) >> 1)) & MASK55; + Test = ((p[c] ^ q[c]) & ((p[c] ^ q[c]) >> 1)) & MASK55; if ( !Pla_OnlyOneOne(Test) ) return 0; fFound = 1; @@ -185,12 +185,12 @@ static inline int Pla_CubesAreConsensus( word * p, word * q, int nWords, int * p } static inline int Pla_TtCountOnesOne( word x ) { - x = x - ((x >> 1) & ABC_CONST(0x5555555555555555)); - x = (x & ABC_CONST(0x3333333333333333)) + ((x >> 2) & ABC_CONST(0x3333333333333333)); - x = (x + (x >> 4)) & ABC_CONST(0x0F0F0F0F0F0F0F0F); + x = x - ((x >> 1) & ABC_CONST(0x5555555555555555)); + x = (x & ABC_CONST(0x3333333333333333)) + ((x >> 2) & ABC_CONST(0x3333333333333333)); + x = (x + (x >> 4)) & ABC_CONST(0x0F0F0F0F0F0F0F0F); x = x + (x >> 8); x = x + (x >> 16); - x = x + (x >> 32); + x = x + (x >> 32); return (int)(x & 0xFF); } static inline int Pla_TtCountOnes( word * p, int nWords ) @@ -200,13 +200,13 @@ static inline int Pla_TtCountOnes( word * p, int nWords ) Count += Pla_TtCountOnesOne( p[i] ); return Count; } - + /**Function************************************************************* Synopsis [Manager APIs.] Description [] - + SideEffects [] SeeAlso [] @@ -268,8 +268,7 @@ static inline void Pla_ManPrintStats( Pla_Man_t * p, int fVerbose ) } -/*=== plaFxch.c ========================================================*/ -extern int Pla_ManPerformFxch( Pla_Man_t * p ); + /*=== plaHash.c ========================================================*/ extern int Pla_ManHashDist1NumTest( Pla_Man_t * p ); extern void Pla_ManComputeDist1Test( Pla_Man_t * p ); @@ -296,4 +295,3 @@ ABC_NAMESPACE_HEADER_END //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// - diff --git a/src/base/pla/plaCom.c b/src/base/pla/plaCom.c index 77fd921c..9060f371 100644 --- a/src/base/pla/plaCom.c +++ b/src/base/pla/plaCom.c @@ -9,7 +9,7 @@ Synopsis [Scalable SOP transformations.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - March 18, 2015.] @@ -396,7 +396,7 @@ usage: Description [] - SideEffects [] + SideEffects [] SeeAlso [] @@ -488,7 +488,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) //Pla_ManFxPerformSimple( nVars ); //Pla_ManConvertFromBits( p ); //Pla_ManConvertToBits( p ); - Pla_ManPerformFxch( p ); + //Pla_ManPerformFxch( p ); return 0; usage: Abc_Print( -2, "usage: |test [-N num] [-vh]\n" ); @@ -505,4 +505,3 @@ usage: ABC_NAMESPACE_IMPL_END - |