Commit 1faab72a by Alan Mishchenko

Experiments with support minimization.

parent 0de189f4
...@@ -4807,6 +4807,10 @@ SOURCE=.\src\aig\gia\giaSupMin.c ...@@ -4807,6 +4807,10 @@ SOURCE=.\src\aig\gia\giaSupMin.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\aig\gia\giaSupp.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaSweep.c SOURCE=.\src\aig\gia\giaSweep.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -577,6 +577,7 @@ static inline int Gia_ObjIsTravIdCurrent( Gia_Man_t * p, Gia_Obj_t * pO ...@@ -577,6 +577,7 @@ static inline int Gia_ObjIsTravIdCurrent( Gia_Man_t * p, Gia_Obj_t * pO
static inline int Gia_ObjIsTravIdPrevious( Gia_Man_t * p, Gia_Obj_t * pObj ) { assert( Gia_ObjId(p, pObj) < p->nTravIdsAlloc ); return (p->pTravIds[Gia_ObjId(p, pObj)] == p->nTravIds - 1); } static inline int Gia_ObjIsTravIdPrevious( Gia_Man_t * p, Gia_Obj_t * pObj ) { assert( Gia_ObjId(p, pObj) < p->nTravIdsAlloc ); return (p->pTravIds[Gia_ObjId(p, pObj)] == p->nTravIds - 1); }
static inline void Gia_ObjSetTravIdCurrentId( Gia_Man_t * p, int Id ) { assert( Id < p->nTravIdsAlloc ); p->pTravIds[Id] = p->nTravIds; } static inline void Gia_ObjSetTravIdCurrentId( Gia_Man_t * p, int Id ) { assert( Id < p->nTravIdsAlloc ); p->pTravIds[Id] = p->nTravIds; }
static inline int Gia_ObjIsTravIdCurrentId( Gia_Man_t * p, int Id ) { assert( Id < p->nTravIdsAlloc ); return (p->pTravIds[Id] == p->nTravIds); } static inline int Gia_ObjIsTravIdCurrentId( Gia_Man_t * p, int Id ) { assert( Id < p->nTravIdsAlloc ); return (p->pTravIds[Id] == p->nTravIds); }
static inline int Gia_ObjIsTravIdPreviousId( Gia_Man_t * p, int Id ) { assert( Id < p->nTravIdsAlloc ); return (p->pTravIds[Id] == p->nTravIds - 1); }
static inline void Gia_ManTimeClean( Gia_Man_t * p ) { int i; assert( p->vTiming != NULL ); Vec_FltFill(p->vTiming, 3*Gia_ManObjNum(p), 0); for ( i = 0; i < Gia_ManObjNum(p); i++ ) Vec_FltWriteEntry( p->vTiming, 3*i+1, (float)(ABC_INFINITY) ); } static inline void Gia_ManTimeClean( Gia_Man_t * p ) { int i; assert( p->vTiming != NULL ); Vec_FltFill(p->vTiming, 3*Gia_ManObjNum(p), 0); for ( i = 0; i < Gia_ManObjNum(p); i++ ) Vec_FltWriteEntry( p->vTiming, 3*i+1, (float)(ABC_INFINITY) ); }
static inline void Gia_ManTimeStart( Gia_Man_t * p ) { assert( p->vTiming == NULL ); p->vTiming = Vec_FltAlloc(0); Gia_ManTimeClean( p ); } static inline void Gia_ManTimeStart( Gia_Man_t * p ) { assert( p->vTiming == NULL ); p->vTiming = Vec_FltAlloc(0); Gia_ManTimeClean( p ); }
...@@ -1464,6 +1465,11 @@ extern int Gia_ManComputeOneWin( Gia_Man_t * p, int iPivot, Vec_ ...@@ -1464,6 +1465,11 @@ extern int Gia_ManComputeOneWin( Gia_Man_t * p, int iPivot, Vec_
/*=== giaStg.c ============================================================*/ /*=== giaStg.c ============================================================*/
extern void Gia_ManStgPrint( FILE * pFile, Vec_Int_t * vLines, int nIns, int nOuts, int nStates ); extern void Gia_ManStgPrint( FILE * pFile, Vec_Int_t * vLines, int nIns, int nOuts, int nStates );
extern Gia_Man_t * Gia_ManStgRead( char * pFileName, int kHot, int fVerbose ); extern Gia_Man_t * Gia_ManStgRead( char * pFileName, int kHot, int fVerbose );
/*=== giaSupp.c ============================================================*/
typedef struct Gia_ManMin_t_ Gia_ManMin_t;
extern Gia_ManMin_t * Gia_ManSuppStart( Gia_Man_t * pGia );
extern void Gia_ManSuppStop( Gia_ManMin_t * p );
extern int Gia_ManSupportAnd( Gia_ManMin_t * p, int iLit0, int iLit1 );
/*=== giaSweep.c ============================================================*/ /*=== giaSweep.c ============================================================*/
extern Gia_Man_t * Gia_ManFraigSweepSimple( Gia_Man_t * p, void * pPars ); extern Gia_Man_t * Gia_ManFraigSweepSimple( Gia_Man_t * p, void * pPars );
extern Gia_Man_t * Gia_ManSweepWithBoxes( Gia_Man_t * p, void * pParsC, void * pParsS, int fConst, int fEquiv, int fVerbose, int fVerbEquivs ); extern Gia_Man_t * Gia_ManSweepWithBoxes( Gia_Man_t * p, void * pParsC, void * pParsS, int fConst, int fEquiv, int fVerbose, int fVerbEquivs );
......
...@@ -76,6 +76,7 @@ SRC += src/aig/gia/giaAig.c \ ...@@ -76,6 +76,7 @@ SRC += src/aig/gia/giaAig.c \
src/aig/gia/giaStg.c \ src/aig/gia/giaStg.c \
src/aig/gia/giaStr.c \ src/aig/gia/giaStr.c \
src/aig/gia/giaSupMin.c \ src/aig/gia/giaSupMin.c \
src/aig/gia/giaSupp.c \
src/aig/gia/giaSweep.c \ src/aig/gia/giaSweep.c \
src/aig/gia/giaSweeper.c \ src/aig/gia/giaSweeper.c \
src/aig/gia/giaSwitch.c \ src/aig/gia/giaSwitch.c \
......
...@@ -58,8 +58,8 @@ static DdNode * cuddBddPermuteRecur ARGS( ( DdManager * manager, DdHashTable * t ...@@ -58,8 +58,8 @@ static DdNode * cuddBddPermuteRecur ARGS( ( DdManager * manager, DdHashTable * t
static DdNode * extraBddAndPermute( DdHashTable * table, DdManager * ddF, DdNode * bF, DdManager * ddG, DdNode * bG, int * pPermute ); static DdNode * extraBddAndPermute( DdHashTable * table, DdManager * ddF, DdNode * bF, DdManager * ddG, DdNode * bG, int * pPermute );
// file "cuddUtils.c" // file "cuddUtils.c"
static void ddSupportStep(DdNode *f, int *support); void ddSupportStep2(DdNode *f, int *support);
static void ddClearFlag(DdNode *f); void ddClearFlag2(DdNode *f);
static DdNode* extraZddPrimes( DdManager *dd, DdNode* F ); static DdNode* extraZddPrimes( DdManager *dd, DdNode* F );
...@@ -547,8 +547,8 @@ Extra_SupportArray( ...@@ -547,8 +547,8 @@ Extra_SupportArray(
support[i] = 0; support[i] = 0;
/* Compute support and clean up markers. */ /* Compute support and clean up markers. */
ddSupportStep(Cudd_Regular(f),support); ddSupportStep2(Cudd_Regular(f),support);
ddClearFlag(Cudd_Regular(f)); ddClearFlag2(Cudd_Regular(f));
return(support); return(support);
...@@ -584,9 +584,9 @@ Extra_VectorSupportArray( ...@@ -584,9 +584,9 @@ Extra_VectorSupportArray(
/* Compute support and clean up markers. */ /* Compute support and clean up markers. */
for ( i = 0; i < n; i++ ) for ( i = 0; i < n; i++ )
ddSupportStep( Cudd_Regular(F[i]), support ); ddSupportStep2( Cudd_Regular(F[i]), support );
for ( i = 0; i < n; i++ ) for ( i = 0; i < n; i++ )
ddClearFlag( Cudd_Regular(F[i]) ); ddClearFlag2( Cudd_Regular(F[i]) );
return support; return support;
} }
...@@ -782,8 +782,8 @@ DdNode * Extra_bddSupportNegativeCube( DdManager * dd, DdNode * f ) ...@@ -782,8 +782,8 @@ DdNode * Extra_bddSupportNegativeCube( DdManager * dd, DdNode * f )
} }
/* Compute support and clean up markers. */ /* Compute support and clean up markers. */
ddSupportStep( Cudd_Regular( f ), support ); ddSupportStep2( Cudd_Regular( f ), support );
ddClearFlag( Cudd_Regular( f ) ); ddClearFlag2( Cudd_Regular( f ) );
/* Transform support from array to cube. */ /* Transform support from array to cube. */
do do
...@@ -1689,8 +1689,8 @@ extraTransferPermuteRecur( ...@@ -1689,8 +1689,8 @@ extraTransferPermuteRecur(
SeeAlso [ddClearFlag] SeeAlso [ddClearFlag]
******************************************************************************/ ******************************************************************************/
static void void
ddSupportStep( ddSupportStep2(
DdNode * f, DdNode * f,
int * support) int * support)
{ {
...@@ -1699,8 +1699,8 @@ ddSupportStep( ...@@ -1699,8 +1699,8 @@ ddSupportStep(
} }
support[f->index] = 1; support[f->index] = 1;
ddSupportStep(cuddT(f),support); ddSupportStep2(cuddT(f),support);
ddSupportStep(Cudd_Regular(cuddE(f)),support); ddSupportStep2(Cudd_Regular(cuddE(f)),support);
/* Mark as visited. */ /* Mark as visited. */
f->next = Cudd_Not(f->next); f->next = Cudd_Not(f->next);
return; return;
...@@ -1720,8 +1720,8 @@ ddSupportStep( ...@@ -1720,8 +1720,8 @@ ddSupportStep(
SeeAlso [ddSupportStep ddDagInt] SeeAlso [ddSupportStep ddDagInt]
******************************************************************************/ ******************************************************************************/
static void void
ddClearFlag( ddClearFlag2(
DdNode * f) DdNode * f)
{ {
if (!Cudd_IsComplement(f->next)) { if (!Cudd_IsComplement(f->next)) {
...@@ -1732,8 +1732,8 @@ ddClearFlag( ...@@ -1732,8 +1732,8 @@ ddClearFlag(
if (cuddIsConstant(f)) { if (cuddIsConstant(f)) {
return; return;
} }
ddClearFlag(cuddT(f)); ddClearFlag2(cuddT(f));
ddClearFlag(Cudd_Regular(cuddE(f))); ddClearFlag2(Cudd_Regular(cuddE(f)));
return; return;
} /* end of ddClearFlag */ } /* end of ddClearFlag */
......
...@@ -159,8 +159,8 @@ Iter 12 -> 3674160 Time = 70.48 sec ...@@ -159,8 +159,8 @@ Iter 12 -> 3674160 Time = 70.48 sec
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
static inline int Abc_DataHasBit( word * p, word i ) { return (p[(i)>>6] & (1<<((i) & 63))) > 0; } static inline int Abc_DataHasBit( word * p, word i ) { return (p[(i)>>6] & (((word)1)<<((i) & 63))) > 0; }
static inline void Abc_DataXorBit( word * p, word i ) { p[(i)>>6] ^= (1<<((i) & 63)); } static inline void Abc_DataXorBit( word * p, word i ) { p[(i)>>6] ^= (((word)1)<<((i) & 63)); }
static inline int Abc_DataGetCube( word w, int i ) { return (w >> (5*i)) & 31; } static inline int Abc_DataGetCube( word w, int i ) { return (w >> (5*i)) & 31; }
static inline word Abc_DataXorCube( word w, int i, int c ) { return w ^ (((word)c) << (5*i)); } static inline word Abc_DataXorCube( word w, int i, int c ) { return w ^ (((word)c) << (5*i)); }
static inline word Abc_CubeGenerateSign( char * pState ) static inline word Abc_CubeGenerateSign( char * pState )
......
...@@ -298,8 +298,8 @@ void Abc_EnumPrint( Vec_Int_t * vGates, int i, int nVars ) ...@@ -298,8 +298,8 @@ void Abc_EnumPrint( Vec_Int_t * vGates, int i, int nVars )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
static inline int Abc_DataHasBit( word * p, word i ) { return (p[(i)>>6] & (1<<((i) & 63))) > 0; } static inline int Abc_DataHasBit( word * p, word i ) { return (p[(i)>>6] & (((word)1)<<((i) & 63))) > 0; }
static inline void Abc_DataXorBit( word * p, word i ) { p[(i)>>6] ^= (1<<((i) & 63)); } static inline void Abc_DataXorBit( word * p, word i ) { p[(i)>>6] ^= (((word)1)<<((i) & 63)); }
/**Function************************************************************* /**Function*************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment