Commit 31b2e8be by Alan Mishchenko

Switch 'fx -x' to use only canonical divisors in 'fx'.

parent 00242f2f
...@@ -3980,7 +3980,7 @@ usage: ...@@ -3980,7 +3980,7 @@ usage:
***********************************************************************/ ***********************************************************************/
int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
extern int Abc_NtkFxPerform( Abc_Ntk_t * pNtk, int nNewNodesMax, int nLitCountMax, int fVerbose, int fVeryVerbose ); extern int Abc_NtkFxPerform( Abc_Ntk_t * pNtk, int nNewNodesMax, int nLitCountMax, int fCanonDivs, int fVerbose, int fVeryVerbose );
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
Fxu_Data_t Params, * p = &Params; Fxu_Data_t Params, * p = &Params;
int c, fNewAlgo = 1; int c, fNewAlgo = 1;
...@@ -3988,7 +3988,7 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -3988,7 +3988,7 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv )
// set the defaults // set the defaults
Abc_NtkSetDefaultFxParams( p ); Abc_NtkSetDefaultFxParams( p );
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( (c = Extra_UtilGetopt(argc, argv, "SDNWMPsdzcnvwh")) != EOF ) while ( (c = Extra_UtilGetopt(argc, argv, "SDNWMPsdzcnxvwh")) != EOF )
{ {
switch (c) switch (c)
{ {
...@@ -4073,6 +4073,9 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -4073,6 +4073,9 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'n': case 'n':
fNewAlgo ^= 1; fNewAlgo ^= 1;
break; break;
case 'x':
p->fCanonDivs ^= 1;
break;
case 'v': case 'v':
p->fVerbose ^= 1; p->fVerbose ^= 1;
break; break;
...@@ -4114,14 +4117,14 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -4114,14 +4117,14 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv )
// the nodes to be merged are linked into the special linked list // the nodes to be merged are linked into the special linked list
if ( fNewAlgo ) if ( fNewAlgo )
Abc_NtkFxPerform( pNtk, p->nNodesExt, p->LitCountMax, p->fVerbose, p->fVeryVerbose ); Abc_NtkFxPerform( pNtk, p->nNodesExt, p->LitCountMax, p->fCanonDivs, p->fVerbose, p->fVeryVerbose );
else else
Abc_NtkFastExtract( pNtk, p ); Abc_NtkFastExtract( pNtk, p );
Abc_NtkFxuFreeInfo( p ); Abc_NtkFxuFreeInfo( p );
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: fx [-SDNWMP <num>] [-sdzcnvwh]\n"); Abc_Print( -2, "usage: fx [-SDNWMP <num>] [-sdzcnxvwh]\n");
Abc_Print( -2, "\t performs unate fast extract on the current network\n"); Abc_Print( -2, "\t performs unate fast extract on the current network\n");
Abc_Print( -2, "\t-S <num> : max number of single-cube divisors to consider [default = %d]\n", p->nSingleMax ); Abc_Print( -2, "\t-S <num> : max number of single-cube divisors to consider [default = %d]\n", p->nSingleMax );
Abc_Print( -2, "\t-D <num> : max number of double-cube divisors to consider [default = %d]\n", p->nPairsMax ); Abc_Print( -2, "\t-D <num> : max number of double-cube divisors to consider [default = %d]\n", p->nPairsMax );
...@@ -4134,6 +4137,7 @@ usage: ...@@ -4134,6 +4137,7 @@ usage:
Abc_Print( -2, "\t-z : use zero-weight divisors [default = %s]\n", p->fUse0? "yes": "no" ); Abc_Print( -2, "\t-z : use zero-weight divisors [default = %s]\n", p->fUse0? "yes": "no" );
Abc_Print( -2, "\t-c : use complement in the binary case [default = %s]\n", p->fUseCompl? "yes": "no" ); Abc_Print( -2, "\t-c : use complement in the binary case [default = %s]\n", p->fUseCompl? "yes": "no" );
Abc_Print( -2, "\t-n : use new implementation of fast extract [default = %s]\n", fNewAlgo? "yes": "no" ); Abc_Print( -2, "\t-n : use new implementation of fast extract [default = %s]\n", fNewAlgo? "yes": "no" );
Abc_Print( -2, "\t-x : use only canonical divisors (AND, XOR, MUX) [default = %s]\n", p->fCanonDivs? "yes": "no" );
Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", p->fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", p->fVerbose? "yes": "no" );
Abc_Print( -2, "\t-w : print additional information [default = %s]\n", p->fVeryVerbose? "yes": "no" ); Abc_Print( -2, "\t-w : print additional information [default = %s]\n", p->fVeryVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
...@@ -88,6 +88,7 @@ struct Fx_Man_t_ ...@@ -88,6 +88,7 @@ struct Fx_Man_t_
// user's data // user's data
Vec_Wec_t * vCubes; // cube -> lit Vec_Wec_t * vCubes; // cube -> lit
int LitCountMax;// max size of divisor to extract int LitCountMax;// max size of divisor to extract
int fCanonDivs; // use only AND/XOR/MUX
// internal data // internal data
Vec_Wec_t * vLits; // lit -> cube Vec_Wec_t * vLits; // lit -> cube
Vec_Int_t * vCounts; // literal counts (currently not used) Vec_Int_t * vCounts; // literal counts (currently not used)
...@@ -300,9 +301,9 @@ int Abc_NtkFxCheck( Abc_Ntk_t * pNtk ) ...@@ -300,9 +301,9 @@ int Abc_NtkFxCheck( Abc_Ntk_t * pNtk )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Abc_NtkFxPerform( Abc_Ntk_t * pNtk, int nNewNodesMax, int LitCountMax, int fVerbose, int fVeryVerbose ) int Abc_NtkFxPerform( Abc_Ntk_t * pNtk, int nNewNodesMax, int LitCountMax, int fCanonDivs, int fVerbose, int fVeryVerbose )
{ {
extern int Fx_FastExtract( Vec_Wec_t * vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fVerbose, int fVeryVerbose ); extern int Fx_FastExtract( Vec_Wec_t * vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fCanonDivs, int fVerbose, int fVeryVerbose );
Vec_Wec_t * vCubes; Vec_Wec_t * vCubes;
assert( Abc_NtkIsSopLogic(pNtk) ); assert( Abc_NtkIsSopLogic(pNtk) );
// check unique fanins // check unique fanins
...@@ -319,7 +320,7 @@ int Abc_NtkFxPerform( Abc_Ntk_t * pNtk, int nNewNodesMax, int LitCountMax, int f ...@@ -319,7 +320,7 @@ int Abc_NtkFxPerform( Abc_Ntk_t * pNtk, int nNewNodesMax, int LitCountMax, int f
// collect information about the covers // collect information about the covers
vCubes = Abc_NtkFxRetrieve( pNtk ); vCubes = Abc_NtkFxRetrieve( pNtk );
// call the fast extract procedure // call the fast extract procedure
if ( Fx_FastExtract( vCubes, Abc_NtkObjNumMax(pNtk), nNewNodesMax, LitCountMax, fVerbose, fVeryVerbose ) > 0 ) if ( Fx_FastExtract( vCubes, Abc_NtkObjNumMax(pNtk), nNewNodesMax, LitCountMax, fCanonDivs, fVerbose, fVeryVerbose ) > 0 )
{ {
// update the network // update the network
Abc_NtkFxInsert( pNtk, vCubes ); Abc_NtkFxInsert( pNtk, vCubes );
...@@ -841,9 +842,13 @@ void Fx_ManCubeDoubleCubeDivisors( Fx_Man_t * p, int iFirst, Vec_Int_t * vPivot, ...@@ -841,9 +842,13 @@ void Fx_ManCubeDoubleCubeDivisors( Fx_Man_t * p, int iFirst, Vec_Int_t * vPivot,
p->nDivMux[1]++; p->nDivMux[1]++;
else else
p->nDivMux[2]++; p->nDivMux[2]++;
if ( p->fCanonDivs && Value < 0 )
continue;
} }
if ( p->LitCountMax && p->LitCountMax < Vec_IntSize(p->vCubeFree) ) if ( p->LitCountMax && p->LitCountMax < Vec_IntSize(p->vCubeFree) )
continue; continue;
if ( p->fCanonDivs && Vec_IntSize(p->vCubeFree) == 3 )
continue;
iDiv = Hsh_VecManAdd( p->pHash, p->vCubeFree ); iDiv = Hsh_VecManAdd( p->pHash, p->vCubeFree );
if ( !fRemove ) if ( !fRemove )
{ {
...@@ -1167,7 +1172,7 @@ void Fx_ManUpdate( Fx_Man_t * p, int iDiv, int * fWarning ) ...@@ -1167,7 +1172,7 @@ void Fx_ManUpdate( Fx_Man_t * p, int iDiv, int * fWarning )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Fx_FastExtract( Vec_Wec_t * vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fVerbose, int fVeryVerbose ) int Fx_FastExtract( Vec_Wec_t * vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fCanonDivs, int fVerbose, int fVeryVerbose )
{ {
int fVeryVeryVerbose = 0; int fVeryVeryVerbose = 0;
int i, iDiv, fWarning = 0; int i, iDiv, fWarning = 0;
...@@ -1176,6 +1181,7 @@ int Fx_FastExtract( Vec_Wec_t * vCubes, int ObjIdMax, int nNewNodesMax, int LitC ...@@ -1176,6 +1181,7 @@ int Fx_FastExtract( Vec_Wec_t * vCubes, int ObjIdMax, int nNewNodesMax, int LitC
// initialize the data-structure // initialize the data-structure
p = Fx_ManStart( vCubes ); p = Fx_ManStart( vCubes );
p->LitCountMax = LitCountMax; p->LitCountMax = LitCountMax;
p->fCanonDivs = fCanonDivs;
Fx_ManCreateLiterals( p, ObjIdMax ); Fx_ManCreateLiterals( p, ObjIdMax );
Fx_ManComputeLevel( p ); Fx_ManComputeLevel( p );
Fx_ManCreateDivisors( p ); Fx_ManCreateDivisors( p );
......
...@@ -56,6 +56,7 @@ struct FxuDataStruct ...@@ -56,6 +56,7 @@ struct FxuDataStruct
int nPairsMax; // the max number of double-cube divisors to consider int nPairsMax; // the max number of double-cube divisors to consider
int WeightMin; // the min weight of a divisor to extract int WeightMin; // the min weight of a divisor to extract
int LitCountMax; // the max literal count of a divisor to consider int LitCountMax; // the max literal count of a divisor to consider
int fCanonDivs; // use only canonical divisors (AND/XOR/MUX)
// the input information // the input information
Vec_Ptr_t * vSops; // the SOPs for each node in the network Vec_Ptr_t * vSops; // the SOPs for each node in the network
Vec_Ptr_t * vFanins; // the fanins of each node in the network Vec_Ptr_t * vFanins; // the fanins of each node in the network
......
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