Commit 41314cea by Alan Mishchenko

Adding switch %blast -d to dump dual-output miter after blasting.

parent 30d1f192
...@@ -324,7 +324,7 @@ extern int Wlc_NtkPdrAbs( Wlc_Ntk_t * p, Wlc_Par_t * pPars ); ...@@ -324,7 +324,7 @@ extern int Wlc_NtkPdrAbs( Wlc_Ntk_t * p, Wlc_Par_t * pPars );
/*=== wlcAbs2.c ========================================================*/ /*=== wlcAbs2.c ========================================================*/
extern int Wlc_NtkAbsCore2( Wlc_Ntk_t * p, Wlc_Par_t * pPars ); extern int Wlc_NtkAbsCore2( Wlc_Ntk_t * p, Wlc_Par_t * pPars );
/*=== wlcBlast.c ========================================================*/ /*=== wlcBlast.c ========================================================*/
extern Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, int nRange, int fGiaSimple, int fAddOutputs, int fBooth, int fNoCleanup ); extern Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, int nRange, int fGiaSimple, int fAddOutputs, int fBooth, int fNoCleanup, int fCreateMiter );
/*=== 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 ========================================================*/
......
...@@ -320,7 +320,7 @@ static Vec_Int_t * Wlc_NtkGetCoreSels( Gia_Man_t * pFrames, int nFrames, int fir ...@@ -320,7 +320,7 @@ static Vec_Int_t * Wlc_NtkGetCoreSels( Gia_Man_t * pFrames, int nFrames, int fir
static Gia_Man_t * Wlc_NtkUnrollWoCex(Wlc_Ntk_t * pChoice, int nFrames, int first_sel_pi, int num_sel_pis) static Gia_Man_t * Wlc_NtkUnrollWoCex(Wlc_Ntk_t * pChoice, int nFrames, int first_sel_pi, int num_sel_pis)
{ {
Gia_Man_t * pGiaChoice = Wlc_NtkBitBlast( pChoice, NULL, -1, 0, 0, 0, 0, 0 ); Gia_Man_t * pGiaChoice = Wlc_NtkBitBlast( pChoice, NULL, -1, 0, 0, 0, 0, 0, 0 );
Gia_Man_t * pFrames = NULL, * pGia; Gia_Man_t * pFrames = NULL, * pGia;
Gia_Obj_t * pObj, * pObjRi; Gia_Obj_t * pObj, * pObjRi;
int f, i; int f, i;
...@@ -366,7 +366,7 @@ static Gia_Man_t * Wlc_NtkUnrollWoCex(Wlc_Ntk_t * pChoice, int nFrames, int firs ...@@ -366,7 +366,7 @@ static Gia_Man_t * Wlc_NtkUnrollWoCex(Wlc_Ntk_t * pChoice, int nFrames, int firs
static Gia_Man_t * Wlc_NtkUnrollWithCex(Wlc_Ntk_t * pChoice, Abc_Cex_t * pCex, int nbits_old_pis, int num_sel_pis, int * p_num_ppis, int sel_pi_first, int fUsePPI) static Gia_Man_t * Wlc_NtkUnrollWithCex(Wlc_Ntk_t * pChoice, Abc_Cex_t * pCex, int nbits_old_pis, int num_sel_pis, int * p_num_ppis, int sel_pi_first, int fUsePPI)
{ {
Gia_Man_t * pGiaChoice = Wlc_NtkBitBlast( pChoice, NULL, -1, 0, 0, 0, 0, 0 ); Gia_Man_t * pGiaChoice = Wlc_NtkBitBlast( pChoice, NULL, -1, 0, 0, 0, 0, 0, 0 );
int nbits_new_pis = Wlc_NtkNumPiBits( pChoice ); int nbits_new_pis = Wlc_NtkNumPiBits( pChoice );
int num_ppis = nbits_new_pis - nbits_old_pis - num_sel_pis; int num_ppis = nbits_new_pis - nbits_old_pis - num_sel_pis;
int num_undc_pis = Gia_ManPiNum(pGiaChoice) - nbits_new_pis; int num_undc_pis = Gia_ManPiNum(pGiaChoice) - nbits_new_pis;
...@@ -560,7 +560,7 @@ Wlc_Ntk_t * Wlc_NtkIntroduceChoices( Wlc_Ntk_t * pNtk, Vec_Int_t * vBlacks, Vec_ ...@@ -560,7 +560,7 @@ Wlc_Ntk_t * Wlc_NtkIntroduceChoices( Wlc_Ntk_t * pNtk, Vec_Int_t * vBlacks, Vec_
static Abc_Cex_t * Wlc_NtkCexIsReal( Wlc_Ntk_t * pOrig, Abc_Cex_t * pCex ) static Abc_Cex_t * Wlc_NtkCexIsReal( Wlc_Ntk_t * pOrig, Abc_Cex_t * pCex )
{ {
Gia_Man_t * pGiaOrig = Wlc_NtkBitBlast( pOrig, NULL, -1, 0, 0, 0, 0, 0 ); Gia_Man_t * pGiaOrig = Wlc_NtkBitBlast( pOrig, NULL, -1, 0, 0, 0, 0, 0, 0 );
int f, i; int f, i;
Gia_Obj_t * pObj, * pObjRi; Gia_Obj_t * pObj, * pObjRi;
Abc_Cex_t * pCexReal = Abc_CexAlloc( Gia_ManRegNum(pGiaOrig), Gia_ManPiNum(pGiaOrig), pCex->iFrame + 1 ); Abc_Cex_t * pCexReal = Abc_CexAlloc( Gia_ManRegNum(pGiaOrig), Gia_ManPiNum(pGiaOrig), pCex->iFrame + 1 );
...@@ -1401,7 +1401,7 @@ Aig_Man_t * Wla_ManBitBlast( Wla_Man_t * pWla, Wlc_Ntk_t * pAbs ) ...@@ -1401,7 +1401,7 @@ Aig_Man_t * Wla_ManBitBlast( Wla_Man_t * pWla, Wlc_Ntk_t * pAbs )
Gia_Man_t * pTemp; Gia_Man_t * pTemp;
Aig_Man_t * pAig; Aig_Man_t * pAig;
pWla->pGia = Wlc_NtkBitBlast( pAbs, NULL, -1, 0, 0, 0, 0, 0 ); pWla->pGia = Wlc_NtkBitBlast( pAbs, NULL, -1, 0, 0, 0, 0, 0, 0 );
// if the abstraction has flops with DC-init state, // if the abstraction has flops with DC-init state,
// new PIs were introduced by bit-blasting at the end of the PI list // new PIs were introduced by bit-blasting at the end of the PI list
...@@ -1828,7 +1828,7 @@ int Wlc_NtkAbsCore( Wlc_Ntk_t * p, Wlc_Par_t * pPars ) ...@@ -1828,7 +1828,7 @@ int Wlc_NtkAbsCore( Wlc_Ntk_t * p, Wlc_Par_t * pPars )
pAbs = Wlc_NtkAbs( p, pPars, vUnmark, &vPisNew, NULL, pPars->fVerbose ); pAbs = Wlc_NtkAbs( p, pPars, vUnmark, &vPisNew, NULL, pPars->fVerbose );
} }
pGia = Wlc_NtkBitBlast( pAbs, NULL, -1, 0, 0, 0, 0, 0 ); pGia = Wlc_NtkBitBlast( pAbs, NULL, -1, 0, 0, 0, 0, 0, 0 );
// if the abstraction has flops with DC-init state, // if the abstraction has flops with DC-init state,
// new PIs were introduced by bit-blasting at the end of the PI list // new PIs were introduced by bit-blasting at the end of the PI list
......
...@@ -328,7 +328,7 @@ int Wlc_NtkAbsCore2( Wlc_Ntk_t * p, Wlc_Par_t * pPars ) ...@@ -328,7 +328,7 @@ int Wlc_NtkAbsCore2( Wlc_Ntk_t * p, Wlc_Par_t * pPars )
// get abstracted GIA and the set of pseudo-PIs (vPisNew) // get abstracted GIA and the set of pseudo-PIs (vPisNew)
pAbs = Wlc_NtkAbs( p, pPars, vUnmark, &vPisNew, pPars->fVerbose ); pAbs = Wlc_NtkAbs( p, pPars, vUnmark, &vPisNew, pPars->fVerbose );
pGia = Wlc_NtkBitBlast( pAbs, NULL, -1, 0, 0, 0, 0, 0 ); pGia = Wlc_NtkBitBlast( pAbs, NULL, -1, 0, 0, 0, 0, 0, 0 );
// if the abstraction has flops with DC-init state, // if the abstraction has flops with DC-init state,
// new PIs were introduced by bit-blasting at the end of the PI list // new PIs were introduced by bit-blasting at the end of the PI list
......
...@@ -868,14 +868,14 @@ void Wlc_BlastBooth( Gia_Man_t * pNew, int * pArgA, int * pArgB, int nArgA, int ...@@ -868,14 +868,14 @@ 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 iOutput, int nOutputRange, int fGiaSimple, int fAddOutputs, int fBooth, int fNoCleanup ) Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, int nOutputRange, int fGiaSimple, int fAddOutputs, int fBooth, int fNoCleanup, int fCreateMiter )
{ {
int fVerbose = 0; int fVerbose = 0;
int fUseOldMultiplierBlasting = 0; int fUseOldMultiplierBlasting = 0;
int fSkipBitRange = 0; int fSkipBitRange = 0;
Tim_Man_t * pManTime = NULL; Tim_Man_t * pManTime = NULL;
Gia_Man_t * pTemp, * pNew, * pExtra = NULL; Gia_Man_t * pTemp, * pNew, * pExtra = NULL;
Wlc_Obj_t * pObj; Wlc_Obj_t * pObj, * pObj2;
Vec_Int_t * vBits = &p->vBits, * vTemp0, * vTemp1, * vTemp2, * vRes, * vAddOutputs = NULL, * vAddObjs = NULL; Vec_Int_t * vBits = &p->vBits, * vTemp0, * vTemp1, * vTemp2, * vRes, * vAddOutputs = NULL, * vAddObjs = NULL;
int nBits = Wlc_NtkPrepareBits( p ); int nBits = Wlc_NtkPrepareBits( p );
int nRange, nRange0, nRange1, nRange2; int nRange, nRange0, nRange1, nRange2;
...@@ -1363,6 +1363,58 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, in ...@@ -1363,6 +1363,58 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, in
Vec_IntFree( vTemp2 ); Vec_IntFree( vTemp2 );
Vec_IntFree( vRes ); Vec_IntFree( vRes );
// create COs // create COs
if ( fCreateMiter )
{
int nPairs = 0, nBits = 0;
assert( Wlc_NtkPoNum(p) % 2 == 0 );
Wlc_NtkForEachCo( p, pObj, i )
{
if ( pObj->fIsFi )
{
nRange = Wlc_ObjRange( pObj );
pFans0 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj)) );
if ( Wlc_ObjRangeIsReversed(pObj) )
{
for ( k = 0; k < nRange; k++ )
Gia_ManAppendCo( pNew, pFans0[nRange-1-k] );
}
else
{
for ( k = 0; k < nRange; k++ )
Gia_ManAppendCo( pNew, pFans0[k] );
}
nFFins += nRange;
continue;
}
pObj2 = Wlc_NtkCo( p, ++i );
nRange1 = Wlc_ObjRange( pObj );
nRange2 = Wlc_ObjRange( pObj2 );
assert( nRange1 == nRange2 );
pFans1 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj)) );
pFans2 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj2)) );
if ( Wlc_ObjRangeIsReversed(pObj) )
{
for ( k = 0; k < nRange1; k++ )
{
Gia_ManAppendCo( pNew, pFans1[nRange1-1-k] );
Gia_ManAppendCo( pNew, pFans2[nRange2-1-k] );
}
}
else
{
for ( k = 0; k < nRange1; k++ )
{
Gia_ManAppendCo( pNew, pFans1[k] );
Gia_ManAppendCo( pNew, pFans2[k] );
}
}
nPairs++;
nBits += nRange1;
}
printf( "Derived a dual-output miter with %d pairs of bits belonging to %d pairs of word-level outputs.\n", nBits, nPairs );
}
else
{
Wlc_NtkForEachCo( p, pObj, i ) Wlc_NtkForEachCo( p, pObj, i )
{ {
// skip all outputs except the given ones // skip all outputs except the given ones
...@@ -1395,6 +1447,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, in ...@@ -1395,6 +1447,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, in
} }
if ( fVerbose ) if ( fVerbose )
printf( "\n" ); printf( "\n" );
}
//Vec_IntErase( vBits ); //Vec_IntErase( vBits );
//Vec_IntErase( &p->vCopies ); //Vec_IntErase( &p->vCopies );
// set the number of registers // set the number of registers
......
...@@ -881,9 +881,9 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -881,9 +881,9 @@ 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, iOutput = -1, nOutputRange = 2, fGiaSimple = 0, fAddOutputs = 0, fMulti = 0, fBooth = 0, fVerbose = 0; int c, iOutput = -1, nOutputRange = 2, fGiaSimple = 0, fAddOutputs = 0, fMulti = 0, fBooth = 0, fCreateMiter = 0, fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "ORcombvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "ORcombdvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -921,6 +921,9 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -921,6 +921,9 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'b': case 'b':
fBooth ^= 1; fBooth ^= 1;
break; break;
case 'd':
fCreateMiter ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
...@@ -947,7 +950,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -947,7 +950,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
} }
// transform // transform
pNew = Wlc_NtkBitBlast( pNtk, vBoxIds, iOutput, nOutputRange, fGiaSimple, fAddOutputs, fBooth, 0 ); pNew = Wlc_NtkBitBlast( pNtk, vBoxIds, iOutput, nOutputRange, fGiaSimple, fAddOutputs, fBooth, 0, fCreateMiter );
Vec_IntFreeP( &vBoxIds ); Vec_IntFreeP( &vBoxIds );
if ( pNew == NULL ) if ( pNew == NULL )
{ {
...@@ -957,7 +960,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -957,7 +960,7 @@ 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 [-OR num] [-combvh]\n" ); Abc_Print( -2, "usage: %%blast [-OR num] [-combdvh]\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-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-R num : the total number of word-level POs to bit-blast [default = %d]\n", nOutputRange );
...@@ -965,6 +968,7 @@ usage: ...@@ -965,6 +968,7 @@ usage:
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" );
Abc_Print( -2, "\t-b : toggle generating radix-4 Booth multipliers [default = %s]\n", fBooth? "yes": "no" ); Abc_Print( -2, "\t-b : toggle generating radix-4 Booth multipliers [default = %s]\n", fBooth? "yes": "no" );
Abc_Print( -2, "\t-d : toggle creating dual-output miter [default = %s]\n", fCreateMiter? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
return 1; return 1;
......
...@@ -210,7 +210,7 @@ Wlc_Ntk_t * Wlc_NtkGraftMulti( Wlc_Ntk_t * p, int fVerbose ) ...@@ -210,7 +210,7 @@ Wlc_Ntk_t * Wlc_NtkGraftMulti( Wlc_Ntk_t * p, int fVerbose )
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
Vec_Int_t * vObjsLHS = Wlc_NtkCollectObjs( p, 0, &nMultiLHS ); Vec_Int_t * vObjsLHS = Wlc_NtkCollectObjs( p, 0, &nMultiLHS );
Vec_Int_t * vObjsRHS = Wlc_NtkCollectObjs( p, 1, &nMultiRHS ); Vec_Int_t * vObjsRHS = Wlc_NtkCollectObjs( p, 1, &nMultiRHS );
Gia_Man_t * pGia = Wlc_NtkBitBlast( p, NULL, -1, 0, 0, 0, 0, 1 ); Gia_Man_t * pGia = Wlc_NtkBitBlast( p, NULL, -1, 0, 0, 0, 0, 1, 0 );
Vec_Mem_t * vTtMem = Vec_MemAlloc( nWords, 10 ); Vec_Mem_t * vTtMem = Vec_MemAlloc( nWords, 10 );
Vec_MemHashAlloc( vTtMem, 10000 ); Vec_MemHashAlloc( vTtMem, 10000 );
...@@ -540,7 +540,7 @@ int Sbc_ManWlcNodes( Wlc_Ntk_t * pNtk, Gia_Man_t * p, Vec_Int_t * vGia2Out, int ...@@ -540,7 +540,7 @@ int Sbc_ManWlcNodes( Wlc_Ntk_t * pNtk, Gia_Man_t * p, Vec_Int_t * vGia2Out, int
void Sbc_ManDetectMultTest( Wlc_Ntk_t * pNtk, int fVerbose ) void Sbc_ManDetectMultTest( Wlc_Ntk_t * pNtk, int fVerbose )
{ {
extern Vec_Int_t * Sdb_StoComputeCutsDetect( Gia_Man_t * pGia ); extern Vec_Int_t * Sdb_StoComputeCutsDetect( Gia_Man_t * pGia );
Gia_Man_t * p = Wlc_NtkBitBlast( pNtk, NULL, -1, 0, 0, 0, 0, 1 ); Gia_Man_t * p = Wlc_NtkBitBlast( pNtk, NULL, -1, 0, 0, 0, 0, 1, 0 );
Vec_Int_t * vIns, * vGia2Out; Vec_Int_t * vIns, * vGia2Out;
int iObjFound = -1; int iObjFound = -1;
// Gia_Obj_t * pObj; int i; // Gia_Obj_t * pObj; int i;
......
...@@ -1292,7 +1292,7 @@ void Io_ReadWordTest( char * pFileName ) ...@@ -1292,7 +1292,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, -1, 0, 0, 0, 0, 0 ); pNew = Wlc_NtkBitBlast( pNtk, NULL, -1, 0, 0, 0, 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, -1, 0, 0, 0, 0, 0 ); Gia_Man_t * pGia = Wlc_NtkBitBlast( p, NULL, -1, 0, 0, 0, 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