Commit 716b8cc6 by Alan Mishchenko

Improvements to print-outs.

parent 397a8c47
...@@ -15470,6 +15470,7 @@ int Abc_CommandDsdLoad( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -15470,6 +15470,7 @@ int Abc_CommandDsdLoad( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1; return 1;
} }
fclose( pFile ); fclose( pFile );
Abc_FrameSetManDsd( NULL );
pDsdMan = If_DsdManLoad(FileName); pDsdMan = If_DsdManLoad(FileName);
if ( pDsdMan == NULL ) if ( pDsdMan == NULL )
return 1; return 1;
...@@ -374,6 +374,71 @@ void If_DsdManPrintOne( FILE * pFile, If_DsdMan_t * p, int iObjId, unsigned char ...@@ -374,6 +374,71 @@ void If_DsdManPrintOne( FILE * pFile, If_DsdMan_t * p, int iObjId, unsigned char
fprintf( pFile, "\n" ); fprintf( pFile, "\n" );
assert( nSupp == If_DsdVecObjSuppSize(p->vObjs, iObjId) ); assert( nSupp == If_DsdVecObjSuppSize(p->vObjs, iObjId) );
} }
#define DSD_ARRAY_LIMIT 16
void If_DsdManPrintDecs( FILE * pFile, If_DsdMan_t * p )
{
Vec_Int_t * vDecs;
int i, k, nSuppSize, nDecMax = 0;
int pDecMax[IF_MAX_FUNC_LUTSIZE] = {0};
int pCountsAll[IF_MAX_FUNC_LUTSIZE] = {0};
int pCountsSSizes[IF_MAX_FUNC_LUTSIZE] = {0};
int pCounts[IF_MAX_FUNC_LUTSIZE][DSD_ARRAY_LIMIT+2] = {{0}};
word * pTruth;
assert( Vec_MemEntryNum(p->vTtMem) == Vec_PtrSize(p->vTtDecs) );
// find max number of decompositions
Vec_PtrForEachEntry( Vec_Int_t *, p->vTtDecs, vDecs, i )
{
pTruth = Vec_MemReadEntry( p->vTtMem, i );
nSuppSize = Abc_TtSupportSize( pTruth, p->nVars );
pDecMax[nSuppSize] = Abc_MaxInt( pDecMax[nSuppSize], Vec_IntSize(vDecs) );
nDecMax = Abc_MaxInt( nDecMax, Vec_IntSize(vDecs) );
}
// fill up
Vec_PtrForEachEntry( Vec_Int_t *, p->vTtDecs, vDecs, i )
{
pTruth = Vec_MemReadEntry( p->vTtMem, i );
nSuppSize = Abc_TtSupportSize( pTruth, p->nVars );
pCountsAll[nSuppSize]++;
pCountsSSizes[nSuppSize] += Vec_IntSize(vDecs);
pCounts[nSuppSize][Abc_MinInt(DSD_ARRAY_LIMIT+1,Vec_IntSize(vDecs))]++;
// pCounts[nSuppSize][Abc_MinInt(DSD_ARRAY_LIMIT+1,Vec_IntSize(vDecs)?1+(Vec_IntSize(vDecs)/10):0)]++;
/*
if ( nSuppSize == 6 && Vec_IntSize(vDecs) == pDecMax[6] )
{
fprintf( pFile, "0x" );
Abc_TtPrintHex( pTruth, nSuppSize );
Dau_DecPrintSets( vDecs, nSuppSize );
}
*/
}
// print header
fprintf( pFile, " N : " );
fprintf( pFile, " Total " );
for ( k = 0; k <= DSD_ARRAY_LIMIT; k++ )
fprintf( pFile, "%6d", k );
fprintf( pFile, " " );
fprintf( pFile, " More" );
fprintf( pFile, " Ave" );
fprintf( pFile, " Max" );
fprintf( pFile, "\n" );
// print rows
for ( i = 0; i <= p->nVars; i++ )
{
fprintf( pFile, "%2d : ", i );
fprintf( pFile, "%6d ", pCountsAll[i] );
for ( k = 0; k <= DSD_ARRAY_LIMIT; k++ )
// fprintf( pFile, "%6d", pCounts[i][k] );
fprintf( pFile, "%6.1f", 100.0*pCounts[i][k]/Abc_MaxInt(1,pCountsAll[i]) );
fprintf( pFile, " " );
// fprintf( pFile, "%6d", pCounts[i][k] );
fprintf( pFile, "%6.1f", 100.0*pCounts[i][k]/Abc_MaxInt(1,pCountsAll[i]) );
fprintf( pFile, " " );
fprintf( pFile, "%6.1f", 1.0*pCountsSSizes[i]/Abc_MaxInt(1,pCountsAll[i]) );
fprintf( pFile, " " );
fprintf( pFile, "%6d", pDecMax[i] );
fprintf( pFile, "\n" );
}
}
void If_DsdManPrintOccurs( FILE * pFile, If_DsdMan_t * p ) void If_DsdManPrintOccurs( FILE * pFile, If_DsdMan_t * p )
{ {
char Buffer[100]; char Buffer[100];
...@@ -507,6 +572,7 @@ void If_DsdManPrint( If_DsdMan_t * p, char * pFileName, int Number, int Support, ...@@ -507,6 +572,7 @@ void If_DsdManPrint( If_DsdMan_t * p, char * pFileName, int Number, int Support,
If_DsdManDumpDsd( p, Support ); If_DsdManDumpDsd( p, Support );
if ( fTtDump ) if ( fTtDump )
If_DsdManDumpAll( p, Support ); If_DsdManDumpAll( p, Support );
// If_DsdManPrintDecs( stdout, p );
if ( !fVerbose ) if ( !fVerbose )
return; return;
If_DsdVecForEachObj( p->vObjs, pObj, i ) If_DsdVecForEachObj( p->vObjs, pObj, i )
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
ABC_NAMESPACE_HEADER_START ABC_NAMESPACE_HEADER_START
#define DAU_MAX_VAR 12 // should be 6 or more #define DAU_MAX_VAR 12 // should be 6 or more
#define DAU_MAX_STR 1000 #define DAU_MAX_STR 2000
#define DAU_MAX_WORD (1<<(DAU_MAX_VAR-6)) #define DAU_MAX_WORD (1<<(DAU_MAX_VAR-6))
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
...@@ -434,7 +434,7 @@ unsigned Dau_DecReadSet( char * pStr ) ...@@ -434,7 +434,7 @@ unsigned Dau_DecReadSet( char * pStr )
void Dau_DecPrintSets( Vec_Int_t * vSets, int nVars ) void Dau_DecPrintSets( Vec_Int_t * vSets, int nVars )
{ {
int i, Entry; int i, Entry;
printf( "The set contains %d entries:\n", Vec_IntSize(vSets) ); printf( "The %d-variable set family contains %d sets:\n", nVars, Vec_IntSize(vSets) );
Vec_IntForEachEntry( vSets, Entry, i ) Vec_IntForEachEntry( vSets, Entry, i )
Dau_DecPrintSet( (unsigned)Entry, nVars, 1 ); Dau_DecPrintSet( (unsigned)Entry, nVars, 1 );
printf( "\n" ); printf( "\n" );
......
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