Commit 93d89eaa by Alan Mishchenko

Various modifications.

parent 9c8db283
...@@ -3811,6 +3811,10 @@ SOURCE=.\src\aig\gia\giaKf.c ...@@ -3811,6 +3811,10 @@ SOURCE=.\src\aig\gia\giaKf.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\aig\gia\giaLf.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaMan.c SOURCE=.\src\aig\gia\giaMan.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -197,6 +197,7 @@ struct Gps_Par_t_ ...@@ -197,6 +197,7 @@ struct Gps_Par_t_
int fCut; int fCut;
int fNpn; int fNpn;
int fLutProf; int fLutProf;
int fMuxXor;
char * pDumpFile; char * pDumpFile;
}; };
...@@ -912,10 +913,14 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re ...@@ -912,10 +913,14 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re
for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- )
#define Gia_ManForEachAnd( p, pObj, i ) \ #define Gia_ManForEachAnd( p, pObj, i ) \
for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsAnd(pObj) ) {} else for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsAnd(pObj) ) {} else
#define Gia_ManForEachAndId( p, i ) \
for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsAnd(Gia_ManObj(p, i)) ) {} else
#define Gia_ManForEachCand( p, pObj, i ) \ #define Gia_ManForEachCand( p, pObj, i ) \
for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsCand(pObj) ) {} else for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsCand(pObj) ) {} else
#define Gia_ManForEachAndReverse( p, pObj, i ) \ #define Gia_ManForEachAndReverse( p, pObj, i ) \
for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) if ( !Gia_ObjIsAnd(pObj) ) {} else for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) if ( !Gia_ObjIsAnd(pObj) ) {} else
#define Gia_ManForEachAndReverseId( p, i ) \
for ( i = p->nObjs - 1; (i > 0); i-- ) if ( !Gia_ObjIsAnd(Gia_ManObj(p, i)) ) {} else
#define Gia_ManForEachMux( p, pObj, i ) \ #define Gia_ManForEachMux( p, pObj, i ) \
for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsMuxId(p, i) ) {} else for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsMuxId(p, i) ) {} else
#define Gia_ManForEachCi( p, pObj, i ) \ #define Gia_ManForEachCi( p, pObj, i ) \
...@@ -928,6 +933,8 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re ...@@ -928,6 +933,8 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re
for ( i = Vec_IntSize(p->vCos) - 1; (i >= 0) && ((pObj) = Gia_ManCo(p, i)); i-- ) for ( i = Vec_IntSize(p->vCos) - 1; (i >= 0) && ((pObj) = Gia_ManCo(p, i)); i-- )
#define Gia_ManForEachCoDriver( p, pObj, i ) \ #define Gia_ManForEachCoDriver( p, pObj, i ) \
for ( i = 0; (i < Vec_IntSize(p->vCos)) && ((pObj) = Gia_ObjFanin0(Gia_ManCo(p, i))); i++ ) for ( i = 0; (i < Vec_IntSize(p->vCos)) && ((pObj) = Gia_ObjFanin0(Gia_ManCo(p, i))); i++ )
#define Gia_ManForEachCoDriverId( p, DriverId, i ) \
for ( i = 0; (i < Vec_IntSize(p->vCos)) && (((DriverId) = Gia_ObjFaninId0p(p, Gia_ManCo(p, i))), 1); i++ )
#define Gia_ManForEachPi( p, pObj, i ) \ #define Gia_ManForEachPi( p, pObj, i ) \
for ( i = 0; (i < Gia_ManPiNum(p)) && ((pObj) = Gia_ManCi(p, i)); i++ ) for ( i = 0; (i < Gia_ManPiNum(p)) && ((pObj) = Gia_ManCi(p, i)); i++ )
#define Gia_ManForEachPo( p, pObj, i ) \ #define Gia_ManForEachPo( p, pObj, i ) \
...@@ -1114,6 +1121,7 @@ extern int Gia_ManLutNum( Gia_Man_t * p ); ...@@ -1114,6 +1121,7 @@ extern int Gia_ManLutNum( Gia_Man_t * p );
extern int Gia_ManLutLevel( Gia_Man_t * p ); extern int Gia_ManLutLevel( Gia_Man_t * p );
extern void Gia_ManSetRefsMapped( Gia_Man_t * p ); extern void Gia_ManSetRefsMapped( Gia_Man_t * p );
extern void Gia_ManSetIfParsDefault( void * pIfPars ); extern void Gia_ManSetIfParsDefault( void * pIfPars );
extern void Gia_ManMappingVerify( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pIfPars, int fNormalized ); extern Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pIfPars, int fNormalized );
/*=== giaJf.c ===========================================================*/ /*=== giaJf.c ===========================================================*/
extern void Jf_ManSetDefaultPars( Jf_Par_t * pPars ); extern void Jf_ManSetDefaultPars( Jf_Par_t * pPars );
...@@ -1269,6 +1277,7 @@ extern Vec_Int_t * Gia_ManRequiredLevel( Gia_Man_t * p ); ...@@ -1269,6 +1277,7 @@ extern Vec_Int_t * Gia_ManRequiredLevel( Gia_Man_t * p );
extern void Gia_ManCreateValueRefs( Gia_Man_t * p ); extern void Gia_ManCreateValueRefs( Gia_Man_t * p );
extern void Gia_ManCreateRefs( Gia_Man_t * p ); extern void Gia_ManCreateRefs( Gia_Man_t * p );
extern int * Gia_ManCreateMuxRefs( Gia_Man_t * p ); extern int * Gia_ManCreateMuxRefs( Gia_Man_t * p );
extern void Gia_ManCountMuxXor( Gia_Man_t * p, int * pnMuxes, int * pnXors );
extern int Gia_ManCrossCut( Gia_Man_t * p, int fReverse ); extern int Gia_ManCrossCut( Gia_Man_t * p, int fReverse );
extern int Gia_ManIsNormalized( Gia_Man_t * p ); extern int Gia_ManIsNormalized( Gia_Man_t * p );
extern Vec_Int_t * Gia_ManCollectPoIds( Gia_Man_t * p ); extern Vec_Int_t * Gia_ManCollectPoIds( Gia_Man_t * p );
......
...@@ -423,9 +423,24 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars ) ...@@ -423,9 +423,24 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
Abc_Print( 1, " ch =%5d", Gia_ManEquivCountClasses(p) ); Abc_Print( 1, " ch =%5d", Gia_ManEquivCountClasses(p) );
if ( p->pMuxes ) if ( p->pMuxes )
{ {
Abc_Print( 1, " and =%5d", Gia_ManAndNum(p)-Gia_ManXorNum(p)-Gia_ManMuxNum(p) ); int nAnds = Gia_ManAndNum(p)-Gia_ManXorNum(p)-Gia_ManMuxNum(p);
Abc_Print( 1, " xor =%5d", Gia_ManXorNum(p) ); int nXors = Gia_ManXorNum(p);
Abc_Print( 1, " mux =%5d", Gia_ManMuxNum(p) ); int nMuxes = Gia_ManMuxNum(p);
int nTotal = nAnds + 3*nXors + 3*nMuxes;
Abc_Print( 1, "\nXOR/MUX stats:" );
Abc_Print( 1, " xor =%8d (%6.2f %%) ", nXors, 300.0*nXors/nTotal );
Abc_Print( 1, " mux =%8d (%6.2f %%) ", nMuxes, 300.0*nMuxes/nTotal );
Abc_Print( 1, " and =%8d (%6.2f %%) ", nAnds, 100.0*nAnds/nTotal );
}
else if ( pPars->fMuxXor )
{
int nAnds, nMuxes, nXors, nTotal = Gia_ManAndNum(p);
Gia_ManCountMuxXor( p, &nMuxes, &nXors );
nAnds = Gia_ManAndNum(p)-3*nMuxes-3*nXors;
Abc_Print( 1, "\nXOR/MUX stats:" );
Abc_Print( 1, " xor =%8d (%6.2f %%) ", nXors, 300.0*nXors/nTotal );
Abc_Print( 1, " mux =%8d (%6.2f %%) ", nMuxes, 300.0*nMuxes/nTotal );
Abc_Print( 1, " and =%8d (%6.2f %%) ", nAnds, 100.0*nAnds/nTotal );
} }
if ( pPars && pPars->fSwitch ) if ( pPars && pPars->fSwitch )
{ {
......
...@@ -746,6 +746,34 @@ int * Gia_ManCreateMuxRefs( Gia_Man_t * p ) ...@@ -746,6 +746,34 @@ int * Gia_ManCreateMuxRefs( Gia_Man_t * p )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Assigns references.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManCountMuxXor( Gia_Man_t * p, int * pnMuxes, int * pnXors )
{
Gia_Obj_t * pObj, * pFan0, * pFan1;
int i;
*pnMuxes = 0;
*pnXors = 0;
Gia_ManForEachAnd( p, pObj, i )
{
if ( !Gia_ObjIsMuxType(pObj) )
continue;
if ( Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
(*pnXors)++;
else
(*pnMuxes)++;
}
}
/**Function*************************************************************
Synopsis [Computes the maximum frontier size.] Synopsis [Computes the maximum frontier size.]
Description [] Description []
......
...@@ -33,6 +33,7 @@ SRC += src/aig/gia/giaAig.c \ ...@@ -33,6 +33,7 @@ SRC += src/aig/gia/giaAig.c \
src/aig/gia/giaIso3.c \ src/aig/gia/giaIso3.c \
src/aig/gia/giaJf.c \ src/aig/gia/giaJf.c \
src/aig/gia/giaKf.c \ src/aig/gia/giaKf.c \
src/aig/gia/giaLf.c \
src/aig/gia/giaMan.c \ src/aig/gia/giaMan.c \
src/aig/gia/giaMem.c \ src/aig/gia/giaMem.c \
src/aig/gia/giaMfs.c \ src/aig/gia/giaMfs.c \
......
...@@ -480,6 +480,11 @@ static inline void Vec_IntUpdateEntry( Vec_Int_t * p, int i, int Value ) ...@@ -480,6 +480,11 @@ static inline void Vec_IntUpdateEntry( Vec_Int_t * p, int i, int Value )
if ( Vec_IntEntry( p, i ) < Value ) if ( Vec_IntEntry( p, i ) < Value )
Vec_IntWriteEntry( p, i, Value ); Vec_IntWriteEntry( p, i, Value );
} }
static inline void Vec_IntDowndateEntry( Vec_Int_t * p, int i, int Value )
{
if ( Vec_IntEntry( p, i ) > Value )
Vec_IntWriteEntry( p, i, Value );
}
/**Function************************************************************* /**Function*************************************************************
......
...@@ -558,14 +558,18 @@ static inline void Vec_PtrClear( Vec_Ptr_t * p ) ...@@ -558,14 +558,18 @@ static inline void Vec_PtrClear( Vec_Ptr_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
static inline void Vec_PtrFreeFree( Vec_Ptr_t * p ) static inline void Vec_PtrFreeData( Vec_Ptr_t * p )
{ {
void * pTemp; void * pTemp; int i;
int i;
if ( p == NULL ) return; if ( p == NULL ) return;
Vec_PtrForEachEntry( void *, p, pTemp, i ) Vec_PtrForEachEntry( void *, p, pTemp, i )
if ( pTemp != (void *)(ABC_PTRINT_T)1 && pTemp != (void *)(ABC_PTRINT_T)2 ) if ( pTemp != (void *)(ABC_PTRINT_T)1 && pTemp != (void *)(ABC_PTRINT_T)2 )
ABC_FREE( pTemp ); ABC_FREE( pTemp );
}
static inline void Vec_PtrFreeFree( Vec_Ptr_t * p )
{
if ( p == NULL ) return;
Vec_PtrFreeData( p );
Vec_PtrFree( p ); Vec_PtrFree( p );
} }
......
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