summaryrefslogtreecommitdiffstats
path: root/src/aig
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-10-03 14:10:23 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2013-10-03 14:10:23 -0700
commit755e09958ffd1a910522ee9cd21c5c604ad46f50 (patch)
treeae4841c9f56271b05fa40aeea5ed52169588934b /src/aig
parent6132d7cb10c13d10cd5de50aea63b3ee9d4472cc (diff)
downloadabc-755e09958ffd1a910522ee9cd21c5c604ad46f50.tar.gz
abc-755e09958ffd1a910522ee9cd21c5c604ad46f50.tar.bz2
abc-755e09958ffd1a910522ee9cd21c5c604ad46f50.zip
Added computation of mapping overlap in &ps.
Diffstat (limited to 'src/aig')
-rw-r--r--src/aig/gia/giaIf.c57
1 files changed, 48 insertions, 9 deletions
diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c
index 706ff957..d50e34c9 100644
--- a/src/aig/gia/giaIf.c
+++ b/src/aig/gia/giaIf.c
@@ -211,7 +211,7 @@ void Gia_ManSetRefsMapped( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
-int Gia_ManComputeOverlapOne_rec( Gia_Man_t * p, int iObj, Vec_Str_t * vLabel, Vec_Int_t * vVisit )
+int Gia_ManComputeOverlap2One_rec( Gia_Man_t * p, int iObj, Vec_Str_t * vLabel, Vec_Int_t * vVisit )
{
Gia_Obj_t * pObj;
int Counter;
@@ -220,34 +220,34 @@ int Gia_ManComputeOverlapOne_rec( Gia_Man_t * p, int iObj, Vec_Str_t * vLabel, V
Vec_StrWriteEntry( vLabel, iObj, 1 );
pObj = Gia_ManObj( p, iObj );
assert( Gia_ObjIsAnd(pObj) );
- Counter = Gia_ManComputeOverlapOne_rec( p, Gia_ObjFaninId0(pObj, iObj), vLabel, vVisit );
- Counter += Gia_ManComputeOverlapOne_rec( p, Gia_ObjFaninId1(pObj, iObj), vLabel, vVisit );
+ Counter = Gia_ManComputeOverlap2One_rec( p, Gia_ObjFaninId0(pObj, iObj), vLabel, vVisit );
+ Counter += Gia_ManComputeOverlap2One_rec( p, Gia_ObjFaninId1(pObj, iObj), vLabel, vVisit );
Vec_IntPush( vVisit, iObj );
return Counter + 1;
}
-int Gia_ManComputeOverlapOne( Gia_Man_t * p, int iObj, Vec_Str_t * vLabel, Vec_Int_t * vVisit )
+int Gia_ManComputeOverlap2One( Gia_Man_t * p, int iObj, Vec_Str_t * vLabel, Vec_Int_t * vVisit )
{
int iFan, k, Counter;
Vec_IntClear( vVisit );
Gia_LutForEachFanin( p, iObj, iFan, k )
Vec_StrWriteEntry( vLabel, iFan, 1 );
- Counter = Gia_ManComputeOverlapOne_rec( p, iObj, vLabel, vVisit );
+ Counter = Gia_ManComputeOverlap2One_rec( p, iObj, vLabel, vVisit );
Gia_LutForEachFanin( p, iObj, iFan, k )
Vec_StrWriteEntry( vLabel, iFan, 0 );
Vec_IntForEachEntry( vVisit, iFan, k )
Vec_StrWriteEntry( vLabel, iFan, 0 );
return Counter;
}
-int Gia_ManComputeOverlap( Gia_Man_t * p )
+int Gia_ManComputeOverlap2( Gia_Man_t * p )
{
Vec_Int_t * vVisit;
Vec_Str_t * vLabel;
- int i, Count = 0;
+ int i, Count = -Gia_ManAndNum(p);
assert( Gia_ManHasMapping(p) );
vVisit = Vec_IntAlloc( 100 );
vLabel = Vec_StrStart( Gia_ManObjNum(p) );
Gia_ManForEachLut( p, i )
- Count += Gia_ManComputeOverlapOne( p, i, vLabel, vVisit );
+ Count += Gia_ManComputeOverlap2One( p, i, vLabel, vVisit );
Vec_StrFree( vLabel );
Vec_IntFree( vVisit );
return Count;
@@ -255,6 +255,45 @@ int Gia_ManComputeOverlap( Gia_Man_t * p )
/**Function*************************************************************
+ Synopsis [Calculate mapping overlap.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Gia_ManComputeOverlapOne_rec( Gia_Man_t * p, int iObj )
+{
+ Gia_Obj_t * pObj;
+ if ( Gia_ObjIsTravIdCurrentId(p, iObj) )
+ return 0;
+ Gia_ObjSetTravIdCurrentId( p, iObj );
+ pObj = Gia_ManObj( p, iObj );
+ assert( Gia_ObjIsAnd(pObj) );
+ return 1 + Gia_ManComputeOverlapOne_rec( p, Gia_ObjFaninId0(pObj, iObj) )
+ + Gia_ManComputeOverlapOne_rec( p, Gia_ObjFaninId1(pObj, iObj) );
+}
+int Gia_ManComputeOverlapOne( Gia_Man_t * p, int iObj )
+{
+ int iFan, k;
+ Gia_ManIncrementTravId(p);
+ Gia_LutForEachFanin( p, iObj, iFan, k )
+ Gia_ObjSetTravIdCurrentId( p, iFan );
+ return Gia_ManComputeOverlapOne_rec( p, iObj );
+}
+int Gia_ManComputeOverlap( Gia_Man_t * p )
+{
+ int i, Count = -Gia_ManAndNum(p);
+ assert( Gia_ManHasMapping(p) );
+ Gia_ManForEachLut( p, i )
+ Count += Gia_ManComputeOverlapOne( p, i );
+ return Count;
+}
+
+/**Function*************************************************************
+
Synopsis [Prints mapping statistics.]
Description []
@@ -286,7 +325,7 @@ void Gia_ManPrintMappingStats( Gia_Man_t * p )
Abc_Print( 1, "lut =%7d ", nLuts );
Abc_Print( 1, "edge =%8d ", nFanins );
Abc_Print( 1, "lev =%5d ", LevelMax );
- Abc_Print( 1, "over =%5.1f %% ", 100.0 * Gia_ManComputeOverlap(p) / Gia_ManAndNum(p) - 100.0 );
+ Abc_Print( 1, "over =%5.1f %% ", 100.0 * Gia_ManComputeOverlap(p) / Gia_ManAndNum(p) );
Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) );
Abc_Print( 1, "\n" );
/*