Adding option to rehash AIG after mapping.

This commit is contained in:
Alan Mishchenko 2016-04-27 18:33:23 -07:00
parent e8f961671c
commit 53e8647719
13 changed files with 22 additions and 21 deletions

View File

@ -1456,7 +1456,7 @@ extern int Gia_ManClockDomainNum( Gia_Man_t * p );
extern int Gia_ManIsSeqWithBoxes( Gia_Man_t * p );
extern int Gia_ManIsNormalized( Gia_Man_t * p );
extern Vec_Int_t * Gia_ManOrderWithBoxes( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p, int fHashMapping );
extern Gia_Man_t * Gia_ManDupUnnormalize( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManDupUnshuffleInputs( Gia_Man_t * p );
extern int Gia_ManLevelWithBoxes( Gia_Man_t * p );

View File

@ -1105,7 +1105,7 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
if ( !Gia_ManIsNormalized(pInit) )
{
// printf( "Gia_AigerWrite(): Normalizing AIG for writing.\n" );
p = Gia_ManDupNormalize( pInit );
p = Gia_ManDupNormalize( pInit, 0 );
Gia_ManTransferMapping( p, pInit );
Gia_ManTransferPacking( p, pInit );
Gia_ManTransferTiming( p, pInit );

View File

@ -1055,7 +1055,7 @@ Gia_Man_t * Gia_ManAreaBalance( Gia_Man_t * p, int fSimpleAnd, int nNewNodesMax,
// normalize if needed
if ( !Gia_ManIsNormalized(pNew2) )
{
pNew2 = Gia_ManDupNormalize( pNew1 = pNew2 );
pNew2 = Gia_ManDupNormalize( pNew1 = pNew2, 0 );
Gia_ManStop( pNew1 );
}
Gia_ManTransferTiming( pNew2, p );

View File

@ -2165,7 +2165,7 @@ Gia_Man_t * Gia_ManDupTopAnd_iter( Gia_Man_t * p, int fVerbose )
printf( "The AIG cannot be decomposed using AND-decomposition.\n" );
Vec_IntFree( vFront );
Vec_IntFree( vLeaves );
return Gia_ManDupNormalize( p );
return Gia_ManDupNormalize( p, 0 );
}
// expand the frontier
Gia_ManForEachObjVec( vFront, p, pObj, i )
@ -2210,7 +2210,7 @@ Gia_Man_t * Gia_ManDupTopAnd_iter( Gia_Man_t * p, int fVerbose )
ABC_FREE( pCi2Lit );
ABC_FREE( pVar2Val );
Vec_IntFree( vLeaves );
return Gia_ManDupNormalize( p );
return Gia_ManDupNormalize( p, 0 );
}
// create array of input literals
Vec_IntClear( vLeaves );
@ -2245,7 +2245,7 @@ Gia_Man_t * Gia_ManDupTopAnd( Gia_Man_t * p, int fVerbose )
{
Gia_Man_t * pNew, * pTemp;
int fContinue, iIter = 0;
pNew = Gia_ManDupNormalize( p );
pNew = Gia_ManDupNormalize( p, 0 );
for ( fContinue = 1; fContinue; )
{
pNew = Gia_ManDupTopAnd_iter( pTemp = pNew, fVerbose );
@ -2425,7 +2425,7 @@ Gia_Man_t * Gia_ManMiter( Gia_Man_t * p0, Gia_Man_t * p1, int nInsDup, int fDual
pNew = Gia_ManCleanup( pTemp = pNew );
Gia_ManStop( pTemp );
pNew = Gia_ManDupNormalize( pTemp = pNew );
pNew = Gia_ManDupNormalize( pTemp = pNew, 0 );
Gia_ManStop( pTemp );
return pNew;
}

View File

@ -726,7 +726,7 @@ Gia_Man_t * Gia_ManDupWithNaturalBoxes( Gia_Man_t * p, int nFaddMin, int fVerbos
pNew->pAigExtra = Gia_ManGenerateExtraAig( nBoxes, 3, 2 );
/*
// normalize
pNew = Gia_ManDupNormalize( pTemp = pNew );
pNew = Gia_ManDupNormalize( pTemp = pNew, 0 );
pNew->pManTime = pTemp->pManTime; pTemp->pManTime = NULL;
pNew->pAigExtra = pTemp->pAigExtra; pTemp->pAigExtra = NULL;
Gia_ManStop( pTemp );

View File

@ -2180,7 +2180,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
Gia_ManStop( p );
}
// normalize
pNew = Gia_ManDupNormalize( p = pNew );
pNew = Gia_ManDupNormalize( p = pNew, ((If_Par_t *)pp)->fHashMapping );
Gia_ManTransferMapping( pNew, p );
Gia_ManTransferPacking( pNew, p );
Gia_ManTransferTiming( pNew, p );
@ -2189,10 +2189,9 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
}
else
{
int fHashMapping = 0;
pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp );
Gia_ManTransferTiming( pNew, p );
if ( fHashMapping )
if ( ((If_Par_t *)pp)->fHashMapping )
{
pNew = Gia_ManDupHashMapping( p = pNew );
Gia_ManTransferPacking( pNew, p );

View File

@ -2210,7 +2210,7 @@ Gia_Man_t * Lf_ManPerformMapping( Gia_Man_t * p, Jf_Par_t * pPars )
Gia_ManStop( p );
}
// normalize
pNew = Gia_ManDupNormalize( p = pNew );
pNew = Gia_ManDupNormalize( p = pNew, 0 );
Gia_ManTransferMapping( pNew, p );
// Gia_ManTransferPacking( pNew, p );
Gia_ManTransferTiming( pNew, p );
@ -2279,7 +2279,7 @@ Gia_Man_t * Gia_ManPerformLfMapping( Gia_Man_t * p, Jf_Par_t * pPars, int fNorma
Gia_ManStop( p );
}
// normalize and transfer mapping
pNew = Gia_ManDupNormalize( p = pNew );
pNew = Gia_ManDupNormalize( p = pNew, 0 );
Gia_ManTransferMapping( pNew, p );
// Gia_ManTransferPacking( pNew, p );
Gia_ManTransferTiming( pNew, p );

View File

@ -1394,7 +1394,7 @@ Gia_Man_t * Gia_ManLutBalance( Gia_Man_t * p, int nLutSize, int fUseMuxes, int f
Gia_ManTransferTiming( pNew, p );
Gia_ManStop( p );
// normalize
pNew = Gia_ManDupNormalize( p = pNew );
pNew = Gia_ManDupNormalize( p = pNew, 0 );
Gia_ManTransferTiming( pNew, p );
Gia_ManStop( p );
// cleanup

View File

@ -691,7 +691,7 @@ Gia_Man_t * Gia_ManSweepWithBoxesAndDomains( Gia_Man_t * p, void * pParsS, int f
}
}
// normalize the result
pNew = Gia_ManDupNormalize( pTemp = pNew );
pNew = Gia_ManDupNormalize( pTemp = pNew, 0 );
Gia_ManTransferTiming( pNew, pTemp );
Gia_ManStop( pTemp );
// check integrity
@ -757,7 +757,7 @@ Gia_Man_t * Gia_ManSweepWithBoxes( Gia_Man_t * p, void * pParsC, void * pParsS,
pFlopTypes[0], pFlopTypes[1], Abc_MaxInt(0, pFlopTypes[2]), Abc_MaxInt(0, -pFlopTypes[2]) );
}
// normalize the result
pNew = Gia_ManDupNormalize( pTemp = pNew );
pNew = Gia_ManDupNormalize( pTemp = pNew, 0 );
Gia_ManTransferTiming( pNew, pTemp );
Gia_ManStop( pTemp );
// check integrity

View File

@ -135,9 +135,8 @@ int Gia_ManIsNormalized( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p )
Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p, int fHashMapping )
{
int fHashMapping = 0;
Gia_Man_t * pNew;
Gia_Obj_t * pObj;
int i;

View File

@ -32988,6 +32988,8 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fVerbose ^= 1;
break;
case 'h':
pPars->fHashMapping ^= 1;
break;
default:
goto usage;
}
@ -33258,7 +33260,7 @@ usage:
sprintf(LutSize, "library" );
else
sprintf(LutSize, "%d", pPars->nLutSize );
Abc_Print( -2, "usage: &if [-KCFAGRTXY num] [-DEW float] [-S str] [-qarlepmsdbgxyofuijkztncvh]\n" );
Abc_Print( -2, "usage: &if [-KCFAGRTXY num] [-DEW float] [-S str] [-qarlepmsdbgxyofuijkztnchv]\n" );
Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" );
Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize );
Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax );
@ -33297,8 +33299,8 @@ usage:
Abc_Print( -2, "\t-t : toggles optimizing average rather than maximum level [default = %s]\n", pPars->fDoAverage? "yes": "no" );
Abc_Print( -2, "\t-n : toggles computing DSDs of the cut functions [default = %s]\n", pPars->fUseDsd? "yes": "no" );
Abc_Print( -2, "\t-c : toggles computing truth tables in a new way [default = %s]\n", pPars->fUseTtPerm? "yes": "no" );
Abc_Print( -2, "\t-h : toggles rehashing AIG after mapping [default = %s]\n", pPars->fHashMapping? "yes": "no" );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : prints the command usage\n");
return 1;
}

View File

@ -1238,7 +1238,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds )
pNew->pAigExtra = pExtra;
pNew->pManTime = pManTime;
// normalize AIG
pNew = Gia_ManDupNormalize( pTemp = pNew );
pNew = Gia_ManDupNormalize( pTemp = pNew, 0 );
Gia_ManTransferTiming( pNew, pTemp );
Gia_ManStop( pTemp );
//Tim_ManPrint( pManTime );

View File

@ -140,6 +140,7 @@ struct If_Par_t_
int fUseTtPerm; // compute truth tables of the cut functions
int fDeriveLuts; // enables deriving LUT structures
int fDoAverage; // optimize average rather than maximum level
int fHashMapping; // perform AIG hashing after mapping
int fVerbose; // the verbosity flag
char * pLutStruct; // LUT structure
float WireDelay; // wire delay