Commit 686f8fda by Alan Mishchenko

Integration of timing manager.

parent a2eb6f9a
...@@ -826,6 +826,7 @@ extern Gia_Man_t * Gia_ManDupDfsCone( Gia_Man_t * p, Gia_Obj_t * pObj ); ...@@ -826,6 +826,7 @@ extern Gia_Man_t * Gia_ManDupDfsCone( Gia_Man_t * p, Gia_Obj_t * pObj );
extern Gia_Man_t * Gia_ManDupDfsLitArray( Gia_Man_t * p, Vec_Int_t * vLits ); extern Gia_Man_t * Gia_ManDupDfsLitArray( Gia_Man_t * p, Vec_Int_t * vLits );
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_ManDupUnnomalize( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManDupWithHierarchy( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManDupTrimmed( Gia_Man_t * p, int fTrimCis, int fTrimCos, int fDualOut, int OutValue ); extern Gia_Man_t * Gia_ManDupTrimmed( Gia_Man_t * p, int fTrimCis, int fTrimCos, int fDualOut, int OutValue );
extern Gia_Man_t * Gia_ManDupOntop( Gia_Man_t * p, Gia_Man_t * p2 ); extern Gia_Man_t * Gia_ManDupOntop( Gia_Man_t * p, Gia_Man_t * p2 );
extern Gia_Man_t * Gia_ManDupWithNewPo( Gia_Man_t * p1, Gia_Man_t * p2 ); extern Gia_Man_t * Gia_ManDupWithNewPo( Gia_Man_t * p1, Gia_Man_t * p2 );
......
...@@ -1131,6 +1131,140 @@ Gia_Man_t * Gia_ManDupUnnomalize( Gia_Man_t * p ) ...@@ -1131,6 +1131,140 @@ Gia_Man_t * Gia_ManDupUnnomalize( Gia_Man_t * p )
return pNew; return pNew;
} }
/**Function*************************************************************
Synopsis [Find the ordering of AIG objects.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManDupFindOrderWithHie_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vNodes )
{
if ( Gia_ObjIsTravIdCurrent(p, pObj) )
return;
Gia_ObjSetTravIdCurrent(p, pObj);
assert( Gia_ObjIsAnd(pObj) );
Gia_ManDupFindOrderWithHie_rec( p, Gia_ObjFanin0(pObj), vNodes );
Gia_ManDupFindOrderWithHie_rec( p, Gia_ObjFanin1(pObj), vNodes );
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
}
Vec_Int_t * Gia_ManDupFindOrderWithHie( 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 ) );
// start trav IDs
Gia_ManIncrementTravId( p );
// start the array
vNodes = Vec_IntAlloc( Gia_ManObjNum(p) );
// include constant
Vec_IntPush( vNodes, 0 );
Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
// include primary inputs
for ( i = 0; i < Tim_ManPiNum(pTime); i++ )
{
pObj = Gia_ManPi( p, i );
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++ )
{
// add internal nodes
for ( k = 0; k < Tim_ManBoxInputNum(pTime, i); k++ )
{
pObj = Gia_ManPo( p, curCo + k );
//Gia_ObjPrint( p, pObj );
//Gia_ObjPrint( p, Gia_ObjFanin0(pObj) );
Gia_ManDupFindOrderWithHie_rec( p, Gia_ObjFanin0(pObj), vNodes );
}
// add POs corresponding to box inputs
for ( k = 0; k < Tim_ManBoxInputNum(pTime, i); k++ )
{
pObj = Gia_ManPo( p, curCo + k );
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
}
curCo += Tim_ManBoxInputNum(pTime, i);
// add PIs corresponding to box outputs
for ( k = 0; k < Tim_ManBoxOutputNum(pTime, i); k++ )
{
pObj = Gia_ManPi( p, curCi + k );
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
}
curCi += Tim_ManBoxOutputNum(pTime, i);
}
// add remaining nodes
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 );
}
// add POs
for ( i = Tim_ManCoNum(pTime) - Tim_ManPoNum(pTime); i < Tim_ManCoNum(pTime); i++ )
{
pObj = Gia_ManPo( p, i );
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
}
curCo += Tim_ManPoNum(pTime);
// verify counts
assert( curCi == Gia_ManPiNum(p) );
assert( curCo == Gia_ManPoNum(p) );
assert( Vec_IntSize(vNodes) == Gia_ManObjNum(p) );
return vNodes;
}
/**Function*************************************************************
Synopsis [Duplicates AIG according to the timing manager.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManDupWithHierarchy( Gia_Man_t * p )
{
Vec_Int_t * vNodes;
Gia_Man_t * pNew;
Gia_Obj_t * pObj;
int i;
Gia_ManFillValue( p );
pNew = Gia_ManStart( Gia_ManObjNum(p) );
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
vNodes = Gia_ManDupFindOrderWithHie( p );
Gia_ManForEachObjVec( vNodes, p, pObj, i )
{
if ( Gia_ObjIsAnd(pObj) )
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
else 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_ObjIsConst0(pObj) )
pObj->Value = 0;
else assert( 0 );
}
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
Vec_IntFree( vNodes );
return pNew;
}
/**Function************************************************************* /**Function*************************************************************
Synopsis [Returns the array of non-const-0 POs of the dual-output miter.] Synopsis [Returns the array of non-const-0 POs of the dual-output miter.]
......
...@@ -624,6 +624,11 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp ) ...@@ -624,6 +624,11 @@ 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;
// reconstruct GIA according to the hierarchy manager
if ( p->pManTime )
p = Gia_ManDupWithHierarchy( p );
else
p = Gia_ManDup( p );
// set the arrival times // set the arrival times
assert( pPars->pTimesArr == NULL ); assert( pPars->pTimesArr == NULL );
pPars->pTimesArr = ABC_ALLOC( float, Gia_ManCiNum(p) ); pPars->pTimesArr = ABC_ALLOC( float, Gia_ManCiNum(p) );
...@@ -631,12 +636,16 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp ) ...@@ -631,12 +636,16 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
// translate into the mapper // translate into the mapper
pIfMan = Gia_ManToIf( p, pPars ); pIfMan = Gia_ManToIf( p, pPars );
if ( pIfMan == NULL ) if ( pIfMan == NULL )
{
Gia_ManStop( p );
return NULL; return NULL;
}
if ( p->pManTime ) if ( p->pManTime )
pIfMan->pManTim = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 ); pIfMan->pManTim = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
if ( !If_ManPerformMapping( pIfMan ) ) if ( !If_ManPerformMapping( pIfMan ) )
{ {
If_ManStop( pIfMan ); If_ManStop( pIfMan );
Gia_ManStop( p );
return NULL; return NULL;
} }
// transform the result of mapping into the new network // transform the result of mapping into the new network
......
...@@ -309,6 +309,8 @@ void Tim_ManPrint( Tim_Man_t * p ) ...@@ -309,6 +309,8 @@ void Tim_ManPrint( Tim_Man_t * p )
if ( p == NULL ) if ( p == NULL )
return; return;
printf( "TIMING MANAGER:\n" ); printf( "TIMING MANAGER:\n" );
printf( "PI = %d. CI = %d. PO = %d. CO = %d. Box = %d.\n",
Tim_ManPiNum(p), Tim_ManCiNum(p), Tim_ManPoNum(p), Tim_ManCoNum(p), Tim_ManBoxNum(p) );
// print CI info // print CI info
pPrev = p->pCis; pPrev = p->pCis;
......
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