Commit abb889fe by Alan Mishchenko

Improving printouts of gates and support.

parent b584fea2
...@@ -1463,14 +1463,16 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -1463,14 +1463,16 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv )
int c; int c;
int fStruct; int fStruct;
int fVerbose; int fVerbose;
int fVeryVerbose;
extern Vec_Ptr_t * Sim_ComputeFunSupp( Abc_Ntk_t * pNtk, int fVerbose ); extern Vec_Ptr_t * Sim_ComputeFunSupp( Abc_Ntk_t * pNtk, int fVerbose );
extern void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk ); extern void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk, int fMatrix );
// set defaults // set defaults
fStruct = 1; fStruct = 1;
fVerbose = 0; fVerbose = 0;
fVeryVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "svh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "svwh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -1480,6 +1482,9 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -1480,6 +1482,9 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
case 'w':
fVeryVerbose ^= 1;
break;
case 'h': case 'h':
goto usage; goto usage;
default: default:
...@@ -1496,7 +1501,7 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -1496,7 +1501,7 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv )
// print support information // print support information
if ( fStruct ) if ( fStruct )
{ {
Abc_NtkPrintStrSupports( pNtk ); Abc_NtkPrintStrSupports( pNtk, fVeryVerbose );
return 0; return 0;
} }
...@@ -1516,10 +1521,11 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -1516,10 +1521,11 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: print_supp [-svh]\n" ); Abc_Print( -2, "usage: print_supp [-svwh]\n" );
Abc_Print( -2, "\t prints the supports of the CO nodes\n" ); Abc_Print( -2, "\t prints the supports of the CO nodes\n" );
Abc_Print( -2, "\t-s : toggle printing structural support only [default = %s].\n", fStruct? "yes": "no" ); Abc_Print( -2, "\t-s : toggle printing structural support only [default = %s].\n", fStruct? "yes": "no" );
Abc_Print( -2, "\t-v : enable verbose output [default = %s].\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : enable verbose output [default = %s].\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-w : enable printing CI/CO dependency matrix [default = %s].\n", fVeryVerbose? "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;
} }
......
...@@ -1004,7 +1004,7 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary ) ...@@ -1004,7 +1004,7 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
{ {
Mio_Gate_t ** ppGates; Mio_Gate_t ** ppGates;
double Area, AreaTotal; double Area, AreaTotal;
int Counter, nGates, i; int Counter, nGates, i, nGateNameLen;
// clean value of all gates // clean value of all gates
nGates = Mio_LibraryReadGateNum( (Mio_Library_t *)pNtk->pManFunc ); nGates = Mio_LibraryReadGateNum( (Mio_Library_t *)pNtk->pManFunc );
...@@ -1020,6 +1020,17 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary ) ...@@ -1020,6 +1020,17 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
Mio_GateSetValue( (Mio_Gate_t *)pObj->pData, 1 + Mio_GateReadValue((Mio_Gate_t *)pObj->pData) ); Mio_GateSetValue( (Mio_Gate_t *)pObj->pData, 1 + Mio_GateReadValue((Mio_Gate_t *)pObj->pData) );
CounterTotal++; CounterTotal++;
} }
// determine the longest gate name
nGateNameLen = 0;
for ( i = 0; i < nGates; i++ )
{
Counter = Mio_GateReadValue( ppGates[i] );
if ( Counter == 0 )
continue;
nGateNameLen = Abc_MaxInt( nGateNameLen, strlen(Mio_GateReadName(ppGates[i])) );
}
// print the gates // print the gates
AreaTotal = Abc_NtkGetMappedArea(pNtk); AreaTotal = Abc_NtkGetMappedArea(pNtk);
for ( i = 0; i < nGates; i++ ) for ( i = 0; i < nGates; i++ )
...@@ -1028,12 +1039,13 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary ) ...@@ -1028,12 +1039,13 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
if ( Counter == 0 ) if ( Counter == 0 )
continue; continue;
Area = Counter * Mio_GateReadArea( ppGates[i] ); Area = Counter * Mio_GateReadArea( ppGates[i] );
printf( "%-12s Fanin = %2d Instance = %8d Area = %10.2f %6.2f %%\n", printf( "%-*s Fanin = %2d Instance = %8d Area = %10.2f %6.2f %%\n",
Mio_GateReadName( ppGates[i] ), nGateNameLen, Mio_GateReadName( ppGates[i] ),
Mio_GateReadInputs( ppGates[i] ), Mio_GateReadInputs( ppGates[i] ),
Counter, Area, 100.0 * Area / AreaTotal ); Counter, Area, 100.0 * Area / AreaTotal );
} }
printf( "%-12s Instance = %8d Area = %10.2f %6.2f %%\n", "TOTAL", printf( "%-*s Instance = %8d Area = %10.2f %6.2f %%\n",
nGateNameLen, "TOTAL",
CounterTotal, AreaTotal, 100.0 ); CounterTotal, AreaTotal, 100.0 );
return; return;
} }
...@@ -1150,11 +1162,11 @@ void Abc_NtkPrintSharing( Abc_Ntk_t * pNtk ) ...@@ -1150,11 +1162,11 @@ void Abc_NtkPrintSharing( Abc_Ntk_t * pNtk )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk ) void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk, int fMatrix )
{ {
Vec_Ptr_t * vSupp, * vNodes; Vec_Ptr_t * vSupp, * vNodes;
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
int i; int i, k;
printf( "Structural support info:\n" ); printf( "Structural support info:\n" );
Abc_NtkForEachCo( pNtk, pObj, i ) Abc_NtkForEachCo( pNtk, pObj, i )
{ {
...@@ -1165,6 +1177,28 @@ void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk ) ...@@ -1165,6 +1177,28 @@ void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk )
Vec_PtrFree( vNodes ); Vec_PtrFree( vNodes );
Vec_PtrFree( vSupp ); Vec_PtrFree( vSupp );
} }
if ( !fMatrix )
return;
Abc_NtkForEachCi( pNtk, pObj, k )
pObj->fMarkA = 0;
printf( "Actual support info:\n" );
Abc_NtkForEachCo( pNtk, pObj, i )
{
vSupp = Abc_NtkNodeSupport( pNtk, &pObj, 1 );
Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, k )
pObj->fMarkA = 1;
Vec_PtrFree( vSupp );
Abc_NtkForEachCi( pNtk, pObj, k )
printf( "%d", pObj->fMarkA );
printf( "\n" );
Abc_NtkForEachCi( pNtk, pObj, k )
pObj->fMarkA = 0;
}
} }
/**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