Commit 6aa1c94e by Alan Mishchenko

Enabling print-out, for each operator, of the percetage of AND nodes after bit-blasting.

parent a1b4773c
...@@ -115,6 +115,7 @@ struct Wlc_Ntk_t_ ...@@ -115,6 +115,7 @@ struct Wlc_Ntk_t_
Vec_Int_t vCos; // combinational outputs Vec_Int_t vCos; // combinational outputs
Vec_Int_t vFfs; // flops Vec_Int_t vFfs; // flops
int nObjs[WLC_OBJ_NUMBER]; // counter of objects of each type int nObjs[WLC_OBJ_NUMBER]; // counter of objects of each type
int nAnds[WLC_OBJ_NUMBER]; // counter of AND gates after blasting
// memory for objects // memory for objects
Wlc_Obj_t * pObjs; Wlc_Obj_t * pObjs;
int iObj; int iObj;
...@@ -218,7 +219,7 @@ extern void Wlc_ObjUpdateType( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, int Ty ...@@ -218,7 +219,7 @@ extern void Wlc_ObjUpdateType( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, int Ty
extern void Wlc_ObjAddFanins( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vFanins ); extern void Wlc_ObjAddFanins( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vFanins );
extern void Wlc_NtkFree( Wlc_Ntk_t * p ); extern void Wlc_NtkFree( Wlc_Ntk_t * p );
extern void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type ); extern void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type );
extern void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fVerbose ); extern void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fDistrib, int fVerbose );
extern Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p ); extern Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p );
extern void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p ); extern void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p );
/*=== wlcReadWord.c ========================================================*/ /*=== wlcReadWord.c ========================================================*/
......
...@@ -352,9 +352,12 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p ) ...@@ -352,9 +352,12 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p )
pNew = Gia_ManStart( 5 * Wlc_NtkObjNum(p) + 1000 ); pNew = Gia_ManStart( 5 * Wlc_NtkObjNum(p) + 1000 );
pNew->pName = Abc_UtilStrsav( p->pName ); pNew->pName = Abc_UtilStrsav( p->pName );
Gia_ManHashAlloc( pNew ); Gia_ManHashAlloc( pNew );
// clean AND-gate counters
memset( p->nAnds, 0, sizeof(int) * WLC_OBJ_NUMBER );
// create primary inputs // create primary inputs
Wlc_NtkForEachObj( p, pObj, i ) Wlc_NtkForEachObj( p, pObj, i )
{ {
int nAndPrev = Gia_ManObjNum(pNew);
// char * pName = Wlc_ObjName(p, i); // char * pName = Wlc_ObjName(p, i);
nRange = Wlc_ObjRange( pObj ); nRange = Wlc_ObjRange( pObj );
nRange0 = Wlc_ObjFaninNum(pObj) > 0 ? Wlc_ObjRange( Wlc_ObjFanin0(p, pObj) ) : -1; nRange0 = Wlc_ObjFaninNum(pObj) > 0 ? Wlc_ObjRange( Wlc_ObjFanin0(p, pObj) ) : -1;
...@@ -564,7 +567,10 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p ) ...@@ -564,7 +567,10 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p )
assert( Vec_IntSize(vBits) == Wlc_ObjCopy(p, i) ); assert( Vec_IntSize(vBits) == Wlc_ObjCopy(p, i) );
Vec_IntAppend( vBits, vRes ); Vec_IntAppend( vBits, vRes );
pPrev = pObj; pPrev = pObj;
if ( pObj->Type != WLC_OBJ_PI && pObj->Type != WLC_OBJ_PO )
p->nAnds[pObj->Type] += Gia_ManObjNum(pNew) - nAndPrev;
} }
p->nAnds[0] = Gia_ManAndNum(pNew);
assert( nBits == Vec_IntSize(vBits) ); assert( nBits == Vec_IntSize(vBits) );
Vec_IntFree( vTemp0 ); Vec_IntFree( vTemp0 );
Vec_IntFree( vTemp1 ); Vec_IntFree( vTemp1 );
......
...@@ -208,9 +208,10 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -208,9 +208,10 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc); Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
int fShowMulti = 0; int fShowMulti = 0;
int fShowAdder = 0; int fShowAdder = 0;
int fDistrib = 0;
int c, fVerbose = 0; int c, fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "mavh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "madvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -220,6 +221,9 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -220,6 +221,9 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'a': case 'a':
fShowAdder ^= 1; fShowAdder ^= 1;
break; break;
case 'd':
fDistrib ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
...@@ -234,17 +238,18 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -234,17 +238,18 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "Abc_CommandPs(): There is no current design.\n" ); Abc_Print( 1, "Abc_CommandPs(): There is no current design.\n" );
return 0; return 0;
} }
Wlc_NtkPrintStats( pNtk, fVerbose ); Wlc_NtkPrintStats( pNtk, fDistrib, fVerbose );
if ( fShowMulti ) if ( fShowMulti )
Wlc_NtkPrintNodes( pNtk, WLC_OBJ_ARI_MULTI ); Wlc_NtkPrintNodes( pNtk, WLC_OBJ_ARI_MULTI );
if ( fShowAdder ) if ( fShowAdder )
Wlc_NtkPrintNodes( pNtk, WLC_OBJ_ARI_ADD ); Wlc_NtkPrintNodes( pNtk, WLC_OBJ_ARI_ADD );
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: %%ps [-mavh]\n" ); Abc_Print( -2, "usage: %%ps [-madvh]\n" );
Abc_Print( -2, "\t prints statistics\n" ); Abc_Print( -2, "\t prints statistics\n" );
Abc_Print( -2, "\t-m : toggle printing multipliers [default = %s]\n", fShowMulti? "yes": "no" ); Abc_Print( -2, "\t-m : toggle printing multipliers [default = %s]\n", fShowMulti? "yes": "no" );
Abc_Print( -2, "\t-a : toggle printing adders [default = %s]\n", fShowAdder? "yes": "no" ); Abc_Print( -2, "\t-a : toggle printing adders [default = %s]\n", fShowAdder? "yes": "no" );
Abc_Print( -2, "\t-d : toggle printing distrubition [default = %s]\n", fDistrib? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
return 1; return 1;
......
...@@ -146,8 +146,8 @@ void Wlc_ObjUpdateType( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, int Type ) ...@@ -146,8 +146,8 @@ void Wlc_ObjUpdateType( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, int Type )
{ {
if ( pObj->Type == WLC_OBJ_PO ) if ( pObj->Type == WLC_OBJ_PO )
{ {
if ( Type != WLC_OBJ_BUF ) // if ( Type != WLC_OBJ_BUF )
printf( "Primary outputs should be driven by buffers.\n" ); // printf( "Primary outputs should be driven by buffers.\n" );
assert( Type == WLC_OBJ_BUF ); assert( Type == WLC_OBJ_BUF );
return; return;
} }
...@@ -303,7 +303,7 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose ) ...@@ -303,7 +303,7 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose )
Vec_Wrd_t * vOccur = (Vec_Wrd_t *)Vec_PtrEntry( vOccurs, i ); Vec_Wrd_t * vOccur = (Vec_Wrd_t *)Vec_PtrEntry( vOccurs, i );
if ( p->nObjs[i] == 0 ) if ( p->nObjs[i] == 0 )
continue; continue;
printf( "%2d : %6d %-8s ", i, p->nObjs[i], Wlc_Names[i] ); printf( "%2d : %-8s %6d ", i, Wlc_Names[i], p->nObjs[i] );
// sort by occurence // sort by occurence
Wlc_NtkPrintDistribSortOne( vTypes, vOccurs, i ); Wlc_NtkPrintDistribSortOne( vTypes, vOccurs, i );
Vec_WrdForEachEntry( vType, Sign, k ) Vec_WrdForEachEntry( vType, Sign, k )
...@@ -345,7 +345,7 @@ void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type ) ...@@ -345,7 +345,7 @@ void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type )
printf( "\n" ); printf( "\n" );
} }
} }
void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fVerbose ) void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fDistrib, int fVerbose )
{ {
int i; int i;
printf( "%-20s : ", p->pName ); printf( "%-20s : ", p->pName );
...@@ -357,12 +357,21 @@ void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fVerbose ) ...@@ -357,12 +357,21 @@ void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fVerbose )
printf( "\n" ); printf( "\n" );
if ( !fVerbose ) if ( !fVerbose )
return; return;
printf( "Node type statisticts:\n" ); if ( fDistrib )
Wlc_NtkPrintDistrib( p, fVerbose ); {
return; Wlc_NtkPrintDistrib( p, fVerbose );
for ( i = 0; i < WLC_OBJ_NUMBER; i++ ) return;
if ( p->nObjs[i] ) }
printf( "%2d : %6d %-8s\n", i, p->nObjs[i], Wlc_Names[i] ); printf( "Node type statistics:\n" );
for ( i = 1; i < WLC_OBJ_NUMBER; i++ )
{
if ( !p->nObjs[i] )
continue;
if ( p->nAnds[0] && p->nAnds[i] )
printf( "%2d : %-8s %6d %7.2f %%\n", i, Wlc_Names[i], p->nObjs[i], 100.0*p->nAnds[i]/p->nAnds[0] );
else
printf( "%2d : %-8s %6d\n", i, Wlc_Names[i], p->nObjs[i] );
}
} }
/**Function************************************************************* /**Function*************************************************************
......
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