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_
Vec_Int_t vCos; // combinational outputs
Vec_Int_t vFfs; // flops
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
Wlc_Obj_t * pObjs;
int iObj;
......@@ -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_NtkFree( Wlc_Ntk_t * p );
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 void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p );
/*=== wlcReadWord.c ========================================================*/
......
......@@ -352,9 +352,12 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p )
pNew = Gia_ManStart( 5 * Wlc_NtkObjNum(p) + 1000 );
pNew->pName = Abc_UtilStrsav( p->pName );
Gia_ManHashAlloc( pNew );
// clean AND-gate counters
memset( p->nAnds, 0, sizeof(int) * WLC_OBJ_NUMBER );
// create primary inputs
Wlc_NtkForEachObj( p, pObj, i )
{
int nAndPrev = Gia_ManObjNum(pNew);
// char * pName = Wlc_ObjName(p, i);
nRange = Wlc_ObjRange( pObj );
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 )
assert( Vec_IntSize(vBits) == Wlc_ObjCopy(p, i) );
Vec_IntAppend( vBits, vRes );
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) );
Vec_IntFree( vTemp0 );
Vec_IntFree( vTemp1 );
......
......@@ -208,9 +208,10 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
int fShowMulti = 0;
int fShowAdder = 0;
int fDistrib = 0;
int c, fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "mavh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "madvh" ) ) != EOF )
{
switch ( c )
{
......@@ -220,6 +221,9 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'a':
fShowAdder ^= 1;
break;
case 'd':
fDistrib ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
......@@ -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" );
return 0;
}
Wlc_NtkPrintStats( pNtk, fVerbose );
Wlc_NtkPrintStats( pNtk, fDistrib, fVerbose );
if ( fShowMulti )
Wlc_NtkPrintNodes( pNtk, WLC_OBJ_ARI_MULTI );
if ( fShowAdder )
Wlc_NtkPrintNodes( pNtk, WLC_OBJ_ARI_ADD );
return 0;
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-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-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-h : print the command usage\n");
return 1;
......
......@@ -146,8 +146,8 @@ void Wlc_ObjUpdateType( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, int Type )
{
if ( pObj->Type == WLC_OBJ_PO )
{
if ( Type != WLC_OBJ_BUF )
printf( "Primary outputs should be driven by buffers.\n" );
// if ( Type != WLC_OBJ_BUF )
// printf( "Primary outputs should be driven by buffers.\n" );
assert( Type == WLC_OBJ_BUF );
return;
}
......@@ -303,7 +303,7 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose )
Vec_Wrd_t * vOccur = (Vec_Wrd_t *)Vec_PtrEntry( vOccurs, i );
if ( p->nObjs[i] == 0 )
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
Wlc_NtkPrintDistribSortOne( vTypes, vOccurs, i );
Vec_WrdForEachEntry( vType, Sign, k )
......@@ -345,7 +345,7 @@ void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type )
printf( "\n" );
}
}
void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fVerbose )
void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fDistrib, int fVerbose )
{
int i;
printf( "%-20s : ", p->pName );
......@@ -357,12 +357,21 @@ void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fVerbose )
printf( "\n" );
if ( !fVerbose )
return;
printf( "Node type statisticts:\n" );
if ( fDistrib )
{
Wlc_NtkPrintDistrib( p, fVerbose );
return;
for ( i = 0; i < WLC_OBJ_NUMBER; i++ )
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*************************************************************
......
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