summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/aig/gia/gia.h8
-rw-r--r--src/aig/gia/giaAiger.c4
-rw-r--r--src/aig/gia/giaDup.c22
-rw-r--r--src/aig/gia/giaIf.c8
-rw-r--r--src/aig/gia/giaLf.c4
-rw-r--r--src/aig/gia/giaMan.c6
-rw-r--r--src/aig/gia/giaMf.c31
-rw-r--r--src/aig/gia/giaMuxes.c53
-rw-r--r--src/aig/gia/giaScl.c1
-rw-r--r--src/aig/gia/giaTim.c4
-rw-r--r--src/aig/gia/giaUtil.c24
-rw-r--r--src/base/abci/abc.c10
-rw-r--r--src/map/mpm/mpmAbc.c4
-rw-r--r--src/opt/dar/darLib.c2
14 files changed, 115 insertions, 66 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index 46e20a5b..85bf8ab0 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -268,6 +268,7 @@ struct Jf_Par_t_
int fCnfObjIds;
int fAddOrCla;
int fPureAig;
+ int fDoAverage;
int fCutHashing;
int fCutSimple;
int fVerbose;
@@ -279,6 +280,8 @@ struct Jf_Par_t_
word Area;
word Edge;
word Clause;
+ float * pTimesArr;
+ float * pTimesReq;
};
static inline unsigned Gia_ObjCutSign( unsigned ObjId ) { return (1 << (ObjId & 31)); }
@@ -368,6 +371,7 @@ static inline int Gia_ManCandNum( Gia_Man_t * p ) { return Gia_ManC
static inline int Gia_ManConstrNum( Gia_Man_t * p ) { return p->nConstrs; }
static inline void Gia_ManFlipVerbose( Gia_Man_t * p ) { p->fVerbose ^= 1; }
static inline int Gia_ManHasChoices( Gia_Man_t * p ) { return p->pSibls != NULL; }
+static inline int Gia_ManChoiceNum( Gia_Man_t * p ) { int c = 0; if (p->pSibls) { int i; for (i = 0; i < p->nObjs; i++) c += (int)(p->pSibls[i] > 0); } return c; }
static inline Gia_Obj_t * Gia_ManConst0( Gia_Man_t * p ) { return p->pObjs; }
static inline Gia_Obj_t * Gia_ManConst1( Gia_Man_t * p ) { return Gia_Not(Gia_ManConst0(p)); }
@@ -1155,6 +1159,7 @@ extern int Gia_ManLutLevel( Gia_Man_t * p );
extern void Gia_ManSetRefsMapped( Gia_Man_t * p );
extern void Gia_ManSetIfParsDefault( void * pIfPars );
extern void Gia_ManMappingVerify( Gia_Man_t * p );
+extern void Gia_ManTransferMapping( Gia_Man_t * pGia, Gia_Man_t * p );
extern Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pIfPars, int fNormalized );
/*=== giaJf.c ===========================================================*/
extern void Jf_ManSetDefaultPars( Jf_Par_t * pPars );
@@ -1167,6 +1172,7 @@ extern Gia_Man_t * Gia_ManIsoReduce2( Gia_Man_t * p, Vec_Ptr_t ** pvPosE
/*=== giaLf.c ===========================================================*/
extern void Lf_ManSetDefaultPars( Jf_Par_t * pPars );
extern Gia_Man_t * Lf_ManPerformMapping( Gia_Man_t * pGia, Jf_Par_t * pPars );
+extern Gia_Man_t * Gia_ManPerformLfMapping( Gia_Man_t * p, Jf_Par_t * pPars, int fNormalized );
/*=== giaLogic.c ===========================================================*/
extern void Gia_ManTestDistance( Gia_Man_t * p );
extern void Gia_ManSolveProblem( Gia_Man_t * pGia, Emb_Par_t * pPars );
@@ -1306,7 +1312,7 @@ extern void Gia_ManCleanValue( Gia_Man_t * p );
extern void Gia_ManCleanLevels( Gia_Man_t * p, int Size );
extern void Gia_ManCleanTruth( Gia_Man_t * p );
extern void Gia_ManFillValue( Gia_Man_t * p );
-extern void Gia_ObjSetPhase( Gia_Obj_t * pObj );
+extern void Gia_ObjSetPhase( Gia_Man_t * p, Gia_Obj_t * pObj );
extern void Gia_ManSetPhase( Gia_Man_t * p );
extern void Gia_ManSetPhasePattern( Gia_Man_t * p, Vec_Int_t * vCiValues );
extern void Gia_ManSetPhase1( Gia_Man_t * p );
diff --git a/src/aig/gia/giaAiger.c b/src/aig/gia/giaAiger.c
index a0bc1cb4..6821aab2 100644
--- a/src/aig/gia/giaAiger.c
+++ b/src/aig/gia/giaAiger.c
@@ -656,7 +656,7 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
else if ( *pCur == 'q' )
{
int i, nPairs, iRepr, iNode;
- assert( pNew->pSibls == NULL );
+ assert( !Gia_ManHasChoices(pNew) );
pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(pNew) );
pCur++;
pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
@@ -1239,7 +1239,7 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
fwrite( p->pPlacement, 1, 4*Gia_ManObjNum(p), pFile );
}
// write choices
- if ( p->pSibls )
+ if ( Gia_ManHasChoices(p) )
{
int i, nPairs = 0;
fprintf( pFile, "q" );
diff --git a/src/aig/gia/giaDup.c b/src/aig/gia/giaDup.c
index 269c2215..d8ddff38 100644
--- a/src/aig/gia/giaDup.c
+++ b/src/aig/gia/giaDup.c
@@ -525,7 +525,7 @@ Gia_Man_t * Gia_ManDup( Gia_Man_t * p )
pNew = Gia_ManStart( Gia_ManObjNum(p) );
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
- if ( p->pSibls )
+ if ( Gia_ManHasChoices(p) )
pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
Gia_ManConst0(p)->Value = 0;
Gia_ManForEachObj1( p, pObj, i )
@@ -975,7 +975,7 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
if ( p->pReprs && p->pNexts )
{
Gia_Obj_t * pRepr;
- pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(p) );
+ pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(pNew) );
for ( i = 0; i < Gia_ManObjNum(p); i++ )
Gia_ObjSetRepr( pNew, i, GIA_VOID );
Gia_ManForEachObj1( p, pObj, i )
@@ -985,7 +985,6 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
pRepr = Gia_ObjReprObj( p, i );
if ( pRepr == NULL )
continue;
-// assert( ~pRepr->Value );
if ( !~pRepr->Value )
continue;
if ( Abc_Lit2Var(pObj->Value) != Abc_Lit2Var(pRepr->Value) )
@@ -993,6 +992,23 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
}
pNew->pNexts = Gia_ManDeriveNexts( pNew );
}
+ if ( Gia_ManHasChoices(p) )
+ {
+ Gia_Obj_t * pSibl;
+ pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(pNew) );
+ Gia_ManForEachObj1( p, pObj, i )
+ {
+ if ( !~pObj->Value )
+ continue;
+ pSibl = Gia_ObjSiblObj( p, i );
+ if ( pSibl == NULL )
+ continue;
+ if ( !~pSibl->Value )
+ continue;
+ assert( Abc_Lit2Var(pObj->Value) > Abc_Lit2Var(pSibl->Value) );
+ pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(pSibl->Value);
+ }
+ }
return pNew;
}
diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c
index a1541da7..22b48f0e 100644
--- a/src/aig/gia/giaIf.c
+++ b/src/aig/gia/giaIf.c
@@ -597,8 +597,8 @@ If_Man_t * Gia_ManToIf( Gia_Man_t * p, If_Par_t * pPars )
// create levels with choices
Gia_ManChoiceLevel( p );
// mark representative nodes
- if ( p->pSibls )
- Gia_ManMarkFanoutDrivers( p );
+ if ( Gia_ManHasChoices(p) )
+ Gia_ManMarkFanoutDrivers( p );
// start the mapping manager and set its parameters
pIfMan = If_ManStart( pPars );
pIfMan->pName = Abc_UtilStrsav( Gia_ManName(p) );
@@ -640,8 +640,8 @@ If_Man_t * Gia_ManToIf( Gia_Man_t * p, If_Par_t * pPars )
}
// assert( If_ObjLevel(pIfObj) == Gia_ObjLevel(pNode) );
}
- if ( p->pSibls )
- Gia_ManCleanMark0( p );
+ if ( Gia_ManHasChoices(p) )
+ Gia_ManCleanMark0( p );
return pIfMan;
}
diff --git a/src/aig/gia/giaLf.c b/src/aig/gia/giaLf.c
index 96a633f4..ebd0dc18 100644
--- a/src/aig/gia/giaLf.c
+++ b/src/aig/gia/giaLf.c
@@ -52,6 +52,10 @@ Gia_Man_t * Lf_ManPerformMapping( Gia_Man_t * pGia, Jf_Par_t * pPars )
{
return Jf_ManPerformMapping( pGia, pPars );
}
+Gia_Man_t * Gia_ManPerformLfMapping( Gia_Man_t * p, Jf_Par_t * pPars, int fNormalized )
+{
+ return Jf_ManPerformMapping( p, pPars );
+}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c
index b229b189..75c7d66a 100644
--- a/src/aig/gia/giaMan.c
+++ b/src/aig/gia/giaMan.c
@@ -424,8 +424,8 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
if ( pPars && pPars->fCut )
Abc_Print( 1, " cut = %d(%d)", Gia_ManCrossCut(p, 0), Gia_ManCrossCut(p, 1) );
Abc_Print( 1, " mem =%5.2f MB", Gia_ManMemory(p)/(1<<20) );
- if ( Gia_ManHasDangling(p) )
- Abc_Print( 1, " ch =%5d", Gia_ManEquivCountClasses(p) );
+ if ( Gia_ManHasChoices(p) )
+ Abc_Print( 1, " ch =%5d", Gia_ManChoiceNum(p) );
if ( pPars && pPars->fMuxXor )
printf( "\nXOR/MUX " ), Gia_ManPrintMuxStats( p );
if ( pPars && pPars->fSwitch )
@@ -445,8 +445,6 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
// Gia_ManSatExperiment( p );
if ( p->pReprs && p->pNexts )
Gia_ManEquivPrintClasses( p, 0, 0.0 );
- if ( p->pSibls )
- Gia_ManPrintChoiceStats( p );
if ( Gia_ManHasMapping(p) && (pPars == NULL || !pPars->fSkipMap) )
Gia_ManPrintMappingStats( p, pPars ? pPars->pDumpFile : NULL );
if ( pPars && pPars->fNpn && Gia_ManHasMapping(p) && Gia_ManLutSizeMax(p) <= 4 )
diff --git a/src/aig/gia/giaMf.c b/src/aig/gia/giaMf.c
index fa48a8c9..0ff54c8d 100644
--- a/src/aig/gia/giaMf.c
+++ b/src/aig/gia/giaMf.c
@@ -646,7 +646,7 @@ static inline void Mf_CutPrint( Mf_Man_t * p, Mf_Cut_t * pCut )
else
printf( "\n" );
}
-static inline int Mf_ManPrepareCuts( Mf_Cut_t * pCuts, Mf_Man_t * p, int iObj )
+static inline int Mf_ManPrepareCuts( Mf_Cut_t * pCuts, Mf_Man_t * p, int iObj, int fAddUnit )
{
if ( Mf_ManObj(p, iObj)->iCutSet )
{
@@ -662,7 +662,7 @@ static inline int Mf_ManPrepareCuts( Mf_Cut_t * pCuts, Mf_Man_t * p, int iObj )
memcpy( pMfCut->pLeaves, pCut+1, sizeof(int) * Mf_CutSize(pCut) );
pMfCut++;
}
- if ( pCuts->nLeaves > 1 )
+ if ( fAddUnit && pCuts->nLeaves > 1 )
return pList[0] + Mf_CutCreateUnit( pMfCut, iObj );
return pList[0];
}
@@ -969,18 +969,35 @@ void Mf_ObjMergeOrder( Mf_Man_t * p, int iObj )
Mf_Obj_t * pBest = Mf_ManObj(p, iObj);
int nLutSize = p->pPars->nLutSize;
int nCutNum = p->pPars->nCutNum;
- int nCuts0 = Mf_ManPrepareCuts(pCuts0, p, Gia_ObjFaninId0(pObj, iObj));
- int nCuts1 = Mf_ManPrepareCuts(pCuts1, p, Gia_ObjFaninId1(pObj, iObj));
+ int nCuts0 = Mf_ManPrepareCuts(pCuts0, p, Gia_ObjFaninId0(pObj, iObj), 1);
+ int nCuts1 = Mf_ManPrepareCuts(pCuts1, p, Gia_ObjFaninId1(pObj, iObj), 1);
int fComp0 = Gia_ObjFaninC0(pObj);
int fComp1 = Gia_ObjFaninC1(pObj);
+ int iSibl = Gia_ObjSibl(p->pGia, iObj);
Mf_Cut_t * pCut0, * pCut1, * pCut0Lim = pCuts0 + nCuts0, * pCut1Lim = pCuts1 + nCuts1;
int i, nCutsR = 0;
for ( i = 0; i < nCutNum; i++ )
pCutsR[i] = pCuts + i;
+ if ( iSibl )
+ {
+ Mf_Cut_t pCuts2[MF_CUT_MAX];
+ Gia_Obj_t * pObjE = Gia_ObjSiblObj(p->pGia, iObj);
+ int fCompE = Gia_ObjPhase(pObj) ^ Gia_ObjPhase(pObjE);
+ int nCuts2 = Mf_ManPrepareCuts(pCuts2, p, iSibl, 0);
+ Mf_Cut_t * pCut2, * pCut2Lim = pCuts2 + nCuts2;
+ for ( pCut2 = pCuts2; pCut2 < pCut2Lim; pCut2++ )
+ {
+ *pCutsR[nCutsR] = *pCut2;
+ if ( pCutsR[nCutsR]->iFunc >= 0 )
+ pCutsR[nCutsR]->iFunc = Abc_LitNotCond( pCutsR[nCutsR]->iFunc, fCompE );
+ Mf_CutParams( p, pCutsR[nCutsR], pBest->nFlowRefs );
+ nCutsR = Mf_SetAddCut( pCutsR, nCutsR, nCutNum );
+ }
+ }
if ( Gia_ObjIsMuxId(p->pGia, iObj) )
{
Mf_Cut_t pCuts2[MF_CUT_MAX];
- int nCuts2 = Mf_ManPrepareCuts(pCuts2, p, Gia_ObjFaninId2(p->pGia, iObj));
+ int nCuts2 = Mf_ManPrepareCuts(pCuts2, p, Gia_ObjFaninId2(p->pGia, iObj), 1);
int fComp2 = Gia_ObjFaninC2(p->pGia, pObj);
Mf_Cut_t * pCut2, * pCut2Lim = pCuts2 + nCuts2;
p->CutCount[0] += nCuts0 * nCuts1 * nCuts2;
@@ -1309,6 +1326,8 @@ Mf_Man_t * Mf_ManAlloc( Gia_Man_t * pGia, Jf_Par_t * pPars )
assert( pPars->nLutSize > 1 && pPars->nLutSize <= MF_LEAF_MAX );
ABC_FREE( pGia->pRefs );
Vec_IntFreeP( &pGia->vMapping );
+ if ( Gia_ManHasChoices(pGia) )
+ Gia_ManSetPhase(pGia);
p = ABC_CALLOC( Mf_Man_t, 1 );
p->clkStart = Abc_Clock();
p->pGia = pGia;
@@ -1557,6 +1576,8 @@ Gia_Man_t * Mf_ManPerformMapping( Gia_Man_t * pGia, Jf_Par_t * pPars )
Gia_Man_t * pNew, * pCls;
if ( pPars->fGenCnf )
pPars->fCutMin = 1;
+ if ( Gia_ManHasChoices(pGia) )
+ pPars->fCutMin = 1, pPars->fCoarsen = 0;
pCls = pPars->fCoarsen ? Gia_ManDupMuxes(pGia, pPars->nCoarseLimit) : pGia;
p = Mf_ManAlloc( pCls, pPars );
p->pGia0 = pGia;
diff --git a/src/aig/gia/giaMuxes.c b/src/aig/gia/giaMuxes.c
index 897f3388..96dda567 100644
--- a/src/aig/gia/giaMuxes.c
+++ b/src/aig/gia/giaMuxes.c
@@ -96,7 +96,7 @@ void Gia_ManPrintMuxStats( Gia_Man_t * p )
Gia_Man_t * Gia_ManDupMuxes( Gia_Man_t * p, int Limit )
{
Gia_Man_t * pNew, * pTemp;
- Gia_Obj_t * pObj, * pFan0, * pFan1, * pFanC;
+ Gia_Obj_t * pObj, * pFan0, * pFan1, * pFanC, * pSiblNew, * pObjNew;
int i;
assert( p->pMuxes == NULL );
assert( Limit >= 2 );
@@ -107,27 +107,17 @@ Gia_Man_t * Gia_ManDupMuxes( Gia_Man_t * p, int Limit )
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
pNew->pMuxes = ABC_CALLOC( unsigned, pNew->nObjsAlloc );
- // create constant
+ if ( Gia_ManHasChoices(p) )
+ pNew->pSibls = ABC_CALLOC( int, pNew->nObjsAlloc );
Gia_ManConst0(p)->Value = 0;
- // create PIs
- Gia_ManForEachCi( p, pObj, i )
- pObj->Value = Gia_ManAppendCi( pNew );
- // create internal nodes
Gia_ManHashStart( pNew );
- Gia_ManForEachAnd( p, pObj, i )
+ Gia_ManForEachObj1( p, pObj, i )
{
-/*
- if ( !Gia_ObjIsMuxType(pObj) || Gia_ObjRefNum(p, Gia_ObjFanin0(pObj)) + Gia_ObjRefNum(p, Gia_ObjFanin1(pObj)) > Limit )
- pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
- else if ( Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
- pObj->Value = Gia_ManHashXorReal( pNew, Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan0)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan1)) );
- else
- {
- pFanC = Gia_ObjRecognizeMux( pObj, &pFan1, &pFan0 );
- pObj->Value = Gia_ManHashMuxReal( pNew, Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFanC)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan1)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan0)) );
- }
-*/
- if ( !Gia_ObjIsMuxType(pObj) )
+ if ( Gia_ObjIsCi(pObj) )
+ pObj->Value = Gia_ManAppendCi( pNew );
+ else if ( Gia_ObjIsCo(pObj) )
+ pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
+ else if ( !Gia_ObjIsMuxType(pObj) || Gia_ObjSibl(p, Gia_ObjFaninId0(pObj, i)) || Gia_ObjSibl(p, Gia_ObjFaninId1(pObj, i)) )
pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
else if ( Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
pObj->Value = Gia_ManHashXorReal( pNew, Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan0)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan1)) );
@@ -138,11 +128,14 @@ Gia_Man_t * Gia_ManDupMuxes( Gia_Man_t * p, int Limit )
pFanC = Gia_ObjRecognizeMux( pObj, &pFan1, &pFan0 );
pObj->Value = Gia_ManHashMuxReal( pNew, Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFanC)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan1)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan0)) );
}
+ if ( !Gia_ObjSibl(p, i) )
+ continue;
+ pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(pObj->Value) );
+ pSiblNew = Gia_ManObj( pNew, Abc_Lit2Var(Gia_ObjSiblObj(p, i)->Value) );
+ if ( Gia_ObjIsAnd(pObjNew) && Gia_ObjIsAnd(pSiblNew) && Gia_ObjId(pNew, pObjNew) > Gia_ObjId(pNew, pSiblNew) )
+ pNew->pSibls[Gia_ObjId(pNew, pObjNew)] = Gia_ObjId(pNew, pSiblNew);
}
Gia_ManHashStop( pNew );
- // create ROs
- Gia_ManForEachCo( p, pObj, i )
- pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
// perform cleanup
pNew = Gia_ManCleanup( pTemp = pNew );
@@ -171,16 +164,15 @@ Gia_Man_t * Gia_ManDupNoMuxes( Gia_Man_t * p )
pNew = Gia_ManStart( 5000 );
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
- // create constant
Gia_ManConst0(p)->Value = 0;
- // create PIs
- Gia_ManForEachCi( p, pObj, i )
- pObj->Value = Gia_ManAppendCi( pNew );
- // create internal nodes
Gia_ManHashStart( pNew );
- Gia_ManForEachAnd( p, pObj, i )
+ Gia_ManForEachObj1( p, pObj, i )
{
- if ( Gia_ObjIsMuxId(p, i) )
+ if ( Gia_ObjIsCi(pObj) )
+ pObj->Value = Gia_ManAppendCi( pNew );
+ else if ( Gia_ObjIsCo(pObj) )
+ pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
+ else if ( Gia_ObjIsMuxId(p, i) )
pObj->Value = Gia_ManHashMux( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
else if ( Gia_ObjIsXor(pObj) )
pObj->Value = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
@@ -188,9 +180,6 @@ Gia_Man_t * Gia_ManDupNoMuxes( Gia_Man_t * p )
pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
}
Gia_ManHashStop( pNew );
- // create ROs
- Gia_ManForEachCo( p, pObj, i )
- pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
// perform cleanup
pNew = Gia_ManCleanup( pTemp = pNew );
diff --git a/src/aig/gia/giaScl.c b/src/aig/gia/giaScl.c
index 727ffa90..3aaf91dc 100644
--- a/src/aig/gia/giaScl.c
+++ b/src/aig/gia/giaScl.c
@@ -53,6 +53,7 @@ int Gia_ManCombMarkUsed_rec( Gia_Man_t * p, Gia_Obj_t * pObj )
return 1 + Gia_ManCombMarkUsed_rec( p, Gia_ObjFanin0(pObj) )
+ Gia_ManCombMarkUsed_rec( p, Gia_ObjFanin1(pObj) )
+ (p->pNexts ? Gia_ManCombMarkUsed_rec( p, Gia_ObjNextObj(p, Gia_ObjId(p, pObj)) ) : 0)
+ + (p->pSibls ? Gia_ManCombMarkUsed_rec( p, Gia_ObjSiblObj(p, Gia_ObjId(p, pObj)) ) : 0)
+ (p->pMuxes ? Gia_ManCombMarkUsed_rec( p, Gia_ObjFanin2(p, pObj) ) : 0);
}
diff --git a/src/aig/gia/giaTim.c b/src/aig/gia/giaTim.c
index b1321685..0e6a9252 100644
--- a/src/aig/gia/giaTim.c
+++ b/src/aig/gia/giaTim.c
@@ -208,7 +208,7 @@ Gia_Man_t * Gia_ManDupUnnormalize( Gia_Man_t * p )
pNew = Gia_ManStart( Gia_ManObjNum(p) );
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
- if ( p->pSibls )
+ if ( Gia_ManHasChoices(p) )
pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
Gia_ManForEachObjVec( vNodes, p, pObj, i )
{
@@ -297,7 +297,7 @@ Gia_Man_t * Gia_ManDupCollapse( Gia_Man_t * p, Gia_Man_t * pBoxes, Vec_Int_t * v
pNew = Gia_ManStart( Gia_ManObjNum(p) );
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
- if ( p->pSibls )
+ if ( Gia_ManHasChoices(p) )
pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
Gia_ManHashAlloc( pNew );
// copy const and real PIs
diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c
index e16ee44f..2febad3b 100644
--- a/src/aig/gia/giaUtil.c
+++ b/src/aig/gia/giaUtil.c
@@ -343,12 +343,22 @@ void Gia_ManFillValue( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
-void Gia_ObjSetPhase( Gia_Obj_t * pObj )
+void Gia_ObjSetPhase( Gia_Man_t * p, Gia_Obj_t * pObj )
{
- assert( !Gia_ObjIsXor(pObj) );
if ( Gia_ObjIsAnd(pObj) )
- pObj->fPhase = (Gia_ObjPhase(Gia_ObjFanin0(pObj)) ^ Gia_ObjFaninC0(pObj)) &
- (Gia_ObjPhase(Gia_ObjFanin1(pObj)) ^ Gia_ObjFaninC1(pObj));
+ {
+ int fPhase0 = Gia_ObjPhase(Gia_ObjFanin0(pObj)) ^ Gia_ObjFaninC0(pObj);
+ int fPhase1 = Gia_ObjPhase(Gia_ObjFanin1(pObj)) ^ Gia_ObjFaninC1(pObj);
+ if ( Gia_ObjIsMux(p, pObj) )
+ {
+ int fPhase2 = Gia_ObjPhase(Gia_ObjFanin2(p, pObj)) ^ Gia_ObjFaninC2(p, pObj);
+ pObj->fPhase = (fPhase2 & fPhase1) | (!fPhase2 & fPhase0);
+ }
+ else if ( Gia_ObjIsXor(pObj) )
+ pObj->fPhase = fPhase0 ^ fPhase1;
+ else
+ pObj->fPhase = fPhase0 & fPhase1;
+ }
else if ( Gia_ObjIsCo(pObj) )
pObj->fPhase = (Gia_ObjPhase(Gia_ObjFanin0(pObj)) ^ Gia_ObjFaninC0(pObj));
else
@@ -371,7 +381,7 @@ void Gia_ManSetPhase( Gia_Man_t * p )
Gia_Obj_t * pObj;
int i;
Gia_ManForEachObj( p, pObj, i )
- Gia_ObjSetPhase( pObj );
+ Gia_ObjSetPhase( p, pObj );
}
void Gia_ManSetPhasePattern( Gia_Man_t * p, Vec_Int_t * vCiValues )
{
@@ -382,7 +392,7 @@ void Gia_ManSetPhasePattern( Gia_Man_t * p, Vec_Int_t * vCiValues )
if ( Gia_ObjIsCi(pObj) )
pObj->fPhase = Vec_IntEntry( vCiValues, Gia_ObjCioId(pObj) );
else
- Gia_ObjSetPhase( pObj );
+ Gia_ObjSetPhase( p, pObj );
}
/**Function*************************************************************
@@ -404,7 +414,7 @@ void Gia_ManSetPhase1( Gia_Man_t * p )
pObj->fPhase = 1;
Gia_ManForEachObj( p, pObj, i )
if ( !Gia_ObjIsCi(pObj) )
- Gia_ObjSetPhase( pObj );
+ Gia_ObjSetPhase( p, pObj );
}
/**Function*************************************************************
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 57f0f62f..f6875464 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -31112,7 +31112,7 @@ int Abc_CommandAbc9Lf( Abc_Frame_t * pAbc, int argc, char ** argv )
Gia_Man_t * pNew; int c;
Lf_ManSetDefaultPars( pPars );
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "KCFARLDWaekmupgvwh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "KCFARLDWaekmupgtvwh" ) ) != EOF )
{
switch ( c )
{
@@ -31231,6 +31231,9 @@ int Abc_CommandAbc9Lf( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'g':
pPars->fPureAig ^= 1;
break;
+ case 't':
+ pPars->fDoAverage ^= 1;
+ break;
case 'v':
pPars->fVerbose ^= 1;
break;
@@ -31263,7 +31266,7 @@ usage:
sprintf(Buffer, "best possible" );
else
sprintf(Buffer, "%d", pPars->DelayTarget );
- Abc_Print( -2, "usage: &lf [-KCFARLD num] [-akmupgvwh]\n" );
+ Abc_Print( -2, "usage: &lf [-KCFARLD num] [-kmupgtvwh]\n" );
Abc_Print( -2, "\t performs technology mapping of the network\n" );
Abc_Print( -2, "\t-K num : LUT size for the mapping (2 <= K <= %d) [default = %d]\n", pPars->nLutSizeMax, pPars->nLutSize );
Abc_Print( -2, "\t-C num : the max number of priority cuts (1 <= C <= %d) [default = %d]\n", pPars->nCutNumMax, pPars->nCutNum );
@@ -31272,13 +31275,14 @@ usage:
Abc_Print( -2, "\t-R num : the delay relaxation ratio (num >= 0) [default = %d]\n", pPars->nRelaxRatio );
Abc_Print( -2, "\t-L num : the fanout limit for coarsening XOR/MUX (num >= 2) [default = %d]\n", pPars->nCoarseLimit );
Abc_Print( -2, "\t-D num : sets the delay constraint for the mapping [default = %s]\n", Buffer );
- Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fAreaOnly? "yes": "no" );
+// Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fAreaOnly? "yes": "no" );
Abc_Print( -2, "\t-e : toggles edge vs node minimization [default = %s]\n", pPars->fOptEdge? "yes": "no" );
Abc_Print( -2, "\t-k : toggles coarsening the subject graph [default = %s]\n", pPars->fCoarsen? "yes": "no" );
Abc_Print( -2, "\t-m : toggles cut minimization [default = %s]\n", pPars->fCutMin? "yes": "no" );
Abc_Print( -2, "\t-u : toggles using additional MUXes [default = %s]\n", pPars->fUseMux7? "yes": "no" );
Abc_Print( -2, "\t-p : toggles power-aware cut selection heuristics [default = %s]\n", pPars->fPower? "yes": "no" );
Abc_Print( -2, "\t-g : toggles generating AIG without mapping [default = %s]\n", pPars->fPureAig? "yes": "no" );
+ Abc_Print( -2, "\t-t : toggles optimizing average rather than maximum level [default = %s]\n", pPars->fDoAverage? "yes": "no" );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" );
Abc_Print( -2, "\t-w : toggles very verbose output [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : prints the command usage\n");
diff --git a/src/map/mpm/mpmAbc.c b/src/map/mpm/mpmAbc.c
index c2817241..65aab082 100644
--- a/src/map/mpm/mpmAbc.c
+++ b/src/map/mpm/mpmAbc.c
@@ -53,7 +53,7 @@ void Mig_ManCreateChoices( Mig_Man_t * pMig, Gia_Man_t * p )
Gia_ManMarkFanoutDrivers( p );
Gia_ManForEachObj( p, pObj, i )
{
- Gia_ObjSetPhase( pObj );
+ Gia_ObjSetPhase( p, pObj );
assert( Abc_Lit2Var(pObj->Value) == i );
Mig_ObjSetPhase( Mig_ManObj(pMig, i), pObj->fPhase );
if ( Gia_ObjSibl(p, i) && pObj->fMark0 )
@@ -104,7 +104,7 @@ Mig_Man_t * Mig_ManCreate( void * pGia )
else assert( 0 );
}
Mig_ManSetRegNum( pNew, Gia_ManRegNum(p) );
- if ( p->pSibls )
+ if ( Gia_ManHasChoices(p) )
Mig_ManCreateChoices( pNew, p );
return pNew;
}
diff --git a/src/opt/dar/darLib.c b/src/opt/dar/darLib.c
index ee440872..339cd316 100644
--- a/src/opt/dar/darLib.c
+++ b/src/opt/dar/darLib.c
@@ -1288,7 +1288,7 @@ int Dar2_LibBuildBest_rec( Gia_Man_t * p, Dar_LibObj_t * pObj )
pNode = Gia_ManObj( p, Abc_Lit2Var(pData->iGunc) );
if ( Gia_ObjIsAnd( pNode ) )
Gia_ObjSetAndLevel( p, pNode );
- Gia_ObjSetPhase( pNode );
+ Gia_ObjSetPhase( p, pNode );
return pData->iGunc;
}