Commit 2f866673 by Alan Mishchenko

Adding output range support to %blast.

parent 3d7034bf
...@@ -259,7 +259,7 @@ extern Vec_Int_t * Wlc_NtkFindUifableMultiplierPairs( Wlc_Ntk_t * p ); ...@@ -259,7 +259,7 @@ extern Vec_Int_t * Wlc_NtkFindUifableMultiplierPairs( Wlc_Ntk_t * p );
extern Wlc_Ntk_t * Wlc_NtkAbstractNodes( Wlc_Ntk_t * pNtk, Vec_Int_t * vNodes ); extern Wlc_Ntk_t * Wlc_NtkAbstractNodes( Wlc_Ntk_t * pNtk, Vec_Int_t * vNodes );
extern Wlc_Ntk_t * Wlc_NtkUifNodePairs( Wlc_Ntk_t * pNtk, Vec_Int_t * vPairs ); extern Wlc_Ntk_t * Wlc_NtkUifNodePairs( Wlc_Ntk_t * pNtk, Vec_Int_t * vPairs );
/*=== wlcBlast.c ========================================================*/ /*=== wlcBlast.c ========================================================*/
extern Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int fGiaSimple, int fAddOutputs ); extern Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, int nRange, int fGiaSimple, int fAddOutputs );
/*=== wlcCom.c ========================================================*/ /*=== wlcCom.c ========================================================*/
extern void Wlc_SetNtk( Abc_Frame_t * pAbc, Wlc_Ntk_t * pNtk ); extern void Wlc_SetNtk( Abc_Frame_t * pAbc, Wlc_Ntk_t * pNtk );
/*=== wlcNtk.c ========================================================*/ /*=== wlcNtk.c ========================================================*/
......
...@@ -820,7 +820,7 @@ void Wlc_BlastBooth( Gia_Man_t * pNew, int * pArgA, int * pArgB, int nArgA, int ...@@ -820,7 +820,7 @@ void Wlc_BlastBooth( Gia_Man_t * pNew, int * pArgA, int * pArgB, int nArgA, int
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int fGiaSimple, int fAddOutputs ) Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, int nOutputRange, int fGiaSimple, int fAddOutputs )
{ {
int fVerbose = 0; int fVerbose = 0;
int fUseOldMultiplierBlasting = 0; int fUseOldMultiplierBlasting = 0;
...@@ -1314,6 +1314,9 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int fGiaSimple, ...@@ -1314,6 +1314,9 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int fGiaSimple,
// create COs // create COs
Wlc_NtkForEachCo( p, pObj, i ) Wlc_NtkForEachCo( p, pObj, i )
{ {
// skip all outputs except the given ones
if ( iOutput >= 0 && (i < iOutput || i >= iOutput + nOutputRange) )
continue;
// create additional PO literals // create additional PO literals
if ( vAddOutputs && pObj->fIsFi ) if ( vAddOutputs && pObj->fIsFi )
{ {
......
...@@ -338,12 +338,34 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -338,12 +338,34 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc); Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
Vec_Int_t * vBoxIds = NULL; Vec_Int_t * vBoxIds = NULL;
Gia_Man_t * pNew = NULL; Gia_Man_t * pNew = NULL;
int c, fGiaSimple = 0, fAddOutputs = 0, fMulti = 0, fVerbose = 0; int c, iOutput = -1, nOutputRange = 2, fGiaSimple = 0, fAddOutputs = 0, fMulti = 0, fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "comvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "ORcomvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
case 'O':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-O\" should be followed by an integer.\n" );
goto usage;
}
iOutput = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( iOutput < 0 )
goto usage;
break;
case 'R':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" );
goto usage;
}
nOutputRange = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( nOutputRange < 0 )
goto usage;
break;
case 'c': case 'c':
fGiaSimple ^= 1; fGiaSimple ^= 1;
break; break;
...@@ -373,8 +395,13 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -373,8 +395,13 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( vBoxIds == NULL ) if ( vBoxIds == NULL )
Abc_Print( 1, "Warning: There is no multipliers in the design.\n" ); Abc_Print( 1, "Warning: There is no multipliers in the design.\n" );
} }
if ( iOutput >= 0 && iOutput + nOutputRange > Wlc_NtkPoNum(pNtk) )
{
Abc_Print( 1, "Abc_CommandBlast(): The output range [%d:%d] is incorrect.\n", iOutput, iOutput + nOutputRange - 1 );
return 0;
}
// transform // transform
pNew = Wlc_NtkBitBlast( pNtk, vBoxIds, fGiaSimple, fAddOutputs ); pNew = Wlc_NtkBitBlast( pNtk, vBoxIds, iOutput, nOutputRange, fGiaSimple, fAddOutputs );
Vec_IntFreeP( &vBoxIds ); Vec_IntFreeP( &vBoxIds );
if ( pNew == NULL ) if ( pNew == NULL )
{ {
...@@ -384,8 +411,10 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -384,8 +411,10 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_FrameUpdateGia( pAbc, pNew ); Abc_FrameUpdateGia( pAbc, pNew );
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: %%blast [-comvh]\n" ); Abc_Print( -2, "usage: %%blast [-OR num] [-comvh]\n" );
Abc_Print( -2, "\t performs bit-blasting of the word-level design\n" ); Abc_Print( -2, "\t performs bit-blasting of the word-level design\n" );
Abc_Print( -2, "\t-O num : zero-based index of the first word-level PO to bit-blast [default = %d]\n", iOutput );
Abc_Print( -2, "\t-R num : the total number of word-level POs to bit-blast [default = %d]\n", nOutputRange );
Abc_Print( -2, "\t-c : toggle using AIG w/o const propagation and strashing [default = %s]\n", fGiaSimple? "yes": "no" ); Abc_Print( -2, "\t-c : toggle using AIG w/o const propagation and strashing [default = %s]\n", fGiaSimple? "yes": "no" );
Abc_Print( -2, "\t-o : toggle using additional POs on the word-level boundaries [default = %s]\n", fAddOutputs? "yes": "no" ); Abc_Print( -2, "\t-o : toggle using additional POs on the word-level boundaries [default = %s]\n", fAddOutputs? "yes": "no" );
Abc_Print( -2, "\t-m : toggle creating boxes for all multipliers in the design [default = %s]\n", fMulti? "yes": "no" ); Abc_Print( -2, "\t-m : toggle creating boxes for all multipliers in the design [default = %s]\n", fMulti? "yes": "no" );
......
...@@ -1291,7 +1291,7 @@ void Io_ReadWordTest( char * pFileName ) ...@@ -1291,7 +1291,7 @@ void Io_ReadWordTest( char * pFileName )
return; return;
Wlc_WriteVer( pNtk, "test.v", 0, 0 ); Wlc_WriteVer( pNtk, "test.v", 0, 0 );
pNew = Wlc_NtkBitBlast( pNtk, NULL, 0, 0 ); pNew = Wlc_NtkBitBlast( pNtk, NULL, -1, 0, 0, 0 );
Gia_AigerWrite( pNew, "test.aig", 0, 0 ); Gia_AigerWrite( pNew, "test.aig", 0, 0 );
Gia_ManStop( pNew ); Gia_ManStop( pNew );
......
...@@ -129,7 +129,7 @@ Vec_Ptr_t * Wlc_NtkSimulate( Wlc_Ntk_t * p, Vec_Int_t * vNodes, int nWords, int ...@@ -129,7 +129,7 @@ Vec_Ptr_t * Wlc_NtkSimulate( Wlc_Ntk_t * p, Vec_Int_t * vNodes, int nWords, int
{ {
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
Vec_Ptr_t * vOne, * vRes; Vec_Ptr_t * vOne, * vRes;
Gia_Man_t * pGia = Wlc_NtkBitBlast( p, NULL, 0, 0 ); Gia_Man_t * pGia = Wlc_NtkBitBlast( p, NULL, -1, 0, 0, 0 );
Wlc_Obj_t * pWlcObj; Wlc_Obj_t * pWlcObj;
int f, i, k, w, nBits, Counter = 0; int f, i, k, w, nBits, Counter = 0;
// allocate simulation info for one timeframe // allocate simulation info for one timeframe
......
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