abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fraig.h File Reference

Go to the source code of this file.

Data Structures

struct  Fraig_ParamsStruct_t_
 
struct  Prove_ParamsStruct_t_
 

Macros

#define Fraig_IsComplement(p)   (((int)((ABC_PTRUINT_T) (p) & 01)))
 GLOBAL VARIABLES ///. More...
 
#define Fraig_Regular(p)   ((Fraig_Node_t *)((ABC_PTRUINT_T)(p) & ~01))
 
#define Fraig_Not(p)   ((Fraig_Node_t *)((ABC_PTRUINT_T)(p) ^ 01))
 
#define Fraig_NotCond(p, c)   ((Fraig_Node_t *)((ABC_PTRUINT_T)(p) ^ (c)))
 
#define Fraig_Ref(p)
 
#define Fraig_Deref(p)
 
#define Fraig_RecursiveDeref(p, c)
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Fraig_ManStruct_t_ 
Fraig_Man_t
 INCLUDES ///. More...
 
typedef struct Fraig_NodeStruct_t_ Fraig_Node_t
 
typedef struct
Fraig_NodeVecStruct_t_ 
Fraig_NodeVec_t
 
typedef struct
Fraig_HashTableStruct_t_ 
Fraig_HashTable_t
 
typedef struct
Fraig_ParamsStruct_t_ 
Fraig_Params_t
 
typedef struct
Fraig_PatternsStruct_t_ 
Fraig_Patterns_t
 
typedef struct
Prove_ParamsStruct_t_ 
Prove_Params_t
 

Functions

Fraig_NodeVec_tFraig_ManReadVecInputs (Fraig_Man_t *p)
 FUNCTION DEFINITIONS ///. More...
 
Fraig_NodeVec_tFraig_ManReadVecOutputs (Fraig_Man_t *p)
 
Fraig_NodeVec_tFraig_ManReadVecNodes (Fraig_Man_t *p)
 
Fraig_Node_t ** Fraig_ManReadInputs (Fraig_Man_t *p)
 
Fraig_Node_t ** Fraig_ManReadOutputs (Fraig_Man_t *p)
 
Fraig_Node_t ** Fraig_ManReadNodes (Fraig_Man_t *p)
 
int Fraig_ManReadInputNum (Fraig_Man_t *p)
 
int Fraig_ManReadOutputNum (Fraig_Man_t *p)
 
int Fraig_ManReadNodeNum (Fraig_Man_t *p)
 
Fraig_Node_tFraig_ManReadConst1 (Fraig_Man_t *p)
 
Fraig_Node_tFraig_ManReadIthVar (Fraig_Man_t *p, int i)
 
Fraig_Node_tFraig_ManReadIthNode (Fraig_Man_t *p, int i)
 
char ** Fraig_ManReadInputNames (Fraig_Man_t *p)
 
char ** Fraig_ManReadOutputNames (Fraig_Man_t *p)
 
char * Fraig_ManReadVarsInt (Fraig_Man_t *p)
 
char * Fraig_ManReadSat (Fraig_Man_t *p)
 
int Fraig_ManReadFuncRed (Fraig_Man_t *p)
 
int Fraig_ManReadFeedBack (Fraig_Man_t *p)
 
int Fraig_ManReadDoSparse (Fraig_Man_t *p)
 
int Fraig_ManReadChoicing (Fraig_Man_t *p)
 
int Fraig_ManReadVerbose (Fraig_Man_t *p)
 
int * Fraig_ManReadModel (Fraig_Man_t *p)
 
int Fraig_ManReadPatternNumRandom (Fraig_Man_t *p)
 
int Fraig_ManReadPatternNumDynamic (Fraig_Man_t *p)
 
int Fraig_ManReadPatternNumDynamicFiltered (Fraig_Man_t *p)
 
int Fraig_ManReadSatFails (Fraig_Man_t *p)
 
int Fraig_ManReadConflicts (Fraig_Man_t *p)
 
int Fraig_ManReadInspects (Fraig_Man_t *p)
 
void Fraig_ManSetFuncRed (Fraig_Man_t *p, int fFuncRed)
 
void Fraig_ManSetFeedBack (Fraig_Man_t *p, int fFeedBack)
 
void Fraig_ManSetDoSparse (Fraig_Man_t *p, int fDoSparse)
 
void Fraig_ManSetChoicing (Fraig_Man_t *p, int fChoicing)
 
void Fraig_ManSetTryProve (Fraig_Man_t *p, int fTryProve)
 
void Fraig_ManSetVerbose (Fraig_Man_t *p, int fVerbose)
 
void Fraig_ManSetOutputNames (Fraig_Man_t *p, char **ppNames)
 
void Fraig_ManSetInputNames (Fraig_Man_t *p, char **ppNames)
 
void Fraig_ManSetPo (Fraig_Man_t *p, Fraig_Node_t *pNode)
 
Fraig_Node_tFraig_NodeReadData0 (Fraig_Node_t *p)
 
Fraig_Node_tFraig_NodeReadData1 (Fraig_Node_t *p)
 
int Fraig_NodeReadNum (Fraig_Node_t *p)
 
Fraig_Node_tFraig_NodeReadOne (Fraig_Node_t *p)
 
Fraig_Node_tFraig_NodeReadTwo (Fraig_Node_t *p)
 
Fraig_Node_tFraig_NodeReadNextE (Fraig_Node_t *p)
 
Fraig_Node_tFraig_NodeReadRepr (Fraig_Node_t *p)
 
int Fraig_NodeReadNumRefs (Fraig_Node_t *p)
 
int Fraig_NodeReadNumFanouts (Fraig_Node_t *p)
 
int Fraig_NodeReadSimInv (Fraig_Node_t *p)
 
int Fraig_NodeReadNumOnes (Fraig_Node_t *p)
 
unsigned * Fraig_NodeReadPatternsRandom (Fraig_Node_t *p)
 
unsigned * Fraig_NodeReadPatternsDynamic (Fraig_Node_t *p)
 
void Fraig_NodeSetData0 (Fraig_Node_t *p, Fraig_Node_t *pData)
 
void Fraig_NodeSetData1 (Fraig_Node_t *p, Fraig_Node_t *pData)
 
int Fraig_NodeIsConst (Fraig_Node_t *p)
 
int Fraig_NodeIsVar (Fraig_Node_t *p)
 
int Fraig_NodeIsAnd (Fraig_Node_t *p)
 
int Fraig_NodeComparePhase (Fraig_Node_t *p1, Fraig_Node_t *p2)
 
Fraig_Node_tFraig_NodeOr (Fraig_Man_t *p, Fraig_Node_t *p1, Fraig_Node_t *p2)
 
Fraig_Node_tFraig_NodeAnd (Fraig_Man_t *p, Fraig_Node_t *p1, Fraig_Node_t *p2)
 
Fraig_Node_tFraig_NodeExor (Fraig_Man_t *p, Fraig_Node_t *p1, Fraig_Node_t *p2)
 
Fraig_Node_tFraig_NodeMux (Fraig_Man_t *p, Fraig_Node_t *pNode, Fraig_Node_t *pNodeT, Fraig_Node_t *pNodeE)
 
void Fraig_NodeSetChoice (Fraig_Man_t *pMan, Fraig_Node_t *pNodeOld, Fraig_Node_t *pNodeNew)
 
void Prove_ParamsSetDefault (Prove_Params_t *pParams)
 FUNCTION DEFINITIONS ///. More...
 
void Fraig_ParamsSetDefault (Fraig_Params_t *pParams)
 
void Fraig_ParamsSetDefaultFull (Fraig_Params_t *pParams)
 
Fraig_Man_tFraig_ManCreate (Fraig_Params_t *pParams)
 
void Fraig_ManFree (Fraig_Man_t *pMan)
 
void Fraig_ManPrintStats (Fraig_Man_t *p)
 
Fraig_NodeVec_tFraig_ManGetSimInfo (Fraig_Man_t *p)
 
int Fraig_ManCheckClauseUsingSimInfo (Fraig_Man_t *p, Fraig_Node_t *pNode1, Fraig_Node_t *pNode2)
 
void Fraig_ManAddClause (Fraig_Man_t *p, Fraig_Node_t **ppNodes, int nNodes)
 
Fraig_NodeVec_tFraig_Dfs (Fraig_Man_t *pMan, int fEquiv)
 FUNCTION DEFINITIONS ///. More...
 
Fraig_NodeVec_tFraig_DfsOne (Fraig_Man_t *pMan, Fraig_Node_t *pNode, int fEquiv)
 
Fraig_NodeVec_tFraig_DfsNodes (Fraig_Man_t *pMan, Fraig_Node_t **ppNodes, int nNodes, int fEquiv)
 
Fraig_NodeVec_tFraig_DfsReverse (Fraig_Man_t *pMan)
 
int Fraig_CountNodes (Fraig_Man_t *pMan, int fEquiv)
 
int Fraig_CheckTfi (Fraig_Man_t *pMan, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
 
int Fraig_CountLevels (Fraig_Man_t *pMan)
 
int Fraig_NodesAreEqual (Fraig_Man_t *p, Fraig_Node_t *pNode1, Fraig_Node_t *pNode2, int nBTLimit, int nTimeLimit)
 FUNCTION DEFINITIONS ///. More...
 
int Fraig_NodeIsEquivalent (Fraig_Man_t *p, Fraig_Node_t *pOld, Fraig_Node_t *pNew, int nBTLimit, int nTimeLimit)
 
void Fraig_ManProveMiter (Fraig_Man_t *p)
 
int Fraig_ManCheckMiter (Fraig_Man_t *p)
 
int Fraig_ManCheckClauseUsingSat (Fraig_Man_t *p, Fraig_Node_t *pNode1, Fraig_Node_t *pNode2, int nBTLimit)
 
Fraig_NodeVec_tFraig_NodeVecAlloc (int nCap)
 DECLARATIONS ///. More...
 
void Fraig_NodeVecFree (Fraig_NodeVec_t *p)
 
Fraig_NodeVec_tFraig_NodeVecDup (Fraig_NodeVec_t *p)
 
Fraig_Node_t ** Fraig_NodeVecReadArray (Fraig_NodeVec_t *p)
 
int Fraig_NodeVecReadSize (Fraig_NodeVec_t *p)
 
void Fraig_NodeVecGrow (Fraig_NodeVec_t *p, int nCapMin)
 
void Fraig_NodeVecShrink (Fraig_NodeVec_t *p, int nSizeNew)
 
void Fraig_NodeVecClear (Fraig_NodeVec_t *p)
 
void Fraig_NodeVecPush (Fraig_NodeVec_t *p, Fraig_Node_t *Entry)
 
int Fraig_NodeVecPushUnique (Fraig_NodeVec_t *p, Fraig_Node_t *Entry)
 
void Fraig_NodeVecPushOrder (Fraig_NodeVec_t *p, Fraig_Node_t *pNode)
 
int Fraig_NodeVecPushUniqueOrder (Fraig_NodeVec_t *p, Fraig_Node_t *pNode)
 
void Fraig_NodeVecPushOrderByLevel (Fraig_NodeVec_t *p, Fraig_Node_t *pNode)
 
int Fraig_NodeVecPushUniqueOrderByLevel (Fraig_NodeVec_t *p, Fraig_Node_t *pNode)
 
Fraig_Node_tFraig_NodeVecPop (Fraig_NodeVec_t *p)
 
void Fraig_NodeVecRemove (Fraig_NodeVec_t *p, Fraig_Node_t *Entry)
 
void Fraig_NodeVecWriteEntry (Fraig_NodeVec_t *p, int i, Fraig_Node_t *Entry)
 
Fraig_Node_tFraig_NodeVecReadEntry (Fraig_NodeVec_t *p, int i)
 
void Fraig_NodeVecSortByLevel (Fraig_NodeVec_t *p, int fIncreasing)
 
void Fraig_NodeVecSortByNumber (Fraig_NodeVec_t *p)
 
void Fraig_ManMarkRealFanouts (Fraig_Man_t *p)
 
int Fraig_ManCheckConsistency (Fraig_Man_t *p)
 
int Fraig_GetMaxLevel (Fraig_Man_t *pMan)
 
void Fraig_ManReportChoices (Fraig_Man_t *pMan)
 
void Fraig_MappingSetChoiceLevels (Fraig_Man_t *pMan, int fMaximum)
 
Fraig_NodeVec_tFraig_CollectSupergate (Fraig_Node_t *pNode, int fStopAtMux)
 

Macro Definition Documentation

#define Fraig_Deref (   p)

Definition at line 114 of file fraig.h.

#define Fraig_IsComplement (   p)    (((int)((ABC_PTRUINT_T) (p) & 01)))

GLOBAL VARIABLES ///.

MACRO DEFINITIONS ///

Definition at line 107 of file fraig.h.

#define Fraig_Not (   p)    ((Fraig_Node_t *)((ABC_PTRUINT_T)(p) ^ 01))

Definition at line 109 of file fraig.h.

#define Fraig_NotCond (   p,
 
)    ((Fraig_Node_t *)((ABC_PTRUINT_T)(p) ^ (c)))

Definition at line 110 of file fraig.h.

#define Fraig_RecursiveDeref (   p,
 
)

Definition at line 115 of file fraig.h.

#define Fraig_Ref (   p)

Definition at line 113 of file fraig.h.

#define Fraig_Regular (   p)    ((Fraig_Node_t *)((ABC_PTRUINT_T)(p) & ~01))

Definition at line 108 of file fraig.h.

Typedef Documentation

Definition at line 43 of file fraig.h.

typedef typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t

INCLUDES ///.

CFile****************************************************************

FileName [fraig.h]

PackageName [FRAIG: Functionally reduced AND-INV graphs.]

Synopsis [External declarations of the FRAIG package.]

Author [Alan Mishchenko alanm.nosp@m.i@ee.nosp@m.cs.be.nosp@m.rkel.nosp@m.ey.ed.nosp@m.u]

Affiliation [UC Berkeley]

Date [Ver. 2.0. Started - October 1, 2004]

Revision [

Id:
fraig.h,v 1.18 2005/07/08 01:01:30 alanmi Exp

]PARAMETERS ///STRUCTURE DEFINITIONS ///

Definition at line 40 of file fraig.h.

Definition at line 41 of file fraig.h.

Definition at line 42 of file fraig.h.

Definition at line 44 of file fraig.h.

typedef struct Fraig_PatternsStruct_t_ Fraig_Patterns_t

Definition at line 45 of file fraig.h.

Definition at line 46 of file fraig.h.

Function Documentation

int Fraig_CheckTfi ( Fraig_Man_t pMan,
Fraig_Node_t pOld,
Fraig_Node_t pNew 
)

Function*************************************************************

Synopsis [Returns 1 if pOld is in the TFI of pNew.]

Description []

SideEffects []

SeeAlso []

Definition at line 173 of file fraigUtil.c.

174 {
175  assert( !Fraig_IsComplement(pOld) );
176  assert( !Fraig_IsComplement(pNew) );
177  pMan->nTravIds++;
178  return Fraig_CheckTfi_rec( pMan, pNew, pOld );
179 }
static int Fraig_CheckTfi_rec(Fraig_Man_t *pMan, Fraig_Node_t *pNode, Fraig_Node_t *pOld)
Definition: fraigUtil.c:192
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fraig.h:107
#define assert(ex)
Definition: util_old.h:213
Fraig_NodeVec_t* Fraig_CollectSupergate ( Fraig_Node_t pNode,
int  fStopAtMux 
)

Function*************************************************************

Synopsis [Returns the array of nodes to be combined into one multi-input AND-gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 960 of file fraigUtil.c.

961 {
962  Fraig_NodeVec_t * vSuper;
963  vSuper = Fraig_NodeVecAlloc( 8 );
964  Fraig_CollectSupergate_rec( pNode, vSuper, 1, fStopAtMux );
965  return vSuper;
966 }
void Fraig_CollectSupergate_rec(Fraig_Node_t *pNode, Fraig_NodeVec_t *vSuper, int fFirst, int fStopAtMux)
Definition: fraigUtil.c:933
Fraig_NodeVec_t * Fraig_NodeVecAlloc(int nCap)
DECLARATIONS ///.
Definition: fraigVec.c:43
int Fraig_CountLevels ( Fraig_Man_t pMan)
int Fraig_CountNodes ( Fraig_Man_t pMan,
int  fEquiv 
)

Function*************************************************************

Synopsis [Computes the DFS ordering of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 152 of file fraigUtil.c.

153 {
154  Fraig_NodeVec_t * vNodes;
155  int RetValue;
156  vNodes = Fraig_Dfs( pMan, fEquiv );
157  RetValue = vNodes->nSize;
158  Fraig_NodeVecFree( vNodes );
159  return RetValue;
160 }
void Fraig_NodeVecFree(Fraig_NodeVec_t *p)
Definition: fraigVec.c:66
Fraig_NodeVec_t * Fraig_Dfs(Fraig_Man_t *pMan, int fEquiv)
FUNCTION DEFINITIONS ///.
Definition: fraigUtil.c:58
Fraig_NodeVec_t* Fraig_Dfs ( Fraig_Man_t pMan,
int  fEquiv 
)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Computes the DFS ordering of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 58 of file fraigUtil.c.

59 {
60  Fraig_NodeVec_t * vNodes;
61  int i;
62  pMan->nTravIds++;
63  vNodes = Fraig_NodeVecAlloc( 100 );
64  for ( i = 0; i < pMan->vOutputs->nSize; i++ )
65  Fraig_Dfs_rec( pMan, Fraig_Regular(pMan->vOutputs->pArray[i]), vNodes, fEquiv );
66  return vNodes;
67 }
Fraig_NodeVec_t * Fraig_NodeVecAlloc(int nCap)
DECLARATIONS ///.
Definition: fraigVec.c:43
#define Fraig_Regular(p)
Definition: fraig.h:108
static void Fraig_Dfs_rec(Fraig_Man_t *pMan, Fraig_Node_t *pNode, Fraig_NodeVec_t *vNodes, int fEquiv)
Definition: fraigUtil.c:122
Fraig_NodeVec_t* Fraig_DfsNodes ( Fraig_Man_t pMan,
Fraig_Node_t **  ppNodes,
int  nNodes,
int  fEquiv 
)

Function*************************************************************

Synopsis [Computes the DFS ordering of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 100 of file fraigUtil.c.

101 {
102  Fraig_NodeVec_t * vNodes;
103  int i;
104  pMan->nTravIds++;
105  vNodes = Fraig_NodeVecAlloc( 100 );
106  for ( i = 0; i < nNodes; i++ )
107  Fraig_Dfs_rec( pMan, Fraig_Regular(ppNodes[i]), vNodes, fEquiv );
108  return vNodes;
109 }
Fraig_NodeVec_t * Fraig_NodeVecAlloc(int nCap)
DECLARATIONS ///.
Definition: fraigVec.c:43
#define Fraig_Regular(p)
Definition: fraig.h:108
static void Fraig_Dfs_rec(Fraig_Man_t *pMan, Fraig_Node_t *pNode, Fraig_NodeVec_t *vNodes, int fEquiv)
Definition: fraigUtil.c:122
Fraig_NodeVec_t* Fraig_DfsOne ( Fraig_Man_t pMan,
Fraig_Node_t pNode,
int  fEquiv 
)

Function*************************************************************

Synopsis [Computes the DFS ordering of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file fraigUtil.c.

81 {
82  Fraig_NodeVec_t * vNodes;
83  pMan->nTravIds++;
84  vNodes = Fraig_NodeVecAlloc( 100 );
85  Fraig_Dfs_rec( pMan, Fraig_Regular(pNode), vNodes, fEquiv );
86  return vNodes;
87 }
Fraig_NodeVec_t * Fraig_NodeVecAlloc(int nCap)
DECLARATIONS ///.
Definition: fraigVec.c:43
#define Fraig_Regular(p)
Definition: fraig.h:108
static void Fraig_Dfs_rec(Fraig_Man_t *pMan, Fraig_Node_t *pNode, Fraig_NodeVec_t *vNodes, int fEquiv)
Definition: fraigUtil.c:122
Fraig_NodeVec_t* Fraig_DfsReverse ( Fraig_Man_t pMan)
int Fraig_GetMaxLevel ( Fraig_Man_t pMan)

Function*************************************************************

Synopsis [Sets up the mask.]

Description []

SideEffects []

SeeAlso []

Definition at line 428 of file fraigUtil.c.

429 {
430  int nLevelMax, i;
431  nLevelMax = 0;
432  for ( i = 0; i < pMan->vOutputs->nSize; i++ )
433  nLevelMax = nLevelMax > Fraig_Regular(pMan->vOutputs->pArray[i])->Level?
434  nLevelMax : Fraig_Regular(pMan->vOutputs->pArray[i])->Level;
435  return nLevelMax;
436 }
#define Fraig_Regular(p)
Definition: fraig.h:108
void Fraig_ManAddClause ( Fraig_Man_t p,
Fraig_Node_t **  ppNodes,
int  nNodes 
)

Function*************************************************************

Synopsis [Adds clauses to the solver.]

Description [This procedure is used to add external clauses to the solver. The clauses are given by sets of nodes. Each node stands for one literal. If the node is complemented, the literal is negated.]

SideEffects []

SeeAlso []

Definition at line 521 of file fraigMan.c.

522 {
523  Fraig_Node_t * pNode;
524  int i, fComp, RetValue;
525  if ( p->pSat == NULL )
527  // create four clauses
528  Msat_IntVecClear( p->vProj );
529  for ( i = 0; i < nNodes; i++ )
530  {
531  pNode = Fraig_Regular(ppNodes[i]);
532  fComp = Fraig_IsComplement(ppNodes[i]);
533  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode->Num, fComp) );
534 // printf( "%d(%d) ", pNode->Num, fComp );
535  }
536 // printf( "\n" );
537  RetValue = Msat_SolverAddClause( p->pSat, p->vProj );
538  assert( RetValue );
539 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Msat_SolverAddClause(Msat_Solver_t *p, Msat_IntVec_t *pLits)
void Msat_IntVecClear(Msat_IntVec_t *p)
Definition: msatVec.c:335
void Fraig_ManCreateSolver(Fraig_Man_t *p)
Definition: fraigMan.c:325
void Msat_IntVecPush(Msat_IntVec_t *p, int Entry)
Definition: msatVec.c:351
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fraig.h:107
#define Fraig_Regular(p)
Definition: fraig.h:108
#define MSAT_VAR2LIT(v, s)
Definition: msat.h:56
#define assert(ex)
Definition: util_old.h:213
int Fraig_ManCheckClauseUsingSat ( Fraig_Man_t p,
Fraig_Node_t pNode1,
Fraig_Node_t pNode2,
int  nBTLimit 
)

Function*************************************************************

Synopsis [Prepares the SAT solver to run on the two nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 653 of file fraigSat.c.

654 {
655  Fraig_Node_t * pNode1R, * pNode2R;
656  int RetValue, RetValue1, i;
657  abctime clk;
658  int fVerbose = 0;
659 
660  pNode1R = Fraig_Regular(pNode1);
661  pNode2R = Fraig_Regular(pNode2);
662  assert( pNode1R != pNode2R );
663 
664  // make sure the solver is allocated and has enough variables
665  if ( p->pSat == NULL )
667  // make sure the SAT solver has enough variables
668  for ( i = Msat_SolverReadVarNum(p->pSat); i < p->vNodes->nSize; i++ )
669  Msat_SolverAddVar( p->pSat, p->vNodes->pArray[i]->Level );
670 
671  // get the logic cone
672 clk = Abc_Clock();
673  Fraig_OrderVariables( p, pNode1R, pNode2R );
674 // Fraig_PrepareCones( p, pNode1R, pNode2R );
675 p->timeTrav += Abc_Clock() - clk;
676 
677  ////////////////////////////////////////////
678  // prepare the solver to run incrementally on these variables
679 //clk = Abc_Clock();
680  Msat_SolverPrepare( p->pSat, p->vVarsInt );
681 //p->time3 += Abc_Clock() - clk;
682 
683  // solve under assumptions
684  // A = 1; B = 0 OR A = 1; B = 1
685  Msat_IntVecClear( p->vProj );
686  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode1R->Num, !Fraig_IsComplement(pNode1)) );
687  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode2R->Num, !Fraig_IsComplement(pNode2)) );
688  // run the solver
689 clk = Abc_Clock();
690  RetValue1 = Msat_SolverSolve( p->pSat, p->vProj, nBTLimit, 1000000 );
691 p->timeSat += Abc_Clock() - clk;
692 
693  if ( RetValue1 == MSAT_FALSE )
694  {
695 //p->time1 += Abc_Clock() - clk;
696 
697 if ( fVerbose )
698 {
699 // printf( "unsat %d ", Msat_SolverReadBackTracks(p->pSat) );
700 //ABC_PRT( "time", Abc_Clock() - clk );
701 }
702 
703  // add the clause
704  Msat_IntVecClear( p->vProj );
705  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode1R->Num, Fraig_IsComplement(pNode1)) );
706  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode2R->Num, Fraig_IsComplement(pNode2)) );
707  RetValue = Msat_SolverAddClause( p->pSat, p->vProj );
708  assert( RetValue );
709 // p->nSatProofImp++;
710  return 1;
711  }
712  else if ( RetValue1 == MSAT_TRUE )
713  {
714 //p->time2 += Abc_Clock() - clk;
715 
716 if ( fVerbose )
717 {
718 // printf( "sat %d ", Msat_SolverReadBackTracks(p->pSat) );
719 //ABC_PRT( "time", Abc_Clock() - clk );
720 }
721  // record the counter example
722 // Fraig_FeedBack( p, Msat_SolverReadModelArray(p->pSat), p->vVarsInt, pNode1R, pNode2R );
723  p->nSatCounterImp++;
724  return 0;
725  }
726  else // if ( RetValue1 == MSAT_UNKNOWN )
727  {
728 p->time3 += Abc_Clock() - clk;
729  p->nSatFailsImp++;
730  return 0;
731  }
732 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Msat_SolverAddClause(Msat_Solver_t *p, Msat_IntVec_t *pLits)
void Msat_IntVecClear(Msat_IntVec_t *p)
Definition: msatVec.c:335
Definition: msat.h:50
static abctime Abc_Clock()
Definition: abc_global.h:279
int Msat_SolverAddVar(Msat_Solver_t *p, int Level)
DECLARATIONS ///.
void Msat_IntVecPush(Msat_IntVec_t *p, int Entry)
Definition: msatVec.c:351
void Msat_SolverPrepare(Msat_Solver_t *pSat, Msat_IntVec_t *vVars)
void Fraig_ManCreateSolver(Fraig_Man_t *p)
Definition: fraigMan.c:325
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fraig.h:107
#define Fraig_Regular(p)
Definition: fraig.h:108
int Msat_SolverReadVarNum(Msat_Solver_t *p)
FUNCTION DEFINITIONS ///.
Definition: msatSolverApi.c:47
#define MSAT_VAR2LIT(v, s)
Definition: msat.h:56
#define assert(ex)
Definition: util_old.h:213
static ABC_NAMESPACE_IMPL_START void Fraig_OrderVariables(Fraig_Man_t *pMan, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
DECLARATIONS ///.
Definition: fraigSat.c:875
ABC_INT64_T abctime
Definition: abc_global.h:278
int Msat_SolverSolve(Msat_Solver_t *p, Msat_IntVec_t *pVecAssumps, int nBackTrackLimit, int nTimeLimit)
int Fraig_ManCheckClauseUsingSimInfo ( Fraig_Man_t p,
Fraig_Node_t pNode1,
Fraig_Node_t pNode2 
)

Function*************************************************************

Synopsis [Returns 1 if A v B is always true based on the siminfo.]

Description [A v B is always true iff A' * B' is always false.]

SideEffects []

SeeAlso []

Definition at line 454 of file fraigMan.c.

455 {
456  int fCompl1, fCompl2, i;
457 
458  fCompl1 = 1 ^ Fraig_IsComplement(pNode1) ^ Fraig_Regular(pNode1)->fInv;
459  fCompl2 = 1 ^ Fraig_IsComplement(pNode2) ^ Fraig_Regular(pNode2)->fInv;
460 
461  pNode1 = Fraig_Regular(pNode1);
462  pNode2 = Fraig_Regular(pNode2);
463  assert( pNode1 != pNode2 );
464 
465  // check the simulation info
466  if ( fCompl1 && fCompl2 )
467  {
468  for ( i = 0; i < p->nWordsRand; i++ )
469  if ( ~pNode1->puSimR[i] & ~pNode2->puSimR[i] )
470  return 0;
471  for ( i = 0; i < p->iWordStart; i++ )
472  if ( ~pNode1->puSimD[i] & ~pNode2->puSimD[i] )
473  return 0;
474  return 1;
475  }
476  if ( !fCompl1 && fCompl2 )
477  {
478  for ( i = 0; i < p->nWordsRand; i++ )
479  if ( pNode1->puSimR[i] & ~pNode2->puSimR[i] )
480  return 0;
481  for ( i = 0; i < p->iWordStart; i++ )
482  if ( pNode1->puSimD[i] & ~pNode2->puSimD[i] )
483  return 0;
484  return 1;
485  }
486  if ( fCompl1 && !fCompl2 )
487  {
488  for ( i = 0; i < p->nWordsRand; i++ )
489  if ( ~pNode1->puSimR[i] & pNode2->puSimR[i] )
490  return 0;
491  for ( i = 0; i < p->iWordStart; i++ )
492  if ( ~pNode1->puSimD[i] & pNode2->puSimD[i] )
493  return 0;
494  return 1;
495  }
496 // if ( fCompl1 && fCompl2 )
497  {
498  for ( i = 0; i < p->nWordsRand; i++ )
499  if ( pNode1->puSimR[i] & pNode2->puSimR[i] )
500  return 0;
501  for ( i = 0; i < p->iWordStart; i++ )
502  if ( pNode1->puSimD[i] & pNode2->puSimD[i] )
503  return 0;
504  return 1;
505  }
506 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned * puSimD
Definition: fraigInt.h:248
unsigned * puSimR
Definition: fraigInt.h:247
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fraig.h:107
#define Fraig_Regular(p)
Definition: fraig.h:108
#define assert(ex)
Definition: util_old.h:213
int Fraig_ManCheckConsistency ( Fraig_Man_t p)

Function*************************************************************

Synopsis [Verify one useful property.]

Description [This procedure verifies one useful property. After the FRAIG construction with choice nodes is over, each primary node should have fanins that are primary nodes. The primary nodes is the one that does not have pNode->pRepr set to point to another node.]

SideEffects []

SeeAlso []

Definition at line 312 of file fraigUtil.c.

313 {
314  Fraig_Node_t * pNode;
315  Fraig_NodeVec_t * pVec;
316  int i;
317  pVec = Fraig_Dfs( p, 0 );
318  for ( i = 0; i < pVec->nSize; i++ )
319  {
320  pNode = pVec->pArray[i];
321  if ( Fraig_NodeIsVar(pNode) )
322  {
323  if ( pNode->pRepr )
324  printf( "Primary input %d is a secondary node.\n", pNode->Num );
325  }
326  else if ( Fraig_NodeIsConst(pNode) )
327  {
328  if ( pNode->pRepr )
329  printf( "Constant 1 %d is a secondary node.\n", pNode->Num );
330  }
331  else
332  {
333  if ( pNode->pRepr )
334  printf( "Internal node %d is a secondary node.\n", pNode->Num );
335  if ( Fraig_Regular(pNode->p1)->pRepr )
336  printf( "Internal node %d has first fanin %d that is a secondary node.\n",
337  pNode->Num, Fraig_Regular(pNode->p1)->Num );
338  if ( Fraig_Regular(pNode->p2)->pRepr )
339  printf( "Internal node %d has second fanin %d that is a secondary node.\n",
340  pNode->Num, Fraig_Regular(pNode->p2)->Num );
341  }
342  }
343  Fraig_NodeVecFree( pVec );
344  return 1;
345 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_Node_t * p2
Definition: fraigInt.h:233
void Fraig_NodeVecFree(Fraig_NodeVec_t *p)
Definition: fraigVec.c:66
Fraig_Node_t * p1
Definition: fraigInt.h:232
Fraig_NodeVec_t * Fraig_Dfs(Fraig_Man_t *pMan, int fEquiv)
FUNCTION DEFINITIONS ///.
Definition: fraigUtil.c:58
Fraig_Node_t * pRepr
Definition: fraigInt.h:242
int Fraig_NodeIsConst(Fraig_Node_t *p)
Definition: fraigApi.c:151
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
#define Fraig_Regular(p)
Definition: fraig.h:108
int Fraig_NodeIsVar(Fraig_Node_t *p)
Definition: fraigApi.c:152
int Fraig_ManCheckMiter ( Fraig_Man_t p)

Function*************************************************************

Synopsis [Returns 1 if the miter is unsat; 0 if sat; -1 if undecided.]

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file fraigSat.c.

131 {
132  Fraig_Node_t * pNode;
133  int i;
134  ABC_FREE( p->pModel );
135  for ( i = 0; i < p->vOutputs->nSize; i++ )
136  {
137  // get the output node (it can be complemented!)
138  pNode = p->vOutputs->pArray[i];
139  // if the miter is constant 0, the problem is UNSAT
140  if ( pNode == Fraig_Not(p->pConst1) )
141  continue;
142  // consider the special case when the miter is constant 1
143  if ( pNode == p->pConst1 )
144  {
145  // in this case, any counter example will do to distinquish it from constant 0
146  // here we pick the counter example composed of all zeros
147  p->pModel = Fraig_ManAllocCounterExample( p );
148  return 0;
149  }
150  // save the counter example
151  p->pModel = Fraig_ManSaveCounterExample( p, pNode );
152  // if the model is not found, return undecided
153  if ( p->pModel == NULL )
154  return -1;
155  else
156  return 0;
157  }
158  return 1;
159 }
int * Fraig_ManAllocCounterExample(Fraig_Man_t *p)
Definition: fraigFeed.c:787
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Fraig_Not(p)
Definition: fraig.h:109
int * Fraig_ManSaveCounterExample(Fraig_Man_t *p, Fraig_Node_t *pNode)
Definition: fraigFeed.c:860
#define ABC_FREE(obj)
Definition: abc_global.h:232
Fraig_Man_t* Fraig_ManCreate ( Fraig_Params_t pParams)

Function*************************************************************

Synopsis [Creates the new FRAIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 184 of file fraigMan.c.

185 {
186  Fraig_Params_t Params;
187  Fraig_Man_t * p;
188 
189  // set the random seed for simulation
190 // srand( 0xFEEDDEAF );
191 // srand( 0xDEADCAFE );
192  Aig_ManRandom( 1 );
193 
194  // set parameters for equivalence checking
195  if ( pParams == NULL )
196  Fraig_ParamsSetDefault( pParams = &Params );
197  // adjust the amount of simulation info
198  if ( pParams->nPatsRand < 128 )
199  pParams->nPatsRand = 128;
200  if ( pParams->nPatsRand > 32768 )
201  pParams->nPatsRand = 32768;
202  if ( pParams->nPatsDyna < 128 )
203  pParams->nPatsDyna = 128;
204  if ( pParams->nPatsDyna > 32768 )
205  pParams->nPatsDyna = 32768;
206  // if reduction is not performed, allocate minimum simulation info
207  if ( !pParams->fFuncRed )
208  pParams->nPatsRand = pParams->nPatsDyna = 128;
209 
210  // start the manager
211  p = ABC_ALLOC( Fraig_Man_t, 1 );
212  memset( p, 0, sizeof(Fraig_Man_t) );
213 
214  // set the default parameters
215  p->nWordsRand = FRAIG_NUM_WORDS( pParams->nPatsRand ); // the number of words of random simulation info
216  p->nWordsDyna = FRAIG_NUM_WORDS( pParams->nPatsDyna ); // the number of patterns for dynamic simulation info
217  p->nBTLimit = pParams->nBTLimit; // -1 means infinite backtrack limit
218  p->nSeconds = pParams->nSeconds; // the timeout for the final miter
219  p->fFuncRed = pParams->fFuncRed; // enables functional reduction (otherwise, only one-level hashing is performed)
220  p->fFeedBack = pParams->fFeedBack; // enables solver feedback (the use of counter-examples in simulation)
221  p->fDist1Pats = pParams->fDist1Pats; // enables solver feedback (the use of counter-examples in simulation)
222  p->fDoSparse = pParams->fDoSparse; // performs equivalence checking for sparse functions (whose sim-info is 0)
223  p->fChoicing = pParams->fChoicing; // disable accumulation of structural choices (keeps only the first choice)
224  p->fTryProve = pParams->fTryProve; // disable accumulation of structural choices (keeps only the first choice)
225  p->fVerbose = pParams->fVerbose; // disable verbose output
226  p->fVerboseP = pParams->fVerboseP; // disable verbose output
227  p->nInspLimit = pParams->nInspLimit; // the limit on the number of inspections
228 
229  // start memory managers
230  p->mmNodes = Fraig_MemFixedStart( sizeof(Fraig_Node_t) );
231  p->mmSims = Fraig_MemFixedStart( sizeof(unsigned) * (p->nWordsRand + p->nWordsDyna) );
232  // allocate node arrays
233  p->vInputs = Fraig_NodeVecAlloc( 1000 ); // the array of primary inputs
234  p->vOutputs = Fraig_NodeVecAlloc( 1000 ); // the array of primary outputs
235  p->vNodes = Fraig_NodeVecAlloc( 1000 ); // the array of internal nodes
236  // start the tables
237  p->pTableS = Fraig_HashTableCreate( 1000 ); // hashing by structure
238  p->pTableF = Fraig_HashTableCreate( 1000 ); // hashing by function
239  p->pTableF0 = Fraig_HashTableCreate( 1000 ); // hashing by function (for sparse functions)
240  // create the constant node
241  p->pConst1 = Fraig_NodeCreateConst( p );
242  // initialize SAT solver feedback data structures
243  Fraig_FeedBackInit( p );
244  // initialize other variables
245  p->vProj = Msat_IntVecAlloc( 10 );
246  p->nTravIds = 1;
247  p->nTravIds2 = 1;
248  return p;
249 }
char * memset()
Fraig_Node_t * Fraig_NodeCreateConst(Fraig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: fraigNode.c:46
typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t
INCLUDES ///.
Definition: fraig.h:40
static Llb_Mgr_t * p
Definition: llb3Image.c:950
ABC_INT64_T nInspLimit
Definition: fraig.h:64
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned Aig_ManRandom(int fReset)
Definition: aigUtil.c:1157
void Fraig_FeedBackInit(Fraig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: fraigFeed.c:57
Fraig_NodeVec_t * Fraig_NodeVecAlloc(int nCap)
DECLARATIONS ///.
Definition: fraigVec.c:43
#define FRAIG_NUM_WORDS(n)
Definition: fraigInt.h:72
Msat_IntVec_t * Msat_IntVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: msatVec.c:48
Fraig_HashTable_t * Fraig_HashTableCreate(int nSize)
FUNCTION DEFINITIONS ///.
Definition: fraigTable.c:46
Fraig_MemFixed_t * Fraig_MemFixedStart(int nEntrySize)
FUNCTION DEFINITIONS ///.
Definition: fraigMem.c:63
void Fraig_ParamsSetDefault(Fraig_Params_t *pParams)
Definition: fraigMan.c:122
void Fraig_ManFree ( Fraig_Man_t p)

Function*************************************************************

Synopsis [Deallocates the mapping manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 262 of file fraigMan.c.

263 {
264  int i;
265  if ( p->fVerbose )
266  {
267  if ( p->fChoicing ) Fraig_ManReportChoices( p );
269 // Fraig_TablePrintStatsS( p );
270 // Fraig_TablePrintStatsF( p );
271 // Fraig_TablePrintStatsF0( p );
272  }
273 
274  for ( i = 0; i < p->vNodes->nSize; i++ )
275  if ( p->vNodes->pArray[i]->vFanins )
276  {
277  Fraig_NodeVecFree( p->vNodes->pArray[i]->vFanins );
278  p->vNodes->pArray[i]->vFanins = NULL;
279  }
280 
281  if ( p->vInputs ) Fraig_NodeVecFree( p->vInputs );
282  if ( p->vNodes ) Fraig_NodeVecFree( p->vNodes );
283  if ( p->vOutputs ) Fraig_NodeVecFree( p->vOutputs );
284 
285  if ( p->pTableS ) Fraig_HashTableFree( p->pTableS );
286  if ( p->pTableF ) Fraig_HashTableFree( p->pTableF );
287  if ( p->pTableF0 ) Fraig_HashTableFree( p->pTableF0 );
288 
289  if ( p->pSat ) Msat_SolverFree( p->pSat );
290  if ( p->vProj ) Msat_IntVecFree( p->vProj );
291  if ( p->vCones ) Fraig_NodeVecFree( p->vCones );
292  if ( p->vPatsReal ) Msat_IntVecFree( p->vPatsReal );
293  if ( p->pModel ) ABC_FREE( p->pModel );
294 
295  Fraig_MemFixedStop( p->mmNodes, 0 );
296  Fraig_MemFixedStop( p->mmSims, 0 );
297 
298  if ( p->pSuppS )
299  {
300  ABC_FREE( p->pSuppS[0] );
301  ABC_FREE( p->pSuppS );
302  }
303  if ( p->pSuppF )
304  {
305  ABC_FREE( p->pSuppF[0] );
306  ABC_FREE( p->pSuppF );
307  }
308 
309  ABC_FREE( p->ppOutputNames );
310  ABC_FREE( p->ppInputNames );
311  ABC_FREE( p );
312 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Msat_SolverFree(Msat_Solver_t *p)
void Fraig_HashTableFree(Fraig_HashTable_t *p)
Definition: fraigTable.c:70
void Fraig_NodeVecFree(Fraig_NodeVec_t *p)
Definition: fraigVec.c:66
void Fraig_ManPrintStats(Fraig_Man_t *p)
Definition: fraigMan.c:351
void Msat_IntVecFree(Msat_IntVec_t *p)
Definition: msatVec.c:160
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Fraig_ManReportChoices(Fraig_Man_t *pMan)
Definition: fraigUtil.c:520
void Fraig_MemFixedStop(Fraig_MemFixed_t *p, int fVerbose)
Definition: fraigMem.c:102
Fraig_NodeVec_t* Fraig_ManGetSimInfo ( Fraig_Man_t p)

Function*************************************************************

Synopsis [Returns simulation info of all nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 417 of file fraigMan.c.

418 {
419  Fraig_NodeVec_t * vInfo;
420  Fraig_Node_t * pNode;
421  unsigned * pUnsigned;
422  int nRandom, nDynamic;
423  int i, k, nWords;
424 
425  nRandom = Fraig_ManReadPatternNumRandom( p );
426  nDynamic = Fraig_ManReadPatternNumDynamic( p );
427  nWords = nRandom / 32 + nDynamic / 32;
428 
429  vInfo = Fraig_UtilInfoAlloc( p->vNodes->nSize, nWords, 0 );
430  for ( i = 0; i < p->vNodes->nSize; i++ )
431  {
432  pNode = p->vNodes->pArray[i];
433  assert( i == pNode->Num );
434  pUnsigned = (unsigned *)vInfo->pArray[i];
435  for ( k = 0; k < nRandom / 32; k++ )
436  pUnsigned[k] = pNode->puSimR[k];
437  for ( k = 0; k < nDynamic / 32; k++ )
438  pUnsigned[nRandom / 32 + k] = pNode->puSimD[k];
439  }
440  return vInfo;
441 }
int Fraig_ManReadPatternNumRandom(Fraig_Man_t *p)
Definition: fraigApi.c:65
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned * puSimD
Definition: fraigInt.h:248
Fraig_NodeVec_t * Fraig_UtilInfoAlloc(int nSize, int nWords, int fClean)
Definition: fraigMan.c:389
int nWords
Definition: abcNpn.c:127
for(p=first;p->value< newval;p=p->next)
unsigned * puSimR
Definition: fraigInt.h:247
int Fraig_ManReadPatternNumDynamic(Fraig_Man_t *p)
Definition: fraigApi.c:67
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
#define assert(ex)
Definition: util_old.h:213
void Fraig_ManMarkRealFanouts ( Fraig_Man_t p)

Function*************************************************************

Synopsis [Sets the number of fanouts (none, one, or many).]

Description [This procedure collects the nodes reachable from the POs of the AIG and sets the type of fanout counter (none, one, or many) for each node. This procedure is useful to determine fanout-free cones of AND-nodes, which is helpful for rebalancing the AIG (see procedure Fraig_ManRebalance, or something like that).]

SideEffects []

SeeAlso []

Definition at line 251 of file fraigUtil.c.

252 {
253  Fraig_NodeVec_t * vNodes;
254  Fraig_Node_t * pNodeR;
255  int i;
256  // collect the nodes reachable
257  vNodes = Fraig_Dfs( p, 0 );
258  // clean the fanouts field
259  for ( i = 0; i < vNodes->nSize; i++ )
260  {
261  vNodes->pArray[i]->nFanouts = 0;
262  vNodes->pArray[i]->pData0 = NULL;
263  }
264  // mark reachable nodes by setting the two-bit counter pNode->nFans
265  for ( i = 0; i < vNodes->nSize; i++ )
266  {
267  pNodeR = Fraig_Regular(vNodes->pArray[i]->p1);
268  if ( pNodeR && ++pNodeR->nFanouts == 3 )
269  pNodeR->nFanouts = 2;
270  pNodeR = Fraig_Regular(vNodes->pArray[i]->p2);
271  if ( pNodeR && ++pNodeR->nFanouts == 3 )
272  pNodeR->nFanouts = 2;
273  }
274  Fraig_NodeVecFree( vNodes );
275 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_Node_t * p2
Definition: fraigInt.h:233
void Fraig_NodeVecFree(Fraig_NodeVec_t *p)
Definition: fraigVec.c:66
Fraig_Node_t * p1
Definition: fraigInt.h:232
Fraig_NodeVec_t * Fraig_Dfs(Fraig_Man_t *pMan, int fEquiv)
FUNCTION DEFINITIONS ///.
Definition: fraigUtil.c:58
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
#define Fraig_Regular(p)
Definition: fraig.h:108
unsigned nFanouts
Definition: fraigInt.h:228
Fraig_Node_t * pData0
Definition: fraigInt.h:251
void Fraig_ManPrintStats ( Fraig_Man_t p)

Function*************************************************************

Synopsis [Deallocates the mapping manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 351 of file fraigMan.c.

352 {
353  double nMemory;
354  nMemory = ((double)(p->vInputs->nSize + p->vNodes->nSize) *
355  (sizeof(Fraig_Node_t) + sizeof(unsigned)*(p->nWordsRand + p->nWordsDyna) /*+ p->nSuppWords*sizeof(unsigned)*/))/(1<<20);
356  printf( "Words: Random = %d. Dynamic = %d. Used = %d. Memory = %0.2f MB.\n",
357  p->nWordsRand, p->nWordsDyna, p->iWordPerm, nMemory );
358  printf( "Proof = %d. Counter-example = %d. Fail = %d. FailReal = %d. Zero = %d.\n",
359  p->nSatProof, p->nSatCounter, p->nSatFails, p->nSatFailsReal, p->nSatZeros );
360  printf( "Nodes: Final = %d. Total = %d. Mux = %d. (Exor = %d.) ClaVars = %d.\n",
361  Fraig_CountNodes(p,0), p->vNodes->nSize, Fraig_ManCountMuxes(p), Fraig_ManCountExors(p), p->nVarsClauses );
362  if ( p->pSat ) Msat_SolverPrintStats( p->pSat );
363  Fraig_PrintTime( "AIG simulation ", p->timeSims );
364  Fraig_PrintTime( "AIG traversal ", p->timeTrav );
365  Fraig_PrintTime( "Solver feedback ", p->timeFeed );
366  Fraig_PrintTime( "SAT solving ", p->timeSat );
367  Fraig_PrintTime( "Network update ", p->timeToNet );
368  Fraig_PrintTime( "TOTAL RUNTIME ", p->timeTotal );
369  if ( p->time1 > 0 ) { Fraig_PrintTime( "time1", p->time1 ); }
370  if ( p->time2 > 0 ) { Fraig_PrintTime( "time2", p->time2 ); }
371  if ( p->time3 > 0 ) { Fraig_PrintTime( "time3", p->time3 ); }
372  if ( p->time4 > 0 ) { Fraig_PrintTime( "time4", p->time4 ); }
373 // ABC_PRT( "Selection ", timeSelect );
374 // ABC_PRT( "Assignment", timeAssign );
375  fflush( stdout );
376 }
int Fraig_CountNodes(Fraig_Man_t *pMan, int fEquiv)
Definition: fraigUtil.c:152
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Fraig_PrintTime(a, t)
Definition: fraigInt.h:90
int Fraig_ManCountMuxes(Fraig_Man_t *pMan)
Definition: fraigUtil.c:763
struct Fraig_NodeStruct_t_ Fraig_Node_t
Definition: fraig.h:41
int Fraig_ManCountExors(Fraig_Man_t *pMan)
Definition: fraigUtil.c:742
void Msat_SolverPrintStats(Msat_Solver_t *p)
void Fraig_ManProveMiter ( Fraig_Man_t p)

Function*************************************************************

Synopsis [Tries to prove the final miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 85 of file fraigSat.c.

86 {
87  Fraig_Node_t * pNode;
88  int i;
89  abctime clk;
90 
91  if ( !p->fTryProve )
92  return;
93 
94  clk = Abc_Clock();
95  // consider all outputs of the multi-output miter
96  for ( i = 0; i < p->vOutputs->nSize; i++ )
97  {
98  pNode = Fraig_Regular(p->vOutputs->pArray[i]);
99  // skip already constant nodes
100  if ( pNode == p->pConst1 )
101  continue;
102  // skip nodes that are different according to simulation
103  if ( !Fraig_CompareSimInfo( pNode, p->pConst1, p->nWordsRand, 1 ) )
104  continue;
105  if ( Fraig_NodeIsEquivalent( p, p->pConst1, pNode, -1, p->nSeconds ) )
106  {
107  if ( Fraig_IsComplement(p->vOutputs->pArray[i]) ^ Fraig_NodeComparePhase(p->pConst1, pNode) )
108  p->vOutputs->pArray[i] = Fraig_Not(p->pConst1);
109  else
110  p->vOutputs->pArray[i] = p->pConst1;
111  }
112  }
113  if ( p->fVerboseP )
114  {
115 // ABC_PRT( "Final miter proof time", Abc_Clock() - clk );
116  }
117 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_NodeComparePhase(Fraig_Node_t *p1, Fraig_Node_t *p2)
Definition: fraigApi.c:154
int Fraig_CompareSimInfo(Fraig_Node_t *pNode1, Fraig_Node_t *pNode2, int iWordLast, int fUseRand)
Definition: fraigTable.c:351
static abctime Abc_Clock()
Definition: abc_global.h:279
#define Fraig_Not(p)
Definition: fraig.h:109
int Fraig_NodeIsEquivalent(Fraig_Man_t *p, Fraig_Node_t *pOld, Fraig_Node_t *pNew, int nBTLimit, int nTimeLimit)
Definition: fraigSat.c:302
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fraig.h:107
#define Fraig_Regular(p)
Definition: fraig.h:108
ABC_INT64_T abctime
Definition: abc_global.h:278
int Fraig_ManReadChoicing ( Fraig_Man_t p)

Definition at line 61 of file fraigApi.c.

61 { return p->fChoicing; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadConflicts ( Fraig_Man_t p)

Definition at line 73 of file fraigApi.c.

73 { return p->pSat? Msat_SolverReadBackTracks(p->pSat) : 0; }
int Msat_SolverReadBackTracks(Msat_Solver_t *p)
Definition: msatSolverApi.c:58
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_Node_t* Fraig_ManReadConst1 ( Fraig_Man_t p)

Definition at line 52 of file fraigApi.c.

52 { return p->pConst1; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadDoSparse ( Fraig_Man_t p)

Definition at line 60 of file fraigApi.c.

60 { return p->fDoSparse; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadFeedBack ( Fraig_Man_t p)

Definition at line 59 of file fraigApi.c.

59 { return p->fFeedBack; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadFuncRed ( Fraig_Man_t p)

Definition at line 58 of file fraigApi.c.

58 { return p->fFuncRed; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char** Fraig_ManReadInputNames ( Fraig_Man_t p)

Definition at line 54 of file fraigApi.c.

54 { return p->ppInputNames; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadInputNum ( Fraig_Man_t p)

Definition at line 49 of file fraigApi.c.

49 { return p->vInputs->nSize; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_Node_t** Fraig_ManReadInputs ( Fraig_Man_t p)

Definition at line 46 of file fraigApi.c.

46 { return p->vInputs->pArray; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadInspects ( Fraig_Man_t p)

Definition at line 75 of file fraigApi.c.

75 { return p->pSat? Msat_SolverReadInspects(p->pSat) : 0; }
int Msat_SolverReadInspects(Msat_Solver_t *p)
Definition: msatSolverApi.c:59
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_Node_t* Fraig_ManReadIthNode ( Fraig_Man_t p,
int  i 
)

Definition at line 53 of file fraigApi.c.

53 { assert ( i < p->vNodes->nSize ); return p->vNodes->pArray[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
Fraig_Node_t* Fraig_ManReadIthVar ( Fraig_Man_t p,
int  i 
)

Function*************************************************************

Synopsis [Returns a new primary input node.]

Description [If the node with this number does not exist, create a new PI node with this number.]

SideEffects []

SeeAlso []

Definition at line 168 of file fraigApi.c.

169 {
170  int k;
171  if ( i < 0 )
172  {
173  printf( "Requesting a PI with a negative number\n" );
174  return NULL;
175  }
176  // create the PIs to fill in the interval
177  if ( i >= p->vInputs->nSize )
178  for ( k = p->vInputs->nSize; k <= i; k++ )
179  Fraig_NodeCreatePi( p );
180  return p->vInputs->pArray[i];
181 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_Node_t * Fraig_NodeCreatePi(Fraig_Man_t *p)
Definition: fraigNode.c:87
int* Fraig_ManReadModel ( Fraig_Man_t p)

Definition at line 63 of file fraigApi.c.

63 { return p->pModel; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadNodeNum ( Fraig_Man_t p)

Definition at line 51 of file fraigApi.c.

51 { return p->vNodes->nSize; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_Node_t** Fraig_ManReadNodes ( Fraig_Man_t p)

Definition at line 48 of file fraigApi.c.

48 { return p->vNodes->pArray; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char** Fraig_ManReadOutputNames ( Fraig_Man_t p)

Definition at line 55 of file fraigApi.c.

55 { return p->ppOutputNames; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadOutputNum ( Fraig_Man_t p)

Definition at line 50 of file fraigApi.c.

50 { return p->vOutputs->nSize; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_Node_t** Fraig_ManReadOutputs ( Fraig_Man_t p)

Definition at line 47 of file fraigApi.c.

47 { return p->vOutputs->pArray; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadPatternNumDynamic ( Fraig_Man_t p)

Definition at line 67 of file fraigApi.c.

67 { return p->iWordStart * 32; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadPatternNumDynamicFiltered ( Fraig_Man_t p)

Definition at line 69 of file fraigApi.c.

69 { return p->iPatsPerm; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadPatternNumRandom ( Fraig_Man_t p)

Definition at line 65 of file fraigApi.c.

65 { return p->nWordsRand * 32; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char* Fraig_ManReadSat ( Fraig_Man_t p)

Definition at line 57 of file fraigApi.c.

57 { return (char *)p->pSat; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadSatFails ( Fraig_Man_t p)

Definition at line 71 of file fraigApi.c.

71 { return p->nSatFailsReal; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char* Fraig_ManReadVarsInt ( Fraig_Man_t p)

Definition at line 56 of file fraigApi.c.

56 { return (char *)p->vVarsInt; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_NodeVec_t* Fraig_ManReadVecInputs ( Fraig_Man_t p)

FUNCTION DEFINITIONS ///.

FUNCTION DEFINITIONS ///.

CFile****************************************************************

FileName [fraigApi.c]

PackageName [FRAIG: Functionally reduced AND-INV graphs.]

Synopsis [Access APIs for the FRAIG manager and node.]

Author [Alan Mishchenko alanm.nosp@m.i@ee.nosp@m.cs.be.nosp@m.rkel.nosp@m.ey.ed.nosp@m.u]

Affiliation [UC Berkeley]

Date [Ver. 2.0. Started - October 1, 2004]

Revision [

Id:
fraigApi.c,v 1.2 2005/07/08 01:01:30 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Access functions to read the data members of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file fraigApi.c.

43 { return p->vInputs; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_NodeVec_t* Fraig_ManReadVecNodes ( Fraig_Man_t p)

Definition at line 45 of file fraigApi.c.

45 { return p->vNodes; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fraig_NodeVec_t* Fraig_ManReadVecOutputs ( Fraig_Man_t p)

Definition at line 44 of file fraigApi.c.

44 { return p->vOutputs; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Fraig_ManReadVerbose ( Fraig_Man_t p)

Definition at line 62 of file fraigApi.c.

62 { return p->fVerbose; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fraig_ManReportChoices ( Fraig_Man_t pMan)

Function*************************************************************

Synopsis [Reports statistics on choice nodes.]

Description [The number of choice nodes is the number of primary nodes, which has pNextE set to a pointer. The number of choices is the number of entries in the equivalent-node lists of the primary nodes.]

SideEffects []

SeeAlso []

Definition at line 520 of file fraigUtil.c.

521 {
522  Fraig_Node_t * pNode, * pTemp;
523  int nChoiceNodes, nChoices;
524  int i, LevelMax1, LevelMax2;
525 
526  // report the number of levels
527  LevelMax1 = Fraig_GetMaxLevel( pMan );
528  Fraig_MappingSetChoiceLevels( pMan, 0 );
529  LevelMax2 = Fraig_GetMaxLevel( pMan );
530 
531  // report statistics about choices
532  nChoiceNodes = nChoices = 0;
533  for ( i = 0; i < pMan->vNodes->nSize; i++ )
534  {
535  pNode = pMan->vNodes->pArray[i];
536  if ( pNode->pRepr == NULL && pNode->pNextE != NULL )
537  { // this is a choice node = the primary node that has equivalent nodes
538  nChoiceNodes++;
539  for ( pTemp = pNode; pTemp; pTemp = pTemp->pNextE )
540  nChoices++;
541  }
542  }
543  printf( "Maximum level: Original = %d. Reduced due to choices = %d.\n", LevelMax1, LevelMax2 );
544  printf( "Choice stats: Choice nodes = %d. Total choices = %d.\n", nChoiceNodes, nChoices );
545 }
int Fraig_GetMaxLevel(Fraig_Man_t *pMan)
Definition: fraigUtil.c:428
Fraig_Node_t * pNextE
Definition: fraigInt.h:241
Fraig_Node_t * pRepr
Definition: fraigInt.h:242
void Fraig_MappingSetChoiceLevels(Fraig_Man_t *pMan, int fMaximum)
Definition: fraigUtil.c:499
void Fraig_ManSetChoicing ( Fraig_Man_t p,
int  fChoicing 
)

Definition at line 91 of file fraigApi.c.

91 { p->fChoicing = fChoicing; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fraig_ManSetDoSparse ( Fraig_Man_t p,
int  fDoSparse 
)

Definition at line 90 of file fraigApi.c.

90 { p->fDoSparse = fDoSparse; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fraig_ManSetFeedBack ( Fraig_Man_t p,
int  fFeedBack 
)

Definition at line 89 of file fraigApi.c.

89 { p->fFeedBack = fFeedBack; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fraig_ManSetFuncRed ( Fraig_Man_t p,
int  fFuncRed 
)

Function*************************************************************

Synopsis [Access functions to set the data members of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 88 of file fraigApi.c.

88 { p->fFuncRed = fFuncRed; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fraig_ManSetInputNames ( Fraig_Man_t p,
char **  ppNames 
)

Definition at line 95 of file fraigApi.c.

95 { p->ppInputNames = ppNames; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fraig_ManSetOutputNames ( Fraig_Man_t p,
char **  ppNames 
)

Definition at line 94 of file fraigApi.c.

94 { p->ppOutputNames = ppNames; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fraig_ManSetPo ( Fraig_Man_t p,
Fraig_Node_t pNode 
)

Function*************************************************************

Synopsis [Creates a new PO node.]

Description [This procedure may take a complemented node.]

SideEffects []

SeeAlso []

Definition at line 194 of file fraigApi.c.

195 {
196  // internal node may be a PO two times
197  Fraig_Regular(pNode)->fNodePo = 1;
198  Fraig_NodeVecPush( p->vOutputs, pNode );
199 }
void Fraig_NodeVecPush(Fraig_NodeVec_t *p, Fraig_Node_t *Entry)
Definition: fraigVec.c:189
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Fraig_Regular(p)
Definition: fraig.h:108
void Fraig_ManSetTryProve ( Fraig_Man_t p,
int  fTryProve 
)

Definition at line 92 of file fraigApi.c.

92 { p->fTryProve = fTryProve; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fraig_ManSetVerbose ( Fraig_Man_t p,
int  fVerbose 
)

Definition at line 93 of file fraigApi.c.

93 { p->fVerbose = fVerbose; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fraig_MappingSetChoiceLevels ( Fraig_Man_t pMan,
int  fMaximum 
)

Function*************************************************************

Synopsis [Resets the levels of the nodes in the choice graph.]

Description [Makes the level of the choice nodes to be equal to the maximum of the level of the nodes in the equivalence class. This way sorting by level leads to the reverse topological order, which is needed for the required time computation.]

SideEffects []

SeeAlso []

Definition at line 499 of file fraigUtil.c.

500 {
501  int i;
502  pMan->nTravIds++;
503  for ( i = 0; i < pMan->vOutputs->nSize; i++ )
504  Fraig_MappingUpdateLevel_rec( pMan, Fraig_Regular(pMan->vOutputs->pArray[i]), fMaximum );
505 }
#define Fraig_Regular(p)
Definition: fraig.h:108
int Fraig_MappingUpdateLevel_rec(Fraig_Man_t *pMan, Fraig_Node_t *pNode, int fMaximum)
Definition: fraigUtil.c:449
Fraig_Node_t* Fraig_NodeAnd ( Fraig_Man_t p,
Fraig_Node_t p1,
Fraig_Node_t p2 
)

Function*************************************************************

Synopsis [Perfoms the AND operation with functional hashing.]

Description []

SideEffects []

SeeAlso []

Definition at line 212 of file fraigApi.c.

213 {
214  return Fraig_NodeAndCanon( p, p1, p2 );
215 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
ABC_NAMESPACE_IMPL_START Fraig_Node_t * Fraig_NodeAndCanon(Fraig_Man_t *pMan, Fraig_Node_t *p1, Fraig_Node_t *p2)
DECLARATIONS ///.
Definition: fraigCanon.c:52
int Fraig_NodeComparePhase ( Fraig_Node_t p1,
Fraig_Node_t p2 
)

Definition at line 154 of file fraigApi.c.

154 { assert( !Fraig_IsComplement(p1) ); assert( !Fraig_IsComplement(p2) ); return p1->fInv ^ p2->fInv; }
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fraig.h:107
#define assert(ex)
Definition: util_old.h:213
Fraig_Node_t* Fraig_NodeExor ( Fraig_Man_t p,
Fraig_Node_t p1,
Fraig_Node_t p2 
)

Function*************************************************************

Synopsis [Perfoms the EXOR operation with functional hashing.]

Description []

SideEffects []

SeeAlso []

Definition at line 244 of file fraigApi.c.

245 {
246  return Fraig_NodeMux( p, p1, Fraig_Not(p2), p2 );
247 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Fraig_Not(p)
Definition: fraig.h:109
Fraig_Node_t * Fraig_NodeMux(Fraig_Man_t *p, Fraig_Node_t *pC, Fraig_Node_t *pT, Fraig_Node_t *pE)
Definition: fraigApi.c:260
int Fraig_NodeIsAnd ( Fraig_Node_t p)

Definition at line 153 of file fraigApi.c.

153 { return (Fraig_Regular(p))->NumPi < 0 && (Fraig_Regular(p))->Num > 0; }
#define Fraig_Regular(p)
Definition: fraig.h:108
int Fraig_NodeIsConst ( Fraig_Node_t p)

Function*************************************************************

Synopsis [Checks the type of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 151 of file fraigApi.c.

151 { return (Fraig_Regular(p))->Num == 0; }
#define Fraig_Regular(p)
Definition: fraig.h:108
int Fraig_NodeIsEquivalent ( Fraig_Man_t p,
Fraig_Node_t pOld,
Fraig_Node_t pNew,
int  nBTLimit,
int  nTimeLimit 
)

Function*************************************************************

Synopsis [Checks whether two nodes are functinally equivalent.]

Description [The flag (fComp) tells whether the nodes to be checked are in the opposite polarity. The second flag (fSkipZeros) tells whether the checking should be performed if the simulation vectors are zeros. Returns 1 if the nodes are equivalent; 0 othewise.]

SideEffects []

SeeAlso []

Definition at line 302 of file fraigSat.c.

303 {
304  int RetValue, RetValue1, i, fComp;
305  abctime clk;
306  int fVerbose = 0;
307  int fSwitch = 0;
308 
309  // make sure the nodes are not complemented
310  assert( !Fraig_IsComplement(pNew) );
311  assert( !Fraig_IsComplement(pOld) );
312  assert( pNew != pOld );
313 
314  // if at least one of the nodes is a failed node, perform adjustments:
315  // if the backtrack limit is small, simply skip this node
316  // if the backtrack limit is > 10, take the quare root of the limit
317  if ( nBTLimit > 0 && (pOld->fFailTfo || pNew->fFailTfo) )
318  {
319  p->nSatFails++;
320 // return 0;
321 // if ( nBTLimit > 10 )
322 // nBTLimit /= 10;
323  if ( nBTLimit <= 10 )
324  return 0;
325  nBTLimit = (int)sqrt((double)nBTLimit);
326 // fSwitch = 1;
327  }
328 
329  p->nSatCalls++;
330 
331  // make sure the solver is allocated and has enough variables
332  if ( p->pSat == NULL )
334  // make sure the SAT solver has enough variables
335  for ( i = Msat_SolverReadVarNum(p->pSat); i < p->vNodes->nSize; i++ )
336  Msat_SolverAddVar( p->pSat, p->vNodes->pArray[i]->Level );
337 
338 
339 
340 /*
341  {
342  Fraig_Node_t * ppNodes[2] = { pOld, pNew };
343  extern void Fraig_MappingShowNodes( Fraig_Man_t * pMan, Fraig_Node_t ** ppRoots, int nRoots, char * pFileName );
344  Fraig_MappingShowNodes( p, ppNodes, 2, "temp_aig" );
345  }
346 */
347 
348  nMuxes = 0;
349 
350 
351  // get the logic cone
352 clk = Abc_Clock();
353 // Fraig_VarsStudy( p, pOld, pNew );
354  Fraig_OrderVariables( p, pOld, pNew );
355 // Fraig_PrepareCones( p, pOld, pNew );
356 p->timeTrav += Abc_Clock() - clk;
357 
358 // printf( "The number of MUXes detected = %d (%5.2f %% of logic). ", nMuxes, 300.0*nMuxes/(p->vNodes->nSize - p->vInputs->nSize) );
359 // ABC_PRT( "Time", Abc_Clock() - clk );
360 
361 if ( fVerbose )
362  printf( "%d(%d) - ", Fraig_CountPis(p,p->vVarsInt), Msat_IntVecReadSize(p->vVarsInt) );
363 
364 
365  // prepare variable activity
366  Fraig_SetActivity( p, pOld, pNew );
367 
368  // get the complemented attribute
369  fComp = Fraig_NodeComparePhase( pOld, pNew );
370 //Msat_SolverPrintClauses( p->pSat );
371 
372  ////////////////////////////////////////////
373  // prepare the solver to run incrementally on these variables
374 //clk = Abc_Clock();
375  Msat_SolverPrepare( p->pSat, p->vVarsInt );
376 //p->time3 += Abc_Clock() - clk;
377 
378 
379  // solve under assumptions
380  // A = 1; B = 0 OR A = 1; B = 1
381  Msat_IntVecClear( p->vProj );
382  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pOld->Num, 0) );
383  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNew->Num, !fComp) );
384 
385 //Msat_SolverWriteDimacs( p->pSat, "temp_fraig.cnf" );
386 
387  // run the solver
388 clk = Abc_Clock();
389  RetValue1 = Msat_SolverSolve( p->pSat, p->vProj, nBTLimit, nTimeLimit );
390 p->timeSat += Abc_Clock() - clk;
391 
392  if ( RetValue1 == MSAT_FALSE )
393  {
394 //p->time1 += Abc_Clock() - clk;
395 
396 if ( fVerbose )
397 {
398 // printf( "unsat %d ", Msat_SolverReadBackTracks(p->pSat) );
399 //ABC_PRT( "time", Abc_Clock() - clk );
400 }
401 
402  // add the clause
403  Msat_IntVecClear( p->vProj );
404  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pOld->Num, 1) );
405  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNew->Num, fComp) );
406  RetValue = Msat_SolverAddClause( p->pSat, p->vProj );
407  assert( RetValue );
408  // continue solving the other implication
409  }
410  else if ( RetValue1 == MSAT_TRUE )
411  {
412 //p->time2 += Abc_Clock() - clk;
413 
414 if ( fVerbose )
415 {
416 // printf( "sat %d ", Msat_SolverReadBackTracks(p->pSat) );
417 //ABC_PRT( "time", Abc_Clock() - clk );
418 }
419 
420  // record the counter example
421  Fraig_FeedBack( p, Msat_SolverReadModelArray(p->pSat), p->vVarsInt, pOld, pNew );
422 
423 // if ( pOld->fFailTfo || pNew->fFailTfo )
424 // printf( "*" );
425 // printf( "s(%d)", pNew->Level );
426  if ( fSwitch )
427  printf( "s(%d)", pNew->Level );
428  p->nSatCounter++;
429  return 0;
430  }
431  else // if ( RetValue1 == MSAT_UNKNOWN )
432  {
433 p->time3 += Abc_Clock() - clk;
434 
435 // if ( pOld->fFailTfo || pNew->fFailTfo )
436 // printf( "*" );
437 // printf( "T(%d)", pNew->Level );
438 
439  // mark the node as the failed node
440  if ( pOld != p->pConst1 )
441  pOld->fFailTfo = 1;
442  pNew->fFailTfo = 1;
443 // p->nSatFails++;
444  if ( fSwitch )
445  printf( "T(%d)", pNew->Level );
446  p->nSatFailsReal++;
447  return 0;
448  }
449 
450  // if the old node was constant 0, we already know the answer
451  if ( pOld == p->pConst1 )
452  return 1;
453 
454  ////////////////////////////////////////////
455  // prepare the solver to run incrementally
456 //clk = Abc_Clock();
457  Msat_SolverPrepare( p->pSat, p->vVarsInt );
458 //p->time3 += Abc_Clock() - clk;
459  // solve under assumptions
460  // A = 0; B = 1 OR A = 0; B = 0
461  Msat_IntVecClear( p->vProj );
462  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pOld->Num, 1) );
463  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNew->Num, fComp) );
464  // run the solver
465 clk = Abc_Clock();
466  RetValue1 = Msat_SolverSolve( p->pSat, p->vProj, nBTLimit, nTimeLimit );
467 p->timeSat += Abc_Clock() - clk;
468 
469  if ( RetValue1 == MSAT_FALSE )
470  {
471 //p->time1 += Abc_Clock() - clk;
472 
473 if ( fVerbose )
474 {
475 // printf( "unsat %d ", Msat_SolverReadBackTracks(p->pSat) );
476 //ABC_PRT( "time", Abc_Clock() - clk );
477 }
478 
479  // add the clause
480  Msat_IntVecClear( p->vProj );
481  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pOld->Num, 0) );
482  Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNew->Num, !fComp) );
483  RetValue = Msat_SolverAddClause( p->pSat, p->vProj );
484  assert( RetValue );
485  // continue solving the other implication
486  }
487  else if ( RetValue1 == MSAT_TRUE )
488  {
489 //p->time2 += Abc_Clock() - clk;
490 
491 if ( fVerbose )
492 {
493 // printf( "sat %d ", Msat_SolverReadBackTracks(p->pSat) );
494 //ABC_PRT( "time", Abc_Clock() - clk );
495 }
496 
497  // record the counter example
498  Fraig_FeedBack( p, Msat_SolverReadModelArray(p->pSat), p->vVarsInt, pOld, pNew );
499  p->nSatCounter++;
500 
501 // if ( pOld->fFailTfo || pNew->fFailTfo )
502 // printf( "*" );
503 // printf( "s(%d)", pNew->Level );
504  if ( fSwitch )
505  printf( "s(%d)", pNew->Level );
506  return 0;
507  }
508  else // if ( RetValue1 == MSAT_UNKNOWN )
509  {
510 p->time3 += Abc_Clock() - clk;
511 
512 // if ( pOld->fFailTfo || pNew->fFailTfo )
513 // printf( "*" );
514 // printf( "T(%d)", pNew->Level );
515  if ( fSwitch )
516  printf( "T(%d)", pNew->Level );
517 
518  // mark the node as the failed node
519  pOld->fFailTfo = 1;
520  pNew->fFailTfo = 1;
521 // p->nSatFails++;
522  p->nSatFailsReal++;
523  return 0;
524  }
525 
526  // return SAT proof
527  p->nSatProof++;
528 
529 // if ( pOld->fFailTfo || pNew->fFailTfo )
530 // printf( "*" );
531 // printf( "u(%d)", pNew->Level );
532 
533  if ( fSwitch )
534  printf( "u(%d)", pNew->Level );
535 
536  return 1;
537 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int * Msat_SolverReadModelArray(Msat_Solver_t *p)
Definition: msatSolverApi.c:57
int Msat_SolverAddClause(Msat_Solver_t *p, Msat_IntVec_t *pLits)
static int nMuxes
Definition: fraigSat.c:48
int Fraig_NodeComparePhase(Fraig_Node_t *p1, Fraig_Node_t *p2)
Definition: fraigApi.c:154
void Msat_IntVecClear(Msat_IntVec_t *p)
Definition: msatVec.c:335
Definition: msat.h:50
static abctime Abc_Clock()
Definition: abc_global.h:279
int Fraig_CountPis(Fraig_Man_t *p, Msat_IntVec_t *vVarNums)
Definition: fraigUtil.c:817
int Msat_SolverAddVar(Msat_Solver_t *p, int Level)
DECLARATIONS ///.
int Msat_IntVecReadSize(Msat_IntVec_t *p)
Definition: msatVec.c:233
void Msat_IntVecPush(Msat_IntVec_t *p, int Entry)
Definition: msatVec.c:351
void Msat_SolverPrepare(Msat_Solver_t *pSat, Msat_IntVec_t *vVars)
static void Fraig_SetActivity(Fraig_Man_t *pMan, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
Definition: fraigSat.c:1436
void Fraig_ManCreateSolver(Fraig_Man_t *p)
Definition: fraigMan.c:325
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fraig.h:107
unsigned fFailTfo
Definition: fraigInt.h:227
int Msat_SolverReadVarNum(Msat_Solver_t *p)
FUNCTION DEFINITIONS ///.
Definition: msatSolverApi.c:47
#define MSAT_VAR2LIT(v, s)
Definition: msat.h:56
#define assert(ex)
Definition: util_old.h:213
static ABC_NAMESPACE_IMPL_START void Fraig_OrderVariables(Fraig_Man_t *pMan, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
DECLARATIONS ///.
Definition: fraigSat.c:875
void Fraig_FeedBack(Fraig_Man_t *p, int *pModel, Msat_IntVec_t *vVars, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
Definition: fraigFeed.c:80
ABC_INT64_T abctime
Definition: abc_global.h:278
int Msat_SolverSolve(Msat_Solver_t *p, Msat_IntVec_t *pVecAssumps, int nBackTrackLimit, int nTimeLimit)
int Fraig_NodeIsVar ( Fraig_Node_t p)

Definition at line 152 of file fraigApi.c.

152 { return (Fraig_Regular(p))->NumPi >= 0; }
#define Fraig_Regular(p)
Definition: fraig.h:108
Fraig_Node_t* Fraig_NodeMux ( Fraig_Man_t p,
Fraig_Node_t pC,
Fraig_Node_t pT,
Fraig_Node_t pE 
)

Function*************************************************************

Synopsis [Perfoms the MUX operation with functional hashing.]

Description []

SideEffects []

SeeAlso []

Definition at line 260 of file fraigApi.c.

261 {
262  Fraig_Node_t * pAnd1, * pAnd2, * pRes;
263  pAnd1 = Fraig_NodeAndCanon( p, pC, pT ); Fraig_Ref( pAnd1 );
264  pAnd2 = Fraig_NodeAndCanon( p, Fraig_Not(pC), pE ); Fraig_Ref( pAnd2 );
265  pRes = Fraig_NodeOr( p, pAnd1, pAnd2 );
266  Fraig_RecursiveDeref( p, pAnd1 );
267  Fraig_RecursiveDeref( p, pAnd2 );
268  Fraig_Deref( pRes );
269  return pRes;
270 }
#define Fraig_RecursiveDeref(p, c)
Definition: fraig.h:115
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Fraig_Ref(p)
Definition: fraig.h:113
#define Fraig_Deref(p)
Definition: fraig.h:114
#define Fraig_Not(p)
Definition: fraig.h:109
Fraig_Node_t * Fraig_NodeOr(Fraig_Man_t *p, Fraig_Node_t *p1, Fraig_Node_t *p2)
Definition: fraigApi.c:228
ABC_NAMESPACE_IMPL_START Fraig_Node_t * Fraig_NodeAndCanon(Fraig_Man_t *pMan, Fraig_Node_t *p1, Fraig_Node_t *p2)
DECLARATIONS ///.
Definition: fraigCanon.c:52
Fraig_Node_t * Fraig_NodeOr ( Fraig_Man_t p,
Fraig_Node_t p1,
Fraig_Node_t p2 
)

Function*************************************************************

Synopsis [Perfoms the OR operation with functional hashing.]

Description []

SideEffects []

SeeAlso []

Definition at line 228 of file fraigApi.c.

229 {
230  return Fraig_Not( Fraig_NodeAndCanon( p, Fraig_Not(p1), Fraig_Not(p2) ) );
231 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Fraig_Not(p)
Definition: fraig.h:109
ABC_NAMESPACE_IMPL_START Fraig_Node_t * Fraig_NodeAndCanon(Fraig_Man_t *pMan, Fraig_Node_t *p1, Fraig_Node_t *p2)
DECLARATIONS ///.
Definition: fraigCanon.c:52
Fraig_Node_t* Fraig_NodeReadData0 ( Fraig_Node_t p)

Function*************************************************************

Synopsis [Access functions to read the data members of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 108 of file fraigApi.c.

108 { return p->pData0; }
Fraig_Node_t * pData0
Definition: fraigInt.h:251
Fraig_Node_t* Fraig_NodeReadData1 ( Fraig_Node_t p)

Definition at line 109 of file fraigApi.c.

109 { return p->pData1; }
Fraig_Node_t * pData1
Definition: fraigInt.h:252
Fraig_Node_t* Fraig_NodeReadNextE ( Fraig_Node_t p)

Definition at line 113 of file fraigApi.c.

113 { return p->pNextE; }
Fraig_Node_t * pNextE
Definition: fraigInt.h:241
int Fraig_NodeReadNum ( Fraig_Node_t p)

Definition at line 110 of file fraigApi.c.

110 { return p->Num; }
int Fraig_NodeReadNumFanouts ( Fraig_Node_t p)

Definition at line 116 of file fraigApi.c.

116 { return p->nFanouts; }
unsigned nFanouts
Definition: fraigInt.h:228
int Fraig_NodeReadNumOnes ( Fraig_Node_t p)

Definition at line 118 of file fraigApi.c.

118 { return p->nOnes; }
int Fraig_NodeReadNumRefs ( Fraig_Node_t p)

Definition at line 115 of file fraigApi.c.

115 { return p->nRefs; }
Fraig_Node_t* Fraig_NodeReadOne ( Fraig_Node_t p)

Definition at line 111 of file fraigApi.c.

111 { assert (!Fraig_IsComplement(p)); return p->p1; }
Fraig_Node_t * p1
Definition: fraigInt.h:232
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fraig.h:107
#define assert(ex)
Definition: util_old.h:213
unsigned* Fraig_NodeReadPatternsDynamic ( Fraig_Node_t p)

Definition at line 124 of file fraigApi.c.

124 { return p->puSimD; }
unsigned * puSimD
Definition: fraigInt.h:248
unsigned* Fraig_NodeReadPatternsRandom ( Fraig_Node_t p)

Definition at line 121 of file fraigApi.c.

121 { return p->puSimR; }
unsigned * puSimR
Definition: fraigInt.h:247
Fraig_Node_t* Fraig_NodeReadRepr ( Fraig_Node_t p)

Definition at line 114 of file fraigApi.c.

114 { return p->pRepr; }
Fraig_Node_t * pRepr
Definition: fraigInt.h:242
int Fraig_NodeReadSimInv ( Fraig_Node_t p)

Definition at line 117 of file fraigApi.c.

117 { return p->fInv; }
Fraig_Node_t* Fraig_NodeReadTwo ( Fraig_Node_t p)

Definition at line 112 of file fraigApi.c.

112 { assert (!Fraig_IsComplement(p)); return p->p2; }
Fraig_Node_t * p2
Definition: fraigInt.h:233
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fraig.h:107
#define assert(ex)
Definition: util_old.h:213
int Fraig_NodesAreEqual ( Fraig_Man_t p,
Fraig_Node_t pNode1,
Fraig_Node_t pNode2,
int  nBTLimit,
int  nTimeLimit 
)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Checks equivalence of two nodes.]

Description [Returns 1 iff the nodes are equivalent.]

SideEffects []

SeeAlso []

Definition at line 65 of file fraigSat.c.

66 {
67  if ( pNode1 == pNode2 )
68  return 1;
69  if ( pNode1 == Fraig_Not(pNode2) )
70  return 0;
71  return Fraig_NodeIsEquivalent( p, Fraig_Regular(pNode1), Fraig_Regular(pNode2), nBTLimit, nTimeLimit );
72 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Fraig_Not(p)
Definition: fraig.h:109
int Fraig_NodeIsEquivalent(Fraig_Man_t *p, Fraig_Node_t *pOld, Fraig_Node_t *pNew, int nBTLimit, int nTimeLimit)
Definition: fraigSat.c:302
#define Fraig_Regular(p)
Definition: fraig.h:108
void Fraig_NodeSetChoice ( Fraig_Man_t pMan,
Fraig_Node_t pNodeOld,
Fraig_Node_t pNodeNew 
)

Function*************************************************************

Synopsis [Sets the node to be equivalent to the given one.]

Description [This procedure is a work-around for the equivalence check. Does not verify the equivalence. Use at the user's risk.]

SideEffects []

SeeAlso []

Definition at line 285 of file fraigApi.c.

286 {
287 // assert( pMan->fChoicing );
288  pNodeNew->pNextE = pNodeOld->pNextE;
289  pNodeOld->pNextE = pNodeNew;
290  pNodeNew->pRepr = pNodeOld;
291 }
Fraig_Node_t * pNextE
Definition: fraigInt.h:241
Fraig_Node_t * pRepr
Definition: fraigInt.h:242
void Fraig_NodeSetData0 ( Fraig_Node_t p,
Fraig_Node_t pData 
)

Function*************************************************************

Synopsis [Access functions to set the data members of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 137 of file fraigApi.c.

137 { p->pData0 = pData; }
Fraig_Node_t * pData0
Definition: fraigInt.h:251
void Fraig_NodeSetData1 ( Fraig_Node_t p,
Fraig_Node_t pData 
)

Definition at line 138 of file fraigApi.c.

138 { p->pData1 = pData; }
Fraig_Node_t * pData1
Definition: fraigInt.h:252
Fraig_NodeVec_t* Fraig_NodeVecAlloc ( int  nCap)

DECLARATIONS ///.

CFile****************************************************************

FileName [fraigVec.c]

PackageName [FRAIG: Functionally reduced AND-INV graphs.]

Synopsis [Vector of FRAIG nodes.]

Author [Alan Mishchenko alanm.nosp@m.i@ee.nosp@m.cs.be.nosp@m.rkel.nosp@m.ey.ed.nosp@m.u]

Affiliation [UC Berkeley]

Date [Ver. 2.0. Started - October 1, 2004]

Revision [

Id:
fraigVec.c,v 1.7 2005/07/08 01:01:34 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Allocates a vector with the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file fraigVec.c.

44 {
46  p = ABC_ALLOC( Fraig_NodeVec_t, 1 );
47  if ( nCap > 0 && nCap < 8 )
48  nCap = 8;
49  p->nSize = 0;
50  p->nCap = nCap;
51  p->pArray = p->nCap? ABC_ALLOC( Fraig_Node_t *, p->nCap ) : NULL;
52  return p;
53 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
void Fraig_NodeVecClear ( Fraig_NodeVec_t p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 173 of file fraigVec.c.

174 {
175  p->nSize = 0;
176 }
Fraig_NodeVec_t* Fraig_NodeVecDup ( Fraig_NodeVec_t pVec)

Function*************************************************************

Synopsis [Duplicates the integer array.]

Description []

SideEffects []

SeeAlso []

Definition at line 83 of file fraigVec.c.

84 {
86  p = ABC_ALLOC( Fraig_NodeVec_t, 1 );
87  p->nSize = pVec->nSize;
88  p->nCap = pVec->nCap;
89  p->pArray = p->nCap? ABC_ALLOC( Fraig_Node_t *, p->nCap ) : NULL;
90  memcpy( p->pArray, pVec->pArray, sizeof(Fraig_Node_t *) * pVec->nSize );
91  return p;
92 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
void Fraig_NodeVecFree ( Fraig_NodeVec_t p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file fraigVec.c.

67 {
68  ABC_FREE( p->pArray );
69  ABC_FREE( p );
70 }
#define ABC_FREE(obj)
Definition: abc_global.h:232
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
void Fraig_NodeVecGrow ( Fraig_NodeVec_t p,
int  nCapMin 
)

Function*************************************************************

Synopsis [Resizes the vector to the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 137 of file fraigVec.c.

138 {
139  if ( p->nCap >= nCapMin )
140  return;
141  p->pArray = ABC_REALLOC( Fraig_Node_t *, p->pArray, nCapMin );
142  p->nCap = nCapMin;
143 }
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
Fraig_Node_t* Fraig_NodeVecPop ( Fraig_NodeVec_t p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 331 of file fraigVec.c.

332 {
333  return p->pArray[--p->nSize];
334 }
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
void Fraig_NodeVecPush ( Fraig_NodeVec_t p,
Fraig_Node_t Entry 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 189 of file fraigVec.c.

190 {
191  if ( p->nSize == p->nCap )
192  {
193  if ( p->nCap < 16 )
194  Fraig_NodeVecGrow( p, 16 );
195  else
196  Fraig_NodeVecGrow( p, 2 * p->nCap );
197  }
198  p->pArray[p->nSize++] = Entry;
199 }
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
void Fraig_NodeVecGrow(Fraig_NodeVec_t *p, int nCapMin)
Definition: fraigVec.c:137
void Fraig_NodeVecPushOrder ( Fraig_NodeVec_t p,
Fraig_Node_t pNode 
)

Function*************************************************************

Synopsis [Inserts a new node in the order by arrival times.]

Description []

SideEffects []

SeeAlso []

Definition at line 233 of file fraigVec.c.

234 {
235  Fraig_Node_t * pNode1, * pNode2;
236  int i;
237  Fraig_NodeVecPush( p, pNode );
238  // find the p of the node
239  for ( i = p->nSize-1; i > 0; i-- )
240  {
241  pNode1 = p->pArray[i ];
242  pNode2 = p->pArray[i-1];
243  if ( pNode1 >= pNode2 )
244  break;
245  p->pArray[i ] = pNode2;
246  p->pArray[i-1] = pNode1;
247  }
248 }
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
void Fraig_NodeVecPush(Fraig_NodeVec_t *p, Fraig_Node_t *Entry)
Definition: fraigVec.c:189
void Fraig_NodeVecPushOrderByLevel ( Fraig_NodeVec_t p,
Fraig_Node_t pNode 
)

Function*************************************************************

Synopsis [Inserts a new node in the order by arrival times.]

Description []

SideEffects []

SeeAlso []

Definition at line 282 of file fraigVec.c.

283 {
284  Fraig_Node_t * pNode1, * pNode2;
285  int i;
286  Fraig_NodeVecPush( p, pNode );
287  // find the p of the node
288  for ( i = p->nSize-1; i > 0; i-- )
289  {
290  pNode1 = p->pArray[i ];
291  pNode2 = p->pArray[i-1];
292  if ( Fraig_Regular(pNode1)->Level <= Fraig_Regular(pNode2)->Level )
293  break;
294  p->pArray[i ] = pNode2;
295  p->pArray[i-1] = pNode1;
296  }
297 }
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
#define Fraig_Regular(p)
Definition: fraig.h:108
void Fraig_NodeVecPush(Fraig_NodeVec_t *p, Fraig_Node_t *Entry)
Definition: fraigVec.c:189
int Fraig_NodeVecPushUnique ( Fraig_NodeVec_t p,
Fraig_Node_t Entry 
)

Function*************************************************************

Synopsis [Add the element while ensuring uniqueness.]

Description [Returns 1 if the element was found, and 0 if it was new. ]

SideEffects []

SeeAlso []

Definition at line 212 of file fraigVec.c.

213 {
214  int i;
215  for ( i = 0; i < p->nSize; i++ )
216  if ( p->pArray[i] == Entry )
217  return 1;
218  Fraig_NodeVecPush( p, Entry );
219  return 0;
220 }
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
void Fraig_NodeVecPush(Fraig_NodeVec_t *p, Fraig_Node_t *Entry)
Definition: fraigVec.c:189
int Fraig_NodeVecPushUniqueOrder ( Fraig_NodeVec_t p,
Fraig_Node_t pNode 
)

Function*************************************************************

Synopsis [Add the element while ensuring uniqueness in the order.]

Description [Returns 1 if the element was found, and 0 if it was new. ]

SideEffects []

SeeAlso []

Definition at line 261 of file fraigVec.c.

262 {
263  int i;
264  for ( i = 0; i < p->nSize; i++ )
265  if ( p->pArray[i] == pNode )
266  return 1;
267  Fraig_NodeVecPushOrder( p, pNode );
268  return 0;
269 }
void Fraig_NodeVecPushOrder(Fraig_NodeVec_t *p, Fraig_Node_t *pNode)
Definition: fraigVec.c:233
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
int Fraig_NodeVecPushUniqueOrderByLevel ( Fraig_NodeVec_t p,
Fraig_Node_t pNode 
)

Function*************************************************************

Synopsis [Add the element while ensuring uniqueness in the order.]

Description [Returns 1 if the element was found, and 0 if it was new. ]

SideEffects []

SeeAlso []

Definition at line 310 of file fraigVec.c.

311 {
312  int i;
313  for ( i = 0; i < p->nSize; i++ )
314  if ( p->pArray[i] == pNode )
315  return 1;
316  Fraig_NodeVecPushOrderByLevel( p, pNode );
317  return 0;
318 }
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
void Fraig_NodeVecPushOrderByLevel(Fraig_NodeVec_t *p, Fraig_Node_t *pNode)
Definition: fraigVec.c:282
Fraig_Node_t** Fraig_NodeVecReadArray ( Fraig_NodeVec_t p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 105 of file fraigVec.c.

106 {
107  return p->pArray;
108 }
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
Fraig_Node_t* Fraig_NodeVecReadEntry ( Fraig_NodeVec_t p,
int  i 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 387 of file fraigVec.c.

388 {
389  assert( i >= 0 && i < p->nSize );
390  return p->pArray[i];
391 }
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
#define assert(ex)
Definition: util_old.h:213
int Fraig_NodeVecReadSize ( Fraig_NodeVec_t p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 121 of file fraigVec.c.

122 {
123  return p->nSize;
124 }
void Fraig_NodeVecRemove ( Fraig_NodeVec_t p,
Fraig_Node_t Entry 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 347 of file fraigVec.c.

348 {
349  int i;
350  for ( i = 0; i < p->nSize; i++ )
351  if ( p->pArray[i] == Entry )
352  break;
353  assert( i < p->nSize );
354  for ( i++; i < p->nSize; i++ )
355  p->pArray[i-1] = p->pArray[i];
356  p->nSize--;
357 }
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
#define assert(ex)
Definition: util_old.h:213
void Fraig_NodeVecShrink ( Fraig_NodeVec_t p,
int  nSizeNew 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 156 of file fraigVec.c.

157 {
158  assert( p->nSize >= nSizeNew );
159  p->nSize = nSizeNew;
160 }
#define assert(ex)
Definition: util_old.h:213
void Fraig_NodeVecSortByLevel ( Fraig_NodeVec_t p,
int  fIncreasing 
)

Function*************************************************************

Synopsis [Sorting the entries by their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 501 of file fraigVec.c.

502 {
503  if ( fIncreasing )
504  qsort( (void *)p->pArray, p->nSize, sizeof(Fraig_Node_t *),
505  (int (*)(const void *, const void *)) Fraig_NodeVecCompareLevelsIncreasing );
506  else
507  qsort( (void *)p->pArray, p->nSize, sizeof(Fraig_Node_t *),
508  (int (*)(const void *, const void *)) Fraig_NodeVecCompareLevelsDecreasing );
509 }
int Fraig_NodeVecCompareLevelsIncreasing(Fraig_Node_t **pp1, Fraig_Node_t **pp2)
Definition: fraigVec.c:404
int Fraig_NodeVecCompareLevelsDecreasing(Fraig_Node_t **pp1, Fraig_Node_t **pp2)
Definition: fraigVec.c:426
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
void Fraig_NodeVecSortByNumber ( Fraig_NodeVec_t p)

Function*************************************************************

Synopsis [Sorting the entries by their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 522 of file fraigVec.c.

523 {
524  qsort( (void *)p->pArray, p->nSize, sizeof(Fraig_Node_t *),
525  (int (*)(const void *, const void *)) Fraig_NodeVecCompareNumbers );
526 }
int Fraig_NodeVecCompareNumbers(Fraig_Node_t **pp1, Fraig_Node_t **pp2)
Definition: fraigVec.c:448
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
void Fraig_NodeVecWriteEntry ( Fraig_NodeVec_t p,
int  i,
Fraig_Node_t Entry 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 370 of file fraigVec.c.

371 {
372  assert( i >= 0 && i < p->nSize );
373  p->pArray[i] = Entry;
374 }
Fraig_Node_t ** pArray
Definition: fraigInt.h:267
#define assert(ex)
Definition: util_old.h:213
void Fraig_ParamsSetDefault ( Fraig_Params_t pParams)

Function*************************************************************

Synopsis [Sets the default parameters of the package.]

Description [This set of parameters is tuned for equivalence checking.]

SideEffects []

SeeAlso []

Definition at line 122 of file fraigMan.c.

123 {
124  memset( pParams, 0, sizeof(Fraig_Params_t) );
125  pParams->nPatsRand = FRAIG_PATTERNS_RANDOM; // the number of words of random simulation info
126  pParams->nPatsDyna = FRAIG_PATTERNS_DYNAMIC; // the number of words of dynamic simulation info
127  pParams->nBTLimit = 99; // the max number of backtracks to perform
128  pParams->nSeconds = 20; // the max number of seconds to solve the miter
129  pParams->fFuncRed = 1; // performs only one level hashing
130  pParams->fFeedBack = 1; // enables solver feedback
131  pParams->fDist1Pats = 1; // enables distance-1 patterns
132  pParams->fDoSparse = 0; // performs equiv tests for sparse functions
133  pParams->fChoicing = 0; // enables recording structural choices
134  pParams->fTryProve = 1; // tries to solve the final miter
135  pParams->fVerbose = 0; // the verbosiness flag
136  pParams->fVerboseP = 0; // the verbose flag for reporting the proof
137  pParams->fInternal = 0; // the flag indicates the internal run
138  pParams->nConfLimit = 0; // the limit on the number of conflicts
139  pParams->nInspLimit = 0; // the limit on the number of inspections
140 }
char * memset()
ABC_INT64_T nInspLimit
Definition: fraig.h:64
#define FRAIG_PATTERNS_RANDOM
Definition: fraigInt.h:58
#define FRAIG_PATTERNS_DYNAMIC
Definition: fraigInt.h:59
void Fraig_ParamsSetDefaultFull ( Fraig_Params_t pParams)

Function*************************************************************

Synopsis [Sets the default parameters of the package.]

Description [This set of parameters is tuned for complete FRAIGing.]

SideEffects []

SeeAlso []

Definition at line 153 of file fraigMan.c.

154 {
155  memset( pParams, 0, sizeof(Fraig_Params_t) );
156  pParams->nPatsRand = FRAIG_PATTERNS_RANDOM; // the number of words of random simulation info
157  pParams->nPatsDyna = FRAIG_PATTERNS_DYNAMIC; // the number of words of dynamic simulation info
158  pParams->nBTLimit = -1; // the max number of backtracks to perform
159  pParams->nSeconds = 20; // the max number of seconds to solve the miter
160  pParams->fFuncRed = 1; // performs only one level hashing
161  pParams->fFeedBack = 1; // enables solver feedback
162  pParams->fDist1Pats = 1; // enables distance-1 patterns
163  pParams->fDoSparse = 1; // performs equiv tests for sparse functions
164  pParams->fChoicing = 0; // enables recording structural choices
165  pParams->fTryProve = 0; // tries to solve the final miter
166  pParams->fVerbose = 0; // the verbosiness flag
167  pParams->fVerboseP = 0; // the verbose flag for reporting the proof
168  pParams->fInternal = 0; // the flag indicates the internal run
169  pParams->nConfLimit = 0; // the limit on the number of conflicts
170  pParams->nInspLimit = 0; // the limit on the number of inspections
171 }
char * memset()
ABC_INT64_T nInspLimit
Definition: fraig.h:64
#define FRAIG_PATTERNS_RANDOM
Definition: fraigInt.h:58
#define FRAIG_PATTERNS_DYNAMIC
Definition: fraigInt.h:59
void Prove_ParamsSetDefault ( Prove_Params_t pParams)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Sets the default parameters of the package.]

Description [This set of parameters is tuned for equivalence checking.]

SideEffects []

SeeAlso []

Definition at line 46 of file fraigMan.c.

47 {
48  // clean the parameter structure
49  memset( pParams, 0, sizeof(Prove_Params_t) );
50  // general parameters
51  pParams->fUseFraiging = 1; // enables fraiging
52  pParams->fUseRewriting = 1; // enables rewriting
53  pParams->fUseBdds = 0; // enables BDD construction when other methods fail
54  pParams->fVerbose = 0; // prints verbose stats
55  // iterations
56  pParams->nItersMax = 6; // the number of iterations
57  // mitering
58  pParams->nMiteringLimitStart = 5000; // starting mitering limit
59  pParams->nMiteringLimitMulti = 2.0; // multiplicative coefficient to increase the limit in each iteration
60  // rewriting (currently not used)
61  pParams->nRewritingLimitStart = 3; // the number of rewriting iterations
62  pParams->nRewritingLimitMulti = 1.0; // multiplicative coefficient to increase the limit in each iteration
63  // fraiging
64  pParams->nFraigingLimitStart = 2; // starting backtrack(conflict) limit
65  pParams->nFraigingLimitMulti = 8.0; // multiplicative coefficient to increase the limit in each iteration
66  // last-gasp BDD construction
67  pParams->nBddSizeLimit = 1000000; // the number of BDD nodes when construction is aborted
68  pParams->fBddReorder = 1; // enables dynamic BDD variable reordering
69  // last-gasp mitering
70 // pParams->nMiteringLimitLast = 1000000; // final mitering limit
71  pParams->nMiteringLimitLast = 0; // final mitering limit
72  // global SAT solver limits
73  pParams->nTotalBacktrackLimit = 0; // global limit on the number of backtracks
74  pParams->nTotalInspectLimit = 0; // global limit on the number of clause inspects
75 // pParams->nTotalInspectLimit = 100000000; // global limit on the number of clause inspects
76 }
char * memset()
ABC_INT64_T nTotalInspectLimit
Definition: ivyFraig.c:134
float nRewritingLimitMulti
Definition: ivyFraig.c:123
ABC_INT64_T nTotalBacktrackLimit
Definition: ivyFraig.c:133