summaryrefslogtreecommitdiffstats
path: root/src/map/scl/sclUtil.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-08-31 09:26:26 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-08-31 09:26:26 -0700
commit8c0e0d7143961f2f575478ca815438817587a90f (patch)
treefaaceda1d9a40c8ae90ad2d4ad58bca76181fe85 /src/map/scl/sclUtil.c
parente63c603e926d85040503d6a6caf73419d1837bae (diff)
downloadabc-8c0e0d7143961f2f575478ca815438817587a90f.tar.gz
abc-8c0e0d7143961f2f575478ca815438817587a90f.tar.bz2
abc-8c0e0d7143961f2f575478ca815438817587a90f.zip
Added command 'print_gs' to print gate sizes in the mapping.
Diffstat (limited to 'src/map/scl/sclUtil.c')
-rw-r--r--src/map/scl/sclUtil.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/map/scl/sclUtil.c b/src/map/scl/sclUtil.c
index 2ae0ddca..b0fdda05 100644
--- a/src/map/scl/sclUtil.c
+++ b/src/map/scl/sclUtil.c
@@ -221,6 +221,52 @@ void Abc_SclManSetGates( SC_Lib * pLib, Abc_Ntk_t * p, Vec_Int_t * vGates )
}
}
+/**Function*************************************************************
+
+ Synopsis [Reports percentage of gates of each size.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+#define ABC_SCL_MAX_SIZE 64
+void Abc_SclManPrintGateSizes( SC_Lib * pLib, Abc_Ntk_t * p, Vec_Int_t * vGates )
+{
+ Abc_Obj_t * pObj;
+ int i, nGates = 0, Counters[ABC_SCL_MAX_SIZE] = {0};
+ double TotArea = 0, Areas[ABC_SCL_MAX_SIZE] = {0};
+ Abc_NtkForEachNode1( p, pObj, i )
+ {
+ SC_Cell * pCell = SC_LibCell( pLib, Vec_IntEntry(vGates, Abc_ObjId(pObj)) );
+ assert( pCell->Order < ABC_SCL_MAX_SIZE );
+ Counters[pCell->Order]++;
+ Areas[pCell->Order] += pCell->area;
+ TotArea += pCell->area;
+ nGates++;
+ }
+ printf( "Total gates = %d. Total area = %.1f\n", nGates, TotArea );
+ for ( i = 0; i < ABC_SCL_MAX_SIZE; i++ )
+ {
+ if ( Counters[i] == 0 )
+ continue;
+ printf( "Cell size = %d. ", i );
+ printf( "Count = %6d ", Counters[i] );
+ printf( "(%5.1f %%) ", 100.0 * Counters[i] / nGates );
+ printf( "Area = %12.1f ", Areas[i] );
+ printf( "(%5.1f %%) ", 100.0 * Areas[i] / TotArea );
+ printf( "\n" );
+ }
+}
+void Abc_SclPrintGateSizes( SC_Lib * pLib, Abc_Ntk_t * p )
+{
+ Vec_Int_t * vGates;
+ vGates = Abc_SclManFindGates( pLib, p );
+ Abc_SclManPrintGateSizes( pLib, p, vGates );
+ Vec_IntFree( vGates );
+}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///