Commit d3c018cd by Alan Mishchenko

Reducing memory usage in bmc2 and bmc3.

parent a4908534
......@@ -739,6 +739,7 @@ extern void Gia_ManUnrollStop( void * pMan );
extern int Gia_ManUnrollLastLit( void * pMan );
extern void Gia_ManFraSetDefaultParams( Gia_ParFra_t * p );
extern Gia_Man_t * Gia_ManFrames( Gia_Man_t * pAig, Gia_ParFra_t * pPars );
extern Gia_Man_t * Gia_ManFramesInitSpecial( Gia_Man_t * pAig, int nFrames, int fVerbose );
/*=== giaFront.c ==========================================================*/
extern Gia_Man_t * Gia_ManFront( Gia_Man_t * p );
extern void Gia_ManFrontTest( Gia_Man_t * p );
......
......@@ -915,6 +915,66 @@ Gia_Man_t * Gia_ManFrames( Gia_Man_t * pAig, Gia_ParFra_t * pPars )
return pFrames;
}
/**Function*************************************************************
Synopsis [Perform init unrolling as long as PO(s) are constant 0.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManFramesInitSpecial( Gia_Man_t * pAig, int nFrames, int fVerbose )
{
Gia_Man_t * pFrames, * pTemp;
Gia_Obj_t * pObj;
int i, f;
assert( Gia_ManRegNum(pAig) > 0 );
if ( nFrames > 0 )
printf( "Computing specialized unrolling with %d frames...\n", nFrames );
pFrames = Gia_ManStart( Gia_ManObjNum(pAig) );
pFrames->pName = Abc_UtilStrsav( pAig->pName );
Gia_ManHashAlloc( pFrames );
Gia_ManConst0(pAig)->Value = 0;
for ( f = 0; nFrames == 0 || f < nFrames; f++ )
{
if ( fVerbose && (f % 100 == 0) )
{
printf( "%6d : ", f );
Gia_ManPrintStats( pFrames, 0, 0 );
}
Gia_ManForEachRo( pAig, pObj, i )
pObj->Value = f ? Gia_ObjRoToRi( pAig, pObj )->Value : 0;
Gia_ManForEachPi( pAig, pObj, i )
pObj->Value = Gia_ManAppendCi( pFrames );
Gia_ManForEachAnd( pAig, pObj, i )
pObj->Value = Gia_ManHashAnd( pFrames, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
Gia_ManForEachPo( pAig, pObj, i )
if ( Gia_ObjFanin0Copy(pObj) != 0 )
break;
if ( i < Gia_ManPoNum(pAig) )
break;
Gia_ManForEachRi( pAig, pObj, i )
pObj->Value = Gia_ObjFanin0Copy(pObj);
}
if ( fVerbose )
printf( "Computed prefix of %d frames.\n", f );
Gia_ManForEachRi( pAig, pObj, i )
Gia_ManAppendCo( pFrames, pObj->Value );
Gia_ManHashStop( pFrames );
pFrames = Gia_ManCleanup( pTemp = pFrames );
if ( fVerbose )
printf( "Before cleanup = %d nodes. After cleanup = %d nodes.\n",
Gia_ManAndNum(pTemp), Gia_ManAndNum(pFrames) );
Gia_ManStop( pTemp );
return pFrames;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
......
......@@ -19927,6 +19927,11 @@ int Abc_CommandBmc3( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Does not work for combinational networks.\n" );
return 0;
}
if ( Abc_NtkConstrNum(pNtk) > 0 )
{
Abc_Print( -1, "Constraints have to be folded (use \"fold\").\n" );
return 0;
}
pAbc->Status = Abc_NtkDarBmc3( pNtk, pPars, fOrDecomp );
pAbc->nFrames = pPars->iFrame;
Abc_FrameReplaceCex( pAbc, &pNtk->pSeqModel );
......@@ -24162,10 +24167,11 @@ int Abc_CommandAbc9Frames( Abc_Frame_t * pAbc, int argc, char ** argv )
Gia_ParFra_t Pars, * pPars = &Pars;
int c;
int nCofFanLit = 0;
int nNewAlgo = 1;
int fNewAlgo = 1;
int fInitSpecial = 0;
Gia_ManFraSetDefaultParams( pPars );
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "FLiavh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "FLiasvh" ) ) != EOF )
{
switch ( c )
{
......@@ -24195,7 +24201,10 @@ int Abc_CommandAbc9Frames( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fInit ^= 1;
break;
case 'a':
nNewAlgo ^= 1;
fNewAlgo ^= 1;
break;
case 's':
fInitSpecial ^= 1;
break;
case 'v':
pPars->fVerbose ^= 1;
......@@ -24216,9 +24225,11 @@ int Abc_CommandAbc9Frames( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "The network is combinational.\n" );
return 0;
}
if ( nCofFanLit )
if ( fInitSpecial )
pTemp = Gia_ManFramesInitSpecial( pAbc->pGia, pPars->nFrames, pPars->fVerbose );
else if ( nCofFanLit )
pTemp = Gia_ManUnrollAndCofactor( pAbc->pGia, pPars->nFrames, nCofFanLit, pPars->fVerbose );
else if ( nNewAlgo )
else if ( fNewAlgo )
pTemp = Gia_ManFrames2( pAbc->pGia, pPars );
else
pTemp = Gia_ManFrames( pAbc->pGia, pPars );
......@@ -24226,12 +24237,13 @@ int Abc_CommandAbc9Frames( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
Abc_Print( -2, "usage: &frames [-FL <num>] [-aivh]\n" );
Abc_Print( -2, "usage: &frames [-FL <num>] [-iasvh]\n" );
Abc_Print( -2, "\t unrolls the design for several timeframes\n" );
Abc_Print( -2, "\t-F num : the number of frames to unroll [default = %d]\n", pPars->nFrames );
Abc_Print( -2, "\t-L num : the limit on fanout count of resets/enables to cofactor [default = %d]\n", nCofFanLit );
Abc_Print( -2, "\t-i : toggle initializing registers [default = %s]\n", pPars->fInit? "yes": "no" );
Abc_Print( -2, "\t-a : toggle using new algorithm [default = %s]\n", nNewAlgo? "yes": "no" );
Abc_Print( -2, "\t-a : toggle using new algorithm [default = %s]\n", fNewAlgo? "yes": "no" );
Abc_Print( -2, "\t-s : toggle computing special AIG for BMC [default = %s]\n", fInitSpecial? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
......
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