ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
ivyFraig.c File Reference
#include <math.h>
#include "sat/bsat/satSolver.h"
#include "misc/extra/extra.h"
#include "ivy.h"
#include "aig/aig/aig.h"
Include dependency graph for ivyFraig.c:

Go to the source code of this file.

Classes

struct  Ivy_FraigList_t_
 
struct  Ivy_FraigSim_t_
 
struct  Ivy_FraigMan_t_
 
struct  Prove_ParamsStruct_t_
 

Macros

#define Ivy_FraigForEachEquivClass(pList, pEnt)
 
#define Ivy_FraigForEachEquivClassSafe(pList, pEnt, pEnt2)
 
#define Ivy_FraigForEachClassNode(pClass, pEnt)
 
#define Ivy_FraigForEachBinNode(pBin, pEnt)
 

Typedefs

typedef typedefABC_NAMESPACE_IMPL_START struct Ivy_FraigMan_t_ Ivy_FraigMan_t
 DECLARATIONS ///.
 
typedef struct Ivy_FraigSim_t_ Ivy_FraigSim_t
 
typedef struct Ivy_FraigList_t_ Ivy_FraigList_t
 
typedef struct Prove_ParamsStruct_t_ Prove_Params_t
 

Functions

void Ivy_FraigParamsDefault (Ivy_FraigParams_t *pParams)
 FUNCTION DEFINITIONS ///.
 
int Ivy_FraigProve (Ivy_Man_t **ppManAig, void *pPars)
 
Ivy_Man_tIvy_FraigPerform (Ivy_Man_t *pManAig, Ivy_FraigParams_t *pParams)
 
Ivy_Man_tIvy_FraigMiter (Ivy_Man_t *pManAig, Ivy_FraigParams_t *pParams)
 
void Ivy_NodeAssignRandom (Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
 
void Ivy_NodeAssignConst (Ivy_FraigMan_t *p, Ivy_Obj_t *pObj, int fConst1)
 
void Ivy_FraigAssignRandom (Ivy_FraigMan_t *p)
 
void Ivy_FraigAssignDist1 (Ivy_FraigMan_t *p, unsigned *pPat)
 
int Ivy_NodeHasZeroSim (Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
 
void Ivy_NodeComplementSim (Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
 
int Ivy_NodeCompareSims (Ivy_FraigMan_t *p, Ivy_Obj_t *pObj0, Ivy_Obj_t *pObj1)
 
void Ivy_NodeSimulateSim (Ivy_FraigMan_t *p, Ivy_FraigSim_t *pSims)
 
void Ivy_NodeSimulate (Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
 
unsigned Ivy_NodeHash (Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
 
void Ivy_FraigSimulateOne (Ivy_FraigMan_t *p)
 
void Ivy_FraigSimulateOneSim (Ivy_FraigMan_t *p)
 
void Ivy_NodeAddToClass (Ivy_Obj_t *pClass, Ivy_Obj_t *pObj)
 
void Ivy_FraigAddClass (Ivy_FraigList_t *pList, Ivy_Obj_t *pClass)
 
void Ivy_FraigInsertClass (Ivy_FraigList_t *pList, Ivy_Obj_t *pBase, Ivy_Obj_t *pClass)
 
void Ivy_FraigRemoveClass (Ivy_FraigList_t *pList, Ivy_Obj_t *pClass)
 
int Ivy_FraigCountPairsClasses (Ivy_FraigMan_t *p)
 
void Ivy_FraigCreateClasses (Ivy_FraigMan_t *p)
 
int Ivy_FraigRefineClass_rec (Ivy_FraigMan_t *p, Ivy_Obj_t *pClass)
 
void Ivy_FraigCheckOutputSimsSavePattern (Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
 
int Ivy_FraigCheckOutputSims (Ivy_FraigMan_t *p)
 
int Ivy_FraigRefineClasses (Ivy_FraigMan_t *p)
 
void Ivy_FraigPrintClass (Ivy_Obj_t *pClass)
 
int Ivy_FraigCountClassNodes (Ivy_Obj_t *pClass)
 
void Ivy_FraigPrintSimClasses (Ivy_FraigMan_t *p)
 
void Ivy_FraigSavePattern0 (Ivy_FraigMan_t *p)
 
void Ivy_FraigSavePattern1 (Ivy_FraigMan_t *p)
 
void Ivy_FraigSavePattern (Ivy_FraigMan_t *p)
 
void Ivy_FraigSavePattern2 (Ivy_FraigMan_t *p)
 
void Ivy_FraigSavePattern3 (Ivy_FraigMan_t *p)
 
void Ivy_FraigCleanPatScores (Ivy_FraigMan_t *p)
 
int Ivy_FraigSelectBestPat (Ivy_FraigMan_t *p)
 
void Ivy_FraigResimulate (Ivy_FraigMan_t *p)
 
void Ivy_FraigPrintActivity (Ivy_FraigMan_t *p)
 
void Ivy_FraigAddClausesMux (Ivy_FraigMan_t *p, Ivy_Obj_t *pNode)
 
void Ivy_FraigAddClausesSuper (Ivy_FraigMan_t *p, Ivy_Obj_t *pNode, Vec_Ptr_t *vSuper)
 
void Ivy_FraigCollectSuper_rec (Ivy_Obj_t *pObj, Vec_Ptr_t *vSuper, int fFirst, int fUseMuxes)
 
Vec_Ptr_tIvy_FraigCollectSuper (Ivy_Obj_t *pObj, int fUseMuxes)
 
void Ivy_FraigObjAddToFrontier (Ivy_FraigMan_t *p, Ivy_Obj_t *pObj, Vec_Ptr_t *vFrontier)
 
int Ivy_FraigSetActivityFactors_rec (Ivy_FraigMan_t *p, Ivy_Obj_t *pObj, int LevelMin, int LevelMax)
 
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START void Ivy_FraigExtractCone_rec (Ivy_Man_t *p, Ivy_Obj_t *pNode, Vec_Int_t *vLeaves, Vec_Int_t *vNodes)
 
Aig_Man_tIvy_FraigExtractCone (Ivy_Man_t *p, Ivy_Obj_t *pObj1, Ivy_Obj_t *pObj2, Vec_Int_t *vLeaves)
 

Macro Definition Documentation

◆ Ivy_FraigForEachBinNode

#define Ivy_FraigForEachBinNode ( pBin,
pEnt )
Value:
for ( pEnt = pBin; \
pEnt; \
pEnt = Ivy_ObjNodeHashNext(pEnt) )

Definition at line 181 of file ivyFraig.c.

181#define Ivy_FraigForEachBinNode( pBin, pEnt ) \
182 for ( pEnt = pBin; \
183 pEnt; \
184 pEnt = Ivy_ObjNodeHashNext(pEnt) )

◆ Ivy_FraigForEachClassNode

#define Ivy_FraigForEachClassNode ( pClass,
pEnt )
Value:
for ( pEnt = pClass; \
pEnt; \
pEnt = Ivy_ObjClassNodeNext(pEnt) )

Definition at line 176 of file ivyFraig.c.

176#define Ivy_FraigForEachClassNode( pClass, pEnt ) \
177 for ( pEnt = pClass; \
178 pEnt; \
179 pEnt = Ivy_ObjClassNodeNext(pEnt) )

◆ Ivy_FraigForEachEquivClass

#define Ivy_FraigForEachEquivClass ( pList,
pEnt )
Value:
for ( pEnt = pList; \
pEnt; \
pEnt = Ivy_ObjEquivListNext(pEnt) )

Definition at line 165 of file ivyFraig.c.

165#define Ivy_FraigForEachEquivClass( pList, pEnt ) \
166 for ( pEnt = pList; \
167 pEnt; \
168 pEnt = Ivy_ObjEquivListNext(pEnt) )

◆ Ivy_FraigForEachEquivClassSafe

#define Ivy_FraigForEachEquivClassSafe ( pList,
pEnt,
pEnt2 )
Value:
for ( pEnt = pList, \
pEnt2 = pEnt? Ivy_ObjEquivListNext(pEnt): NULL; \
pEnt; \
pEnt = pEnt2, \
pEnt2 = pEnt? Ivy_ObjEquivListNext(pEnt): NULL )

Definition at line 169 of file ivyFraig.c.

169#define Ivy_FraigForEachEquivClassSafe( pList, pEnt, pEnt2 ) \
170 for ( pEnt = pList, \
171 pEnt2 = pEnt? Ivy_ObjEquivListNext(pEnt): NULL; \
172 pEnt; \
173 pEnt = pEnt2, \
174 pEnt2 = pEnt? Ivy_ObjEquivListNext(pEnt): NULL )

Typedef Documentation

◆ Ivy_FraigList_t

Definition at line 35 of file ivyFraig.c.

◆ Ivy_FraigMan_t

typedef typedefABC_NAMESPACE_IMPL_START struct Ivy_FraigMan_t_ Ivy_FraigMan_t

DECLARATIONS ///.

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

FileName [ivyFraig.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [Functional reduction of AIGs]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
ivyFraig.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

]

Definition at line 33 of file ivyFraig.c.

◆ Ivy_FraigSim_t

Definition at line 34 of file ivyFraig.c.

◆ Prove_Params_t

Definition at line 108 of file ivyFraig.c.

Function Documentation

◆ Ivy_FraigAddClass()

void Ivy_FraigAddClass ( Ivy_FraigList_t * pList,
Ivy_Obj_t * pClass )

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

Synopsis [Adds equivalence class to the list of classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1067 of file ivyFraig.c.

1068{
1069 if ( pList->pHead == NULL )
1070 {
1071 pList->pHead = pClass;
1072 pList->pTail = pClass;
1073 Ivy_ObjSetEquivListPrev( pClass, NULL );
1074 Ivy_ObjSetEquivListNext( pClass, NULL );
1075 }
1076 else
1077 {
1078 Ivy_ObjSetEquivListNext( pList->pTail, pClass );
1079 Ivy_ObjSetEquivListPrev( pClass, pList->pTail );
1080 Ivy_ObjSetEquivListNext( pClass, NULL );
1081 pList->pTail = pClass;
1082 }
1083 pList->nItems++;
1084}
Ivy_Obj_t * pTail
Definition ivyFraig.c:40
Ivy_Obj_t * pHead
Definition ivyFraig.c:39
Here is the caller graph for this function:

◆ Ivy_FraigAddClausesMux()

void Ivy_FraigAddClausesMux ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pNode )

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

Synopsis [Addes clauses to the solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 2352 of file ivyFraig.c.

2353{
2354 Ivy_Obj_t * pNodeI, * pNodeT, * pNodeE;
2355 int pLits[4], RetValue, VarF, VarI, VarT, VarE, fCompT, fCompE;
2356
2357 assert( !Ivy_IsComplement( pNode ) );
2358 assert( Ivy_ObjIsMuxType( pNode ) );
2359 // get nodes (I = if, T = then, E = else)
2360 pNodeI = Ivy_ObjRecognizeMux( pNode, &pNodeT, &pNodeE );
2361 // get the variable numbers
2362 VarF = Ivy_ObjSatNum(pNode);
2363 VarI = Ivy_ObjSatNum(pNodeI);
2364 VarT = Ivy_ObjSatNum(Ivy_Regular(pNodeT));
2365 VarE = Ivy_ObjSatNum(Ivy_Regular(pNodeE));
2366 // get the complementation flags
2367 fCompT = Ivy_IsComplement(pNodeT);
2368 fCompE = Ivy_IsComplement(pNodeE);
2369
2370 // f = ITE(i, t, e)
2371
2372 // i' + t' + f
2373 // i' + t + f'
2374 // i + e' + f
2375 // i + e + f'
2376
2377 // create four clauses
2378 pLits[0] = toLitCond(VarI, 1);
2379 pLits[1] = toLitCond(VarT, 1^fCompT);
2380 pLits[2] = toLitCond(VarF, 0);
2381 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 3 );
2382 assert( RetValue );
2383 pLits[0] = toLitCond(VarI, 1);
2384 pLits[1] = toLitCond(VarT, 0^fCompT);
2385 pLits[2] = toLitCond(VarF, 1);
2386 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 3 );
2387 assert( RetValue );
2388 pLits[0] = toLitCond(VarI, 0);
2389 pLits[1] = toLitCond(VarE, 1^fCompE);
2390 pLits[2] = toLitCond(VarF, 0);
2391 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 3 );
2392 assert( RetValue );
2393 pLits[0] = toLitCond(VarI, 0);
2394 pLits[1] = toLitCond(VarE, 0^fCompE);
2395 pLits[2] = toLitCond(VarF, 1);
2396 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 3 );
2397 assert( RetValue );
2398
2399 // two additional clauses
2400 // t' & e' -> f'
2401 // t & e -> f
2402
2403 // t + e + f'
2404 // t' + e' + f
2405
2406 if ( VarT == VarE )
2407 {
2408// assert( fCompT == !fCompE );
2409 return;
2410 }
2411
2412 pLits[0] = toLitCond(VarT, 0^fCompT);
2413 pLits[1] = toLitCond(VarE, 0^fCompE);
2414 pLits[2] = toLitCond(VarF, 1);
2415 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 3 );
2416 assert( RetValue );
2417 pLits[0] = toLitCond(VarT, 1^fCompT);
2418 pLits[1] = toLitCond(VarE, 1^fCompE);
2419 pLits[2] = toLitCond(VarF, 0);
2420 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 3 );
2421 assert( RetValue );
2422}
#define sat_solver_addclause
Definition cecSatG2.c:37
Cube * p
Definition exorList.c:222
struct Ivy_Obj_t_ Ivy_Obj_t
Definition ivy.h:47
int Ivy_ObjIsMuxType(Ivy_Obj_t *pObj)
Definition ivyUtil.c:479
Ivy_Obj_t * Ivy_ObjRecognizeMux(Ivy_Obj_t *pObj, Ivy_Obj_t **ppObjT, Ivy_Obj_t **ppObjE)
Definition ivyUtil.c:517
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Ivy_FraigAddClausesSuper()

void Ivy_FraigAddClausesSuper ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pNode,
Vec_Ptr_t * vSuper )

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

Synopsis [Addes clauses to the solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 2435 of file ivyFraig.c.

2436{
2437 Ivy_Obj_t * pFanin;
2438 int * pLits, nLits, RetValue, i;
2439 assert( !Ivy_IsComplement(pNode) );
2440 assert( Ivy_ObjIsNode( pNode ) );
2441 // create storage for literals
2442 nLits = Vec_PtrSize(vSuper) + 1;
2443 pLits = ABC_ALLOC( int, nLits );
2444 // suppose AND-gate is A & B = C
2445 // add !A => !C or A + !C
2446 Vec_PtrForEachEntry( Ivy_Obj_t *, vSuper, pFanin, i )
2447 {
2448 pLits[0] = toLitCond(Ivy_ObjSatNum(Ivy_Regular(pFanin)), Ivy_IsComplement(pFanin));
2449 pLits[1] = toLitCond(Ivy_ObjSatNum(pNode), 1);
2450 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 2 );
2451 assert( RetValue );
2452 }
2453 // add A & B => C or !A + !B + C
2454 Vec_PtrForEachEntry( Ivy_Obj_t *, vSuper, pFanin, i )
2455 pLits[i] = toLitCond(Ivy_ObjSatNum(Ivy_Regular(pFanin)), !Ivy_IsComplement(pFanin));
2456 pLits[nLits-1] = toLitCond(Ivy_ObjSatNum(pNode), 0);
2457 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + nLits );
2458 assert( RetValue );
2459 ABC_FREE( pLits );
2460}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55

◆ Ivy_FraigAssignDist1()

void Ivy_FraigAssignDist1 ( Ivy_FraigMan_t * p,
unsigned * pPat )

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

Synopsis [Assings distance-1 simulation info for the PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 741 of file ivyFraig.c.

742{
743 Ivy_Obj_t * pObj;
744 int i, Limit;
745 Ivy_ManForEachPi( p->pManAig, pObj, i )
746 {
747 Ivy_NodeAssignConst( p, pObj, Ivy_InfoHasBit(pPat, i) );
748// printf( "%d", Ivy_InfoHasBit(pPat, i) );
749 }
750// printf( "\n" );
751
752 Limit = IVY_MIN( Ivy_ManPiNum(p->pManAig), p->nSimWords * 32 - 1 );
753 for ( i = 0; i < Limit; i++ )
754 Ivy_InfoXorBit( Ivy_ObjSim( Ivy_ManPi(p->pManAig,i) )->pData, i+1 );
755}
void Ivy_NodeAssignConst(Ivy_FraigMan_t *p, Ivy_Obj_t *pObj, int fConst1)
Definition ivyFraig.c:701
#define IVY_MIN(a, b)
MACRO DEFINITIONS ///.
Definition ivy.h:182
#define Ivy_ManForEachPi(p, pObj, i)
ITERATORS ///.
Definition ivy.h:387
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigAssignRandom()

void Ivy_FraigAssignRandom ( Ivy_FraigMan_t * p)

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

Synopsis [Assings random simulation info for the PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 722 of file ivyFraig.c.

723{
724 Ivy_Obj_t * pObj;
725 int i;
726 Ivy_ManForEachPi( p->pManAig, pObj, i )
727 Ivy_NodeAssignRandom( p, pObj );
728}
void Ivy_NodeAssignRandom(Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
Definition ivyFraig.c:680
Here is the call graph for this function:

◆ Ivy_FraigCheckOutputSims()

int Ivy_FraigCheckOutputSims ( Ivy_FraigMan_t * p)

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

Synopsis [Returns 1 if the one of the output is already non-constant 0.]

Description []

SideEffects []

SeeAlso []

Definition at line 1349 of file ivyFraig.c.

1350{
1351 Ivy_Obj_t * pObj;
1352 int i;
1353 // make sure the reference simulation pattern does not detect the bug
1354// pObj = Ivy_ManPo( p->pManAig, 0 );
1355 Ivy_ManForEachPo( p->pManAig, pObj, i )
1356 {
1357 //assert( Ivy_ObjFanin0(pObj)->fPhase == (unsigned)Ivy_ObjFaninC0(pObj) ); // Ivy_ObjFaninPhase(Ivy_ObjChild0(pObj)) == 0
1358 // complement simulation info
1359// if ( Ivy_ObjFanin0(pObj)->fPhase ^ Ivy_ObjFaninC0(pObj) ) // Ivy_ObjFaninPhase(Ivy_ObjChild0(pObj))
1360// Ivy_NodeComplementSim( p, Ivy_ObjFanin0(pObj) );
1361 // check
1362 if ( !Ivy_NodeHasZeroSim( p, Ivy_ObjFanin0(pObj) ) )
1363 {
1364 // create the counter-example from this pattern
1365 Ivy_FraigCheckOutputSimsSavePattern( p, Ivy_ObjFanin0(pObj) );
1366 return 1;
1367 }
1368 // complement simulation info
1369// if ( Ivy_ObjFanin0(pObj)->fPhase ^ Ivy_ObjFaninC0(pObj) )
1370// Ivy_NodeComplementSim( p, Ivy_ObjFanin0(pObj) );
1371 }
1372 return 0;
1373}
void Ivy_FraigCheckOutputSimsSavePattern(Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
Definition ivyFraig.c:1307
int Ivy_NodeHasZeroSim(Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
Definition ivyFraig.c:768
#define Ivy_ManForEachPo(p, pObj, i)
Definition ivy.h:390
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigCheckOutputSimsSavePattern()

void Ivy_FraigCheckOutputSimsSavePattern ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pObj )

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

Synopsis [Creates the counter-example from the successful pattern.]

Description []

SideEffects []

SeeAlso []

Definition at line 1307 of file ivyFraig.c.

1308{
1309 Ivy_FraigSim_t * pSims;
1310 int i, k, BestPat, * pModel;
1311 // find the word of the pattern
1312 pSims = Ivy_ObjSim(pObj);
1313 for ( i = 0; i < p->nSimWords; i++ )
1314 if ( pSims->pData[i] )
1315 break;
1316 assert( i < p->nSimWords );
1317 // find the bit of the pattern
1318 for ( k = 0; k < 32; k++ )
1319 if ( pSims->pData[i] & (1 << k) )
1320 break;
1321 assert( k < 32 );
1322 // determine the best pattern
1323 BestPat = i * 32 + k;
1324 // fill in the counter-example data
1325 pModel = ABC_ALLOC( int, Ivy_ManPiNum(p->pManFraig) );
1326 Ivy_ManForEachPi( p->pManAig, pObj, i )
1327 {
1328 pModel[i] = Ivy_InfoHasBit(Ivy_ObjSim(pObj)->pData, BestPat);
1329// printf( "%d", pModel[i] );
1330 }
1331// printf( "\n" );
1332 // set the model
1333 assert( p->pManFraig->pData == NULL );
1334 p->pManFraig->pData = pModel;
1335 return;
1336}
struct Ivy_FraigSim_t_ Ivy_FraigSim_t
Definition ivyFraig.c:34
unsigned pData[0]
Definition ivyFraig.c:50
Here is the caller graph for this function:

◆ Ivy_FraigCleanPatScores()

void Ivy_FraigCleanPatScores ( Ivy_FraigMan_t * p)

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

Synopsis [Cleans pattern scores.]

Description []

SideEffects []

SeeAlso []

Definition at line 1664 of file ivyFraig.c.

1665{
1666 int i, nLimit = p->nSimWords * 32;
1667 for ( i = 0; i < nLimit; i++ )
1668 p->pPatScores[i] = 0;
1669}
Here is the caller graph for this function:

◆ Ivy_FraigCollectSuper()

Vec_Ptr_t * Ivy_FraigCollectSuper ( Ivy_Obj_t * pObj,
int fUseMuxes )

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

Synopsis [Collects the supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 2498 of file ivyFraig.c.

2499{
2500 Vec_Ptr_t * vSuper;
2501 assert( !Ivy_IsComplement(pObj) );
2502 assert( !Ivy_ObjIsPi(pObj) );
2503 vSuper = Vec_PtrAlloc( 4 );
2504 Ivy_FraigCollectSuper_rec( pObj, vSuper, 1, fUseMuxes );
2505 return vSuper;
2506}
void Ivy_FraigCollectSuper_rec(Ivy_Obj_t *pObj, Vec_Ptr_t *vSuper, int fFirst, int fUseMuxes)
Definition ivyFraig.c:2473
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:

◆ Ivy_FraigCollectSuper_rec()

void Ivy_FraigCollectSuper_rec ( Ivy_Obj_t * pObj,
Vec_Ptr_t * vSuper,
int fFirst,
int fUseMuxes )

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

Synopsis [Collects the supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 2473 of file ivyFraig.c.

2474{
2475 // if the new node is complemented or a PI, another gate begins
2476 if ( Ivy_IsComplement(pObj) || Ivy_ObjIsPi(pObj) || (!fFirst && Ivy_ObjRefs(pObj) > 1) ||
2477 (fUseMuxes && Ivy_ObjIsMuxType(pObj)) )
2478 {
2479 Vec_PtrPushUnique( vSuper, pObj );
2480 return;
2481 }
2482 // go through the branches
2483 Ivy_FraigCollectSuper_rec( Ivy_ObjChild0(pObj), vSuper, 0, fUseMuxes );
2484 Ivy_FraigCollectSuper_rec( Ivy_ObjChild1(pObj), vSuper, 0, fUseMuxes );
2485}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigCountClassNodes()

int Ivy_FraigCountClassNodes ( Ivy_Obj_t * pClass)

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

Synopsis [Count the number of elements in the class.]

Description []

SideEffects []

SeeAlso []

Definition at line 1446 of file ivyFraig.c.

1447{
1448 Ivy_Obj_t * pObj;
1449 int Counter = 0;
1450 Ivy_FraigForEachClassNode( pClass, pObj )
1451 Counter++;
1452 return Counter;
1453}
#define Ivy_FraigForEachClassNode(pClass, pEnt)
Definition ivyFraig.c:176
Here is the caller graph for this function:

◆ Ivy_FraigCountPairsClasses()

int Ivy_FraigCountPairsClasses ( Ivy_FraigMan_t * p)

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

Synopsis [Count the number of pairs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1147 of file ivyFraig.c.

1148{
1149 Ivy_Obj_t * pClass, * pNode;
1150 int nPairs = 0, nNodes;
1151 return nPairs;
1152
1153 Ivy_FraigForEachEquivClass( p->lClasses.pHead, pClass )
1154 {
1155 nNodes = 0;
1156 Ivy_FraigForEachClassNode( pClass, pNode )
1157 nNodes++;
1158 nPairs += nNodes * (nNodes - 1) / 2;
1159 }
1160 return nPairs;
1161}
#define Ivy_FraigForEachEquivClass(pList, pEnt)
Definition ivyFraig.c:165

◆ Ivy_FraigCreateClasses()

void Ivy_FraigCreateClasses ( Ivy_FraigMan_t * p)

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

Synopsis [Creates initial simulation classes.]

Description [Assumes that simulation info is assigned.]

SideEffects []

SeeAlso []

Definition at line 1174 of file ivyFraig.c.

1175{
1176 Ivy_Obj_t ** pTable;
1177 Ivy_Obj_t * pObj, * pConst1, * pBin, * pEntry;
1178 int i, nTableSize;
1179 unsigned Hash;
1180 pConst1 = Ivy_ManConst1(p->pManAig);
1181 // allocate the table
1182 nTableSize = Ivy_ManObjNum(p->pManAig) / 2 + 13;
1183 pTable = ABC_ALLOC( Ivy_Obj_t *, nTableSize );
1184 memset( pTable, 0, sizeof(Ivy_Obj_t *) * nTableSize );
1185 // collect nodes into the table
1186 Ivy_ManForEachObj( p->pManAig, pObj, i )
1187 {
1188 if ( !Ivy_ObjIsPi(pObj) && !Ivy_ObjIsNode(pObj) )
1189 continue;
1190 Hash = Ivy_NodeHash( p, pObj );
1191 if ( Hash == 0 && Ivy_NodeHasZeroSim( p, pObj ) )
1192 {
1193 Ivy_NodeAddToClass( pConst1, pObj );
1194 continue;
1195 }
1196 // add the node to the table
1197 pBin = pTable[Hash % nTableSize];
1198 Ivy_FraigForEachBinNode( pBin, pEntry )
1199 if ( Ivy_NodeCompareSims( p, pEntry, pObj ) )
1200 {
1201 Ivy_NodeAddToClass( pEntry, pObj );
1202 break;
1203 }
1204 // check if the entry was added
1205 if ( pEntry )
1206 continue;
1207 Ivy_ObjSetNodeHashNext( pObj, pBin );
1208 pTable[Hash % nTableSize] = pObj;
1209 }
1210 // collect non-trivial classes
1211 assert( p->lClasses.pHead == NULL );
1212 Ivy_ManForEachObj( p->pManAig, pObj, i )
1213 {
1214 if ( !Ivy_ObjIsConst1(pObj) && !Ivy_ObjIsPi(pObj) && !Ivy_ObjIsNode(pObj) )
1215 continue;
1216 Ivy_ObjSetNodeHashNext( pObj, NULL );
1217 if ( Ivy_ObjClassNodeRepr(pObj) == NULL )
1218 {
1219 assert( Ivy_ObjClassNodeNext(pObj) == NULL );
1220 continue;
1221 }
1222 // recognize the head of the class
1223 if ( Ivy_ObjClassNodeNext( Ivy_ObjClassNodeRepr(pObj) ) != NULL )
1224 continue;
1225 // clean the class representative and add it to the list
1226 Ivy_ObjSetClassNodeRepr( pObj, NULL );
1227 Ivy_FraigAddClass( &p->lClasses, pObj );
1228 }
1229 // free the table
1230 ABC_FREE( pTable );
1231}
#define Ivy_FraigForEachBinNode(pBin, pEnt)
Definition ivyFraig.c:181
void Ivy_FraigAddClass(Ivy_FraigList_t *pList, Ivy_Obj_t *pClass)
Definition ivyFraig.c:1067
unsigned Ivy_NodeHash(Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
Definition ivyFraig.c:951
int Ivy_NodeCompareSims(Ivy_FraigMan_t *p, Ivy_Obj_t *pObj0, Ivy_Obj_t *pObj1)
Definition ivyFraig.c:810
void Ivy_NodeAddToClass(Ivy_Obj_t *pClass, Ivy_Obj_t *pObj)
Definition ivyFraig.c:1045
#define Ivy_ManForEachObj(p, pObj, i)
Definition ivy.h:393
char * memset()
Here is the call graph for this function:

◆ Ivy_FraigExtractCone()

Aig_Man_t * Ivy_FraigExtractCone ( Ivy_Man_t * p,
Ivy_Obj_t * pObj1,
Ivy_Obj_t * pObj2,
Vec_Int_t * vLeaves )

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

Synopsis [Checks equivalence using BDDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 2867 of file ivyFraig.c.

2868{
2869 Aig_Man_t * pMan;
2870 Aig_Obj_t * pMiter;
2871 Vec_Int_t * vNodes;
2872 Ivy_Obj_t * pObjIvy;
2873 int i;
2874 // collect nodes
2875 vNodes = Vec_IntAlloc( 100 );
2876 Ivy_ManConst1(p)->fMarkB = 1;
2877 Ivy_FraigExtractCone_rec( p, pObj1, vLeaves, vNodes );
2878 Ivy_FraigExtractCone_rec( p, pObj2, vLeaves, vNodes );
2879 Ivy_ManConst1(p)->fMarkB = 0;
2880 // create new manager
2881 pMan = Aig_ManStart( 1000 );
2882 Ivy_ManConst1(p)->pEquiv = (Ivy_Obj_t *)Aig_ManConst1(pMan);
2883 Ivy_ManForEachNodeVec( p, vLeaves, pObjIvy, i )
2884 {
2885 pObjIvy->pEquiv = (Ivy_Obj_t *)Aig_ObjCreateCi( pMan );
2886 pObjIvy->fMarkB = 0;
2887 }
2888 // duplicate internal nodes
2889 Ivy_ManForEachNodeVec( p, vNodes, pObjIvy, i )
2890 {
2891
2892 pObjIvy->pEquiv = (Ivy_Obj_t *)Aig_And( pMan, (Aig_Obj_t *)Ivy_ObjChild0Equiv(pObjIvy), (Aig_Obj_t *)Ivy_ObjChild1Equiv(pObjIvy) );
2893 pObjIvy->fMarkB = 0;
2894
2895 pMiter = (Aig_Obj_t *)pObjIvy->pEquiv;
2896 assert( pMiter->fPhase == pObjIvy->fPhase );
2897 }
2898 // create the PO
2899 pMiter = Aig_Exor( pMan, (Aig_Obj_t *)pObj1->pEquiv, (Aig_Obj_t *)pObj2->pEquiv );
2900 pMiter = Aig_NotCond( pMiter, Aig_Regular(pMiter)->fPhase ^ Aig_IsComplement(pMiter) );
2901
2902/*
2903printf( "Polarity = %d\n", pMiter->fPhase );
2904 if ( Ivy_ObjIsConst1(pObj1) || Ivy_ObjIsConst1(pObj2) )
2905 {
2906 pMiter = Aig_NotCond( pMiter, 1 );
2907printf( "***************\n" );
2908 }
2909*/
2910 pMiter = Aig_ObjCreateCo( pMan, pMiter );
2911//printf( "Polarity = %d\n", pMiter->fPhase );
2912 Aig_ManCleanup( pMan );
2913 Vec_IntFree( vNodes );
2914 return pMan;
2915}
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition aigObj.c:66
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:220
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
int Aig_ManCleanup(Aig_Man_t *p)
Definition aigMan.c:265
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigObj.c:45
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START void Ivy_FraigExtractCone_rec(Ivy_Man_t *p, Ivy_Obj_t *pNode, Vec_Int_t *vLeaves, Vec_Int_t *vNodes)
Definition ivyFraig.c:2840
#define Ivy_ManForEachNodeVec(p, vIds, pObj, i)
Definition ivy.h:408
unsigned int fPhase
Definition aig.h:78
unsigned fMarkB
Definition ivy.h:79
Ivy_Obj_t * pEquiv
Definition ivy.h:93
unsigned fPhase
Definition ivy.h:81
Here is the call graph for this function:

◆ Ivy_FraigExtractCone_rec()

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

Synopsis [Computes truth table of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 2840 of file ivyFraig.c.

2841{
2842 if ( pNode->fMarkB )
2843 return;
2844 pNode->fMarkB = 1;
2845 if ( Ivy_ObjIsPi(pNode) )
2846 {
2847 Vec_IntPush( vLeaves, pNode->Id );
2848 return;
2849 }
2850 assert( Ivy_ObjIsAnd(pNode) );
2851 Ivy_FraigExtractCone_rec( p, Ivy_ObjFanin0(pNode), vLeaves, vNodes );
2852 Ivy_FraigExtractCone_rec( p, Ivy_ObjFanin1(pNode), vLeaves, vNodes );
2853 Vec_IntPush( vNodes, pNode->Id );
2854}
int Id
Definition ivy.h:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigInsertClass()

void Ivy_FraigInsertClass ( Ivy_FraigList_t * pList,
Ivy_Obj_t * pBase,
Ivy_Obj_t * pClass )

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

Synopsis [Updates the list of classes after base class has split.]

Description []

SideEffects []

SeeAlso []

Definition at line 1097 of file ivyFraig.c.

1098{
1099 Ivy_ObjSetEquivListPrev( pClass, pBase );
1100 Ivy_ObjSetEquivListNext( pClass, Ivy_ObjEquivListNext(pBase) );
1101 if ( Ivy_ObjEquivListNext(pBase) )
1102 Ivy_ObjSetEquivListPrev( Ivy_ObjEquivListNext(pBase), pClass );
1103 Ivy_ObjSetEquivListNext( pBase, pClass );
1104 if ( pList->pTail == pBase )
1105 pList->pTail = pClass;
1106 pList->nItems++;
1107}
Here is the caller graph for this function:

◆ Ivy_FraigMiter()

Ivy_Man_t * Ivy_FraigMiter ( Ivy_Man_t * pManAig,
Ivy_FraigParams_t * pParams )

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

Synopsis [Applies brute-force SAT to the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 480 of file ivyFraig.c.

481{
483 Ivy_Man_t * pManAigNew;
484 Ivy_Obj_t * pObj;
485 int i;
486 abctime clk;
487clk = Abc_Clock();
488 assert( Ivy_ManLatchNum(pManAig) == 0 );
489 p = Ivy_FraigStartSimple( pManAig, pParams );
490 // set global limits
491 p->nBTLimitGlobal = s_nBTLimitGlobal;
492 p->nInsLimitGlobal = s_nInsLimitGlobal;
493 // duplicate internal nodes
494 Ivy_ManForEachNode( p->pManAig, pObj, i )
495 pObj->pEquiv = Ivy_And( p->pManFraig, Ivy_ObjChild0Equiv(pObj), Ivy_ObjChild1Equiv(pObj) );
496 // try to prove each output of the miter
497 Ivy_FraigMiterProve( p );
498 // add the POs
499 Ivy_ManForEachPo( p->pManAig, pObj, i )
500 Ivy_ObjCreatePo( p->pManFraig, Ivy_ObjChild0Equiv(pObj) );
501 // clean the new manager
502 Ivy_ManForEachObj( p->pManFraig, pObj, i )
503 {
504 if ( Ivy_ObjFaninVec(pObj) )
505 Vec_PtrFree( Ivy_ObjFaninVec(pObj) );
506 pObj->pNextFan0 = pObj->pNextFan1 = NULL;
507 }
508 // remove dangling nodes
509 Ivy_ManCleanup( p->pManFraig );
510 pManAigNew = p->pManFraig;
511p->timeTotal = Abc_Clock() - clk;
512
513//printf( "Final nodes = %6d. ", Ivy_ManNodeNum(pManAigNew) );
514//ABC_PRT( "Time", p->timeTotal );
515 Ivy_FraigStop( p );
516 return pManAigNew;
517}
ABC_INT64_T abctime
Definition abc_global.h:332
typedefABC_NAMESPACE_IMPL_START struct Ivy_FraigMan_t_ Ivy_FraigMan_t
DECLARATIONS ///.
Definition ivyFraig.c:33
typedefABC_NAMESPACE_HEADER_START struct Ivy_Man_t_ Ivy_Man_t
INCLUDES ///.
Definition ivy.h:46
int Ivy_ManCleanup(Ivy_Man_t *p)
Definition ivyMan.c:265
#define Ivy_ManForEachNode(p, pObj, i)
Definition ivy.h:402
Ivy_Obj_t * Ivy_ObjCreatePo(Ivy_Man_t *p, Ivy_Obj_t *pDriver)
Definition ivyObj.c:61
Ivy_Obj_t * Ivy_And(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
Definition ivyOper.c:84
Ivy_Obj_t * pNextFan1
Definition ivy.h:90
Ivy_Obj_t * pNextFan0
Definition ivy.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigObjAddToFrontier()

void Ivy_FraigObjAddToFrontier ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pObj,
Vec_Ptr_t * vFrontier )

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

Synopsis [Updates the solver clause database.]

Description []

SideEffects []

SeeAlso []

Definition at line 2519 of file ivyFraig.c.

2520{
2521 assert( !Ivy_IsComplement(pObj) );
2522 if ( Ivy_ObjSatNum(pObj) )
2523 return;
2524 assert( Ivy_ObjSatNum(pObj) == 0 );
2525 assert( Ivy_ObjFaninVec(pObj) == NULL );
2526 if ( Ivy_ObjIsConst1(pObj) )
2527 return;
2528//printf( "Assigning node %d number %d\n", pObj->Id, p->nSatVars );
2529 Ivy_ObjSetSatNum( pObj, p->nSatVars++ );
2530 if ( Ivy_ObjIsNode(pObj) )
2531 Vec_PtrPush( vFrontier, pObj );
2532}

◆ Ivy_FraigParamsDefault()

void Ivy_FraigParamsDefault ( Ivy_FraigParams_t * pParams)

FUNCTION DEFINITIONS ///.

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

Synopsis [Sets the default solving parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 225 of file ivyFraig.c.

226{
227 memset( pParams, 0, sizeof(Ivy_FraigParams_t) );
228 pParams->nSimWords = 32; // the number of words in the simulation info
229 pParams->dSimSatur = 0.005; // the ratio of refined classes when saturation is reached
230 pParams->fPatScores = 0; // enables simulation pattern scoring
231 pParams->MaxScore = 25; // max score after which resimulation is used
232 pParams->fDoSparse = 1; // skips sparse functions
233// pParams->dActConeRatio = 0.05; // the ratio of cone to be bumped
234// pParams->dActConeBumpMax = 5.0; // the largest bump of activity
235 pParams->dActConeRatio = 0.3; // the ratio of cone to be bumped
236 pParams->dActConeBumpMax = 10.0; // the largest bump of activity
237
238 pParams->nBTLimitNode = 100; // conflict limit at a node
239 pParams->nBTLimitMiter = 500000; // conflict limit at an output
240// pParams->nBTLimitGlobal = 0; // conflict limit global
241// pParams->nInsLimitGlobal = 0; // inspection limit global
242}
struct Ivy_FraigParams_t_ Ivy_FraigParams_t
Definition ivy.h:49
double dActConeBumpMax
Definition ivy.h:139
double dActConeRatio
Definition ivy.h:138
double dSimSatur
Definition ivy.h:135
int nBTLimitMiter
Definition ivy.h:144
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigPerform()

Ivy_Man_t * Ivy_FraigPerform ( Ivy_Man_t * pManAig,
Ivy_FraigParams_t * pParams )

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

Synopsis [Performs fraiging of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 451 of file ivyFraig.c.

452{
454 Ivy_Man_t * pManAigNew;
455 abctime clk;
456 if ( Ivy_ManNodeNum(pManAig) == 0 )
457 return Ivy_ManDup(pManAig);
458clk = Abc_Clock();
459 assert( Ivy_ManLatchNum(pManAig) == 0 );
460 p = Ivy_FraigStart( pManAig, pParams );
461 Ivy_FraigSimulate( p );
462 Ivy_FraigSweep( p );
463 pManAigNew = p->pManFraig;
464p->timeTotal = Abc_Clock() - clk;
465 Ivy_FraigStop( p );
466 return pManAigNew;
467}
Ivy_Man_t * Ivy_ManDup(Ivy_Man_t *p)
Definition ivyMan.c:110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigPrintActivity()

void Ivy_FraigPrintActivity ( Ivy_FraigMan_t * p)

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

Synopsis [Prints variable activity.]

Description []

SideEffects []

SeeAlso []

Definition at line 2080 of file ivyFraig.c.

2081{
2082 int i;
2083 for ( i = 0; i < p->nSatVars; i++ )
2084 printf( "%d %d ", i, (int)p->pSat->activity[i] );
2085 printf( "\n" );
2086}

◆ Ivy_FraigPrintClass()

void Ivy_FraigPrintClass ( Ivy_Obj_t * pClass)

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

Synopsis [Print the class.]

Description []

SideEffects []

SeeAlso []

Definition at line 1426 of file ivyFraig.c.

1427{
1428 Ivy_Obj_t * pObj;
1429 printf( "Class {" );
1430 Ivy_FraigForEachClassNode( pClass, pObj )
1431 printf( " %d(%d)%c", pObj->Id, pObj->Level, pObj->fPhase? '+' : '-' );
1432 printf( " }\n" );
1433}
unsigned Level
Definition ivy.h:84

◆ Ivy_FraigPrintSimClasses()

void Ivy_FraigPrintSimClasses ( Ivy_FraigMan_t * p)

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

Synopsis [Prints simulation classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1466 of file ivyFraig.c.

1467{
1468 Ivy_Obj_t * pClass;
1469 Ivy_FraigForEachEquivClass( p->lClasses.pHead, pClass )
1470 {
1471// Ivy_FraigPrintClass( pClass );
1472 printf( "%d ", Ivy_FraigCountClassNodes( pClass ) );
1473 }
1474// printf( "\n" );
1475}
int Ivy_FraigCountClassNodes(Ivy_Obj_t *pClass)
Definition ivyFraig.c:1446
Here is the call graph for this function:

◆ Ivy_FraigProve()

int Ivy_FraigProve ( Ivy_Man_t ** ppManAig,
void * pPars )

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

Synopsis [Performs combinational equivalence checking for the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 255 of file ivyFraig.c.

256{
257 Prove_Params_t * pParams = (Prove_Params_t *)pPars;
258 Ivy_FraigParams_t Params, * pIvyParams = &Params;
259 Ivy_Man_t * pManAig, * pManTemp;
260 int RetValue, nIter;
261 abctime clk;//, Counter;
262 ABC_INT64_T nSatConfs = 0, nSatInspects = 0;
263
264 // start the network and parameters
265 pManAig = *ppManAig;
266 Ivy_FraigParamsDefault( pIvyParams );
267 pIvyParams->fVerbose = pParams->fVerbose;
268 pIvyParams->fProve = 1;
269
270 if ( pParams->fVerbose )
271 {
272 printf( "RESOURCE LIMITS: Iterations = %d. Rewriting = %s. Fraiging = %s.\n",
273 pParams->nItersMax, pParams->fUseRewriting? "yes":"no", pParams->fUseFraiging? "yes":"no" );
274 printf( "Miter = %d (%3.1f). Rwr = %d (%3.1f). Fraig = %d (%3.1f). Last = %d.\n",
275 pParams->nMiteringLimitStart, pParams->nMiteringLimitMulti,
277 pParams->nFraigingLimitStart, pParams->nFraigingLimitMulti, pParams->nMiteringLimitLast );
278 }
279
280 // if SAT only, solve without iteration
281 if ( !pParams->fUseRewriting && !pParams->fUseFraiging )
282 {
283 clk = Abc_Clock();
284 pIvyParams->nBTLimitMiter = pParams->nMiteringLimitLast / Ivy_ManPoNum(pManAig);
285 pManAig = Ivy_FraigMiter( pManTemp = pManAig, pIvyParams ); Ivy_ManStop( pManTemp );
286 RetValue = Ivy_FraigMiterStatus( pManAig );
287 Ivy_FraigMiterPrint( pManAig, "SAT solving", clk, pParams->fVerbose );
288 *ppManAig = pManAig;
289 return RetValue;
290 }
291
292 if ( Ivy_ManNodeNum(pManAig) < 500 )
293 {
294 // run the first mitering
295 clk = Abc_Clock();
296 pIvyParams->nBTLimitMiter = pParams->nMiteringLimitStart / Ivy_ManPoNum(pManAig);
297 pManAig = Ivy_FraigMiter( pManTemp = pManAig, pIvyParams ); Ivy_ManStop( pManTemp );
298 RetValue = Ivy_FraigMiterStatus( pManAig );
299 Ivy_FraigMiterPrint( pManAig, "SAT solving", clk, pParams->fVerbose );
300 if ( RetValue >= 0 )
301 {
302 *ppManAig = pManAig;
303 return RetValue;
304 }
305 }
306
307 // check the current resource limits
308 RetValue = -1;
309 for ( nIter = 0; nIter < pParams->nItersMax; nIter++ )
310 {
311 if ( pParams->fVerbose )
312 {
313 printf( "ITERATION %2d : Confs = %6d. FraigBTL = %3d. \n", nIter+1,
314 (int)(pParams->nMiteringLimitStart * pow(pParams->nMiteringLimitMulti,nIter)),
315 (int)(pParams->nFraigingLimitStart * pow(pParams->nFraigingLimitMulti,nIter)) );
316 fflush( stdout );
317 }
318
319 // try rewriting
320 if ( pParams->fUseRewriting )
321 { // bug in Ivy_NodeFindCutsAll() when leaves are identical!
322/*
323 clk = Abc_Clock();
324 Counter = (int)(pParams->nRewritingLimitStart * pow(pParams->nRewritingLimitMulti,nIter));
325 pManAig = Ivy_ManRwsat( pManAig, 0 );
326 RetValue = Ivy_FraigMiterStatus( pManAig );
327 Ivy_FraigMiterPrint( pManAig, "Rewriting ", clk, pParams->fVerbose );
328*/
329 }
330 if ( RetValue >= 0 )
331 break;
332
333 // catch the situation when ref pattern detects the bug
334 RetValue = Ivy_FraigMiterStatus( pManAig );
335 if ( RetValue >= 0 )
336 break;
337
338 // try fraiging followed by mitering
339 if ( pParams->fUseFraiging )
340 {
341 clk = Abc_Clock();
342 pIvyParams->nBTLimitNode = (int)(pParams->nFraigingLimitStart * pow(pParams->nFraigingLimitMulti,nIter));
343 pIvyParams->nBTLimitMiter = 1 + (int)(pParams->nMiteringLimitStart * pow(pParams->nMiteringLimitMulti,nIter)) / Ivy_ManPoNum(pManAig);
344 pManAig = Ivy_FraigPerform_int( pManTemp = pManAig, pIvyParams, pParams->nTotalBacktrackLimit, pParams->nTotalInspectLimit, &nSatConfs, &nSatInspects ); Ivy_ManStop( pManTemp );
345 RetValue = Ivy_FraigMiterStatus( pManAig );
346 Ivy_FraigMiterPrint( pManAig, "Fraiging ", clk, pParams->fVerbose );
347 }
348 if ( RetValue >= 0 )
349 break;
350
351 // add to the number of backtracks and inspects
352 pParams->nTotalBacktracksMade += nSatConfs;
353 pParams->nTotalInspectsMade += nSatInspects;
354 // check if global resource limit is reached
355 if ( (pParams->nTotalBacktrackLimit && pParams->nTotalBacktracksMade >= pParams->nTotalBacktrackLimit) ||
356 (pParams->nTotalInspectLimit && pParams->nTotalInspectsMade >= pParams->nTotalInspectLimit) )
357 {
358 printf( "Reached global limit on conflicts/inspects. Quitting.\n" );
359 *ppManAig = pManAig;
360 return -1;
361 }
362 }
363/*
364 if ( RetValue < 0 )
365 {
366 if ( pParams->fVerbose )
367 {
368 printf( "Attempting SAT with conflict limit %d ...\n", pParams->nMiteringLimitLast );
369 fflush( stdout );
370 }
371 clk = Abc_Clock();
372 pIvyParams->nBTLimitMiter = pParams->nMiteringLimitLast / Ivy_ManPoNum(pManAig);
373 if ( pParams->nTotalBacktrackLimit )
374 s_nBTLimitGlobal = pParams->nTotalBacktrackLimit - pParams->nTotalBacktracksMade;
375 if ( pParams->nTotalInspectLimit )
376 s_nInsLimitGlobal = pParams->nTotalInspectLimit - pParams->nTotalInspectsMade;
377 pManAig = Ivy_FraigMiter( pManTemp = pManAig, pIvyParams ); Ivy_ManStop( pManTemp );
378 s_nBTLimitGlobal = 0;
379 s_nInsLimitGlobal = 0;
380 RetValue = Ivy_FraigMiterStatus( pManAig );
381 Ivy_FraigMiterPrint( pManAig, "SAT solving", clk, pParams->fVerbose );
382 // make sure that the sover never returns "undecided" when infinite resource limits are set
383 if( RetValue == -1 && pParams->nTotalInspectLimit == 0 &&
384 pParams->nTotalBacktrackLimit == 0 )
385 {
386 extern void Prove_ParamsPrint( Prove_Params_t * pParams );
387 Prove_ParamsPrint( pParams );
388 printf("ERROR: ABC has returned \"undecided\" in spite of no limits...\n");
389 exit(1);
390 }
391 }
392*/
393 // assign the model if it was proved by rewriting (const 1 miter)
394 if ( RetValue == 0 && pManAig->pData == NULL )
395 {
396 pManAig->pData = ABC_ALLOC( int, Ivy_ManPiNum(pManAig) );
397 memset( pManAig->pData, 0, sizeof(int) * Ivy_ManPiNum(pManAig) );
398 }
399 *ppManAig = pManAig;
400 return RetValue;
401}
struct Prove_ParamsStruct_t_ Prove_Params_t
Definition ivyFraig.c:108
void Ivy_FraigParamsDefault(Ivy_FraigParams_t *pParams)
FUNCTION DEFINITIONS ///.
Definition ivyFraig.c:225
Ivy_Man_t * Ivy_FraigMiter(Ivy_Man_t *pManAig, Ivy_FraigParams_t *pParams)
Definition ivyFraig.c:480
void Ivy_ManStop(Ivy_Man_t *p)
Definition ivyMan.c:238
ABC_INT64_T nTotalBacktracksMade
Definition ivyFraig.c:136
ABC_INT64_T nTotalInspectsMade
Definition ivyFraig.c:137
ABC_INT64_T nTotalBacktrackLimit
Definition ivyFraig.c:133
ABC_INT64_T nTotalInspectLimit
Definition ivyFraig.c:134
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigRefineClass_rec()

int Ivy_FraigRefineClass_rec ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pClass )

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

Synopsis [Recursively refines the class after simulation.]

Description [Returns 1 if the class has changed.]

SideEffects []

SeeAlso []

Definition at line 1244 of file ivyFraig.c.

1245{
1246 Ivy_Obj_t * pClassNew, * pListOld, * pListNew, * pNode;
1247 int RetValue = 0;
1248 // check if there is refinement
1249 pListOld = pClass;
1250 Ivy_FraigForEachClassNode( Ivy_ObjClassNodeNext(pClass), pClassNew )
1251 {
1252 if ( !Ivy_NodeCompareSims(p, pClass, pClassNew) )
1253 {
1254 if ( p->pParams->fPatScores )
1255 Ivy_FraigAddToPatScores( p, pClass, pClassNew );
1256 break;
1257 }
1258 pListOld = pClassNew;
1259 }
1260 if ( pClassNew == NULL )
1261 return 0;
1262 // set representative of the new class
1263 Ivy_ObjSetClassNodeRepr( pClassNew, NULL );
1264 // start the new list
1265 pListNew = pClassNew;
1266 // go through the remaining nodes and sort them into two groups:
1267 // (1) matches of the old node; (2) non-matches of the old node
1268 Ivy_FraigForEachClassNode( Ivy_ObjClassNodeNext(pClassNew), pNode )
1269 if ( Ivy_NodeCompareSims( p, pClass, pNode ) )
1270 {
1271 Ivy_ObjSetClassNodeNext( pListOld, pNode );
1272 pListOld = pNode;
1273 }
1274 else
1275 {
1276 Ivy_ObjSetClassNodeNext( pListNew, pNode );
1277 Ivy_ObjSetClassNodeRepr( pNode, pClassNew );
1278 pListNew = pNode;
1279 }
1280 // finish both lists
1281 Ivy_ObjSetClassNodeNext( pListNew, NULL );
1282 Ivy_ObjSetClassNodeNext( pListOld, NULL );
1283 // update the list of classes
1284 Ivy_FraigInsertClass( &p->lClasses, pClass, pClassNew );
1285 // if the old class is trivial, remove it
1286 if ( Ivy_ObjClassNodeNext(pClass) == NULL )
1287 Ivy_FraigRemoveClass( &p->lClasses, pClass );
1288 // if the new class is trivial, remove it; otherwise, try to refine it
1289 if ( Ivy_ObjClassNodeNext(pClassNew) == NULL )
1290 Ivy_FraigRemoveClass( &p->lClasses, pClassNew );
1291 else
1292 RetValue = Ivy_FraigRefineClass_rec( p, pClassNew );
1293 return RetValue + 1;
1294}
void Ivy_FraigRemoveClass(Ivy_FraigList_t *pList, Ivy_Obj_t *pClass)
Definition ivyFraig.c:1120
int Ivy_FraigRefineClass_rec(Ivy_FraigMan_t *p, Ivy_Obj_t *pClass)
Definition ivyFraig.c:1244
void Ivy_FraigInsertClass(Ivy_FraigList_t *pList, Ivy_Obj_t *pBase, Ivy_Obj_t *pClass)
Definition ivyFraig.c:1097
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigRefineClasses()

int Ivy_FraigRefineClasses ( Ivy_FraigMan_t * p)

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

Synopsis [Refines the classes after simulation.]

Description [Assumes that simulation info is assigned. Returns the number of classes refined.]

SideEffects [Large equivalence class of constant 0 may cause problems.]

SeeAlso []

Definition at line 1387 of file ivyFraig.c.

1388{
1389 Ivy_Obj_t * pClass, * pClass2;
1390 int RetValue, Counter = 0;
1391 abctime clk;
1392 // check if some outputs already became non-constant
1393 // this is a special case when computation can be stopped!!!
1394 if ( p->pParams->fProve )
1396 if ( p->pManFraig->pData )
1397 return 0;
1398 // refine the classed
1399clk = Abc_Clock();
1400 Ivy_FraigForEachEquivClassSafe( p->lClasses.pHead, pClass, pClass2 )
1401 {
1402 if ( pClass->fMarkA )
1403 continue;
1404 RetValue = Ivy_FraigRefineClass_rec( p, pClass );
1405 Counter += ( RetValue > 0 );
1406//if ( Ivy_ObjIsConst1(pClass) )
1407//printf( "%d ", RetValue );
1408//if ( Ivy_ObjIsConst1(pClass) )
1409// p->time1 += Abc_Clock() - clk;
1410 }
1411p->timeRef += Abc_Clock() - clk;
1412 return Counter;
1413}
int Ivy_FraigCheckOutputSims(Ivy_FraigMan_t *p)
Definition ivyFraig.c:1349
#define Ivy_FraigForEachEquivClassSafe(pList, pEnt, pEnt2)
Definition ivyFraig.c:169
unsigned fMarkA
Definition ivy.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigRemoveClass()

void Ivy_FraigRemoveClass ( Ivy_FraigList_t * pList,
Ivy_Obj_t * pClass )

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

Synopsis [Removes equivalence class from the list of classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1120 of file ivyFraig.c.

1121{
1122 if ( pList->pHead == pClass )
1123 pList->pHead = Ivy_ObjEquivListNext(pClass);
1124 if ( pList->pTail == pClass )
1125 pList->pTail = Ivy_ObjEquivListPrev(pClass);
1126 if ( Ivy_ObjEquivListPrev(pClass) )
1127 Ivy_ObjSetEquivListNext( Ivy_ObjEquivListPrev(pClass), Ivy_ObjEquivListNext(pClass) );
1128 if ( Ivy_ObjEquivListNext(pClass) )
1129 Ivy_ObjSetEquivListPrev( Ivy_ObjEquivListNext(pClass), Ivy_ObjEquivListPrev(pClass) );
1130 Ivy_ObjSetEquivListNext( pClass, NULL );
1131 Ivy_ObjSetEquivListPrev( pClass, NULL );
1132 pClass->fMarkA = 0;
1133 pList->nItems--;
1134}
Here is the caller graph for this function:

◆ Ivy_FraigResimulate()

void Ivy_FraigResimulate ( Ivy_FraigMan_t * p)

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

Synopsis [Resimulates fraiging manager after finding a counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 1752 of file ivyFraig.c.

1753{
1754 int nChanges;
1755 Ivy_FraigAssignDist1( p, p->pPatWords );
1757 if ( p->pParams->fPatScores )
1759 nChanges = Ivy_FraigRefineClasses( p );
1760 if ( p->pManFraig->pData )
1761 return;
1762 if ( nChanges < 1 )
1763 printf( "Error: A counter-example did not refine classes!\n" );
1764 assert( nChanges >= 1 );
1765//printf( "Refined classes! = %5d. Changes = %4d.\n", p->lClasses.nItems, nChanges );
1766 if ( !p->pParams->fPatScores )
1767 return;
1768
1769 // perform additional simulation using dist1 patterns derived from successful patterns
1770 while ( Ivy_FraigSelectBestPat(p) > p->pParams->MaxScore )
1771 {
1772 Ivy_FraigAssignDist1( p, p->pPatWords );
1775 nChanges = Ivy_FraigRefineClasses( p );
1776 if ( p->pManFraig->pData )
1777 return;
1778//printf( "Refined class!!! = %5d. Changes = %4d. Pairs = %6d.\n", p->lClasses.nItems, nChanges, Ivy_FraigCountPairsClasses(p) );
1779 if ( nChanges == 0 )
1780 break;
1781 }
1782}
void Ivy_FraigCleanPatScores(Ivy_FraigMan_t *p)
Definition ivyFraig.c:1664
void Ivy_FraigSimulateOne(Ivy_FraigMan_t *p)
Definition ivyFraig.c:990
int Ivy_FraigRefineClasses(Ivy_FraigMan_t *p)
Definition ivyFraig.c:1387
void Ivy_FraigAssignDist1(Ivy_FraigMan_t *p, unsigned *pPat)
Definition ivyFraig.c:741
int Ivy_FraigSelectBestPat(Ivy_FraigMan_t *p)
Definition ivyFraig.c:1713
Here is the call graph for this function:

◆ Ivy_FraigSavePattern()

void Ivy_FraigSavePattern ( Ivy_FraigMan_t * p)

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

Synopsis [Copy pattern from the solver into the internal storage.]

Description []

SideEffects []

SeeAlso []

Definition at line 1543 of file ivyFraig.c.

1544{
1545 Ivy_Obj_t * pObj;
1546 int i;
1547 memset( p->pPatWords, 0, sizeof(unsigned) * p->nPatWords );
1548 Ivy_ManForEachPi( p->pManFraig, pObj, i )
1549// Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPiVars, pObj, i )
1550// if ( p->pSat->model.ptr[Ivy_ObjSatNum(pObj)] == l_True )
1551 if ( p->pSat->model[Ivy_ObjSatNum(pObj)] == l_True )
1552 Ivy_InfoSetBit( p->pPatWords, i );
1553// Ivy_InfoSetBit( p->pPatWords, pObj->Id - 1 );
1554}
#define l_True
Definition bmcBmcS.c:35
Here is the call graph for this function:

◆ Ivy_FraigSavePattern0()

void Ivy_FraigSavePattern0 ( Ivy_FraigMan_t * p)

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

Synopsis [Generated const 0 pattern.]

Description []

SideEffects []

SeeAlso []

Definition at line 1488 of file ivyFraig.c.

1489{
1490 memset( p->pPatWords, 0, sizeof(unsigned) * p->nPatWords );
1491}
Here is the call graph for this function:

◆ Ivy_FraigSavePattern1()

void Ivy_FraigSavePattern1 ( Ivy_FraigMan_t * p)

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

Synopsis [[Generated const 1 pattern.]

Description []

SideEffects []

SeeAlso []

Definition at line 1504 of file ivyFraig.c.

1505{
1506 memset( p->pPatWords, 0xff, sizeof(unsigned) * p->nPatWords );
1507}
Here is the call graph for this function:

◆ Ivy_FraigSavePattern2()

void Ivy_FraigSavePattern2 ( Ivy_FraigMan_t * p)

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

Synopsis [Copy pattern from the solver into the internal storage.]

Description []

SideEffects []

SeeAlso []

Definition at line 1567 of file ivyFraig.c.

1568{
1569 Ivy_Obj_t * pObj;
1570 int i;
1571 memset( p->pPatWords, 0, sizeof(unsigned) * p->nPatWords );
1572// Ivy_ManForEachPi( p->pManFraig, pObj, i )
1573 Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPiVars, pObj, i )
1574// if ( p->pSat->model.ptr[Ivy_ObjSatNum(pObj)] == l_True )
1575 if ( p->pSat->model[Ivy_ObjSatNum(pObj)] == l_True )
1576// Ivy_InfoSetBit( p->pPatWords, i );
1577 Ivy_InfoSetBit( p->pPatWords, pObj->Id - 1 );
1578}
Here is the call graph for this function:

◆ Ivy_FraigSavePattern3()

void Ivy_FraigSavePattern3 ( Ivy_FraigMan_t * p)

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

Synopsis [Copy pattern from the solver into the internal storage.]

Description []

SideEffects []

SeeAlso []

Definition at line 1591 of file ivyFraig.c.

1592{
1593 Ivy_Obj_t * pObj;
1594 int i;
1595 for ( i = 0; i < p->nPatWords; i++ )
1596 p->pPatWords[i] = Ivy_ObjRandomSim();
1597 Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPiVars, pObj, i )
1598// if ( Ivy_InfoHasBit( p->pPatWords, pObj->Id - 1 ) ^ (p->pSat->model.ptr[Ivy_ObjSatNum(pObj)] == l_True) )
1599 if ( Ivy_InfoHasBit( p->pPatWords, pObj->Id - 1 ) ^ sat_solver_var_value(p->pSat, Ivy_ObjSatNum(pObj)) )
1600 Ivy_InfoXorBit( p->pPatWords, pObj->Id - 1 );
1601}

◆ Ivy_FraigSelectBestPat()

int Ivy_FraigSelectBestPat ( Ivy_FraigMan_t * p)

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

Synopsis [Selects the best pattern.]

Description [Returns 1 if such pattern is found.]

SideEffects []

SeeAlso []

Definition at line 1713 of file ivyFraig.c.

1714{
1715 Ivy_FraigSim_t * pSims;
1716 Ivy_Obj_t * pObj;
1717 int i, nLimit = p->nSimWords * 32, MaxScore = 0, BestPat = -1;
1718 for ( i = 1; i < nLimit; i++ )
1719 {
1720 if ( MaxScore < p->pPatScores[i] )
1721 {
1722 MaxScore = p->pPatScores[i];
1723 BestPat = i;
1724 }
1725 }
1726 if ( MaxScore == 0 )
1727 return 0;
1728// if ( MaxScore > p->pParams->MaxScore )
1729// printf( "Max score is %3d. ", MaxScore );
1730 // copy the best pattern into the selected pattern
1731 memset( p->pPatWords, 0, sizeof(unsigned) * p->nPatWords );
1732 Ivy_ManForEachPi( p->pManAig, pObj, i )
1733 {
1734 pSims = Ivy_ObjSim(pObj);
1735 if ( Ivy_InfoHasBit(pSims->pData, BestPat) )
1736 Ivy_InfoSetBit(p->pPatWords, i);
1737 }
1738 return MaxScore;
1739}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigSetActivityFactors_rec()

int Ivy_FraigSetActivityFactors_rec ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pObj,
int LevelMin,
int LevelMax )

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

Synopsis [Sets variable activities in the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 2600 of file ivyFraig.c.

2601{
2602 Vec_Ptr_t * vFanins;
2603 Ivy_Obj_t * pFanin;
2604 int i, Counter = 0;
2605 assert( !Ivy_IsComplement(pObj) );
2606 assert( Ivy_ObjSatNum(pObj) );
2607 // skip visited variables
2608 if ( Ivy_ObjIsTravIdCurrent(p->pManFraig, pObj) )
2609 return 0;
2610 Ivy_ObjSetTravIdCurrent(p->pManFraig, pObj);
2611 // add the PI to the list
2612 if ( pObj->Level <= (unsigned)LevelMin || Ivy_ObjIsPi(pObj) )
2613 return 0;
2614 // set the factor of this variable
2615 // (LevelMax-LevelMin) / (pObj->Level-LevelMin) = p->pParams->dActConeBumpMax / ThisBump
2616 p->pSat->factors[Ivy_ObjSatNum(pObj)] = p->pParams->dActConeBumpMax * (pObj->Level - LevelMin)/(LevelMax - LevelMin);
2617 veci_push(&p->pSat->act_vars, Ivy_ObjSatNum(pObj));
2618 // explore the fanins
2619 vFanins = Ivy_ObjFaninVec( pObj );
2620 Vec_PtrForEachEntry( Ivy_Obj_t *, vFanins, pFanin, i )
2621 Counter += Ivy_FraigSetActivityFactors_rec( p, Ivy_Regular(pFanin), LevelMin, LevelMax );
2622 return 1 + Counter;
2623}
int Ivy_FraigSetActivityFactors_rec(Ivy_FraigMan_t *p, Ivy_Obj_t *pObj, int LevelMin, int LevelMax)
Definition ivyFraig.c:2600
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigSimulateOne()

void Ivy_FraigSimulateOne ( Ivy_FraigMan_t * p)

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

Synopsis [Simulates AIG manager.]

Description [Assumes that the PI simulation info is attached.]

SideEffects []

SeeAlso []

Definition at line 990 of file ivyFraig.c.

991{
992 Ivy_Obj_t * pObj;
993 int i;
994 abctime clk;
995clk = Abc_Clock();
996 Ivy_ManForEachNode( p->pManAig, pObj, i )
997 {
998 Ivy_NodeSimulate( p, pObj );
999/*
1000 if ( Ivy_ObjFraig(pObj) == NULL )
1001 printf( "%3d --- -- %d : ", pObj->Id, pObj->fPhase );
1002 else
1003 printf( "%3d %3d %2d %d : ", pObj->Id, Ivy_Regular(Ivy_ObjFraig(pObj))->Id, Ivy_ObjSatNum(Ivy_Regular(Ivy_ObjFraig(pObj))), pObj->fPhase );
1004 Extra_PrintBinary( stdout, Ivy_ObjSim(pObj), 30 );
1005 printf( "\n" );
1006*/
1007 }
1008p->timeSim += Abc_Clock() - clk;
1009p->nSimRounds++;
1010}
void Ivy_NodeSimulate(Ivy_FraigMan_t *p, Ivy_Obj_t *pObj)
Definition ivyFraig.c:888
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigSimulateOneSim()

void Ivy_FraigSimulateOneSim ( Ivy_FraigMan_t * p)

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

Synopsis [Simulates AIG manager.]

Description [Assumes that the PI simulation info is attached.]

SideEffects []

SeeAlso []

Definition at line 1023 of file ivyFraig.c.

1024{
1025 Ivy_FraigSim_t * pSims;
1026 abctime clk;
1027clk = Abc_Clock();
1028 for ( pSims = p->pSimStart; pSims; pSims = pSims->pNext )
1029 Ivy_NodeSimulateSim( p, pSims );
1030p->timeSim += Abc_Clock() - clk;
1031p->nSimRounds++;
1032}
void Ivy_NodeSimulateSim(Ivy_FraigMan_t *p, Ivy_FraigSim_t *pSims)
Definition ivyFraig.c:833
Ivy_FraigSim_t * pNext
Definition ivyFraig.c:47
Here is the call graph for this function:

◆ Ivy_NodeAddToClass()

void Ivy_NodeAddToClass ( Ivy_Obj_t * pClass,
Ivy_Obj_t * pObj )

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

Synopsis [Adds one node to the equivalence class.]

Description []

SideEffects []

SeeAlso []

Definition at line 1045 of file ivyFraig.c.

1046{
1047 if ( Ivy_ObjClassNodeNext(pClass) == NULL )
1048 Ivy_ObjSetClassNodeNext( pClass, pObj );
1049 else
1050 Ivy_ObjSetClassNodeNext( Ivy_ObjClassNodeLast(pClass), pObj );
1051 Ivy_ObjSetClassNodeLast( pClass, pObj );
1052 Ivy_ObjSetClassNodeRepr( pObj, pClass );
1053 Ivy_ObjSetClassNodeNext( pObj, NULL );
1054}
Here is the caller graph for this function:

◆ Ivy_NodeAssignConst()

void Ivy_NodeAssignConst ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pObj,
int fConst1 )

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

Synopsis [Assigns constant patterns to the PI node.]

Description []

SideEffects []

SeeAlso []

Definition at line 701 of file ivyFraig.c.

702{
703 Ivy_FraigSim_t * pSims;
704 int i;
705 assert( Ivy_ObjIsPi(pObj) );
706 pSims = Ivy_ObjSim(pObj);
707 for ( i = 0; i < p->nSimWords; i++ )
708 pSims->pData[i] = fConst1? ~(unsigned)0 : 0;
709}
Here is the caller graph for this function:

◆ Ivy_NodeAssignRandom()

void Ivy_NodeAssignRandom ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pObj )

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

Synopsis [Assigns random patterns to the PI node.]

Description []

SideEffects []

SeeAlso []

Definition at line 680 of file ivyFraig.c.

681{
682 Ivy_FraigSim_t * pSims;
683 int i;
684 assert( Ivy_ObjIsPi(pObj) );
685 pSims = Ivy_ObjSim(pObj);
686 for ( i = 0; i < p->nSimWords; i++ )
687 pSims->pData[i] = Ivy_ObjRandomSim();
688}
Here is the caller graph for this function:

◆ Ivy_NodeCompareSims()

int Ivy_NodeCompareSims ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pObj0,
Ivy_Obj_t * pObj1 )

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

Synopsis [Returns 1 if simulation infos are equal.]

Description []

SideEffects []

SeeAlso []

Definition at line 810 of file ivyFraig.c.

811{
812 Ivy_FraigSim_t * pSims0, * pSims1;
813 int i;
814 pSims0 = Ivy_ObjSim(pObj0);
815 pSims1 = Ivy_ObjSim(pObj1);
816 for ( i = 0; i < p->nSimWords; i++ )
817 if ( pSims0->pData[i] != pSims1->pData[i] )
818 return 0;
819 return 1;
820}
Here is the caller graph for this function:

◆ Ivy_NodeComplementSim()

void Ivy_NodeComplementSim ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pObj )

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

Synopsis [Returns 1 if simulation info is composed of all zeros.]

Description []

SideEffects []

SeeAlso []

Definition at line 790 of file ivyFraig.c.

791{
792 Ivy_FraigSim_t * pSims;
793 int i;
794 pSims = Ivy_ObjSim(pObj);
795 for ( i = 0; i < p->nSimWords; i++ )
796 pSims->pData[i] = ~pSims->pData[i];
797}

◆ Ivy_NodeHash()

unsigned Ivy_NodeHash ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pObj )

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

Synopsis [Computes hash value using simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 951 of file ivyFraig.c.

952{
953 static int s_FPrimes[128] = {
954 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
955 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
956 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
957 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
958 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
959 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
960 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
961 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
962 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
963 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
964 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
965 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
966 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
967 };
968 Ivy_FraigSim_t * pSims;
969 unsigned uHash;
970 int i;
971 assert( p->nSimWords <= 128 );
972 uHash = 0;
973 pSims = Ivy_ObjSim(pObj);
974 for ( i = 0; i < p->nSimWords; i++ )
975 uHash ^= pSims->pData[i] * s_FPrimes[i];
976 return uHash;
977}
Here is the caller graph for this function:

◆ Ivy_NodeHasZeroSim()

int Ivy_NodeHasZeroSim ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pObj )

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

Synopsis [Returns 1 if simulation info is composed of all zeros.]

Description []

SideEffects []

SeeAlso []

Definition at line 768 of file ivyFraig.c.

769{
770 Ivy_FraigSim_t * pSims;
771 int i;
772 pSims = Ivy_ObjSim(pObj);
773 for ( i = 0; i < p->nSimWords; i++ )
774 if ( pSims->pData[i] )
775 return 0;
776 return 1;
777}
Here is the caller graph for this function:

◆ Ivy_NodeSimulate()

void Ivy_NodeSimulate ( Ivy_FraigMan_t * p,
Ivy_Obj_t * pObj )

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

Synopsis [Simulates one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 888 of file ivyFraig.c.

889{
890 Ivy_FraigSim_t * pSims, * pSims0, * pSims1;
891 int fCompl, fCompl0, fCompl1, i;
892 assert( !Ivy_IsComplement(pObj) );
893 // get hold of the simulation information
894 pSims = Ivy_ObjSim(pObj);
895 pSims0 = Ivy_ObjSim(Ivy_ObjFanin0(pObj));
896 pSims1 = Ivy_ObjSim(Ivy_ObjFanin1(pObj));
897 // get complemented attributes of the children using their random info
898 fCompl = pObj->fPhase;
899 fCompl0 = Ivy_ObjFaninPhase(Ivy_ObjChild0(pObj));
900 fCompl1 = Ivy_ObjFaninPhase(Ivy_ObjChild1(pObj));
901 // simulate
902 if ( fCompl0 && fCompl1 )
903 {
904 if ( fCompl )
905 for ( i = 0; i < p->nSimWords; i++ )
906 pSims->pData[i] = (pSims0->pData[i] | pSims1->pData[i]);
907 else
908 for ( i = 0; i < p->nSimWords; i++ )
909 pSims->pData[i] = ~(pSims0->pData[i] | pSims1->pData[i]);
910 }
911 else if ( fCompl0 && !fCompl1 )
912 {
913 if ( fCompl )
914 for ( i = 0; i < p->nSimWords; i++ )
915 pSims->pData[i] = (pSims0->pData[i] | ~pSims1->pData[i]);
916 else
917 for ( i = 0; i < p->nSimWords; i++ )
918 pSims->pData[i] = (~pSims0->pData[i] & pSims1->pData[i]);
919 }
920 else if ( !fCompl0 && fCompl1 )
921 {
922 if ( fCompl )
923 for ( i = 0; i < p->nSimWords; i++ )
924 pSims->pData[i] = (~pSims0->pData[i] | pSims1->pData[i]);
925 else
926 for ( i = 0; i < p->nSimWords; i++ )
927 pSims->pData[i] = (pSims0->pData[i] & ~pSims1->pData[i]);
928 }
929 else // if ( !fCompl0 && !fCompl1 )
930 {
931 if ( fCompl )
932 for ( i = 0; i < p->nSimWords; i++ )
933 pSims->pData[i] = ~(pSims0->pData[i] & pSims1->pData[i]);
934 else
935 for ( i = 0; i < p->nSimWords; i++ )
936 pSims->pData[i] = (pSims0->pData[i] & pSims1->pData[i]);
937 }
938}
Here is the caller graph for this function:

◆ Ivy_NodeSimulateSim()

void Ivy_NodeSimulateSim ( Ivy_FraigMan_t * p,
Ivy_FraigSim_t * pSims )

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

Synopsis [Simulates one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 833 of file ivyFraig.c.

834{
835 unsigned * pData, * pData0, * pData1;
836 int i;
837 pData = pSims->pData;
838 pData0 = pSims->pFanin0->pData;
839 pData1 = pSims->pFanin1->pData;
840 switch( pSims->Type )
841 {
842 case 0:
843 for ( i = 0; i < p->nSimWords; i++ )
844 pData[i] = (pData0[i] & pData1[i]);
845 break;
846 case 1:
847 for ( i = 0; i < p->nSimWords; i++ )
848 pData[i] = ~(pData0[i] & pData1[i]);
849 break;
850 case 2:
851 for ( i = 0; i < p->nSimWords; i++ )
852 pData[i] = (pData0[i] & ~pData1[i]);
853 break;
854 case 3:
855 for ( i = 0; i < p->nSimWords; i++ )
856 pData[i] = (~pData0[i] | pData1[i]);
857 break;
858 case 4:
859 for ( i = 0; i < p->nSimWords; i++ )
860 pData[i] = (~pData0[i] & pData1[i]);
861 break;
862 case 5:
863 for ( i = 0; i < p->nSimWords; i++ )
864 pData[i] = (pData0[i] | ~pData1[i]);
865 break;
866 case 6:
867 for ( i = 0; i < p->nSimWords; i++ )
868 pData[i] = ~(pData0[i] | pData1[i]);
869 break;
870 case 7:
871 for ( i = 0; i < p->nSimWords; i++ )
872 pData[i] = (pData0[i] | pData1[i]);
873 break;
874 }
875}
Ivy_FraigSim_t * pFanin0
Definition ivyFraig.c:48
Ivy_FraigSim_t * pFanin1
Definition ivyFraig.c:49
Here is the caller graph for this function: