mirror of https://github.com/YosysHQ/abc.git
Adding frontier comptuation based on reversed CO order in &ps.
This commit is contained in:
parent
2be812b4e0
commit
bc21cb41b4
|
|
@ -906,7 +906,7 @@ extern int Gia_ManLevelNum( Gia_Man_t * p );
|
||||||
extern void Gia_ManCreateValueRefs( Gia_Man_t * p );
|
extern void Gia_ManCreateValueRefs( Gia_Man_t * p );
|
||||||
extern void Gia_ManCreateRefs( Gia_Man_t * p );
|
extern void Gia_ManCreateRefs( Gia_Man_t * p );
|
||||||
extern int * Gia_ManCreateMuxRefs( Gia_Man_t * p );
|
extern int * Gia_ManCreateMuxRefs( Gia_Man_t * p );
|
||||||
extern int Gia_ManCrossCut( Gia_Man_t * p );
|
extern int Gia_ManCrossCut( Gia_Man_t * p, int fReverse );
|
||||||
extern int Gia_ManIsNormalized( Gia_Man_t * p );
|
extern int Gia_ManIsNormalized( Gia_Man_t * p );
|
||||||
extern Vec_Int_t * Gia_ManCollectPoIds( Gia_Man_t * p );
|
extern Vec_Int_t * Gia_ManCollectPoIds( Gia_Man_t * p );
|
||||||
extern int Gia_ObjIsMuxType( Gia_Obj_t * pNode );
|
extern int Gia_ObjIsMuxType( Gia_Obj_t * pNode );
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,47 @@ void Gia_ManFrontTransform( Gia_Man_t * p )
|
||||||
ABC_FREE( pFrontToId );
|
ABC_FREE( pFrontToId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**Function*************************************************************
|
||||||
|
|
||||||
|
Synopsis [Determine the frontier.]
|
||||||
|
|
||||||
|
Description []
|
||||||
|
|
||||||
|
SideEffects []
|
||||||
|
|
||||||
|
SeeAlso []
|
||||||
|
|
||||||
|
***********************************************************************/
|
||||||
|
int Gia_ManCrossCutSimple( Gia_Man_t * p )
|
||||||
|
{
|
||||||
|
Gia_Obj_t * pObj;
|
||||||
|
int i, nCutCur = 0, nCutMax = 0;
|
||||||
|
Gia_ManCreateValueRefs( p );
|
||||||
|
Gia_ManForEachObj( p, pObj, i )
|
||||||
|
{
|
||||||
|
if ( pObj->Value )
|
||||||
|
nCutCur++;
|
||||||
|
if ( nCutMax < nCutCur )
|
||||||
|
nCutMax = nCutCur;
|
||||||
|
if ( Gia_ObjIsAnd(pObj) )
|
||||||
|
{
|
||||||
|
if ( --Gia_ObjFanin0(pObj)->Value == 0 )
|
||||||
|
nCutCur--;
|
||||||
|
if ( --Gia_ObjFanin1(pObj)->Value == 0 )
|
||||||
|
nCutCur--;
|
||||||
|
}
|
||||||
|
else if ( Gia_ObjIsCo(pObj) )
|
||||||
|
{
|
||||||
|
if ( --Gia_ObjFanin0(pObj)->Value == 0 )
|
||||||
|
nCutCur--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Gia_ManForEachObj( p, pObj, i )
|
||||||
|
// assert( pObj->Value == 0 );
|
||||||
|
return nCutMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**Function*************************************************************
|
/**Function*************************************************************
|
||||||
|
|
||||||
Synopsis [Determine the frontier.]
|
Synopsis [Determine the frontier.]
|
||||||
|
|
@ -109,7 +150,7 @@ Gia_Man_t * Gia_ManFront( Gia_Man_t * p )
|
||||||
Gia_Obj_t * pObj, * pFanin0New, * pFanin1New, * pObjNew;
|
Gia_Obj_t * pObj, * pFanin0New, * pFanin1New, * pObjNew;
|
||||||
char * pFront; // places used for the frontier
|
char * pFront; // places used for the frontier
|
||||||
int i, iLit, nCrossCut = 0, nCrossCutMax = 0;
|
int i, iLit, nCrossCut = 0, nCrossCutMax = 0;
|
||||||
int nCrossCutMaxInit = Gia_ManCrossCut( p );
|
int nCrossCutMaxInit = Gia_ManCrossCutSimple( p );
|
||||||
int iFront = 0;//, clk = clock();
|
int iFront = 0;//, clk = clock();
|
||||||
// set references for all objects
|
// set references for all objects
|
||||||
Gia_ManCreateValueRefs( p );
|
Gia_ManCreateValueRefs( p );
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ void Gia_ManPrintStats( Gia_Man_t * p, int fTents, int fSwitch )
|
||||||
printf( " ff =%7d", Gia_ManRegNum(p) );
|
printf( " ff =%7d", Gia_ManRegNum(p) );
|
||||||
printf( " and =%8d", Gia_ManAndNum(p) );
|
printf( " and =%8d", Gia_ManAndNum(p) );
|
||||||
printf( " lev =%5d", Gia_ManLevelNum(p) ); Vec_IntFreeP( &p->vLevels );
|
printf( " lev =%5d", Gia_ManLevelNum(p) ); Vec_IntFreeP( &p->vLevels );
|
||||||
printf( " cut =%5d", Gia_ManCrossCut(p) );
|
printf( " cut = %d(%d)", Gia_ManCrossCut(p, 0), Gia_ManCrossCut(p, 1) );
|
||||||
// printf( " mem =%5.2f MB", 1.0*(sizeof(Gia_Obj_t)*p->nObjs + sizeof(int)*(Vec_IntSize(p->vCis) + Vec_IntSize(p->vCos)))/(1<<20) );
|
// printf( " mem =%5.2f MB", 1.0*(sizeof(Gia_Obj_t)*p->nObjs + sizeof(int)*(Vec_IntSize(p->vCis) + Vec_IntSize(p->vCos)))/(1<<20) );
|
||||||
printf( " mem =%5.2f MB", 1.0*(sizeof(Gia_Obj_t)*p->nObjsAlloc + sizeof(int)*(Vec_IntCap(p->vCis) + Vec_IntCap(p->vCos)))/(1<<20) );
|
printf( " mem =%5.2f MB", 1.0*(sizeof(Gia_Obj_t)*p->nObjsAlloc + sizeof(int)*(Vec_IntCap(p->vCis) + Vec_IntCap(p->vCos)))/(1<<20) );
|
||||||
if ( Gia_ManHasDangling(p) )
|
if ( Gia_ManHasDangling(p) )
|
||||||
|
|
|
||||||
|
|
@ -574,7 +574,7 @@ void Gia_ManDfsForCrossCut_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vNo
|
||||||
Gia_ManDfsForCrossCut_rec( p, Gia_ObjFanin1(pObj), vNodes );
|
Gia_ManDfsForCrossCut_rec( p, Gia_ObjFanin1(pObj), vNodes );
|
||||||
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
|
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
|
||||||
}
|
}
|
||||||
Vec_Int_t * Gia_ManDfsForCrossCut( Gia_Man_t * p )
|
Vec_Int_t * Gia_ManDfsForCrossCut( Gia_Man_t * p, int fReverse )
|
||||||
{
|
{
|
||||||
Vec_Int_t * vNodes;
|
Vec_Int_t * vNodes;
|
||||||
Gia_Obj_t * pObj;
|
Gia_Obj_t * pObj;
|
||||||
|
|
@ -582,17 +582,26 @@ Vec_Int_t * Gia_ManDfsForCrossCut( Gia_Man_t * p )
|
||||||
Gia_ManCleanValue( p );
|
Gia_ManCleanValue( p );
|
||||||
vNodes = Vec_IntAlloc( Gia_ManObjNum(p) );
|
vNodes = Vec_IntAlloc( Gia_ManObjNum(p) );
|
||||||
Gia_ManIncrementTravId( p );
|
Gia_ManIncrementTravId( p );
|
||||||
|
if ( fReverse )
|
||||||
|
{
|
||||||
|
Gia_ManForEachCoReverse( p, pObj, i )
|
||||||
|
if ( !Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
|
||||||
|
Gia_ManDfsForCrossCut_rec( p, pObj, vNodes );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Gia_ManForEachCo( p, pObj, i )
|
Gia_ManForEachCo( p, pObj, i )
|
||||||
if ( !Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
|
if ( !Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
|
||||||
Gia_ManDfsForCrossCut_rec( p, pObj, vNodes );
|
Gia_ManDfsForCrossCut_rec( p, pObj, vNodes );
|
||||||
|
}
|
||||||
return vNodes;
|
return vNodes;
|
||||||
}
|
}
|
||||||
int Gia_ManCrossCut( Gia_Man_t * p )
|
int Gia_ManCrossCut( Gia_Man_t * p, int fReverse )
|
||||||
{
|
{
|
||||||
Vec_Int_t * vNodes;
|
Vec_Int_t * vNodes;
|
||||||
Gia_Obj_t * pObj;
|
Gia_Obj_t * pObj;
|
||||||
int i, nCutCur = 0, nCutMax = 0;
|
int i, nCutCur = 0, nCutMax = 0;
|
||||||
vNodes = Gia_ManDfsForCrossCut( p );
|
vNodes = Gia_ManDfsForCrossCut( p, fReverse );
|
||||||
Gia_ManForEachObjVec( vNodes, p, pObj, i )
|
Gia_ManForEachObjVec( vNodes, p, pObj, i )
|
||||||
{
|
{
|
||||||
if ( pObj->Value )
|
if ( pObj->Value )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue