Commit 77fde55b by Niklas Een

Added switch for netlist type to 'send_aig'. Changed defautl to &-space. Fixed…

Added switch for netlist type to 'send_aig'. Changed defautl to &-space. Fixed printf -> Abc_Print in some places.
parent 7da6ef1c
......@@ -193,7 +193,6 @@ float Abc_NtkGetArea( Abc_Ntk_t * pNtk )
***********************************************************************/
void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch )
{
FILE * pFile = stdout;
int Num;
if ( fSaveBest )
Abc_NtkCompareAndSaveBest( pNtk );
......@@ -209,38 +208,38 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum
// if ( Abc_NtkIsStrash(pNtk) )
// Abc_AigCountNext( pNtk->pManFunc );
fprintf( pFile, "%-13s:", pNtk->pName );
fprintf( pFile, " i/o =%5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) );
Abc_Print( 1,"%-13s:", pNtk->pName );
Abc_Print( 1," i/o =%5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) );
if ( Abc_NtkConstrNum(pNtk) )
fprintf( pFile, "(c=%d)", Abc_NtkConstrNum(pNtk) );
Abc_Print( 1,"(c=%d)", Abc_NtkConstrNum(pNtk) );
if ( pNtk->nRealPos )
fprintf( pFile, "(p=%d)", Abc_NtkPoNum(pNtk) - pNtk->nRealPos );
fprintf( pFile, " lat =%5d", Abc_NtkLatchNum(pNtk) );
Abc_Print( 1,"(p=%d)", Abc_NtkPoNum(pNtk) - pNtk->nRealPos );
Abc_Print( 1," lat =%5d", Abc_NtkLatchNum(pNtk) );
if ( Abc_NtkIsNetlist(pNtk) )
{
fprintf( pFile, " net =%5d", Abc_NtkNetNum(pNtk) );
fprintf( pFile, " nd =%5d", Abc_NtkNodeNum(pNtk) );
fprintf( pFile, " wbox =%3d", Abc_NtkWhiteboxNum(pNtk) );
fprintf( pFile, " bbox =%3d", Abc_NtkBlackboxNum(pNtk) );
Abc_Print( 1," net =%5d", Abc_NtkNetNum(pNtk) );
Abc_Print( 1," nd =%5d", Abc_NtkNodeNum(pNtk) );
Abc_Print( 1," wbox =%3d", Abc_NtkWhiteboxNum(pNtk) );
Abc_Print( 1," bbox =%3d", Abc_NtkBlackboxNum(pNtk) );
}
else if ( Abc_NtkIsStrash(pNtk) )
{
fprintf( pFile, " and =%7d", Abc_NtkNodeNum(pNtk) );
Abc_Print( 1," and =%7d", Abc_NtkNodeNum(pNtk) );
if ( (Num = Abc_NtkGetChoiceNum(pNtk)) )
fprintf( pFile, " (choice = %d)", Num );
Abc_Print( 1," (choice = %d)", Num );
if ( fPrintMuxes )
{
extern int Abc_NtkCountMuxes( Abc_Ntk_t * pNtk );
Num = Abc_NtkGetExorNum(pNtk);
fprintf( pFile, " (exor = %d)", Num );
fprintf( pFile, " (mux = %d)", Abc_NtkCountMuxes(pNtk)-Num );
fprintf( pFile, " (pure and = %d)", Abc_NtkNodeNum(pNtk) - (Abc_NtkCountMuxes(pNtk) * 3) );
Abc_Print( 1," (exor = %d)", Num );
Abc_Print( 1," (mux = %d)", Abc_NtkCountMuxes(pNtk)-Num );
Abc_Print( 1," (pure and = %d)", Abc_NtkNodeNum(pNtk) - (Abc_NtkCountMuxes(pNtk) * 3) );
}
}
else
{
fprintf( pFile, " nd =%6d", Abc_NtkNodeNum(pNtk) );
fprintf( pFile, " edge =%7d", Abc_NtkGetTotalFanins(pNtk) );
Abc_Print( 1," nd =%6d", Abc_NtkNodeNum(pNtk) );
Abc_Print( 1," edge =%7d", Abc_NtkGetTotalFanins(pNtk) );
}
if ( Abc_NtkIsStrash(pNtk) || Abc_NtkIsNetlist(pNtk) )
......@@ -249,19 +248,19 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum
else if ( Abc_NtkHasSop(pNtk) )
{
fprintf( pFile, " cube =%6d", Abc_NtkGetCubeNum(pNtk) );
// fprintf( pFile, " lit(sop) = %5d", Abc_NtkGetLitNum(pNtk) );
Abc_Print( 1," cube =%6d", Abc_NtkGetCubeNum(pNtk) );
// Abc_Print( 1," lit(sop) = %5d", Abc_NtkGetLitNum(pNtk) );
if ( fFactored )
fprintf( pFile, " lit(fac) =%6d", Abc_NtkGetLitFactNum(pNtk) );
Abc_Print( 1," lit(fac) =%6d", Abc_NtkGetLitFactNum(pNtk) );
}
else if ( Abc_NtkHasAig(pNtk) )
fprintf( pFile, " aig =%6d", Abc_NtkGetAigNodeNum(pNtk) );
Abc_Print( 1," aig =%6d", Abc_NtkGetAigNodeNum(pNtk) );
else if ( Abc_NtkHasBdd(pNtk) )
fprintf( pFile, " bdd =%6d", Abc_NtkGetBddNodeNum(pNtk) );
Abc_Print( 1," bdd =%6d", Abc_NtkGetBddNodeNum(pNtk) );
else if ( Abc_NtkHasMapping(pNtk) )
{
fprintf( pFile, " area =%5.2f", Abc_NtkGetMappedArea(pNtk) );
fprintf( pFile, " delay =%5.2f", Abc_NtkDelayTrace(pNtk, NULL, NULL, 0) );
Abc_Print( 1," area =%5.2f", Abc_NtkGetMappedArea(pNtk) );
Abc_Print( 1," delay =%5.2f", Abc_NtkDelayTrace(pNtk, NULL, NULL, 0) );
}
else if ( !Abc_NtkHasBlackbox(pNtk) )
{
......@@ -271,27 +270,27 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum
if ( Abc_NtkIsStrash(pNtk) )
{
extern int Abc_NtkGetMultiRefNum( Abc_Ntk_t * pNtk );
fprintf( pFile, " lev =%3d", Abc_AigLevel(pNtk) );
// fprintf( pFile, " ff = %5d", Abc_NtkNodeNum(pNtk) + 2 * (Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk)) );
// fprintf( pFile, " var = %5d", Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk) );
Abc_Print( 1," lev =%3d", Abc_AigLevel(pNtk) );
// Abc_Print( 1," ff = %5d", Abc_NtkNodeNum(pNtk) + 2 * (Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk)) );
// Abc_Print( 1," var = %5d", Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk) );
}
else
fprintf( pFile, " lev =%3d", Abc_NtkLevel(pNtk) );
Abc_Print( 1," lev =%3d", Abc_NtkLevel(pNtk) );
if ( fUseLutLib && Abc_FrameReadLibLut() )
fprintf( pFile, " delay =%5.2f", Abc_NtkDelayTraceLut(pNtk, 1) );
Abc_Print( 1," delay =%5.2f", Abc_NtkDelayTraceLut(pNtk, 1) );
if ( fUseLutLib && Abc_FrameReadLibLut() )
fprintf( pFile, " area =%5.2f", Abc_NtkGetArea(pNtk) );
Abc_Print( 1," area =%5.2f", Abc_NtkGetArea(pNtk) );
if ( fPower )
fprintf( pFile, " power =%7.2f", Abc_NtkMfsTotalSwitching(pNtk) );
Abc_Print( 1," power =%7.2f", Abc_NtkMfsTotalSwitching(pNtk) );
if ( fGlitch )
{
extern float Abc_NtkMfsTotalGlitching( Abc_Ntk_t * pNtk );
if ( Abc_NtkIsLogic(pNtk) && Abc_NtkGetFaninMax(pNtk) <= 6 )
fprintf( pFile, " glitch =%7.2f %%", Abc_NtkMfsTotalGlitching(pNtk) );
Abc_Print( 1," glitch =%7.2f %%", Abc_NtkMfsTotalGlitching(pNtk) );
else
printf( "\nCurrently computes glitching only for K-LUT networks with K <= 6." );
}
fprintf( pFile, "\n" );
Abc_Print( 1,"\n" );
{
// extern int Abc_NtkPrintSubraphSizes( Abc_Ntk_t * pNtk );
......@@ -1548,4 +1547,3 @@ void Abc_NtkShow6VarFunc( char * pF0, char * pF1 )
ABC_NAMESPACE_IMPL_END
......@@ -247,12 +247,20 @@ int CmdCommandEcho( Abc_Frame_t * pAbc, int argc, char **argv )
}
}
if (pAbc->Out == stdout){
for ( i = globalUtilOptind; i < argc; i++ )
Abc_Print( 1, "%s ", argv[i] );
if ( n )
Abc_Print( 1, "\n" );
}else{
for ( i = globalUtilOptind; i < argc; i++ )
fprintf( pAbc->Out, "%s ", argv[i] );
if ( n )
fprintf( pAbc->Out, "\n" );
else
fflush ( pAbc->Out );
}
return 0;
usage:
......@@ -2122,4 +2130,3 @@ int CmdCommandVersion( Abc_Frame_t * pAbc, int argc, char **argv )
ABC_NAMESPACE_IMPL_END
......@@ -276,10 +276,19 @@ static inline void Abc_Print( int level, const char * format, ... )
{
extern ABC_DLL int Abc_FrameIsBridgeMode();
va_list args;
if ( ! Abc_FrameIsBridgeMode() ){
if ( level == ABC_ERROR )
printf( "Error: " );
else if ( level == ABC_WARNING )
printf( "Warning: " );
}else{
if ( level == ABC_ERROR )
Gia_ManToBridgeText( stdout, strlen("Error: "), (unsigned char*)"Error: " );
else if ( level == ABC_WARNING )
Gia_ManToBridgeText( stdout, strlen("Warning: "), (unsigned char*)"Warning: " );
}
va_start( args, format );
if ( Abc_FrameIsBridgeMode() )
{
......
......@@ -33,6 +33,7 @@ ABC_NAMESPACE_IMPL_START
#define BRIDGE_TEXT_MESSAGE 999996
#define BRIDGE_RESULTS 101
#define BRIDGE_NETLIST 106
#define BRIDGE_ABS_NETLIST 107
#define BRIDGE_BAD_ABS 105
......@@ -150,11 +151,11 @@ int Gia_ManToBridgeText( FILE * pFile, int Size, unsigned char * pBuffer )
Gia_CreateHeader( pFile, BRIDGE_TEXT_MESSAGE, Size, pBuffer );
return 1;
}
int Gia_ManToBridgeAbsNetlist( FILE * pFile, Gia_Man_t * p )
int Gia_ManToBridgeAbsNetlist( FILE * pFile, Gia_Man_t * p, int pkg_type )
{
Vec_Str_t * vBuffer;
vBuffer = Gia_ManToBridgeVec( p );
Gia_CreateHeader( pFile, BRIDGE_ABS_NETLIST, Vec_StrSize(vBuffer), (unsigned char *)Vec_StrArray(vBuffer) );
Gia_CreateHeader( pFile, pkg_type, Vec_StrSize(vBuffer), (unsigned char *)Vec_StrArray(vBuffer) );
Vec_StrFree( vBuffer );
return 1;
}
......@@ -449,7 +450,7 @@ Gia_Man_t * Gia_ManFromBridge( FILE * pFile, Vec_Int_t ** pvInit )
SeeAlso []
***********************************************************************/
void Gia_ManToBridgeAbsNetlistTest( char * pFileName, Gia_Man_t * p )
void Gia_ManToBridgeAbsNetlistTest( char * pFileName, Gia_Man_t * p, int msg_type )
{
FILE * pFile = fopen( pFileName, "wb" );
if ( pFile == NULL )
......@@ -457,7 +458,7 @@ void Gia_ManToBridgeAbsNetlistTest( char * pFileName, Gia_Man_t * p )
printf( "Cannot open output file \"%s\".\n", pFileName );
return;
}
Gia_ManToBridgeAbsNetlist( pFile, p );
Gia_ManToBridgeAbsNetlist( pFile, p, msg_type );
fclose ( pFile );
}
......@@ -488,7 +489,7 @@ void Gia_ManFromBridgeTest( char * pFileName )
Gia_ManPrintStats( p, 0, 0 );
Gia_WriteAiger( p, "temp.aig", 0, 0 );
Gia_ManToBridgeAbsNetlistTest( "par_.dump", p );
Gia_ManToBridgeAbsNetlistTest( "par_.dump", p, BRIDGE_ABS_NETLIST );
Gia_ManStop( p );
}
......
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