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
......
......@@ -68,100 +68,6 @@ Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p )
/**Function*************************************************************
Synopsis [Duplicates AIG according to the timing manager.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManDupUnnomalize( Gia_Man_t * p )
{
Tim_Man_t * pTime = (Tim_Man_t *)p->pManTime;
Gia_Man_t * pNew;
Gia_Obj_t * pObj;
int i, k, curCi, curCo, curNo, nodeLim;
//Gia_ManPrint( p );
assert( pTime != NULL );
assert( Gia_ManIsNormalized(p) );
Gia_ManFillValue( p );
pNew = Gia_ManStart( Gia_ManObjNum(p) );
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
Gia_ManConst0(p)->Value = 0;
if ( p->pSibls )
pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
// copy primary inputs
for ( k = 0; k < Tim_ManPiNum(pTime); k++ )
Gia_ManPi(p, k)->Value = Gia_ManAppendCi(pNew);
curCi = Tim_ManPiNum(pTime);
curCo = 0;
curNo = Gia_ManPiNum(p)+1;
for ( i = 0; i < Tim_ManBoxNum(pTime); i++ )
{
// find the latest node feeding into inputs of this box
nodeLim = -1;
for ( k = 0; k < Tim_ManBoxInputNum(pTime, i); k++ )
{
pObj = Gia_ManPo( p, curCo + k );
nodeLim = Abc_MaxInt( nodeLim, Gia_ObjFaninId0p(p, pObj)+1 );
}
// copy nodes up to the given node
for ( k = curNo; k < nodeLim; k++ )
{
pObj = Gia_ManObj( p, k );
assert( Gia_ObjIsAnd(pObj) );
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
}
curNo = Abc_MaxInt( curNo, nodeLim );
// copy COs
for ( k = 0; k < Tim_ManBoxInputNum(pTime, i); k++ )
{
pObj = Gia_ManPo( p, curCo + k );
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
}
curCo += Tim_ManBoxInputNum(pTime, i);
// copy CIs
for ( k = 0; k < Tim_ManBoxOutputNum(pTime, i); k++ )
{
pObj = Gia_ManPi( p, curCi + k );
pObj->Value = Gia_ManAppendCi(pNew);
}
curCi += Tim_ManBoxOutputNum(pTime, i);
}
// copy remaining nodes
nodeLim = Gia_ManObjNum(p) - Gia_ManPoNum(p);
for ( k = curNo; k < nodeLim; k++ )
{
pObj = Gia_ManObj( p, k );
assert( Gia_ObjIsAnd(pObj) );
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
}
curNo = Abc_MaxInt( curNo, nodeLim );
curNo += Gia_ManPoNum(p);
// copy primary outputs
for ( k = 0; k < Tim_ManPoNum(pTime); k++ )
{
pObj = Gia_ManPo( p, curCo + k );
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
}
curCo += Tim_ManPoNum(pTime);
assert( curCi == Gia_ManPiNum(p) );
assert( curCo == Gia_ManPoNum(p) );
assert( curNo == Gia_ManObjNum(p) );
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
Gia_ManDupRemapEquiv( pNew, p );
//Gia_ManPrint( pNew );
// pass the timing manager
pNew->pManTime = pTime; p->pManTime = NULL;
return pNew;
}
/**Function*************************************************************
Synopsis [Find the ordering of AIG objects.]
Description []
......@@ -171,7 +77,7 @@ Gia_Man_t * Gia_ManDupUnnomalize( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
int Gia_ManDupFindOrderWithHie_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vNodes )
int Gia_ManOrderWithBoxes_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vNodes )
{
if ( Gia_ObjIsTravIdCurrent(p, pObj) )
return 0;
......@@ -183,23 +89,23 @@ int Gia_ManDupFindOrderWithHie_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t *
}
assert( Gia_ObjIsAnd(pObj) );
if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) )
if ( Gia_ManDupFindOrderWithHie_rec( p, Gia_ObjSiblObj(p, Gia_ObjId(p, pObj)), vNodes ) )
if ( Gia_ManOrderWithBoxes_rec( p, Gia_ObjSiblObj(p, Gia_ObjId(p, pObj)), vNodes ) )
return 1;
if ( Gia_ManDupFindOrderWithHie_rec( p, Gia_ObjFanin0(pObj), vNodes ) )
if ( Gia_ManOrderWithBoxes_rec( p, Gia_ObjFanin0(pObj), vNodes ) )
return 1;
if ( Gia_ManDupFindOrderWithHie_rec( p, Gia_ObjFanin1(pObj), vNodes ) )
if ( Gia_ManOrderWithBoxes_rec( p, Gia_ObjFanin1(pObj), vNodes ) )
return 1;
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
return 0;
}
Vec_Int_t * Gia_ManDupFindOrderWithHie( Gia_Man_t * p )
Vec_Int_t * Gia_ManOrderWithBoxes( Gia_Man_t * p )
{
Tim_Man_t * pTime = (Tim_Man_t *)p->pManTime;
Vec_Int_t * vNodes;
Gia_Obj_t * pObj;
int i, k, curCi, curCo;
assert( p->pManTime != NULL );
// assert( Gia_ManIsNormalized( p ) );
assert( Gia_ManIsNormalized( p ) );
// start trav IDs
Gia_ManIncrementTravId( p );
// start the array
......@@ -214,22 +120,17 @@ Vec_Int_t * Gia_ManDupFindOrderWithHie( Gia_Man_t * p )
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
Gia_ObjSetTravIdCurrent( p, pObj );
assert( Gia_ObjId(p, pObj) == i+1 );
//printf( "%d ", Gia_ObjId(p, pObj) );
}
// for each box, include box nodes
curCi = Tim_ManPiNum(pTime);
curCo = 0;
for ( i = 0; i < Tim_ManBoxNum(pTime); i++ )
{
//printf( "Box %d:\n", i );
// add internal nodes
for ( k = 0; k < Tim_ManBoxInputNum(pTime, i); k++ )
{
pObj = Gia_ManPo( p, curCo + k );
//Gia_ObjPrint( p, pObj );
//printf( "Fanin " );
//Gia_ObjPrint( p, Gia_ObjFanin0(pObj) );
if ( Gia_ManDupFindOrderWithHie_rec( p, Gia_ObjFanin0(pObj), vNodes ) )
if ( Gia_ManOrderWithBoxes_rec( p, Gia_ObjFanin0(pObj), vNodes ) )
{
int iCiNum = (int)(ABC_PTRUINT_T)p->pData2;
int iBoxNum = Tim_ManBoxFindFromCiNum( p->pManTime, iCiNum );
......@@ -257,7 +158,6 @@ Vec_Int_t * Gia_ManDupFindOrderWithHie( Gia_Man_t * p )
for ( k = 0; k < Tim_ManBoxOutputNum(pTime, i); k++ )
{
pObj = Gia_ManPi( p, curCi + k );
//Gia_ObjPrint( p, pObj );
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
Gia_ObjSetTravIdCurrent( p, pObj );
}
......@@ -267,7 +167,7 @@ Vec_Int_t * Gia_ManDupFindOrderWithHie( Gia_Man_t * p )
for ( i = Tim_ManCoNum(pTime) - Tim_ManPoNum(pTime); i < Tim_ManCoNum(pTime); i++ )
{
pObj = Gia_ManPo( p, i );
Gia_ManDupFindOrderWithHie_rec( p, Gia_ObjFanin0(pObj), vNodes );
Gia_ManOrderWithBoxes_rec( p, Gia_ObjFanin0(pObj), vNodes );
}
// add POs
for ( i = Tim_ManCoNum(pTime) - Tim_ManPoNum(pTime); i < Tim_ManCoNum(pTime); i++ )
......@@ -294,13 +194,13 @@ Vec_Int_t * Gia_ManDupFindOrderWithHie( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManDupWithHierarchy( Gia_Man_t * p, Vec_Int_t ** pvNodes )
Gia_Man_t * Gia_ManDupUnnormalize( Gia_Man_t * p )
{
Vec_Int_t * vNodes;
Gia_Man_t * pNew;
Gia_Obj_t * pObj;
int i;
vNodes = Gia_ManDupFindOrderWithHie( p );
vNodes = Gia_ManOrderWithBoxes( p );
if ( vNodes == NULL )
return NULL;
Gia_ManFillValue( p );
......@@ -326,9 +226,6 @@ Gia_Man_t * Gia_ManDupWithHierarchy( Gia_Man_t * p, Vec_Int_t ** pvNodes )
else assert( 0 );
}
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
if ( pvNodes )
*pvNodes = vNodes;
else
Vec_IntFree( vNodes );
return pNew;
}
......@@ -364,7 +261,7 @@ void Gia_ManCleanupRemap( Gia_Man_t * p, Gia_Man_t * pGia )
/**Function*************************************************************
Synopsis []
Synopsis [Computes AIG with boxes.]
Description []
......@@ -373,22 +270,22 @@ void Gia_ManCleanupRemap( Gia_Man_t * p, Gia_Man_t * pGia )
SeeAlso []
***********************************************************************/
void Gia_ManDupWithBoxes_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Man_t * pNew )
void Gia_ManDupCollapse_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Man_t * pNew )
{
if ( Gia_ObjIsTravIdCurrent(p, pObj) )
return;
Gia_ObjSetTravIdCurrent(p, pObj);
assert( Gia_ObjIsAnd(pObj) );
if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) )
Gia_ManDupWithBoxes_rec( p, Gia_ObjSiblObj(p, Gia_ObjId(p, pObj)), pNew );
Gia_ManDupWithBoxes_rec( p, Gia_ObjFanin0(pObj), pNew );
Gia_ManDupWithBoxes_rec( p, Gia_ObjFanin1(pObj), pNew );
Gia_ManDupCollapse_rec( p, Gia_ObjSiblObj(p, Gia_ObjId(p, pObj)), pNew );
Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew );
Gia_ManDupCollapse_rec( p, Gia_ObjFanin1(pObj), pNew );
// assert( !~pObj->Value );
pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) )
pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(Gia_ObjSiblObj(p, Gia_ObjId(p, pObj))->Value);
}
Gia_Man_t * Gia_ManDupWithBoxes( Gia_Man_t * p, Gia_Man_t * pBoxes )
Gia_Man_t * Gia_ManDupCollapse( Gia_Man_t * p, Gia_Man_t * pBoxes )
{
Tim_Man_t * pTime = (Tim_Man_t *)p->pManTime;
Gia_Man_t * pNew, * pTemp;
......@@ -427,7 +324,7 @@ Gia_Man_t * Gia_ManDupWithBoxes( Gia_Man_t * p, Gia_Man_t * pBoxes )
{
// build logic
pObj = Gia_ManPo( p, curCo + k );
Gia_ManDupWithBoxes_rec( p, Gia_ObjFanin0(pObj), pNew );
Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew );
// transfer to the PI
pObjBox = Gia_ManPi( pBoxes, k );
pObjBox->Value = Gia_ObjFanin0Copy(pObj);
......@@ -439,7 +336,7 @@ Gia_Man_t * Gia_ManDupWithBoxes( Gia_Man_t * p, Gia_Man_t * pBoxes )
{
// build logic
pObjBox = Gia_ManPo( pBoxes, curCi - Tim_ManPiNum(pTime) + k );
Gia_ManDupWithBoxes_rec( pBoxes, Gia_ObjFanin0(pObjBox), pNew );
Gia_ManDupCollapse_rec( pBoxes, Gia_ObjFanin0(pObjBox), pNew );
// transfer to the PI
pObj = Gia_ManPi( p, curCi + k );
pObj->Value = Gia_ObjFanin0Copy(pObjBox);
......@@ -451,7 +348,7 @@ Gia_Man_t * Gia_ManDupWithBoxes( Gia_Man_t * p, Gia_Man_t * pBoxes )
for ( i = Tim_ManCoNum(pTime) - Tim_ManPoNum(pTime); i < Tim_ManCoNum(pTime); i++ )
{
pObj = Gia_ManPo( p, i );
Gia_ManDupWithBoxes_rec( p, Gia_ObjFanin0(pObj), pNew );
Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew );
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
}
curCo += Tim_ManPoNum(pTime);
......@@ -470,7 +367,7 @@ Gia_Man_t * Gia_ManDupWithBoxes( Gia_Man_t * p, Gia_Man_t * pBoxes )
/**Function*************************************************************
Synopsis []
Synopsis [Computes level with boxes.]
Description []
......@@ -560,7 +457,7 @@ int Gia_ManLevelWithBoxes( Gia_Man_t * p )
/**Function*************************************************************
Synopsis []
Synopsis [Verify XAIG against its spec.]
Description []
......@@ -601,8 +498,8 @@ int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit )
printf( "Spec has no box logic. Use standard flow.\n" );
return Status;
}
pGia0 = Gia_ManDupWithBoxes( pSpec, pSpec->pAigExtra );
pGia1 = Gia_ManDupWithBoxes( pGia, pGia->pAigExtra );
pGia0 = Gia_ManDupCollapse( pSpec, pSpec->pAigExtra );
pGia1 = Gia_ManDupCollapse( pGia, pGia->pAigExtra );
// compute the miter
pMiter = Gia_ManMiter( pGia0, pGia1, 1, 0, fVerbose );
if ( pMiter )
......@@ -625,7 +522,7 @@ int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit )
/**Function*************************************************************
Synopsis []
Synopsis [Update hierarchy/timing manager.]
Description []
......@@ -639,12 +536,11 @@ void * Gia_ManUpdateTimMan( Gia_Man_t * p, Vec_Int_t * vBoxPres )
assert( p->pManTime != NULL );
assert( Tim_ManBoxNum(p->pManTime) == Vec_IntSize(vBoxPres) );
return Tim_ManTrim( p->pManTime, vBoxPres );
}
/**Function*************************************************************
Synopsis []
Synopsis [Update AIG of the holes.]
Description []
......@@ -653,24 +549,23 @@ void * Gia_ManUpdateTimMan( Gia_Man_t * p, Vec_Int_t * vBoxPres )
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManUpdateExtraAig( void * pTime, Gia_Man_t * pAig, Vec_Int_t * vBoxPres )
Gia_Man_t * Gia_ManUpdateExtraAig( void * pTime, Gia_Man_t * p, Vec_Int_t * vBoxPres )
{
Gia_Man_t * pNew = NULL;
Vec_Int_t * vOutPres;
Tim_Man_t * pManTime = (Tim_Man_t *)pTime;
Vec_Int_t * vOutPres = Vec_IntAlloc( 100 );
int i, k, curPo = 0;
assert( Vec_IntSize(vBoxPres) == Tim_ManBoxNum(pManTime) );
assert( Gia_ManPoNum(pAig) == Tim_ManCiNum(pManTime) - Tim_ManPiNum(pManTime) );
vOutPres = Vec_IntAlloc( 100 );
assert( Gia_ManPoNum(p) == Tim_ManCiNum(pManTime) - Tim_ManPiNum(pManTime) );
for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ )
{
for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ )
Vec_IntPush( vOutPres, Vec_IntEntry(vBoxPres, i) );
curPo += Tim_ManBoxOutputNum(pManTime, i);
}
assert( curPo == Gia_ManPoNum(pAig) );
if ( Vec_IntSize(vOutPres) > 0 )
pNew = Gia_ManDupOutputVec( pAig, vOutPres );
assert( curPo == Gia_ManPoNum(p) );
// if ( Vec_IntSize(vOutPres) > 0 )
pNew = Gia_ManDupOutputVec( p, vOutPres );
Vec_IntFree( vOutPres );
return pNew;
}
......
......@@ -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