Commit 7e0f7eba by Alan Mishchenko

Changes to LUT mappers.

parent 6ad7dae1
...@@ -371,16 +371,7 @@ Jf_Man_t * Jf_ManAlloc( Gia_Man_t * pGia, Jf_Par_t * pPars ) ...@@ -371,16 +371,7 @@ Jf_Man_t * Jf_ManAlloc( Gia_Man_t * pGia, Jf_Par_t * pPars )
p->pGia = pGia; p->pGia = pGia;
p->pPars = pPars; p->pPars = pPars;
if ( pPars->fCutMin && !pPars->fFuncDsd ) if ( pPars->fCutMin && !pPars->fFuncDsd )
{ p->vTtMem = Vec_MemAllocForTT( pPars->nLutSize );
word uTruth[JF_WORD_MAX];
int Value, nWords = Abc_Truth6WordNum(pPars->nLutSize);
p->vTtMem = Vec_MemAlloc( nWords, 12 ); // 32 KB/page for 6-var functions
Vec_MemHashAlloc( p->vTtMem, 10000 );
memset( uTruth, 0x00, sizeof(word) * nWords );
Value = Vec_MemHashInsert( p->vTtMem, uTruth ); assert( Value == 0 );
memset( uTruth, 0xAA, sizeof(word) * nWords );
Value = Vec_MemHashInsert( p->vTtMem, uTruth ); assert( Value == 1 );
}
else if ( pPars->fCutMin && pPars->fFuncDsd ) else if ( pPars->fCutMin && pPars->fFuncDsd )
{ {
p->pDsd = Sdm_ManRead(); p->pDsd = Sdm_ManRead();
...@@ -401,18 +392,6 @@ Jf_Man_t * Jf_ManAlloc( Gia_Man_t * pGia, Jf_Par_t * pPars ) ...@@ -401,18 +392,6 @@ Jf_Man_t * Jf_ManAlloc( Gia_Man_t * pGia, Jf_Par_t * pPars )
p->clkStart = Abc_Clock(); p->clkStart = Abc_Clock();
return p; return p;
} }
void Jf_ManDumpTruthTables( Jf_Man_t * p )
{
char pFileName[1000];
FILE * pFile;
sprintf( pFileName, "tt_%s_%02d.txt", Gia_ManName(p->pGia), p->pPars->nLutSize );
pFile = fopen( pFileName, "wb" );
Vec_MemDump( pFile, p->vTtMem );
fclose( pFile );
printf( "Dumped %d %d-var truth tables into file \"%s\" (%.2f MB).\n",
Vec_MemEntryNum(p->vTtMem), p->pPars->nLutSize, pFileName,
17.0 * Vec_MemEntryNum(p->vTtMem) / (1 << 20) );
}
void Jf_ManFree( Jf_Man_t * p ) void Jf_ManFree( Jf_Man_t * p )
{ {
if ( p->pPars->fVerbose && p->pDsd ) if ( p->pPars->fVerbose && p->pDsd )
...@@ -1748,7 +1727,7 @@ Gia_Man_t * Jf_ManPerformMapping( Gia_Man_t * pGia, Jf_Par_t * pPars ) ...@@ -1748,7 +1727,7 @@ Gia_Man_t * Jf_ManPerformMapping( Gia_Man_t * pGia, Jf_Par_t * pPars )
Jf_ManPropagateEla( p, 1 ); Jf_ManPrintStats( p, "Edge " ); Jf_ManPropagateEla( p, 1 ); Jf_ManPrintStats( p, "Edge " );
} }
if ( p->pPars->fVeryVerbose && p->pPars->fCutMin && !p->pPars->fFuncDsd ) if ( p->pPars->fVeryVerbose && p->pPars->fCutMin && !p->pPars->fFuncDsd )
Jf_ManDumpTruthTables( p ); Vec_MemDumpTruthTables( p->vTtMem, Gia_ManName(p->pGia), p->pPars->nLutSize );
if ( p->pPars->fPureAig ) if ( p->pPars->fPureAig )
pNew = Jf_ManDeriveGia(p); pNew = Jf_ManDeriveGia(p);
else if ( p->pPars->fCutMin ) else if ( p->pPars->fCutMin )
......
...@@ -515,6 +515,7 @@ extern int If_CluCheckExt3( void * p, word * pTruth, int nVars, int ...@@ -515,6 +515,7 @@ extern int If_CluCheckExt3( void * p, word * pTruth, int nVars, int
char * pLut0, char * pLut1, char * pLut2, word * pFunc0, word * pFunc1, word * pFunc2 ); char * pLut0, char * pLut1, char * pLut2, word * pFunc0, word * pFunc1, word * pFunc2 );
/*=== ifDsd.c =============================================================*/ /*=== ifDsd.c =============================================================*/
extern If_DsdMan_t * If_DsdManAlloc( int nLutSize ); extern If_DsdMan_t * If_DsdManAlloc( int nLutSize );
extern void If_DsdManDump( If_DsdMan_t * p );
extern void If_DsdManPrint( If_DsdMan_t * p, char * pFileName ); extern void If_DsdManPrint( If_DsdMan_t * p, char * pFileName );
extern void If_DsdManFree( If_DsdMan_t * p ); extern void If_DsdManFree( If_DsdMan_t * p );
extern int If_DsdManCompute( If_DsdMan_t * p, word * pTruth, int nLeaves, unsigned char * pPerm ); extern int If_DsdManCompute( If_DsdMan_t * p, word * pTruth, int nLeaves, unsigned char * pPerm );
......
...@@ -153,10 +153,7 @@ void If_ManStop( If_Man_t * p ) ...@@ -153,10 +153,7 @@ void If_ManStop( If_Man_t * p )
if ( p->pPars->fVerbose && p->nCuts5 ) if ( p->pPars->fVerbose && p->nCuts5 )
Abc_Print( 1, "Statistics about 5-cuts: Total = %d Non-decomposable = %d (%.2f %%)\n", p->nCuts5, p->nCuts5-p->nCuts5a, 100.0*(p->nCuts5-p->nCuts5a)/p->nCuts5 ); Abc_Print( 1, "Statistics about 5-cuts: Total = %d Non-decomposable = %d (%.2f %%)\n", p->nCuts5, p->nCuts5-p->nCuts5a, 100.0*(p->nCuts5-p->nCuts5a)/p->nCuts5 );
if ( p->pPars->fUseDsd ) if ( p->pPars->fUseDsd )
{
If_DsdManPrint( p->pIfDsdMan, NULL );
If_DsdManFree( p->pIfDsdMan ); If_DsdManFree( p->pIfDsdMan );
}
// Abc_PrintTime( 1, "Truth", p->timeTruth ); // Abc_PrintTime( 1, "Truth", p->timeTruth );
// Abc_Print( 1, "Small support = %d.\n", p->nSmallSupp ); // Abc_Print( 1, "Small support = %d.\n", p->nSmallSupp );
Vec_IntFreeP( &p->vCoAttrs ); Vec_IntFreeP( &p->vCoAttrs );
......
...@@ -281,7 +281,7 @@ static inline void Vec_MemDump( FILE * pFile, Vec_Mem_t * pVec ) ...@@ -281,7 +281,7 @@ static inline void Vec_MemDump( FILE * pFile, Vec_Mem_t * pVec )
word * pEntry; word * pEntry;
int i, w, d; int i, w, d;
if ( pFile == stdout ) if ( pFile == stdout )
printf( "Memory vector has %d entries: ", Vec_MemEntryNum(pVec) ); printf( "Memory vector has %d entries: \n", Vec_MemEntryNum(pVec) );
Vec_MemForEachEntry( pVec, pEntry, i ) Vec_MemForEachEntry( pVec, pEntry, i )
{ {
for ( w = pVec->nEntrySize - 1; w >= 0; w-- ) for ( w = pVec->nEntrySize - 1; w >= 0; w-- )
...@@ -392,12 +392,13 @@ static inline void Vec_MemDumpTruthTables( Vec_Mem_t * p, char * pName, int nLut ...@@ -392,12 +392,13 @@ static inline void Vec_MemDumpTruthTables( Vec_Mem_t * p, char * pName, int nLut
{ {
FILE * pFile; FILE * pFile;
char pFileName[1000]; char pFileName[1000];
sprintf( pFileName, "tt_%s_%02d.txt", pName, nLutSize ); sprintf( pFileName, "tt_%s_%02d.txt", pName ? pName : NULL, nLutSize );
pFile = fopen( pFileName, "wb" ); pFile = pName ? fopen( pFileName, "wb" ) : stdout;
Vec_MemDump( pFile, p ); Vec_MemDump( pFile, p );
fclose( pFile ); if ( pFile != stdout )
fclose( pFile );
printf( "Dumped %d %d-var truth tables into file \"%s\" (%.2f MB).\n", printf( "Dumped %d %d-var truth tables into file \"%s\" (%.2f MB).\n",
Vec_MemEntryNum(p), nLutSize, pFileName, Vec_MemEntryNum(p), nLutSize, pName ? pFileName : "stdout",
8.0 * Vec_MemEntryNum(p) * Vec_MemEntrySize(p) / (1 << 20) ); 8.0 * Vec_MemEntryNum(p) * Vec_MemEntrySize(p) / (1 << 20) );
} }
......
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