Commit 81282155 by Alan Mishchenko

Adding miter construction with one bit-level output for each pair of word-level outputs.

parent bfefe96c
...@@ -1426,6 +1426,7 @@ extern int Gia_ManHashLookupInt( Gia_Man_t * p, int iLit0, int i ...@@ -1426,6 +1426,7 @@ extern int Gia_ManHashLookupInt( Gia_Man_t * p, int iLit0, int i
extern int Gia_ManHashLookup( Gia_Man_t * p, Gia_Obj_t * p0, Gia_Obj_t * p1 ); extern int Gia_ManHashLookup( Gia_Man_t * p, Gia_Obj_t * p0, Gia_Obj_t * p1 );
extern int Gia_ManHashAndMulti( Gia_Man_t * p, Vec_Int_t * vLits ); extern int Gia_ManHashAndMulti( Gia_Man_t * p, Vec_Int_t * vLits );
extern int Gia_ManHashAndMulti2( Gia_Man_t * p, Vec_Int_t * vLits ); extern int Gia_ManHashAndMulti2( Gia_Man_t * p, Vec_Int_t * vLits );
extern int Gia_ManHashDualMiter( Gia_Man_t * p, Vec_Int_t * vOuts );
/*=== giaIf.c ===========================================================*/ /*=== giaIf.c ===========================================================*/
extern void Gia_ManPrintMappingStats( Gia_Man_t * p, char * pDumpFile ); extern void Gia_ManPrintMappingStats( Gia_Man_t * p, char * pDumpFile );
extern void Gia_ManPrintPackingStats( Gia_Man_t * p ); extern void Gia_ManPrintPackingStats( Gia_Man_t * p );
......
...@@ -806,6 +806,13 @@ int Gia_ManHashAndMulti2( Gia_Man_t * p, Vec_Int_t * vLits ) ...@@ -806,6 +806,13 @@ int Gia_ManHashAndMulti2( Gia_Man_t * p, Vec_Int_t * vLits )
iRes = Gia_ManHashAnd( p, iRes, iLit ); iRes = Gia_ManHashAnd( p, iRes, iLit );
return iRes; return iRes;
} }
int Gia_ManHashDualMiter( Gia_Man_t * p, Vec_Int_t * vOuts )
{
int i, iLit0, iLit1, iRes = 1;
Vec_IntForEachEntryDouble( vOuts, iLit0, iLit1, i )
iRes = Gia_ManHashOr( p, iRes, Gia_ManHashXor(p, iLit0, iLit1) );
return iRes;
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// END OF FILE /// /// END OF FILE ///
......
...@@ -217,6 +217,7 @@ struct Wlc_BstPar_t_ ...@@ -217,6 +217,7 @@ struct Wlc_BstPar_t_
int fCla; int fCla;
int fNoCleanup; int fNoCleanup;
int fCreateMiter; int fCreateMiter;
int fCreateWordMiter;
int fDecMuxes; int fDecMuxes;
int fSaveFfNames; int fSaveFfNames;
int fVerbose; int fVerbose;
...@@ -236,6 +237,7 @@ static inline void Wlc_BstParDefault( Wlc_BstPar_t * pPar ) ...@@ -236,6 +237,7 @@ static inline void Wlc_BstParDefault( Wlc_BstPar_t * pPar )
pPar->fBooth = 0; pPar->fBooth = 0;
pPar->fCla = 0; pPar->fCla = 0;
pPar->fCreateMiter = 0; pPar->fCreateMiter = 0;
pPar->fCreateWordMiter = 0;
pPar->fDecMuxes = 0; pPar->fDecMuxes = 0;
pPar->fVerbose = 0; pPar->fVerbose = 0;
} }
......
...@@ -1936,9 +1936,10 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn ) ...@@ -1936,9 +1936,10 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
} }
Vec_IntFree( vFf2Ci ); Vec_IntFree( vFf2Ci );
// create COs // create COs
if ( pPar->fCreateMiter ) if ( pPar->fCreateMiter || pPar->fCreateWordMiter )
{ {
int nPairs = 0, nBits = 0; int nPairs = 0, nBits = 0;
Vec_Int_t * vOuts = Vec_IntAlloc( 100 );
assert( Wlc_NtkPoNum(p) % 2 == 0 ); assert( Wlc_NtkPoNum(p) % 2 == 0 );
Wlc_NtkForEachCo( p, pObj, i ) Wlc_NtkForEachCo( p, pObj, i )
{ {
...@@ -1965,6 +1966,23 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn ) ...@@ -1965,6 +1966,23 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
assert( nRange1 == nRange2 ); assert( nRange1 == nRange2 );
pFans1 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj)) ); pFans1 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj)) );
pFans2 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj2)) ); pFans2 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj2)) );
if ( pPar->fCreateWordMiter )
{
Vec_IntClear( vOuts );
if ( Wlc_ObjRangeIsReversed(pObj) )
{
for ( k = 0; k < nRange1; k++ )
Vec_IntPushTwo( vOuts, pFans1[nRange1-1-k], pFans2[nRange2-1-k] );
}
else
{
for ( k = 0; k < nRange1; k++ )
Vec_IntPushTwo( vOuts, pFans1[k], pFans2[k] );
}
Gia_ManAppendCo( pNew, Gia_ManHashDualMiter(pNew, vOuts) );
}
else
{
if ( Wlc_ObjRangeIsReversed(pObj) ) if ( Wlc_ObjRangeIsReversed(pObj) )
{ {
for ( k = 0; k < nRange1; k++ ) for ( k = 0; k < nRange1; k++ )
...@@ -1981,9 +1999,14 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn ) ...@@ -1981,9 +1999,14 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
Gia_ManAppendCo( pNew, pFans2[k] ); Gia_ManAppendCo( pNew, pFans2[k] );
} }
} }
}
nPairs++; nPairs++;
nBits += nRange1; nBits += nRange1;
} }
Vec_IntFree( vOuts );
if ( pPar->fCreateWordMiter )
printf( "Derived an ordinary miter with %d bit-level outputs, one for each pair of word-level outputs.\n", nPairs );
else
printf( "Derived a dual-output miter with %d pairs of bits belonging to %d pairs of word-level outputs.\n", nBits, nPairs ); printf( "Derived a dual-output miter with %d pairs of bits belonging to %d pairs of word-level outputs.\n", nBits, nPairs );
} }
else else
...@@ -2280,7 +2303,16 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn ) ...@@ -2280,7 +2303,16 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
{ {
char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj)); char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
nRange = Wlc_ObjRange( pObj ); nRange = Wlc_ObjRange( pObj );
if ( pPar->fCreateMiter && nRange > 1 ) if ( pPar->fCreateWordMiter )
{
Wlc_Obj_t * pObj2 = Wlc_NtkCo( p, ++i );
char * pName2 = Wlc_ObjName(p, Wlc_ObjId(p, pObj2));
char Buffer[1000];
sprintf( Buffer, "%s_xor_%s", pName, pName2 );
Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
//printf( "Adding output %s\n", Buffer );
}
else if ( pPar->fCreateMiter && nRange > 1 )
{ {
Wlc_Obj_t * pObj2 = Wlc_NtkCo( p, ++i ); Wlc_Obj_t * pObj2 = Wlc_NtkCo( p, ++i );
char * pName2 = Wlc_ObjName(p, Wlc_ObjId(p, pObj2)); char * pName2 = Wlc_ObjName(p, Wlc_ObjId(p, pObj2));
......
...@@ -1037,7 +1037,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -1037,7 +1037,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Wlc_BstParDefault( pPar ); Wlc_BstParDefault( pPar );
pPar->nOutputRange = 2; pPar->nOutputRange = 2;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "ORAMcombadstnizvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "ORAMcombadestnizvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -1103,6 +1103,9 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -1103,6 +1103,9 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'd': case 'd':
pPar->fCreateMiter ^= 1; pPar->fCreateMiter ^= 1;
break; break;
case 'e':
pPar->fCreateWordMiter ^= 1;
break;
case 's': case 's':
pPar->fDecMuxes ^= 1; pPar->fDecMuxes ^= 1;
break; break;
...@@ -1192,7 +1195,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -1192,7 +1195,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 [-ORAM num] [-combadstnizvh]\n" ); Abc_Print( -2, "usage: %%blast [-ORAM num] [-combadestnizvh]\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", pPar->iOutput ); Abc_Print( -2, "\t-O num : zero-based index of the first word-level PO to bit-blast [default = %d]\n", pPar->iOutput );
Abc_Print( -2, "\t-R num : the total number of word-level POs to bit-blast [default = %d]\n", pPar->nOutputRange ); Abc_Print( -2, "\t-R num : the total number of word-level POs to bit-blast [default = %d]\n", pPar->nOutputRange );
...@@ -1204,6 +1207,7 @@ usage: ...@@ -1204,6 +1207,7 @@ usage:
Abc_Print( -2, "\t-b : toggle generating radix-4 Booth multipliers [default = %s]\n", pPar->fBooth? "yes": "no" ); Abc_Print( -2, "\t-b : toggle generating radix-4 Booth multipliers [default = %s]\n", pPar->fBooth? "yes": "no" );
Abc_Print( -2, "\t-a : toggle generating carry-look-ahead adder [default = %s]\n", pPar->fCla? "yes": "no" ); Abc_Print( -2, "\t-a : toggle generating carry-look-ahead adder [default = %s]\n", pPar->fCla? "yes": "no" );
Abc_Print( -2, "\t-d : toggle creating dual-output multi-output miter [default = %s]\n", pPar->fCreateMiter? "yes": "no" ); Abc_Print( -2, "\t-d : toggle creating dual-output multi-output miter [default = %s]\n", pPar->fCreateMiter? "yes": "no" );
Abc_Print( -2, "\t-e : toggle creating miter with output word bits combined [default = %s]\n", pPar->fCreateWordMiter? "yes": "no" );
Abc_Print( -2, "\t-s : toggle creating decoded MUXes [default = %s]\n", pPar->fDecMuxes? "yes": "no" ); Abc_Print( -2, "\t-s : toggle creating decoded MUXes [default = %s]\n", pPar->fDecMuxes? "yes": "no" );
Abc_Print( -2, "\t-t : toggle creating regular multi-output miter [default = %s]\n", fMiter? "yes": "no" ); Abc_Print( -2, "\t-t : toggle creating regular multi-output miter [default = %s]\n", fMiter? "yes": "no" );
Abc_Print( -2, "\t-n : toggle dumping signal names into a text file [default = %s]\n", fDumpNames? "yes": "no" ); Abc_Print( -2, "\t-n : toggle dumping signal names into a text file [default = %s]\n", fDumpNames? "yes": "no" );
......
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