Commit b0968094 by Alan Mishchenko

Integrating sweeping information.

parent aa7daf1e
...@@ -978,9 +978,8 @@ extern float Gia_ManEvaluateSwitching( Gia_Man_t * p ); ...@@ -978,9 +978,8 @@ extern float Gia_ManEvaluateSwitching( Gia_Man_t * p );
extern float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbOne ); extern float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbOne );
/*=== giaTim.c ===========================================================*/ /*=== giaTim.c ===========================================================*/
extern Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManDupUnnomalize( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupUnnormalize( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManDupWithHierarchy( Gia_Man_t * p, Vec_Int_t ** pvNodes ); extern Gia_Man_t * Gia_ManDupCollapse( Gia_Man_t * p, Gia_Man_t * pBoxes );
extern Gia_Man_t * Gia_ManDupWithBoxes( Gia_Man_t * p, Gia_Man_t * pBoxes );
extern int Gia_ManLevelWithBoxes( Gia_Man_t * p ); extern int Gia_ManLevelWithBoxes( Gia_Man_t * p );
extern int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit ); extern int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit );
extern void * Gia_ManUpdateTimMan( Gia_Man_t * p, Vec_Int_t * vBoxPres ); extern void * Gia_ManUpdateTimMan( Gia_Man_t * p, Vec_Int_t * vBoxPres );
......
...@@ -726,22 +726,10 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS ...@@ -726,22 +726,10 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
if ( Abc_FrameReadLibBox() == NULL ) if ( Abc_FrameReadLibBox() == NULL )
printf( "Cannot create TIM manager because box library is not available.\n" ); printf( "Cannot create TIM manager because box library is not available.\n" );
else else
{
Tim_ManCreate( (Tim_Man_t *)pNew->pManTime, Abc_FrameReadLibBox(), pNew->vInArrs, pNew->vOutReqs ); Tim_ManCreate( (Tim_Man_t *)pNew->pManTime, Abc_FrameReadLibBox(), pNew->vInArrs, pNew->vOutReqs );
// Tim_ManPrint( (Tim_Man_t *)pNew->pManTime );
// printf( "Created timing manager using Tim_ManCreate().\n" );
}
} }
Vec_FltFreeP( &pNew->vInArrs ); Vec_FltFreeP( &pNew->vInArrs );
Vec_FltFreeP( &pNew->vOutReqs ); Vec_FltFreeP( &pNew->vOutReqs );
/*
if ( pNew->pManTime )
{
pNew = Gia_ManDupUnnomalize( pTemp = pNew );
Gia_ManStop( pTemp );
}
*/
/* /*
// check the result // check the result
if ( fCheck && !Gia_ManCheck( pNew ) ) if ( fCheck && !Gia_ManCheck( pNew ) )
......
...@@ -245,7 +245,7 @@ Gia_Man_t * Gia_ManDupOutputVec( Gia_Man_t * p, Vec_Int_t * vOutPres ) ...@@ -245,7 +245,7 @@ Gia_Man_t * Gia_ManDupOutputVec( Gia_Man_t * p, Vec_Int_t * vOutPres )
pObj->Value = Gia_ManAppendCi(pNew); pObj->Value = Gia_ManAppendCi(pNew);
Gia_ManForEachPo( p, pObj, i ) Gia_ManForEachPo( p, pObj, i )
if ( Vec_IntEntry(vOutPres, i) ) if ( Vec_IntEntry(vOutPres, i) )
Gia_ManDupOrderDfs_rec( pNew, p, pObj ); Gia_ManDupOrderDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
Gia_ManForEachPo( p, pObj, i ) Gia_ManForEachPo( p, pObj, i )
if ( Vec_IntEntry(vOutPres, i) ) if ( Vec_IntEntry(vOutPres, i) )
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
......
...@@ -229,7 +229,7 @@ void Gia_ManPrintMappingStats( Gia_Man_t * p ) ...@@ -229,7 +229,7 @@ void Gia_ManPrintMappingStats( Gia_Man_t * p )
LevelMax = Abc_MaxInt( LevelMax, pLevels[i] ); LevelMax = Abc_MaxInt( LevelMax, pLevels[i] );
} }
ABC_FREE( pLevels ); ABC_FREE( pLevels );
Abc_Print( 1, "mapping (K=%d) : ", nLutSize ); Abc_Print( 1, "Mapping (K=%d) : ", nLutSize );
Abc_Print( 1, "lut =%7d ", nLuts ); Abc_Print( 1, "lut =%7d ", nLuts );
Abc_Print( 1, "edge =%8d ", nFanins ); Abc_Print( 1, "edge =%8d ", nFanins );
Abc_Print( 1, "lev =%5d ", LevelMax ); Abc_Print( 1, "lev =%5d ", LevelMax );
...@@ -277,7 +277,7 @@ void Gia_ManPrintPackingStats( Gia_Man_t * p ) ...@@ -277,7 +277,7 @@ void Gia_ManPrintPackingStats( Gia_Man_t * p )
MaxSize = 2; MaxSize = 2;
else if ( nNumStr[1] > 0 ) else if ( nNumStr[1] > 0 )
MaxSize = 1; MaxSize = 1;
Abc_Print( 1, "packing (N=%d) : ", MaxSize ); Abc_Print( 1, "Packing (N=%d) : ", MaxSize );
for ( i = 1; i <= MaxSize; i++ ) for ( i = 1; i <= MaxSize; i++ )
Abc_Print( 1, "%d x LUT = %d ", i, nNumStr[i] ); Abc_Print( 1, "%d x LUT = %d ", i, nNumStr[i] );
Abc_Print( 1, "Total = %d", nEntries2 ); Abc_Print( 1, "Total = %d", nEntries2 );
...@@ -1141,11 +1141,10 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp ) ...@@ -1141,11 +1141,10 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
Gia_Man_t * pNew; Gia_Man_t * pNew;
If_Man_t * pIfMan; If_Man_t * pIfMan;
If_Par_t * pPars = (If_Par_t *)pp; If_Par_t * pPars = (If_Par_t *)pp;
Vec_Int_t * vNodes = NULL;
// reconstruct GIA according to the hierarchy manager // reconstruct GIA according to the hierarchy manager
if ( p->pManTime ) if ( p->pManTime )
{ {
pNew = Gia_ManDupWithHierarchy( p, &vNodes ); pNew = Gia_ManDupUnnormalize( p );
if ( pNew == NULL ) if ( pNew == NULL )
return NULL; return NULL;
pNew->pManTime = p->pManTime; p->pManTime = NULL; pNew->pManTime = p->pManTime; p->pManTime = NULL;
...@@ -1154,7 +1153,6 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp ) ...@@ -1154,7 +1153,6 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
} }
else else
p = Gia_ManDup( p ); p = Gia_ManDup( p );
Vec_IntFreeP( &vNodes );
// set the arrival times // set the arrival times
assert( pPars->pTimesArr == NULL ); assert( pPars->pTimesArr == NULL );
pPars->pTimesArr = ABC_CALLOC( float, Gia_ManCiNum(p) ); pPars->pTimesArr = ABC_CALLOC( float, Gia_ManCiNum(p) );
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
ABC_NAMESPACE_IMPL_START ABC_NAMESPACE_IMPL_START
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// DECLARATIONS /// /// DECLARATIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
...@@ -62,7 +61,10 @@ Gia_Obj_t * Gia_ManFraigMarkCos( Gia_Man_t * p, Gia_Obj_t * pObj, int fMark ) ...@@ -62,7 +61,10 @@ Gia_Obj_t * Gia_ManFraigMarkCos( Gia_Man_t * p, Gia_Obj_t * pObj, int fMark )
{ {
for ( assert( Gia_ObjIsCo(pObj) ); Gia_ObjIsCo(pObj); pObj-- ) for ( assert( Gia_ObjIsCo(pObj) ); Gia_ObjIsCo(pObj); pObj-- )
if ( fMark ) if ( fMark )
{
Gia_ObjSetTravIdCurrent( p, pObj ); Gia_ObjSetTravIdCurrent( p, pObj );
Gia_ObjSetTravIdCurrent( p, Gia_ObjFanin0(pObj) );
}
return pObj; return pObj;
} }
Gia_Obj_t * Gia_ManFraigMarkAnd( Gia_Man_t * p, Gia_Obj_t * pObj ) Gia_Obj_t * Gia_ManFraigMarkAnd( Gia_Man_t * p, Gia_Obj_t * pObj )
...@@ -133,6 +135,9 @@ Gia_Man_t * Gia_ManFraigCreateGia( Gia_Man_t * p ) ...@@ -133,6 +135,9 @@ Gia_Man_t * Gia_ManFraigCreateGia( Gia_Man_t * p )
assert( pNew->pAigExtra == NULL ); assert( pNew->pAigExtra == NULL );
pNew->pAigExtra = Gia_ManUpdateExtraAig( p->pManTime, p->pAigExtra, vBoxPres ); pNew->pAigExtra = Gia_ManUpdateExtraAig( p->pManTime, p->pAigExtra, vBoxPres );
Vec_IntFree( vBoxPres ); Vec_IntFree( vBoxPres );
// assert( Gia_ManPiNum(pNew) == Tim_ManCiNum(pNew->pManTime) );
// assert( Gia_ManPoNum(pNew) == Tim_ManCoNum(pNew->pManTime) );
// assert( Gia_ManPiNum(pNew) == Tim_ManPiNum(pNew->pManTime) + Gia_ManPoNum(pNew->pAigExtra) );
return pNew; return pNew;
} }
...@@ -149,19 +154,19 @@ Gia_Man_t * Gia_ManFraigCreateGia( Gia_Man_t * p ) ...@@ -149,19 +154,19 @@ Gia_Man_t * Gia_ManFraigCreateGia( Gia_Man_t * p )
***********************************************************************/ ***********************************************************************/
int Gia_ObjFanin0CopyRepr( Gia_Man_t * p, Gia_Obj_t * pObj, int * pReprs ) int Gia_ObjFanin0CopyRepr( Gia_Man_t * p, Gia_Obj_t * pObj, int * pReprs )
{ {
int faninId = Gia_ObjFaninId0p( p, pObj ); int fanId = Gia_ObjFaninId0p( p, pObj );
if ( pReprs[faninId] == -1 ) if ( pReprs[fanId] == -1 )
return Gia_ObjFanin0Copy( pObj ); return Gia_ObjFanin0Copy( pObj );
assert( Abc_Lit2Var(pReprs[faninId]) < Gia_ObjId(p, pObj) ); assert( Abc_Lit2Var(pReprs[fanId]) < Gia_ObjId(p, pObj) );
return Abc_LitNotCond( Gia_ObjValue(Gia_ManObj(p, Abc_Lit2Var(pReprs[faninId]))), Gia_ObjFaninC0(pObj) ^ Abc_LitIsCompl(pReprs[faninId]) ); return Abc_LitNotCond( Gia_ObjValue(Gia_ManObj(p, Abc_Lit2Var(pReprs[fanId]))), Gia_ObjFaninC0(pObj) ^ Abc_LitIsCompl(pReprs[fanId]) );
} }
int Gia_ObjFanin1CopyRepr( Gia_Man_t * p, Gia_Obj_t * pObj, int * pReprs ) int Gia_ObjFanin1CopyRepr( Gia_Man_t * p, Gia_Obj_t * pObj, int * pReprs )
{ {
int faninId = Gia_ObjFaninId1p( p, pObj ); int fanId = Gia_ObjFaninId1p( p, pObj );
if ( pReprs[faninId] == -1 ) if ( pReprs[fanId] == -1 )
return Gia_ObjFanin1Copy( pObj ); return Gia_ObjFanin1Copy( pObj );
assert( Abc_Lit2Var(pReprs[faninId]) < Gia_ObjId(p, pObj) ); assert( Abc_Lit2Var(pReprs[fanId]) < Gia_ObjId(p, pObj) );
return Abc_LitNotCond( Gia_ObjValue(Gia_ManObj(p, Abc_Lit2Var(pReprs[faninId]))), Gia_ObjFaninC1(pObj) ^ Abc_LitIsCompl(pReprs[faninId]) ); return Abc_LitNotCond( Gia_ObjValue(Gia_ManObj(p, Abc_Lit2Var(pReprs[fanId]))), Gia_ObjFaninC1(pObj) ^ Abc_LitIsCompl(pReprs[fanId]) );
} }
Gia_Man_t * Gia_ManFraigReduceGia( Gia_Man_t * p, int * pReprs ) Gia_Man_t * Gia_ManFraigReduceGia( Gia_Man_t * p, int * pReprs )
{ {
...@@ -188,15 +193,6 @@ Gia_Man_t * Gia_ManFraigReduceGia( Gia_Man_t * p, int * pReprs ) ...@@ -188,15 +193,6 @@ Gia_Man_t * Gia_ManFraigReduceGia( Gia_Man_t * p, int * pReprs )
else assert( 0 ); else assert( 0 );
} }
Gia_ManHashStop( pNew ); Gia_ManHashStop( pNew );
/*
{
Gia_Man_t * pTemp;
Gia_ManPrintStats( pNew, 0, 0, 0 );
pNew = Gia_ManCleanup( pTemp = pNew );
Gia_ManStop( pTemp );
Gia_ManPrintStats( pNew, 0, 0, 0 );
}
*/
return pNew; return pNew;
} }
...@@ -233,23 +229,21 @@ int * Gia_ManFraigSelectReprs( Gia_Man_t * p, Gia_Man_t * pGia, int fVerbose ) ...@@ -233,23 +229,21 @@ int * Gia_ManFraigSelectReprs( Gia_Man_t * p, Gia_Man_t * pGia, int fVerbose )
pGia2Abc[iReprGia] = i; pGia2Abc[iReprGia] = i;
else else
{ {
// iLitGia2 = Abc2_ObjCopyId( p, pGia2Abc[iReprGia] );
iLitGia2 = Gia_ObjValue( Gia_ManObj(p, pGia2Abc[iReprGia]) ); iLitGia2 = Gia_ObjValue( Gia_ManObj(p, pGia2Abc[iReprGia]) );
assert( Gia_ObjReprSelf(pGia, Abc_Lit2Var(iLitGia)) == Gia_ObjReprSelf(pGia, Abc_Lit2Var(iLitGia2)) ); assert( Gia_ObjReprSelf(pGia, Abc_Lit2Var(iLitGia)) == Gia_ObjReprSelf(pGia, Abc_Lit2Var(iLitGia2)) );
fCompl = Abc_LitIsCompl(iLitGia) ^ Abc_LitIsCompl(iLitGia2); fCompl = Abc_LitIsCompl(iLitGia) ^ Abc_LitIsCompl(iLitGia2);
fCompl ^= Gia_ManObj(pGia, Abc_Lit2Var(iLitGia))->fPhase; fCompl ^= Gia_ManObj(pGia, Abc_Lit2Var(iLitGia))->fPhase;
fCompl ^= Gia_ManObj(pGia, Abc_Lit2Var(iLitGia2))->fPhase; fCompl ^= Gia_ManObj(pGia, Abc_Lit2Var(iLitGia2))->fPhase;
pReprs[i] = Abc_Var2Lit( pGia2Abc[iReprGia], fCompl ); pReprs[i] = Abc_Var2Lit( pGia2Abc[iReprGia], fCompl );
assert( Abc_Lit2Var(pReprs[i]) < i );
if ( pGia2Abc[iReprGia] == 0 ) if ( pGia2Abc[iReprGia] == 0 )
nConsts++; nConsts++;
else else
nReprs++; nReprs++;
assert( Abc_Lit2Var(pReprs[i]) < i );
// printf( "%d -> %d\n", i, Abc_Lit2Var(pReprs[i]) );
} }
} }
ABC_FREE( pGia2Abc ); ABC_FREE( pGia2Abc );
// if ( fVerbose ) if ( fVerbose )
printf( "Found %d const reprs and %d other reprs.\n", nConsts, nReprs ); printf( "Found %d const reprs and %d other reprs.\n", nConsts, nReprs );
return pReprs; return pReprs;
} }
...@@ -305,12 +299,12 @@ Gia_Man_t * Gia_ManFraigSweep( Gia_Man_t * p, void * pPars ) ...@@ -305,12 +299,12 @@ Gia_Man_t * Gia_ManFraigSweep( Gia_Man_t * p, void * pPars )
return NULL; return NULL;
} }
// ordering AIG objects // ordering AIG objects
pNew = Gia_ManDupWithHierarchy( p, NULL ); pNew = Gia_ManDupUnnormalize( p );
if ( pNew == NULL ) if ( pNew == NULL )
return NULL; return NULL;
// find global equivalences // find global equivalences
pNew->pManTime = p->pManTime; pNew->pManTime = p->pManTime;
pGia = Gia_ManDupWithBoxes( pNew, p->pAigExtra ); pGia = Gia_ManDupCollapse( pNew, p->pAigExtra );
pNew->pManTime = NULL; pNew->pManTime = NULL;
Gia_ManFraigSweepPerform( pGia, pPars ); Gia_ManFraigSweepPerform( pGia, pPars );
// transfer equivalences // transfer equivalences
......
...@@ -168,12 +168,13 @@ Tim_Man_t * Tim_ManTrim( Tim_Man_t * p, Vec_Int_t * vBoxPres ) ...@@ -168,12 +168,13 @@ Tim_Man_t * Tim_ManTrim( Tim_Man_t * p, Vec_Int_t * vBoxPres )
// count the number of CIs and COs in the trimmed manager // count the number of CIs and COs in the trimmed manager
nNewCis = Tim_ManPiNum(p); nNewCis = Tim_ManPiNum(p);
nNewCos = Tim_ManPoNum(p); nNewCos = Tim_ManPoNum(p);
Tim_ManForEachBox( p, pBox, i ) if ( Tim_ManBoxNum(p) )
if ( Vec_IntEntry(vBoxPres, i) ) Tim_ManForEachBox( p, pBox, i )
{ if ( Vec_IntEntry(vBoxPres, i) )
nNewCis += pBox->nOutputs; {
nNewCos += pBox->nInputs; nNewCis += pBox->nOutputs;
} nNewCos += pBox->nInputs;
}
if ( nNewCis == Tim_ManCiNum(p) && nNewCos == Tim_ManCoNum(p) ) if ( nNewCis == Tim_ManCiNum(p) && nNewCos == Tim_ManCoNum(p) )
return Tim_ManDup( p, 0 ); return Tim_ManDup( p, 0 );
assert( nNewCis < Tim_ManCiNum(p) ); assert( nNewCis < Tim_ManCiNum(p) );
...@@ -494,7 +495,7 @@ void Tim_ManPrintStats( Tim_Man_t * p ) ...@@ -494,7 +495,7 @@ void Tim_ManPrintStats( Tim_Man_t * p )
int i, Count, IdMax; int i, Count, IdMax;
if ( p == NULL ) if ( p == NULL )
return; return;
Abc_Print( 1, "hierarchy : " ); Abc_Print( 1, "Hierarchy : " );
printf( "PI/CI = %d/%d PO/CO = %d/%d Box = %d", printf( "PI/CI = %d/%d PO/CO = %d/%d Box = %d",
Tim_ManPiNum(p), Tim_ManCiNum(p), Tim_ManPiNum(p), Tim_ManCiNum(p),
Tim_ManPoNum(p), Tim_ManCoNum(p), Tim_ManPoNum(p), Tim_ManCoNum(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