summaryrefslogtreecommitdiffstats
path: root/src/aig/gia/giaMan.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-10-24 17:39:38 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-10-24 17:39:38 -0700
commit6b96d9a84e1356295c8c25588915701bd9160001 (patch)
tree620261ecac8299bd3b259a11bef7b513efefb7a4 /src/aig/gia/giaMan.c
parent5cd1396b3d752c968cd558f02625ce5f12688415 (diff)
downloadabc-6b96d9a84e1356295c8c25588915701bd9160001.tar.gz
abc-6b96d9a84e1356295c8c25588915701bd9160001.tar.bz2
abc-6b96d9a84e1356295c8c25588915701bd9160001.zip
Integrating GIA with LUT mapping.
Diffstat (limited to 'src/aig/gia/giaMan.c')
-rw-r--r--src/aig/gia/giaMan.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c
index f82e7952..0ae484fc 100644
--- a/src/aig/gia/giaMan.c
+++ b/src/aig/gia/giaMan.c
@@ -21,6 +21,7 @@
#include "gia.h"
#include "misc/tim/tim.h"
#include "proof/abs/abs.h"
+#include "opt/dar/dar.h"
ABC_NAMESPACE_IMPL_START
@@ -277,6 +278,7 @@ void Gia_ManPrintChoiceStats( Gia_Man_t * p )
assert( Gia_ObjIsAnd(Gia_ObjSiblObj(p, i)) );
}
Abc_Print( 1, "Choice stats: Equivs =%7d. Choices =%7d.\n", nEquivs, nChoices );
+ Gia_ManCleanMark0( p );
}
/**Function*************************************************************
@@ -459,6 +461,96 @@ void Gia_ManReportImprovement( Gia_Man_t * p, Gia_Man_t * pNew )
printf( "\n" );
}
+/**Function*************************************************************
+
+ Synopsis [Prints NPN class statistics.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Gia_ManPrintNpnClasses( Gia_Man_t * p )
+{
+ extern char ** Kit_DsdNpn4ClassNames();
+ char ** pNames = Kit_DsdNpn4ClassNames();
+ Vec_Int_t * vLeaves, * vTruth, * vVisited;
+ int * pLutClass, ClassCounts[222] = {0};
+ int i, k, iFan, Class, OtherClasses, OtherClasses2, nTotal, Counter, Counter2;
+ unsigned * pTruth;
+ assert( p->pMapping != NULL );
+ assert( Gia_ManLutSizeMax( p ) <= 4 );
+ vLeaves = Vec_IntAlloc( 100 );
+ vVisited = Vec_IntAlloc( 100 );
+ vTruth = Vec_IntAlloc( (1<<16) );
+ pLutClass = ABC_CALLOC( int, Gia_ManObjNum(p) );
+ Gia_ManCleanTruth( p );
+ Gia_ManForEachLut( p, i )
+ {
+ if ( Gia_ObjLutSize(p,i) > 4 )
+ continue;
+ Vec_IntClear( vLeaves );
+ Gia_LutForEachFanin( p, i, iFan, k )
+ Vec_IntPush( vLeaves, iFan );
+ for ( ; k < 4; k++ )
+ Vec_IntPush( vLeaves, 0 );
+ pTruth = Gia_ManConvertAigToTruth( p, Gia_ManObj(p, i), vLeaves, vTruth, vVisited );
+ Class = Dar_LibReturnClass( *pTruth );
+ ClassCounts[ Class ]++;
+ pLutClass[i] = Class;
+ }
+ Vec_IntFree( vLeaves );
+ Vec_IntFree( vTruth );
+ Vec_IntFree( vVisited );
+ Vec_IntFreeP( &p->vTruths );
+ nTotal = 0;
+ for ( i = 0; i < 222; i++ )
+ nTotal += ClassCounts[i];
+ Abc_Print( 1, "NPN CLASS STATISTICS (for %d LUT4 present in the current mapping):\n", nTotal );
+ OtherClasses = 0;
+ for ( i = 0; i < 222; i++ )
+ {
+ if ( ClassCounts[i] == 0 )
+ continue;
+ if ( 100.0 * ClassCounts[i] / (nTotal+1) < 0.1 ) // do not show anything below 0.1 percent
+ continue;
+ OtherClasses += ClassCounts[i];
+ Abc_Print( 1, "Class %3d : Count = %6d (%7.2f %%) %s\n",
+ i, ClassCounts[i], 100.0 * ClassCounts[i] / (nTotal+1), pNames[i] );
+ }
+ OtherClasses = nTotal - OtherClasses;
+ Abc_Print( 1, "Other : Count = %6d (%7.2f %%)\n",
+ OtherClasses, 100.0 * OtherClasses / (nTotal+1) );
+ // count the number of LUTs that have MUX function and two fanins with MUX functions
+ OtherClasses = OtherClasses2 = 0;
+ ABC_FREE( p->pRefs );
+ Gia_ManSetRefsMapped( p );
+ Gia_ManForEachLut( p, i )
+ {
+ if ( pLutClass[i] != 109 )
+ continue;
+ Counter = Counter2 = 0;
+ Gia_LutForEachFanin( p, i, iFan, k )
+ {
+ Counter += (pLutClass[iFan] == 109);
+ Counter2 += (pLutClass[iFan] == 109) && (Gia_ObjRefNumId(p, iFan) == 1);
+ }
+ OtherClasses += (Counter > 1);
+ OtherClasses2 += (Counter2 > 1);
+// Abc_Print( 1, "%d -- ", pLutClass[i] );
+// Gia_LutForEachFanin( p, i, iFan, k )
+// Abc_Print( 1, "%d ", pLutClass[iFan] );
+// Abc_Print( 1, "\n" );
+ }
+ ABC_FREE( p->pRefs );
+ Abc_Print( 1, "Approximate number of 4:1 MUX structures: All = %6d (%7.2f %%) MFFC = %6d (%7.2f %%)\n",
+ OtherClasses, 100.0 * OtherClasses / (nTotal+1),
+ OtherClasses2, 100.0 * OtherClasses2 / (nTotal+1) );
+ ABC_FREE( pLutClass );
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////