Commit b0968094 by Alan Mishchenko

Integrating sweeping information.

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