diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2007-07-26 08:01:00 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2007-07-26 08:01:00 -0700 |
commit | 054e2cd3a8ab4ada55db4def2d6ce7d309341e07 (patch) | |
tree | a951eeeafa90dc555cb6442151761190e0b5af6a /src/aig/fra | |
parent | 64dc240b904adafee78e2a66a1fc31b717f8985f (diff) | |
download | abc-054e2cd3a8ab4ada55db4def2d6ce7d309341e07.tar.gz abc-054e2cd3a8ab4ada55db4def2d6ce7d309341e07.tar.bz2 abc-054e2cd3a8ab4ada55db4def2d6ce7d309341e07.zip |
Version abc70726
Diffstat (limited to 'src/aig/fra')
-rw-r--r-- | src/aig/fra/fra.h | 15 | ||||
-rw-r--r-- | src/aig/fra/fraAnd.c | 156 | ||||
-rw-r--r-- | src/aig/fra/fraCore.c | 195 | ||||
-rw-r--r-- | src/aig/fra/fraDfs.c | 87 | ||||
-rw-r--r-- | src/aig/fra/fraMan.c | 3 | ||||
-rw-r--r-- | src/aig/fra/fraSat.c | 17 | ||||
-rw-r--r-- | src/aig/fra/module.make | 4 |
7 files changed, 306 insertions, 171 deletions
diff --git a/src/aig/fra/fra.h b/src/aig/fra/fra.h index 7f2df105..127882ea 100644 --- a/src/aig/fra/fra.h +++ b/src/aig/fra/fra.h @@ -60,6 +60,7 @@ struct Fra_Par_t_ int MaxScore; // max score after which resimulation is used double dActConeRatio; // the ratio of cone to be bumped double dActConeBumpMax; // the largest bump in activity + int fChoicing; // enables choicing int fSpeculate; // use speculative reduction int fProve; // prove the miter outputs int fVerbose; // verbose output @@ -101,6 +102,7 @@ struct Fra_Man_t_ // various data members Aig_Obj_t ** pMemFraig; // memory allocated for points to the fraig nodes Aig_Obj_t ** pMemRepr; // memory allocated for points to the node representatives + Aig_Obj_t ** pMemReprFra; // memory allocated for points to the node representatives in the FRAIG Vec_Ptr_t ** pMemFanins; // the arrays of fanins int * pMemSatNums; // the array of SAT numbers int nSizeAlloc; // allocated size of the arrays @@ -118,7 +120,9 @@ struct Fra_Man_t_ int nSatProof; int nSatFails; int nSatFailsReal; - int nSpeculs; + int nSpeculs; + int nChoices; + int nChoicesFake; // runtime int timeSim; int timeTrav; @@ -141,11 +145,13 @@ static inline unsigned Fra_ObjRandomSim() { return (rand() << static inline Aig_Obj_t * Fra_ObjFraig( Aig_Obj_t * pObj ) { return ((Fra_Man_t *)pObj->pData)->pMemFraig[pObj->Id]; } static inline Aig_Obj_t * Fra_ObjRepr( Aig_Obj_t * pObj ) { return ((Fra_Man_t *)pObj->pData)->pMemRepr[pObj->Id]; } +static inline Aig_Obj_t * Fra_ObjReprFra( Aig_Obj_t * pObj ) { return ((Fra_Man_t *)pObj->pData)->pMemReprFra[pObj->Id]; } static inline Vec_Ptr_t * Fra_ObjFaninVec( Aig_Obj_t * pObj ) { return ((Fra_Man_t *)pObj->pData)->pMemFanins[pObj->Id]; } static inline int Fra_ObjSatNum( Aig_Obj_t * pObj ) { return ((Fra_Man_t *)pObj->pData)->pMemSatNums[pObj->Id]; } static inline void Fra_ObjSetFraig( Aig_Obj_t * pObj, Aig_Obj_t * pNode ) { ((Fra_Man_t *)pObj->pData)->pMemFraig[pObj->Id] = pNode; } static inline void Fra_ObjSetRepr( Aig_Obj_t * pObj, Aig_Obj_t * pNode ) { ((Fra_Man_t *)pObj->pData)->pMemRepr[pObj->Id] = pNode; } +static inline void Fra_ObjSetReprFra( Aig_Obj_t * pObj, Aig_Obj_t * pNode ) { ((Fra_Man_t *)pObj->pData)->pMemReprFra[pObj->Id] = pNode; } static inline void Fra_ObjSetFaninVec( Aig_Obj_t * pObj, Vec_Ptr_t * vFanins ) { ((Fra_Man_t *)pObj->pData)->pMemFanins[pObj->Id] = vFanins; } static inline void Fra_ObjSetSatNum( Aig_Obj_t * pObj, int Num ) { ((Fra_Man_t *)pObj->pData)->pMemSatNums[pObj->Id] = Num; } @@ -160,8 +166,6 @@ static inline Aig_Obj_t * Fra_ObjChild1Fra( Aig_Obj_t * pObj ) { assert( !Aig_I /// FUNCTION DECLARATIONS /// //////////////////////////////////////////////////////////////////////// -/*=== fraAnd.c ========================================================*/ -extern void Fra_Sweep( Fra_Man_t * p ); /*=== fraClass.c ========================================================*/ extern void Fra_PrintClasses( Fra_Man_t * p ); extern void Fra_CreateClasses( Fra_Man_t * p ); @@ -170,7 +174,10 @@ extern int Fra_RefineClasses1( Fra_Man_t * p ); /*=== fraCnf.c ========================================================*/ extern void Fra_NodeAddToSolver( Fra_Man_t * p, Aig_Obj_t * pOld, Aig_Obj_t * pNew ); /*=== fraCore.c ========================================================*/ -extern Aig_Man_t * Fra_Perform( Aig_Man_t * pManAig, Fra_Par_t * pParams ); +extern Aig_Man_t * Fra_Perform( Aig_Man_t * pManAig, Fra_Par_t * pPars ); +extern Aig_Man_t * Fra_Choice( Aig_Man_t * pManAig ); +/*=== fraDfs.c ========================================================*/ +extern int Fra_CheckTfi( Fra_Man_t * p, Aig_Obj_t * pNew, Aig_Obj_t * pOld ); /*=== fraMan.c ========================================================*/ extern void Fra_ParamsDefault( Fra_Par_t * pParams ); extern Fra_Man_t * Fra_ManStart( Aig_Man_t * pManAig, Fra_Par_t * pParams ); diff --git a/src/aig/fra/fraAnd.c b/src/aig/fra/fraAnd.c deleted file mode 100644 index 36b4ccc3..00000000 --- a/src/aig/fra/fraAnd.c +++ /dev/null @@ -1,156 +0,0 @@ -/**CFile**************************************************************** - - FileName [fraAnd.c] - - SystemName [ABC: Logic synthesis and verification system.] - - PackageName [Fraig FRAIG package.] - - Synopsis [] - - Author [Alan Mishchenko] - - Affiliation [UC Berkeley] - - Date [Ver. 1.0. Started - June 30, 2007.] - - Revision [$Id: fraAnd.c,v 1.00 2007/06/30 00:00:00 alanmi Exp $] - -***********************************************************************/ - -#include "fra.h" - -//////////////////////////////////////////////////////////////////////// -/// DECLARATIONS /// -//////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////// -/// FUNCTION DEFINITIONS /// -//////////////////////////////////////////////////////////////////////// - - -/**Function************************************************************* - - Synopsis [Performs fraiging for one node.] - - Description [Returns the fraiged node.] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -Aig_Obj_t * Fra_And( Fra_Man_t * p, Aig_Obj_t * pObjOld ) -{ - Aig_Obj_t * pObjOldRepr, * pObjFraig, * pFanin0Fraig, * pFanin1Fraig, * pObjOldReprFraig; - int RetValue; - assert( !Aig_IsComplement(pObjOld) ); - assert( Aig_ObjIsNode(pObjOld) ); - // get the fraiged fanins - pFanin0Fraig = Fra_ObjChild0Fra(pObjOld); - pFanin1Fraig = Fra_ObjChild1Fra(pObjOld); - // get the fraiged node - pObjFraig = Aig_And( p->pManFraig, pFanin0Fraig, pFanin1Fraig ); - if ( Aig_ObjIsConst1(Aig_Regular(pObjFraig)) ) - return pObjFraig; - Aig_Regular(pObjFraig)->pData = p; - // get representative of this class - pObjOldRepr = Fra_ObjRepr(pObjOld); - if ( pObjOldRepr == NULL || // this is a unique node - (!p->pPars->fDoSparse && pObjOldRepr == Aig_ManConst1(p->pManAig)) ) // this is a sparse node - { - assert( Aig_Regular(pFanin0Fraig) != Aig_Regular(pFanin1Fraig) ); - assert( Aig_Regular(pObjFraig) != Aig_Regular(pFanin0Fraig) ); - assert( Aig_Regular(pObjFraig) != Aig_Regular(pFanin1Fraig) ); - return pObjFraig; - } - // get the fraiged representative - pObjOldReprFraig = Fra_ObjFraig(pObjOldRepr); - // if the fraiged nodes are the same, return - if ( Aig_Regular(pObjFraig) == Aig_Regular(pObjOldReprFraig) ) - return pObjFraig; - assert( Aig_Regular(pObjFraig) != Aig_ManConst1(p->pManFraig) ); -// printf( "Node = %d. Repr = %d.\n", pObjOld->Id, pObjOldRepr->Id ); - - // if they are proved different, the c-ex will be in p->pPatWords - RetValue = Fra_NodesAreEquiv( p, Aig_Regular(pObjOldReprFraig), Aig_Regular(pObjFraig) ); - if ( RetValue == 1 ) // proved equivalent - { -// pObjOld->fMarkA = 1; - return Aig_NotCond( pObjOldReprFraig, pObjOld->fPhase ^ pObjOldRepr->fPhase ); - } - if ( RetValue == -1 ) // failed - { - Aig_Obj_t * ppNodes[2] = { Aig_Regular(pObjOldReprFraig), Aig_Regular(pObjFraig) }; - Vec_Ptr_t * vNodes; - - if ( !p->pPars->fSpeculate ) - return pObjFraig; - // substitute the node -// pObjOld->fMarkB = 1; - p->nSpeculs++; - - vNodes = Aig_ManDfsNodes( p->pManFraig, ppNodes, 2 ); - printf( "%d ", Vec_PtrSize(vNodes) ); - Vec_PtrFree( vNodes ); - - return Aig_NotCond( pObjOldReprFraig, pObjOld->fPhase ^ pObjOldRepr->fPhase ); - } -// printf( "Disproved %d and %d.\n", pObjOldRepr->Id, pObjOld->Id ); - // simulate the counter-example and return the Fraig node -// printf( "Representaive before = %d.\n", Fra_ObjRepr(pObjOld)? Fra_ObjRepr(pObjOld)->Id : -1 ); - Fra_Resimulate( p ); -// printf( "Representaive after = %d.\n", Fra_ObjRepr(pObjOld)? Fra_ObjRepr(pObjOld)->Id : -1 ); - assert( Fra_ObjRepr(pObjOld) != pObjOldRepr ); - return pObjFraig; -} - -/**Function************************************************************* - - Synopsis [Performs fraiging for the internal nodes.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -void Fra_Sweep( Fra_Man_t * p ) -{ - Aig_Obj_t * pObj, * pObjNew; - int i, k = 0; -p->nClassesZero = Vec_PtrSize(p->vClasses1); -p->nClassesBeg = Vec_PtrSize(p->vClasses) + (int)(Vec_PtrSize(p->vClasses1) > 0); - // duplicate internal nodes -// p->pProgress = Extra_ProgressBarStart( stdout, Aig_ManNodeNum(p->pManAig) ); - Aig_ManForEachNode( p->pManAig, pObj, i ) - { -// Extra_ProgressBarUpdate( p->pProgress, k++, NULL ); - // default to simple strashing if simulation detected a counter-example for a PO - if ( p->pManFraig->pData ) - pObjNew = Aig_And( p->pManFraig, Fra_ObjChild0Fra(pObj), Fra_ObjChild1Fra(pObj) ); - else - pObjNew = Fra_And( p, pObj ); // pObjNew can be complemented - Fra_ObjSetFraig( pObj, pObjNew ); - assert( Fra_ObjFraig(pObj) != NULL ); - } -// Extra_ProgressBarStop( p->pProgress ); -p->nClassesEnd = Vec_PtrSize(p->vClasses) + (int)(Vec_PtrSize(p->vClasses1) > 0); - // try to prove the outputs of the miter - p->nNodesMiter = Aig_ManNodeNum(p->pManFraig); -// Fra_MiterStatus( p->pManFraig ); -// if ( p->pPars->fProve && p->pManFraig->pData == NULL ) -// Fra_MiterProve( p ); - // add the POs - Aig_ManForEachPo( p->pManAig, pObj, i ) - Aig_ObjCreatePo( p->pManFraig, Fra_ObjChild0Fra(pObj) ); - // remove dangling nodes - Aig_ManCleanup( p->pManFraig ); -} - -//////////////////////////////////////////////////////////////////////// -/// END OF FILE /// -//////////////////////////////////////////////////////////////////////// - - diff --git a/src/aig/fra/fraCore.c b/src/aig/fra/fraCore.c index 9e1a9a1a..ca2d0fb4 100644 --- a/src/aig/fra/fraCore.c +++ b/src/aig/fra/fraCore.c @@ -30,6 +30,177 @@ /**Function************************************************************* + Synopsis [Performs fraiging for one node.] + + Description [Returns the fraiged node.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Aig_Obj_t * Fra_And( Fra_Man_t * p, Aig_Obj_t * pObjOld ) +{ + Aig_Obj_t * pObjOldRepr, * pObjFraig, * pFanin0Fraig, * pFanin1Fraig, * pObjOldReprFraig; + int RetValue; + assert( !Aig_IsComplement(pObjOld) ); + assert( Aig_ObjIsNode(pObjOld) ); + // get the fraiged fanins + pFanin0Fraig = Fra_ObjChild0Fra(pObjOld); + pFanin1Fraig = Fra_ObjChild1Fra(pObjOld); + // get the fraiged node + pObjFraig = Aig_And( p->pManFraig, pFanin0Fraig, pFanin1Fraig ); + if ( Aig_ObjIsConst1(Aig_Regular(pObjFraig)) ) + return pObjFraig; + Aig_Regular(pObjFraig)->pData = p; + // get representative of this class + pObjOldRepr = Fra_ObjRepr(pObjOld); + if ( pObjOldRepr == NULL || // this is a unique node + (!p->pPars->fDoSparse && pObjOldRepr == Aig_ManConst1(p->pManAig)) ) // this is a sparse node + { + assert( Aig_Regular(pFanin0Fraig) != Aig_Regular(pFanin1Fraig) ); + assert( Aig_Regular(pObjFraig) != Aig_Regular(pFanin0Fraig) ); + assert( Aig_Regular(pObjFraig) != Aig_Regular(pFanin1Fraig) ); + return pObjFraig; + } + // get the fraiged representative + pObjOldReprFraig = Fra_ObjFraig(pObjOldRepr); + // if the fraiged nodes are the same, return + if ( Aig_Regular(pObjFraig) == Aig_Regular(pObjOldReprFraig) ) + return pObjFraig; + assert( Aig_Regular(pObjFraig) != Aig_ManConst1(p->pManFraig) ); +// printf( "Node = %d. Repr = %d.\n", pObjOld->Id, pObjOldRepr->Id ); + + // if they are proved different, the c-ex will be in p->pPatWords + RetValue = Fra_NodesAreEquiv( p, Aig_Regular(pObjOldReprFraig), Aig_Regular(pObjFraig) ); + if ( RetValue == 1 ) // proved equivalent + { +// pObjOld->fMarkA = 1; + if ( p->pPars->fChoicing && !Fra_CheckTfi( p, Aig_Regular(pObjFraig), Aig_Regular(pObjOldReprFraig) ) ) + { +// Fra_ObjSetReprFra( Aig_Regular(pObjFraig), Aig_Regular(pObjOldReprFraig) ); + Aig_Obj_t * pObjNew = Aig_Regular(pObjFraig); + Aig_Obj_t * pObjOld = Aig_Regular(pObjOldReprFraig); + Aig_Obj_t * pTemp; + assert( pObjNew != pObjOld ); + for ( pTemp = Fra_ObjReprFra(pObjOld); pTemp; pTemp = Fra_ObjReprFra(pTemp) ) + if ( pTemp == pObjNew ) + break; + if ( pTemp == NULL ) + { + Fra_ObjSetReprFra( pObjNew, Fra_ObjReprFra(pObjOld) ); + Fra_ObjSetReprFra( pObjOld, pObjNew ); + assert( pObjOld != Fra_ObjReprFra(pObjOld) ); + assert( pObjNew != Fra_ObjReprFra(pObjNew) ); + p->nChoices++; + + assert( pObjOld->Id < pObjNew->Id ); + } + else + p->nChoicesFake++; + } + return Aig_NotCond( pObjOldReprFraig, pObjOld->fPhase ^ pObjOldRepr->fPhase ); + } + if ( RetValue == -1 ) // failed + { + static int Counter = 0; + char FileName[20]; + Aig_Man_t * pTemp; + Aig_Obj_t * pObj; + int i; + + Aig_Obj_t * ppNodes[2] = { Aig_Regular(pObjOldReprFraig), Aig_Regular(pObjFraig) }; +// Vec_Ptr_t * vNodes; + + if ( !p->pPars->fSpeculate ) + return pObjFraig; + // substitute the node +// pObjOld->fMarkB = 1; + p->nSpeculs++; + + pTemp = Aig_ManExtractMiter( p->pManFraig, ppNodes, 2 ); + sprintf( FileName, "aig\\%03d.blif", ++Counter ); + Aig_ManDumpBlif( pTemp, FileName ); + printf( "Speculation cone with %d nodes was written into file \"%s\".\n", Aig_ManNodeNum(pTemp), FileName ); + Aig_ManStop( pTemp ); + + Aig_ManForEachObj( p->pManFraig, pObj, i ) + pObj->pData = p; + +// vNodes = Aig_ManDfsNodes( p->pManFraig, ppNodes, 2 ); +// printf( "Cone=%d ", Vec_PtrSize(vNodes) ); +// Vec_PtrFree( vNodes ); + + return Aig_NotCond( pObjOldReprFraig, pObjOld->fPhase ^ pObjOldRepr->fPhase ); + } +// printf( "Disproved %d and %d.\n", pObjOldRepr->Id, pObjOld->Id ); + // simulate the counter-example and return the Fraig node +// printf( "Representaive before = %d.\n", Fra_ObjRepr(pObjOld)? Fra_ObjRepr(pObjOld)->Id : -1 ); + Fra_Resimulate( p ); +// printf( "Representaive after = %d.\n", Fra_ObjRepr(pObjOld)? Fra_ObjRepr(pObjOld)->Id : -1 ); + assert( Fra_ObjRepr(pObjOld) != pObjOldRepr ); + return pObjFraig; +} + +/**Function************************************************************* + + Synopsis [Performs fraiging for the internal nodes.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Fra_Sweep( Fra_Man_t * p ) +{ + ProgressBar * pProgress; + Aig_Obj_t * pObj, * pObjNew; + int i, k = 0; +p->nClassesZero = Vec_PtrSize(p->vClasses1); +p->nClassesBeg = Vec_PtrSize(p->vClasses) + (int)(Vec_PtrSize(p->vClasses1) > 0); + // duplicate internal nodes + pProgress = Extra_ProgressBarStart( stdout, Aig_ManObjIdMax(p->pManAig) ); + Aig_ManForEachNode( p->pManAig, pObj, i ) + { + Extra_ProgressBarUpdate( pProgress, i, NULL ); + // default to simple strashing if simulation detected a counter-example for a PO + if ( p->pManFraig->pData ) + pObjNew = Aig_And( p->pManFraig, Fra_ObjChild0Fra(pObj), Fra_ObjChild1Fra(pObj) ); + else + pObjNew = Fra_And( p, pObj ); // pObjNew can be complemented + Fra_ObjSetFraig( pObj, pObjNew ); + assert( Fra_ObjFraig(pObj) != NULL ); + } + Extra_ProgressBarStop( pProgress ); +p->nClassesEnd = Vec_PtrSize(p->vClasses) + (int)(Vec_PtrSize(p->vClasses1) > 0); + // try to prove the outputs of the miter + p->nNodesMiter = Aig_ManNodeNum(p->pManFraig); +// Fra_MiterStatus( p->pManFraig ); +// if ( p->pPars->fProve && p->pManFraig->pData == NULL ) +// Fra_MiterProve( p ); + // add the POs + Aig_ManForEachPo( p->pManAig, pObj, i ) + Aig_ObjCreatePo( p->pManFraig, Fra_ObjChild0Fra(pObj) ); + // postprocess + Aig_ManCleanMarkB( p->pManFraig ); + if ( p->pPars->fChoicing ) + { + // transfer the representative info + p->pManFraig->pReprs = p->pMemReprFra; + p->pMemReprFra = NULL; +// printf( "The number of choices = %d. Fake choices = %d.\n", p->nChoices, p->nChoicesFake ); + } + else + { + // remove dangling nodes + Aig_ManCleanup( p->pManFraig ); + } +} + +/**Function************************************************************* + Synopsis [Performs fraiging of the AIG.] Description [] @@ -57,6 +228,30 @@ p->timeTotal = clock() - clk; return pManAigNew; } +/**Function************************************************************* + + Synopsis [Performs choicing of the AIG.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Aig_Man_t * Fra_Choice( Aig_Man_t * pManAig ) +{ + Fra_Par_t Pars, * pPars = &Pars; + Fra_ParamsDefault( pPars ); + pPars->nBTLimitNode = 1000; + pPars->fVerbose = 0; + pPars->fProve = 0; + pPars->fDoSparse = 1; + pPars->fSpeculate = 0; + pPars->fChoicing = 1; + return Fra_Perform( pManAig, pPars ); +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/aig/fra/fraDfs.c b/src/aig/fra/fraDfs.c new file mode 100644 index 00000000..cd0985e0 --- /dev/null +++ b/src/aig/fra/fraDfs.c @@ -0,0 +1,87 @@ +/**CFile**************************************************************** + + FileName [fraDfs.c] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Fraig FRAIG package.] + + Synopsis [] + + Author [Alan Mishchenko] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - June 30, 2007.] + + Revision [$Id: fraDfs.c,v 1.00 2007/06/30 00:00:00 alanmi Exp $] + +***********************************************************************/ + +#include "fra.h" + +//////////////////////////////////////////////////////////////////////// +/// DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +/**Function************************************************************* + + Synopsis [Returns 1 if pOld is in the TFI of pNew.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Fra_CheckTfi_rec( Fra_Man_t * p, Aig_Obj_t * pNode, Aig_Obj_t * pOld ) +{ + // check the trivial cases + if ( pNode == NULL ) + return 0; +// if ( pNode->Id < pOld->Id ) // cannot use because of choicesof pNode +// return 0; + if ( pNode == pOld ) + return 1; + // skip the visited node + if ( Aig_ObjIsTravIdCurrent(p->pManFraig, pNode) ) + return 0; + Aig_ObjSetTravIdCurrent(p->pManFraig, pNode); + // check the children + if ( Fra_CheckTfi_rec( p, Aig_ObjFanin0(pNode), pOld ) ) + return 1; + if ( Fra_CheckTfi_rec( p, Aig_ObjFanin1(pNode), pOld ) ) + return 1; + // check equivalent nodes + return Fra_CheckTfi_rec( p, Fra_ObjReprFra(pNode), pOld ); +} + +/**Function************************************************************* + + Synopsis [Returns 1 if pOld is in the TFI of pNew.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Fra_CheckTfi( Fra_Man_t * p, Aig_Obj_t * pNew, Aig_Obj_t * pOld ) +{ + assert( !Aig_IsComplement(pNew) ); + assert( !Aig_IsComplement(pOld) ); + Aig_ManIncrementTravId( p->pManFraig ); + return Fra_CheckTfi_rec( p, pNew, pOld ); +} + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + + diff --git a/src/aig/fra/fraMan.c b/src/aig/fra/fraMan.c index 78246a8c..0e583d6c 100644 --- a/src/aig/fra/fraMan.c +++ b/src/aig/fra/fraMan.c @@ -97,6 +97,8 @@ Fra_Man_t * Fra_ManStart( Aig_Man_t * pManAig, Fra_Par_t * pPars ) memset( p->pMemFraig, 0, p->nSizeAlloc * sizeof(Aig_Obj_t *) ); p->pMemRepr = ALLOC( Aig_Obj_t *, p->nSizeAlloc ); memset( p->pMemRepr, 0, p->nSizeAlloc * sizeof(Aig_Obj_t *) ); + p->pMemReprFra = ALLOC( Aig_Obj_t *, p->nSizeAlloc ); + memset( p->pMemReprFra, 0, p->nSizeAlloc * sizeof(Aig_Obj_t *) ); p->pMemFanins = ALLOC( Vec_Ptr_t *, p->nSizeAlloc ); memset( p->pMemFanins, 0, p->nSizeAlloc * sizeof(Vec_Ptr_t *) ); p->pMemSatNums = ALLOC( int, p->nSizeAlloc ); @@ -166,6 +168,7 @@ void Fra_ManStop( Fra_Man_t * p ) FREE( p->pMemSatNums ); FREE( p->pMemFanins ); FREE( p->pMemRepr ); + FREE( p->pMemReprFra ); FREE( p->pMemFraig ); FREE( p->pMemClasses ); FREE( p->pPatScores ); diff --git a/src/aig/fra/fraSat.c b/src/aig/fra/fraSat.c index 66b1ba5a..8ab10c40 100644 --- a/src/aig/fra/fraSat.c +++ b/src/aig/fra/fraSat.c @@ -54,8 +54,7 @@ int Fra_NodesAreEquiv( Fra_Man_t * p, Aig_Obj_t * pOld, Aig_Obj_t * pNew ) // if the backtrack limit is small, simply skip this node // if the backtrack limit is > 10, take the quare root of the limit nBTLimit = p->pPars->nBTLimitNode; -/* - if ( nBTLimit > 0 && (pOld->fFailTfo || pNew->fFailTfo) ) + if ( !p->pPars->fSpeculate && (nBTLimit > 0 && (pOld->fMarkB || pNew->fMarkB)) ) { p->nSatFails++; // fail immediately @@ -64,7 +63,7 @@ int Fra_NodesAreEquiv( Fra_Man_t * p, Aig_Obj_t * pOld, Aig_Obj_t * pNew ) return -1; nBTLimit = (int)pow(nBTLimit, 0.7); } -*/ + p->nSatCalls++; // make sure the solver is allocated and has enough variables @@ -112,9 +111,9 @@ p->timeSatSat += clock() - clk; { p->timeSatFail += clock() - clk; // mark the node as the failed node -// if ( pOld != p->pManFraig->pConst1 ) -// pOld->fFailTfo = 1; -// pNew->fFailTfo = 1; + if ( pOld != p->pManFraig->pConst1 ) + pOld->fMarkB = 1; + pNew->fMarkB = 1; p->nSatFailsReal++; return -1; } @@ -155,8 +154,8 @@ p->timeSatSat += clock() - clk; { p->timeSatFail += clock() - clk; // mark the node as the failed node -// pOld->fFailTfo = 1; -// pNew->fFailTfo = 1; + pOld->fMarkB = 1; + pNew->fMarkB = 1; p->nSatFailsReal++; return -1; } @@ -240,7 +239,7 @@ p->timeSatSat += clock() - clk; { p->timeSatFail += clock() - clk; // mark the node as the failed node -// pNew->fFailTfo = 1; + pNew->fMarkB = 1; p->nSatFailsReal++; return -1; } diff --git a/src/aig/fra/module.make b/src/aig/fra/module.make index 934fbdac..df690700 100644 --- a/src/aig/fra/module.make +++ b/src/aig/fra/module.make @@ -1,7 +1,7 @@ -SRC += src/aig/fra/fraAnd.c \ - src/aig/fra/fraClass.c \ +SRC += src/aig/fra/fraClass.c \ src/aig/fra/fraCnf.c \ src/aig/fra/fraCore.c \ + src/aig/fra/fraDfs.c \ src/aig/fra/fraMan.c \ src/aig/fra/fraSat.c \ src/aig/fra/fraSim.c |