ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaEra2.c File Reference
#include "gia.h"
#include "giaAig.h"
#include "sat/cnf/cnf.h"
#include "sat/bsat/satSolver.h"
Include dependency graph for giaEra2.c:

Go to the source code of this file.

Classes

struct  Gia_PtrAre_t_
 
union  Gia_PtrAreInt_t_
 
struct  Gia_ObjAre_t_
 
struct  Gia_StaAre_t_
 
struct  Gia_ManAre_t_
 

Macros

#define MAX_CALL_NUM   (1000000)
 DECLARATIONS ///.
 
#define MAX_ITEM_NUM   (1<<20)
 
#define MAX_PAGE_NUM   (1<<11)
 
#define MAX_VARS_NUM   (1<<14)
 
#define MAX_CUBE_NUM   63
 
#define Gia_ManAreForEachCubeList(p, pList, pCube)
 
#define Gia_ManAreForEachCubeList2(p, iList, pCube, iCube)
 
#define Gia_ManAreForEachCubeStore(p, pCube, i)
 
#define Gia_ManAreForEachCubeVec(vVec, p, pCube, i)
 

Typedefs

typedef struct Gia_PtrAre_t_ Gia_PtrAre_t
 
typedef union Gia_PtrAreInt_t_ Gia_PtrAreInt_t
 
typedef struct Gia_ObjAre_t_ Gia_ObjAre_t
 
typedef struct Gia_StaAre_t_ Gia_StaAre_t
 
typedef struct Gia_ManAre_t_ Gia_ManAre_t
 

Functions

void Gia_ManCountMintermsInCube (Gia_StaAre_t *pCube, int nVars, unsigned *pStore)
 FUNCTION DEFINITIONS ///.
 
int Gia_ManCountMinterms (Gia_ManAre_t *p)
 
int Gia_ManDeriveCiTfo_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vRes)
 
Vec_Int_tGia_ManDeriveCiTfoOne (Gia_Man_t *p, Gia_Obj_t *pPivot)
 
Vec_Vec_tGia_ManDeriveCiTfo (Gia_Man_t *p)
 
Gia_ManAre_tGia_ManAreCreate (Gia_Man_t *pAig)
 
void Gia_ManAreFree (Gia_ManAre_t *p)
 
void Gia_ManArePrintCube (Gia_ManAre_t *p, Gia_StaAre_t *pSta)
 
int Gia_ManAreDepth (Gia_ManAre_t *p, int iState)
 
int Gia_ManAreListCountUsed_rec (Gia_ManAre_t *p, Gia_PtrAre_t Root, int fTree)
 
int Gia_ManArePrintUsed_rec (Gia_ManAre_t *p, Gia_PtrAre_t Root, int fTree)
 
int Gia_ManAreFindBestVar (Gia_ManAre_t *p, Gia_PtrAre_t List)
 
int Gia_ManAreCubeCheckTree_rec (Gia_ManAre_t *p, Gia_ObjAre_t *pObj, Gia_StaAre_t *pSta)
 
void Gia_ManAreCubeAddToTree_rec (Gia_ManAre_t *p, Gia_ObjAre_t *pObj, Gia_StaAre_t *pSta)
 
int Gia_ManAreCubeCollectTree_rec (Gia_ManAre_t *p, Gia_ObjAre_t *pObj, Gia_StaAre_t *pSta)
 
int Gia_ManAreCubeCheckTree (Gia_ManAre_t *p, Gia_StaAre_t *pSta)
 
void Gia_ManAreMostUsedPi_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
int Gia_ManCheckPOs_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
int Gia_ManAreDeriveNexts_rec (Gia_ManAre_t *p, Gia_PtrAre_t Sta)
 
int Gia_ManAreDeriveNexts (Gia_ManAre_t *p, Gia_PtrAre_t Sta)
 
void Gia_ManArePrintReport (Gia_ManAre_t *p, abctime Time, int fFinal)
 
int Gia_ManArePerform (Gia_Man_t *pAig, int nStatesMax, int fMiter, int fVerbose)
 
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START void Gia_ManAreDeriveCexSatStart (Gia_ManAre_t *p)
 
void Gia_ManAreDeriveCexSatStop (Gia_ManAre_t *p)
 
void Gia_ManAreDeriveCexSat (Gia_ManAre_t *p, Gia_StaAre_t *pCur, Gia_StaAre_t *pNext, int iOutFailed)
 
Abc_Cex_tGia_ManAreDeriveCex (Gia_ManAre_t *p, Gia_StaAre_t *pLast)
 

Macro Definition Documentation

◆ Gia_ManAreForEachCubeList

#define Gia_ManAreForEachCubeList ( p,
pList,
pCube )
Value:
for ( pCube = pList; Gia_StaIsGood(p, pCube); pCube = Gia_StaNext(p, pCube) )
Cube * p
Definition exorList.c:222

Definition at line 160 of file giaEra2.c.

160#define Gia_ManAreForEachCubeList( p, pList, pCube ) \
161 for ( pCube = pList; Gia_StaIsGood(p, pCube); pCube = Gia_StaNext(p, pCube) )

◆ Gia_ManAreForEachCubeList2

#define Gia_ManAreForEachCubeList2 ( p,
iList,
pCube,
iCube )
Value:
for ( iCube = Gia_Ptr2Int(iList), pCube = Gia_ManAreSta(p, iList); \
Gia_StaIsGood(p, pCube); \
iCube = Gia_Ptr2Int(pCube->iNext), pCube = Gia_StaNext(p, pCube) )

Definition at line 162 of file giaEra2.c.

162#define Gia_ManAreForEachCubeList2( p, iList, pCube, iCube ) \
163 for ( iCube = Gia_Ptr2Int(iList), pCube = Gia_ManAreSta(p, iList); \
164 Gia_StaIsGood(p, pCube); \
165 iCube = Gia_Ptr2Int(pCube->iNext), pCube = Gia_StaNext(p, pCube) )

◆ Gia_ManAreForEachCubeStore

#define Gia_ManAreForEachCubeStore ( p,
pCube,
i )
Value:
for ( i = 1; i < p->nStas && (pCube = Gia_ManAreStaInt(p, i)); i++ )

Definition at line 166 of file giaEra2.c.

166#define Gia_ManAreForEachCubeStore( p, pCube, i ) \
167 for ( i = 1; i < p->nStas && (pCube = Gia_ManAreStaInt(p, i)); i++ )

◆ Gia_ManAreForEachCubeVec

#define Gia_ManAreForEachCubeVec ( vVec,
p,
pCube,
i )
Value:
for ( i = 0; i < Vec_IntSize(vVec) && (pCube = Gia_ManAreStaInt(p, Vec_IntEntry(vVec,i))); i++ )

Definition at line 168 of file giaEra2.c.

168#define Gia_ManAreForEachCubeVec( vVec, p, pCube, i ) \
169 for ( i = 0; i < Vec_IntSize(vVec) && (pCube = Gia_ManAreStaInt(p, Vec_IntEntry(vVec,i))); i++ )

◆ MAX_CALL_NUM

#define MAX_CALL_NUM   (1000000)

DECLARATIONS ///.

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

FileName [gia.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
gia.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 38 of file giaEra2.c.

◆ MAX_CUBE_NUM

#define MAX_CUBE_NUM   63

Definition at line 42 of file giaEra2.c.

◆ MAX_ITEM_NUM

#define MAX_ITEM_NUM   (1<<20)

Definition at line 39 of file giaEra2.c.

◆ MAX_PAGE_NUM

#define MAX_PAGE_NUM   (1<<11)

Definition at line 40 of file giaEra2.c.

◆ MAX_VARS_NUM

#define MAX_VARS_NUM   (1<<14)

Definition at line 41 of file giaEra2.c.

Typedef Documentation

◆ Gia_ManAre_t

typedef struct Gia_ManAre_t_ Gia_ManAre_t

Definition at line 81 of file giaEra2.c.

◆ Gia_ObjAre_t

typedef struct Gia_ObjAre_t_ Gia_ObjAre_t

Definition at line 61 of file giaEra2.c.

◆ Gia_PtrAre_t

typedef struct Gia_PtrAre_t_ Gia_PtrAre_t

Definition at line 45 of file giaEra2.c.

◆ Gia_PtrAreInt_t

Definition at line 53 of file giaEra2.c.

◆ Gia_StaAre_t

typedef struct Gia_StaAre_t_ Gia_StaAre_t

Definition at line 72 of file giaEra2.c.

Function Documentation

◆ Gia_ManAreCreate()

Gia_ManAre_t * Gia_ManAreCreate ( Gia_Man_t * pAig)

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

Synopsis [Creates reachability manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 481 of file giaEra2.c.

482{
483 Gia_ManAre_t * p;
484 assert( sizeof(Gia_ObjAre_t) == 16 );
485 p = ABC_CALLOC( Gia_ManAre_t, 1 );
486 p->pAig = pAig;
487 p->nWords = Abc_BitWordNum( 2 * Gia_ManRegNum(pAig) );
488 p->nSize = sizeof(Gia_StaAre_t)/4 + p->nWords;
489 p->ppObjs = ABC_CALLOC( unsigned *, MAX_PAGE_NUM );
490 p->ppStas = ABC_CALLOC( unsigned *, MAX_PAGE_NUM );
491 p->vCiTfos = Gia_ManDeriveCiTfo( pAig );
492 p->vCiLits = Vec_VecDupInt( p->vCiTfos );
493 p->vCubesA = Vec_IntAlloc( 100 );
494 p->vCubesB = Vec_IntAlloc( 100 );
495 p->iOutFail = -1;
496 return p;
497}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define MAX_PAGE_NUM
Definition giaEra2.c:40
struct Gia_ObjAre_t_ Gia_ObjAre_t
Definition giaEra2.c:61
struct Gia_ManAre_t_ Gia_ManAre_t
Definition giaEra2.c:81
Vec_Vec_t * Gia_ManDeriveCiTfo(Gia_Man_t *p)
Definition giaEra2.c:312
struct Gia_StaAre_t_ Gia_StaAre_t
Definition giaEra2.c:72
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreCubeAddToTree_rec()

void Gia_ManAreCubeAddToTree_rec ( Gia_ManAre_t * p,
Gia_ObjAre_t * pObj,
Gia_StaAre_t * pSta )

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

Synopsis [Adds new cube to the tree.]

Description []

SideEffects []

SeeAlso []

Definition at line 1102 of file giaEra2.c.

1103{
1104 if ( Gia_StaHasValue0(pSta, pObj->iVar) )
1105 {
1106 if ( Gia_ObjHasBranch0(pObj) )
1107 Gia_ManAreCubeAddToTree_rec( p, Gia_ObjNextObj0(p, pObj), pSta );
1108 else
1109 {
1110 Gia_ManAreCubeAddToList( p, pObj->F, pSta );
1111 if ( ++pObj->nStas0 == MAX_CUBE_NUM )
1112 {
1113 pObj->nStas0 = Gia_ManAreListCountListUsed( p, pObj->F[0] );
1114 if ( pObj->nStas0 < MAX_CUBE_NUM/2 )
1115 Gia_ManAreCompress( p, pObj->F );
1116 else
1117 {
1118 Gia_ManAreRebalance( p, pObj->F );
1119 pObj->nStas0 = 0;
1120 }
1121 }
1122 }
1123 }
1124 else if ( Gia_StaHasValue1(pSta, pObj->iVar) )
1125 {
1126 if ( Gia_ObjHasBranch1(pObj) )
1127 Gia_ManAreCubeAddToTree_rec( p, Gia_ObjNextObj1(p, pObj), pSta );
1128 else
1129 {
1130 Gia_ManAreCubeAddToList( p, pObj->F+1, pSta );
1131 if ( ++pObj->nStas1 == MAX_CUBE_NUM )
1132 {
1133 pObj->nStas1 = Gia_ManAreListCountListUsed( p, pObj->F[1] );
1134 if ( pObj->nStas1 < MAX_CUBE_NUM/2 )
1135 Gia_ManAreCompress( p, pObj->F+1 );
1136 else
1137 {
1138 Gia_ManAreRebalance( p, pObj->F+1 );
1139 pObj->nStas1 = 0;
1140 }
1141 }
1142 }
1143 }
1144 else
1145 {
1146 if ( Gia_ObjHasBranch2(pObj) )
1147 Gia_ManAreCubeAddToTree_rec( p, Gia_ObjNextObj2(p, pObj), pSta );
1148 else
1149 {
1150 Gia_ManAreCubeAddToList( p, pObj->F+2, pSta );
1151 if ( ++pObj->nStas2 == MAX_CUBE_NUM )
1152 {
1153 pObj->nStas2 = Gia_ManAreListCountListUsed( p, pObj->F[2] );
1154 if ( pObj->nStas2 < MAX_CUBE_NUM/2 )
1155 Gia_ManAreCompress( p, pObj->F+2 );
1156 else
1157 {
1158 Gia_ManAreRebalance( p, pObj->F+2 );
1159 pObj->nStas2 = 0;
1160 }
1161 }
1162 }
1163 }
1164}
void Gia_ManAreCubeAddToTree_rec(Gia_ManAre_t *p, Gia_ObjAre_t *pObj, Gia_StaAre_t *pSta)
Definition giaEra2.c:1102
#define MAX_CUBE_NUM
Definition giaEra2.c:42
unsigned nStas0
Definition giaEra2.c:65
unsigned iVar
Definition giaEra2.c:64
unsigned nStas2
Definition giaEra2.c:67
unsigned nStas1
Definition giaEra2.c:66
Gia_PtrAre_t F[3]
Definition giaEra2.c:68
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreCubeCheckTree()

int Gia_ManAreCubeCheckTree ( Gia_ManAre_t * p,
Gia_StaAre_t * pSta )

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

Synopsis [Checks if the cube like this exists in the tree.]

Description []

SideEffects []

SeeAlso []

Definition at line 1260 of file giaEra2.c.

1261{
1262 Gia_StaAre_t * pCube;
1263 int i, iVar;
1264 assert( p->fTree );
1265 Vec_IntClear( p->vCubesA );
1266 Vec_IntClear( p->vCubesB );
1267 Gia_ManAreCubeCollectTree_rec( p, Gia_ManAreObj(p, p->Root), pSta );
1268// if ( p->nStas > 3000 )
1269// printf( "%d %d \n", Vec_IntSize(p->vCubesA), Vec_IntSize(p->vCubesB) );
1270// Vec_IntSort( p->vCubesA, 0 );
1271// Vec_IntSort( p->vCubesB, 0 );
1272 Gia_ManAreForEachCubeVec( p->vCubesA, p, pCube, i )
1273 {
1274 if ( Gia_StaIsUnused( pCube ) )
1275 continue;
1276 if ( Gia_StaAreDisjoint( pSta, pCube, p->nWords ) )
1277 continue;
1278 if ( Gia_StaAreContain( pCube, pSta, p->nWords ) )
1279 {
1280 Gia_ManAreRycycleSta( p, pSta );
1281 return 0;
1282 }
1283 if ( Gia_StaAreContain( pSta, pCube, p->nWords ) )
1284 {
1285 Gia_StaSetUnused( pCube );
1286 continue;
1287 }
1288 iVar = Gia_StaAreSharpVar( pSta, pCube, p->nWords );
1289 if ( iVar == -1 )
1290 continue;
1291 assert( !Gia_StaHasValue0(pSta, iVar) && !Gia_StaHasValue1(pSta, iVar) );
1292 assert( Gia_StaHasValue0(pCube, iVar) ^ Gia_StaHasValue1(pCube, iVar) );
1293 if ( Gia_StaHasValue0(pCube, iVar) )
1294 Gia_StaSetValue1( pSta, iVar );
1295 else
1296 Gia_StaSetValue0( pSta, iVar );
1297 return Gia_ManAreCubeCheckTree( p, pSta );
1298 }
1299 Gia_ManAreForEachCubeVec( p->vCubesB, p, pCube, i )
1300 {
1301 if ( Gia_StaIsUnused( pCube ) )
1302 continue;
1303 if ( Gia_StaAreDisjoint( pSta, pCube, p->nWords ) )
1304 continue;
1305 if ( Gia_StaAreContain( pCube, pSta, p->nWords ) )
1306 {
1307 Gia_ManAreRycycleSta( p, pSta );
1308 return 0;
1309 }
1310 if ( Gia_StaAreContain( pSta, pCube, p->nWords ) )
1311 {
1312 Gia_StaSetUnused( pCube );
1313 continue;
1314 }
1315 iVar = Gia_StaAreSharpVar( pSta, pCube, p->nWords );
1316 if ( iVar == -1 )
1317 continue;
1318 assert( !Gia_StaHasValue0(pSta, iVar) && !Gia_StaHasValue1(pSta, iVar) );
1319 assert( Gia_StaHasValue0(pCube, iVar) ^ Gia_StaHasValue1(pCube, iVar) );
1320 if ( Gia_StaHasValue0(pCube, iVar) )
1321 Gia_StaSetValue1( pSta, iVar );
1322 else
1323 Gia_StaSetValue0( pSta, iVar );
1324 return Gia_ManAreCubeCheckTree( p, pSta );
1325 }
1326/*
1327 if ( p->nStas > 3000 )
1328 {
1329printf( "Trying cube: " );
1330Gia_ManArePrintCube( p, pSta );
1331 Gia_ManAreForEachCubeVec( p->vCubesA, p, pCube, i )
1332 {
1333printf( "aaaaaaaaaaaa %5d ", Vec_IntEntry(p->vCubesA,i) );
1334Gia_ManArePrintCube( p, pCube );
1335 }
1336 Gia_ManAreForEachCubeVec( p->vCubesB, p, pCube, i )
1337 {
1338printf( "bbbbbbbbbbbb %5d ", Vec_IntEntry(p->vCubesB,i) );
1339Gia_ManArePrintCube( p, pCube );
1340 }
1341 }
1342*/
1343 return 1;
1344}
#define Gia_ManAreForEachCubeVec(vVec, p, pCube, i)
Definition giaEra2.c:168
int Gia_ManAreCubeCollectTree_rec(Gia_ManAre_t *p, Gia_ObjAre_t *pObj, Gia_StaAre_t *pSta)
Definition giaEra2.c:1223
int Gia_ManAreCubeCheckTree(Gia_ManAre_t *p, Gia_StaAre_t *pSta)
Definition giaEra2.c:1260
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreCubeCheckTree_rec()

int Gia_ManAreCubeCheckTree_rec ( Gia_ManAre_t * p,
Gia_ObjAre_t * pObj,
Gia_StaAre_t * pSta )

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

Synopsis [Checks if the cube like this exists in the tree.]

Description []

SideEffects []

SeeAlso []

Definition at line 1065 of file giaEra2.c.

1066{
1067 int RetValue;
1068 if ( Gia_StaHasValue0(pSta, pObj->iVar) )
1069 {
1070 if ( Gia_ObjHasBranch0(pObj) )
1071 RetValue = Gia_ManAreCubeCheckTree_rec( p, Gia_ObjNextObj0(p, pObj), pSta );
1072 else
1073 RetValue = Gia_ManAreCubeCheckList( p, pObj->F, pSta );
1074 if ( RetValue == 0 )
1075 return 0;
1076 }
1077 else if ( Gia_StaHasValue1(pSta, pObj->iVar) )
1078 {
1079 if ( Gia_ObjHasBranch1(pObj) )
1080 RetValue = Gia_ManAreCubeCheckTree_rec( p, Gia_ObjNextObj1(p, pObj), pSta );
1081 else
1082 RetValue = Gia_ManAreCubeCheckList( p, pObj->F + 1, pSta );
1083 if ( RetValue == 0 )
1084 return 0;
1085 }
1086 if ( Gia_ObjHasBranch2(pObj) )
1087 return Gia_ManAreCubeCheckTree_rec( p, Gia_ObjNextObj2(p, pObj), pSta );
1088 return Gia_ManAreCubeCheckList( p, pObj->F + 2, pSta );
1089}
int Gia_ManAreCubeCheckTree_rec(Gia_ManAre_t *p, Gia_ObjAre_t *pObj, Gia_StaAre_t *pSta)
Definition giaEra2.c:1065
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreCubeCollectTree_rec()

int Gia_ManAreCubeCollectTree_rec ( Gia_ManAre_t * p,
Gia_ObjAre_t * pObj,
Gia_StaAre_t * pSta )

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

Synopsis [Collects overlapping cubes in the tree.]

Description []

SideEffects []

SeeAlso []

Definition at line 1223 of file giaEra2.c.

1224{
1225 int RetValue;
1226 if ( Gia_StaHasValue0(pSta, pObj->iVar) )
1227 {
1228 if ( Gia_ObjHasBranch0(pObj) )
1229 RetValue = Gia_ManAreCubeCollectTree_rec( p, Gia_ObjNextObj0(p, pObj), pSta );
1230 else
1231 RetValue = Gia_ManAreCubeCollectList( p, pObj->F, pSta );
1232 if ( RetValue == 0 )
1233 return 0;
1234 }
1235 else if ( Gia_StaHasValue1(pSta, pObj->iVar) )
1236 {
1237 if ( Gia_ObjHasBranch1(pObj) )
1238 RetValue = Gia_ManAreCubeCollectTree_rec( p, Gia_ObjNextObj1(p, pObj), pSta );
1239 else
1240 RetValue = Gia_ManAreCubeCollectList( p, pObj->F + 1, pSta );
1241 if ( RetValue == 0 )
1242 return 0;
1243 }
1244 if ( Gia_ObjHasBranch2(pObj) )
1245 return Gia_ManAreCubeCollectTree_rec( p, Gia_ObjNextObj2(p, pObj), pSta );
1246 return Gia_ManAreCubeCollectList( p, pObj->F + 2, pSta );
1247}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreDepth()

int Gia_ManAreDepth ( Gia_ManAre_t * p,
int iState )

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

Synopsis [Counts the depth of state transitions leading ot this state.]

Description []

SideEffects []

SeeAlso []

Definition at line 714 of file giaEra2.c.

715{
716 Gia_StaAre_t * pSta;
717 int Counter = 0;
718 for ( pSta = Gia_ManAreStaInt(p, iState); Gia_StaIsGood(p, pSta); pSta = Gia_StaPrev(p, pSta) )
719 Counter++;
720 return Counter;
721}
Here is the caller graph for this function:

◆ Gia_ManAreDeriveCex()

Abc_Cex_t * Gia_ManAreDeriveCex ( Gia_ManAre_t * p,
Gia_StaAre_t * pLast )

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

Synopsis [Returns the status of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 1919 of file giaEra2.c.

1920{
1921 Abc_Cex_t * pCex;
1922 Vec_Ptr_t * vStates;
1923 Gia_StaAre_t * pSta, * pPrev;
1924 int Var, i, v;
1925 assert( p->iOutFail >= 0 );
1927 // compute the trace
1928 vStates = Vec_PtrAlloc( 1000 );
1929 for ( pSta = pLast; Gia_StaIsGood(p, pSta); pSta = Gia_StaPrev(p, pSta) )
1930 if ( pSta != pLast )
1931 Vec_PtrPush( vStates, pSta );
1932 assert( Vec_PtrSize(vStates) >= 1 );
1933 // start the counter-example
1934 pCex = Abc_CexAlloc( Gia_ManRegNum(p->pAig), Gia_ManPiNum(p->pAig), Vec_PtrSize(vStates) );
1935 pCex->iFrame = Vec_PtrSize(vStates)-1;
1936 pCex->iPo = p->iOutFail;
1937 // compute states
1938 pPrev = NULL;
1939 Vec_PtrForEachEntry( Gia_StaAre_t *, vStates, pSta, i )
1940 {
1941 Gia_ManAreDeriveCexSat( p, pSta, pPrev, (i == 0) ? p->iOutFail : -1 );
1942 pPrev = pSta;
1943 // create the counter-example
1944 Vec_IntForEachEntry( p->vCofVars, Var, v )
1945 {
1946 assert( Var < Gia_ManPiNum(p->pAig) );
1947 Abc_InfoSetBit( pCex->pData, Gia_ManRegNum(p->pAig) + (Vec_PtrSize(vStates)-1-i) * Gia_ManPiNum(p->pAig) + Var );
1948 }
1949 }
1950 // free temporary things
1951 Vec_PtrFree( vStates );
1953 return pCex;
1954}
int Var
Definition exorList.c:228
void Gia_ManAreDeriveCexSatStop(Gia_ManAre_t *p)
Definition giaEra2.c:1827
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START void Gia_ManAreDeriveCexSatStart(Gia_ManAre_t *p)
Definition giaEra2.c:1799
void Gia_ManAreDeriveCexSat(Gia_ManAre_t *p, Gia_StaAre_t *pCur, Gia_StaAre_t *pNext, int iOutFailed)
Definition giaEra2.c:1852
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition utilCex.c:51
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreDeriveCexSat()

void Gia_ManAreDeriveCexSat ( Gia_ManAre_t * p,
Gia_StaAre_t * pCur,
Gia_StaAre_t * pNext,
int iOutFailed )

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

Synopsis [Computes satisfying assignment in one timeframe.]

Description [Returns the vector of integers represeting PIO ids of the primary inputs that should be 1 in the counter-example.]

SideEffects []

SeeAlso []

Definition at line 1852 of file giaEra2.c.

1853{
1854 int i, status;
1855 // make assuptions
1856 Vec_IntClear( p->vAssumps );
1857 for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
1858 {
1859 if ( Gia_StaHasValue0(pCur, i) )
1860 Vec_IntPush( p->vAssumps, Abc_Var2Lit( Vec_IntEntry(p->vSatNumCis, Gia_ManPiNum(p->pAig)+i), 1 ) );
1861 else if ( Gia_StaHasValue1(pCur, i) )
1862 Vec_IntPush( p->vAssumps, Abc_Var2Lit( Vec_IntEntry(p->vSatNumCis, Gia_ManPiNum(p->pAig)+i), 0 ) );
1863 }
1864 if ( pNext )
1865 for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
1866 {
1867 if ( Gia_StaHasValue0(pNext, i) )
1868 Vec_IntPush( p->vAssumps, Abc_Var2Lit( Vec_IntEntry(p->vSatNumCos, Gia_ManPoNum(p->pAig)+i), 1 ) );
1869 else if ( Gia_StaHasValue1(pNext, i) )
1870 Vec_IntPush( p->vAssumps, Abc_Var2Lit( Vec_IntEntry(p->vSatNumCos, Gia_ManPoNum(p->pAig)+i), 0 ) );
1871 }
1872 if ( iOutFailed >= 0 )
1873 {
1874 assert( iOutFailed < Gia_ManPoNum(p->pAig) );
1875 Vec_IntPush( p->vAssumps, Abc_Var2Lit( Vec_IntEntry(p->vSatNumCos, iOutFailed), 0 ) );
1876 }
1877 // solve SAT
1878 status = sat_solver_solve( (sat_solver *)p->pSat, (int *)Vec_IntArray(p->vAssumps), (int *)Vec_IntArray(p->vAssumps) + Vec_IntSize(p->vAssumps),
1879 (ABC_INT64_T)1000000, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
1880 if ( status != l_True )
1881 {
1882 printf( "SAT problem is not satisfiable. Failure...\n" );
1883 return;
1884 }
1885 assert( status == l_True );
1886 // check the model
1887 Vec_IntClear( p->vCofVars );
1888 for ( i = 0; i < Gia_ManPiNum(p->pAig); i++ )
1889 {
1890 if ( sat_solver_var_value( (sat_solver *)p->pSat, Vec_IntEntry(p->vSatNumCis, i) ) )
1891 Vec_IntPush( p->vCofVars, i );
1892 }
1893 // write the current state
1894 for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
1895 {
1896 if ( Gia_StaHasValue0(pCur, i) )
1897 assert( sat_solver_var_value( (sat_solver *)p->pSat, Vec_IntEntry(p->vSatNumCis, Gia_ManPiNum(p->pAig)+i) ) == 0 );
1898 else if ( Gia_StaHasValue1(pCur, i) )
1899 assert( sat_solver_var_value( (sat_solver *)p->pSat, Vec_IntEntry(p->vSatNumCis, Gia_ManPiNum(p->pAig)+i) ) == 1 );
1900 // set don't-care value
1901 if ( sat_solver_var_value( (sat_solver *)p->pSat, Vec_IntEntry(p->vSatNumCis, Gia_ManPiNum(p->pAig)+i) ) == 0 )
1902 Gia_StaSetValue0( pCur, i );
1903 else
1904 Gia_StaSetValue1( pCur, i );
1905 }
1906}
#define l_True
Definition bmcBmcS.c:35
#define sat_solver
Definition cecSatG2.c:34
#define sat_solver_solve
Definition cecSatG2.c:45
Here is the caller graph for this function:

◆ Gia_ManAreDeriveCexSatStart()

ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START void Gia_ManAreDeriveCexSatStart ( Gia_ManAre_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1799 of file giaEra2.c.

1800{
1801 Aig_Man_t * pAig2;
1802 Cnf_Dat_t * pCnf;
1803 assert( p->pSat == NULL );
1804 pAig2 = Gia_ManToAig( p->pAig, 0 );
1805 Aig_ManSetRegNum( pAig2, 0 );
1806 pCnf = Cnf_Derive( pAig2, Gia_ManCoNum(p->pAig) );
1807 p->pSat = Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
1808 p->vSatNumCis = Cnf_DataCollectCiSatNums( pCnf, pAig2 );
1809 p->vSatNumCos = Cnf_DataCollectCoSatNums( pCnf, pAig2 );
1810 Cnf_DataFree( pCnf );
1811 Aig_ManStop( pAig2 );
1812 p->vAssumps = Vec_IntAlloc( 100 );
1813 p->vCofVars = Vec_IntAlloc( 100 );
1814}
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition aigMan.c:438
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
Vec_Int_t * Cnf_DataCollectCoSatNums(Cnf_Dat_t *pCnf, Aig_Man_t *p)
Definition cnfUtil.c:429
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
Definition cnfCore.c:165
struct Cnf_Dat_t_ Cnf_Dat_t
Definition cnf.h:52
void Cnf_DataFree(Cnf_Dat_t *p)
Definition cnfMan.c:207
Vec_Int_t * Cnf_DataCollectCiSatNums(Cnf_Dat_t *pCnf, Aig_Man_t *p)
Definition cnfUtil.c:407
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition giaAig.c:318
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Definition cnfMan.c:579
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreDeriveCexSatStop()

void Gia_ManAreDeriveCexSatStop ( Gia_ManAre_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1827 of file giaEra2.c.

1828{
1829 assert( p->pSat != NULL );
1830 assert( p->pTarget != NULL );
1831 sat_solver_delete( (sat_solver *)p->pSat );
1832 Vec_IntFree( p->vSatNumCis );
1833 Vec_IntFree( p->vSatNumCos );
1834 Vec_IntFree( p->vAssumps );
1835 Vec_IntFree( p->vCofVars );
1836 p->pTarget = NULL;
1837 p->pSat = NULL;
1838}
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreDeriveNexts()

int Gia_ManAreDeriveNexts ( Gia_ManAre_t * p,
Gia_PtrAre_t Sta )

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

Synopsis [Derives next state cubes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1618 of file giaEra2.c.

1619{
1620 Gia_StaAre_t * pSta;
1621 Gia_Obj_t * pObj;
1622 int i, RetValue;
1623 abctime clk = Abc_Clock();
1624 pSta = Gia_ManAreSta( p, Sta );
1625 if ( Gia_StaIsUnused(pSta) )
1626 return 0;
1627 // recycle the manager
1628 if ( p->pNew && Gia_ManObjNum(p->pNew) > 1000000 )
1629 {
1630 Gia_ManStop( p->pNew );
1631 p->pNew = NULL;
1632 }
1633 // allocate the manager
1634 if ( p->pNew == NULL )
1635 {
1636 p->pNew = Gia_ManStart( 10 * Gia_ManObjNum(p->pAig) );
1637 Gia_ManIncrementTravId( p->pNew );
1638 Gia_ManHashAlloc( p->pNew );
1639 Gia_ManConst0(p->pAig)->Value = 0;
1640 Gia_ManForEachCi( p->pAig, pObj, i )
1641 pObj->Value = Gia_ManAppendCi(p->pNew);
1642 }
1643 Gia_ManForEachRo( p->pAig, pObj, i )
1644 {
1645 if ( Gia_StaHasValue0( pSta, i ) )
1646 pObj->Value = 0;
1647 else if ( Gia_StaHasValue1( pSta, i ) )
1648 pObj->Value = 1;
1649 else // don't-care literal
1650 pObj->Value = Abc_Var2Lit( Gia_ObjId( p->pNew, Gia_ManCi(p->pNew, Gia_ObjCioId(pObj)) ), 0 );
1651 }
1652 Gia_ManForEachAnd( p->pAig, pObj, i )
1653 pObj->Value = Gia_ManHashAnd( p->pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1654 Gia_ManForEachCo( p->pAig, pObj, i )
1655 pObj->Value = Gia_ObjFanin0Copy(pObj);
1656
1657 // perform case-splitting
1658 p->nRecCalls = 0;
1659 RetValue = Gia_ManAreDeriveNexts_rec( p, Sta );
1660 if ( p->nRecCalls >= MAX_CALL_NUM )
1661 {
1662 printf( "Exceeded the limit on the number of transitions from a state cube (%d).\n", MAX_CALL_NUM );
1663 p->fStopped = 1;
1664 }
1665// printf( "%d ", p->nRecCalls );
1666//printf( "%d ", Gia_ManObjNum(p->pNew) );
1667 p->timeAig += Abc_Clock() - clk;
1668 return RetValue;
1669}
ABC_INT64_T abctime
Definition abc_global.h:332
#define MAX_CALL_NUM
DECLARATIONS ///.
Definition giaEra2.c:38
int Gia_ManAreDeriveNexts_rec(Gia_ManAre_t *p, Gia_PtrAre_t Sta)
Definition giaEra2.c:1541
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
#define Gia_ManForEachRo(p, pObj, i)
Definition gia.h:1252
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
unsigned Value
Definition gia.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreDeriveNexts_rec()

int Gia_ManAreDeriveNexts_rec ( Gia_ManAre_t * p,
Gia_PtrAre_t Sta )

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

Synopsis [Derives next state cubes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1541 of file giaEra2.c.

1542{
1543 Gia_Obj_t * pPivot;
1544 Vec_Int_t * vLits, * vTfos;
1545 Gia_Obj_t * pObj;
1546 int i;
1547 abctime clk;
1548 if ( ++p->nRecCalls == MAX_CALL_NUM )
1549 return 0;
1550 if ( (pPivot = Gia_ManAreMostUsedPi(p)) == NULL )
1551 {
1552 Gia_StaAre_t * pNew;
1553 clk = Abc_Clock();
1554 pNew = Gia_ManAreCreateStaNew( p );
1555 pNew->iPrev = Sta;
1556 p->fStopped = (p->fMiter && (Gia_ManCheckPOstatus(p) & 1));
1557 if ( p->fStopped )
1558 {
1559 assert( p->pTarget == NULL );
1560 p->pTarget = pNew;
1561 return 1;
1562 }
1563 Gia_ManAreCubeProcess( p, pNew );
1564 p->timeCube += Abc_Clock() - clk;
1565 return p->fStopped;
1566 }
1567 // remember values in the cone and perform update
1568 vTfos = Vec_VecEntryInt( p->vCiTfos, Gia_ObjCioId(pPivot) );
1569 vLits = Vec_VecEntryInt( p->vCiLits, Gia_ObjCioId(pPivot) );
1570 assert( Vec_IntSize(vTfos) == Vec_IntSize(vLits) );
1571 Gia_ManForEachObjVec( vTfos, p->pAig, pObj, i )
1572 {
1573 Vec_IntWriteEntry( vLits, i, pObj->Value );
1574 if ( Gia_ObjIsAnd(pObj) )
1575 pObj->Value = Gia_ManHashAnd( p->pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1576 else if ( Gia_ObjIsCo(pObj) )
1577 pObj->Value = Gia_ObjFanin0Copy(pObj);
1578 else
1579 {
1580 assert( Gia_ObjIsCi(pObj) );
1581 pObj->Value = 0;
1582 }
1583 }
1584 if ( Gia_ManAreDeriveNexts_rec( p, Sta ) )
1585 return 1;
1586 // compute different values
1587 Gia_ManForEachObjVec( vTfos, p->pAig, pObj, i )
1588 {
1589 if ( Gia_ObjIsAnd(pObj) )
1590 pObj->Value = Gia_ManHashAnd( p->pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1591 else if ( Gia_ObjIsCo(pObj) )
1592 pObj->Value = Gia_ObjFanin0Copy(pObj);
1593 else
1594 {
1595 assert( Gia_ObjIsCi(pObj) );
1596 pObj->Value = 1;
1597 }
1598 }
1599 if ( Gia_ManAreDeriveNexts_rec( p, Sta ) )
1600 return 1;
1601 // reset the original values
1602 Gia_ManForEachObjVec( vTfos, p->pAig, pObj, i )
1603 pObj->Value = Vec_IntEntry( vLits, i );
1604 return 0;
1605}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
Gia_PtrAre_t iPrev
Definition giaEra2.c:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreFindBestVar()

int Gia_ManAreFindBestVar ( Gia_ManAre_t * p,
Gia_PtrAre_t List )

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

Synopsis [Best var has max weight.]

Description [Weight is defined as the number of 0/1-lits minus the absolute value of the diff between the number of 0-lits and 1-lits.]

SideEffects []

SeeAlso []

Definition at line 853 of file giaEra2.c.

854{
855 Gia_StaAre_t * pCube;
856 int Count0, Count1, Count2;
857 int iVarThis, iVarBest = -1, WeightThis, WeightBest = -1;
858 for ( iVarThis = 0; iVarThis < Gia_ManRegNum(p->pAig); iVarThis++ )
859 {
860 Count0 = Count1 = Count2 = 0;
861 Gia_ManAreForEachCubeList( p, Gia_ManAreSta(p, List), pCube )
862 {
863 if ( Gia_StaIsUnused(pCube) )
864 continue;
865 if ( Gia_StaHasValue0(pCube, iVarThis) )
866 Count0++;
867 else if ( Gia_StaHasValue1(pCube, iVarThis) )
868 Count1++;
869 else
870 Count2++;
871 }
872// printf( "%4d : %5d %5d %5d Weight = %5d\n", iVarThis, Count0, Count1, Count2,
873// Count0 + Count1 - (Count0 > Count1 ? Count0 - Count1 : Count1 - Count0) );
874 if ( (!Count0 && !Count1) || (!Count0 && !Count2) || (!Count1 && !Count2) )
875 continue;
876 WeightThis = Count0 + Count1 - (Count0 > Count1 ? Count0 - Count1 : Count1 - Count0);
877 if ( WeightBest < WeightThis )
878 {
879 WeightBest = WeightThis;
880 iVarBest = iVarThis;
881 }
882 }
883 if ( iVarBest == -1 )
884 {
885 Gia_ManArePrintListUsed( p, List );
886 printf( "Error: Best variable not found!!!\n" );
887 }
888 assert( iVarBest != -1 );
889 return iVarBest;
890}
#define Gia_ManAreForEachCubeList(p, pList, pCube)
Definition giaEra2.c:160

◆ Gia_ManAreFree()

void Gia_ManAreFree ( Gia_ManAre_t * p)

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

Synopsis [Deletes reachability manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 510 of file giaEra2.c.

511{
512 int i;
513 Gia_ManStop( p->pAig );
514 if ( p->pNew )
515 Gia_ManStop( p->pNew );
516 Vec_IntFree( p->vCubesA );
517 Vec_IntFree( p->vCubesB );
518 Vec_VecFree( p->vCiTfos );
519 Vec_VecFree( p->vCiLits );
520 for ( i = 0; i < p->nObjPages; i++ )
521 ABC_FREE( p->ppObjs[i] );
522 ABC_FREE( p->ppObjs );
523 for ( i = 0; i < p->nStaPages; i++ )
524 ABC_FREE( p->ppStas[i] );
525 ABC_FREE( p->ppStas );
526// ABC_FREE( p->pfUseless );
527 ABC_FREE( p );
528}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreListCountUsed_rec()

int Gia_ManAreListCountUsed_rec ( Gia_ManAre_t * p,
Gia_PtrAre_t Root,
int fTree )

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

Synopsis [Counts the number of used cubes in the tree.]

Description []

SideEffects []

SeeAlso []

Definition at line 754 of file giaEra2.c.

755{
756 Gia_ObjAre_t * pObj;
757 if ( !fTree )
758 return Gia_ManAreListCountListUsed( p, Root );
759 pObj = Gia_ManAreObj(p, Root);
760 return Gia_ManAreListCountUsed_rec( p, pObj->F[0], Gia_ObjHasBranch0(pObj) ) +
761 Gia_ManAreListCountUsed_rec( p, pObj->F[1], Gia_ObjHasBranch1(pObj) ) +
762 Gia_ManAreListCountUsed_rec( p, pObj->F[2], Gia_ObjHasBranch2(pObj) );
763}
int Gia_ManAreListCountUsed_rec(Gia_ManAre_t *p, Gia_PtrAre_t Root, int fTree)
Definition giaEra2.c:754
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAreMostUsedPi_rec()

void Gia_ManAreMostUsedPi_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj )

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

Synopsis [Returns the most used CI, or NULL if condition is met.]

Description []

SideEffects []

SeeAlso []

Definition at line 1392 of file giaEra2.c.

1393{
1394 if ( Gia_ObjIsTravIdCurrent(p, pObj) )
1395 return;
1396 Gia_ObjSetTravIdCurrent(p, pObj);
1397 if ( Gia_ObjIsCi(pObj) )
1398 {
1399 pObj->Value++;
1400 return;
1401 }
1402 assert( Gia_ObjIsAnd(pObj) );
1403 Gia_ManAreMostUsedPi_rec( p, Gia_ObjFanin0(pObj) );
1404 Gia_ManAreMostUsedPi_rec( p, Gia_ObjFanin1(pObj) );
1405}
void Gia_ManAreMostUsedPi_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaEra2.c:1392
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManArePerform()

int Gia_ManArePerform ( Gia_Man_t * pAig,
int nStatesMax,
int fMiter,
int fVerbose )

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

Synopsis [Performs explicit reachability.]

Description []

SideEffects []

SeeAlso []

Definition at line 1710 of file giaEra2.c.

1711{
1712// extern Gia_Man_t * Gia_ManCompress2( Gia_Man_t * p, int fUpdateLevel, int fVerbose );
1714 Gia_ManAre_t * p;
1715 abctime clk = Abc_Clock();
1716 int RetValue = 1;
1717 if ( Gia_ManRegNum(pAig) > MAX_VARS_NUM )
1718 {
1719 printf( "Currently can only handle circuit with up to %d registers.\n", MAX_VARS_NUM );
1720 return -1;
1721 }
1722 ABC_FREE( pAig->pCexSeq );
1723// p = Gia_ManAreCreate( Gia_ManCompress2(pAig, 0, 0) );
1724 p = Gia_ManAreCreate( Gia_ManDup(pAig) );
1725 p->fMiter = fMiter;
1726 Gia_ManAreCubeProcess( p, Gia_ManAreCreateStaInit(p) );
1727 for ( p->iStaCur = 1; p->iStaCur < p->nStas; p->iStaCur++ )
1728 {
1729// printf( "Explored state %d. Total cubes %d.\n", p->iStaCur, p->nStas-1 );
1730 if ( Gia_ManAreDeriveNexts( p, Gia_Int2Ptr(p->iStaCur) ) || p->nStas > nStatesMax )
1731 pAig->pCexSeq = Gia_ManAreDeriveCex( p, p->pTarget );
1732 if ( p->fStopped )
1733 {
1734 RetValue = -1;
1735 break;
1736 }
1737 if ( fVerbose )//&& p->iStaCur % 5000 == 0 )
1738 Gia_ManArePrintReport( p, clk, 0 );
1739 }
1740 Gia_ManArePrintReport( p, clk, 1 );
1741 printf( "%s after finding %d state cubes (%d not contained) with depth %d. ",
1742 p->fStopped ? "Stopped" : "Completed",
1743 p->nStas, Gia_ManAreListCountUsed(p),
1744 Gia_ManAreDepth(p, p->iStaCur-1) );
1745 ABC_PRT( "Time", Abc_Clock() - clk );
1746 if ( pAig->pCexSeq != NULL )
1747 Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d.\n",
1748 p->iStaCur, pAig->pName, Gia_ManAreDepth(p, p->iStaCur)-1 );
1749 if ( fVerbose )
1750 {
1751 ABC_PRTP( "Cofactoring", p->timeAig - p->timeCube, Abc_Clock() - clk );
1752 ABC_PRTP( "Containment", p->timeCube, Abc_Clock() - clk );
1753 ABC_PRTP( "Other ", Abc_Clock() - clk - p->timeAig, Abc_Clock() - clk );
1754 ABC_PRTP( "TOTAL ", Abc_Clock() - clk, Abc_Clock() - clk );
1755 }
1756 if ( Gia_ManRegNum(pAig) <= 30 )
1757 {
1758 clk = Abc_Clock();
1759 printf( "The number of unique state minterms in computed state cubes is %d. ", Gia_ManCountMinterms(p) );
1760 ABC_PRT( "Time", Abc_Clock() - clk );
1761 }
1762// printf( "Compares = %d. Equals = %d. Disj = %d. Disj2 = %d. Disj3 = %d.\n",
1763// p->nCompares, p->nEquals, p->nDisjs, p->nDisjs2, p->nDisjs3 );
1764// Gia_ManAreFindBestVar( p, Gia_ManAreSta(p, p->Root) );
1765// Gia_ManArePrintUsed( p );
1766 Gia_ManAreFree( p );
1767 // verify
1768 if ( pAig->pCexSeq )
1769 {
1770 if ( !Gia_ManVerifyCex( pAig, pAig->pCexSeq, 0 ) )
1771 printf( "Generated counter-example is INVALID. \n" );
1772 else
1773 printf( "Generated counter-example verified correctly. \n" );
1774 return 0;
1775 }
1776 return RetValue;
1777}
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_PRTP(a, t, T)
Definition abc_global.h:258
Gia_ManAre_t * Gia_ManAreCreate(Gia_Man_t *pAig)
Definition giaEra2.c:481
int Gia_ManAreDepth(Gia_ManAre_t *p, int iState)
Definition giaEra2.c:714
int Gia_ManAreDeriveNexts(Gia_ManAre_t *p, Gia_PtrAre_t Sta)
Definition giaEra2.c:1618
Abc_Cex_t * Gia_ManAreDeriveCex(Gia_ManAre_t *p, Gia_StaAre_t *pLast)
Definition giaEra2.c:1919
int Gia_ManCountMinterms(Gia_ManAre_t *p)
Definition giaEra2.c:223
#define MAX_VARS_NUM
Definition giaEra2.c:41
void Gia_ManArePrintReport(Gia_ManAre_t *p, abctime Time, int fFinal)
Definition giaEra2.c:1683
void Gia_ManAreFree(Gia_ManAre_t *p)
Definition giaEra2.c:510
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
int Gia_ManVerifyCex(Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
DECLARATIONS ///.
Definition giaCex.c:48
Abc_Cex_t * pCexSeq
Definition gia.h:150
char * pName
Definition gia.h:99
Here is the call graph for this function:

◆ Gia_ManArePrintCube()

void Gia_ManArePrintCube ( Gia_ManAre_t * p,
Gia_StaAre_t * pSta )

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

Synopsis [Prints the state cube.]

Description []

SideEffects []

SeeAlso []

Definition at line 681 of file giaEra2.c.

682{
683 Gia_Obj_t * pObj;
684 int i, Count0 = 0, Count1 = 0, Count2 = 0;
685 printf( "%4d %4d : ", p->iStaCur, p->nStas-1 );
686 printf( "Prev %4d ", Gia_Ptr2Int(pSta->iPrev) );
687 printf( "%p ", pSta );
688 Gia_ManForEachRi( p->pAig, pObj, i )
689 {
690 if ( Gia_StaHasValue0(pSta, i) )
691 printf( "0" ), Count0++;
692 else if ( Gia_StaHasValue1(pSta, i) )
693 printf( "1" ), Count1++;
694 else
695 printf( "-" ), Count2++;
696 }
697 printf( " 0 =%3d", Count0 );
698 printf( " 1 =%3d", Count1 );
699 printf( " - =%3d", Count2 );
700 printf( "\n" );
701}
#define Gia_ManForEachRi(p, pObj, i)
Definition gia.h:1254

◆ Gia_ManArePrintReport()

void Gia_ManArePrintReport ( Gia_ManAre_t * p,
abctime Time,
int fFinal )

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

Synopsis [Prints the report]

Description []

SideEffects []

SeeAlso []

Definition at line 1683 of file giaEra2.c.

1684{
1685 printf( "States =%10d. Reached =%10d. R = %5.3f. Depth =%6d. Mem =%9.2f MB. ",
1686 p->iStaCur, p->nStas, 1.0*p->iStaCur/p->nStas, Gia_ManAreDepth(p, p->iStaCur),
1687 (sizeof(Gia_ManAre_t) + 4.0*Gia_ManRegNum(p->pAig) + 8.0*MAX_PAGE_NUM +
1688 4.0*p->nStaPages*p->nSize*MAX_ITEM_NUM + 16.0*p->nObjPages*MAX_ITEM_NUM)/(1<<20) );
1689 if ( fFinal )
1690 {
1691 ABC_PRT( "Time", Abc_Clock() - Time );
1692 }
1693 else
1694 {
1695 ABC_PRTr( "Time", Abc_Clock() - Time );
1696 }
1697}
#define ABC_PRTr(a, t)
Definition abc_global.h:256
#define MAX_ITEM_NUM
Definition giaEra2.c:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManArePrintUsed_rec()

int Gia_ManArePrintUsed_rec ( Gia_ManAre_t * p,
Gia_PtrAre_t Root,
int fTree )

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

Synopsis [Prints used cubes in the tree.]

Description []

SideEffects []

SeeAlso []

Definition at line 813 of file giaEra2.c.

814{
815 Gia_ObjAre_t * pObj;
816 if ( !fTree )
817 return Gia_ManArePrintListUsed( p, Root );
818 pObj = Gia_ManAreObj(p, Root);
819 return Gia_ManArePrintUsed_rec( p, pObj->F[0], Gia_ObjHasBranch0(pObj) ) +
820 Gia_ManArePrintUsed_rec( p, pObj->F[1], Gia_ObjHasBranch1(pObj) ) +
821 Gia_ManArePrintUsed_rec( p, pObj->F[2], Gia_ObjHasBranch2(pObj) );
822}
int Gia_ManArePrintUsed_rec(Gia_ManAre_t *p, Gia_PtrAre_t Root, int fTree)
Definition giaEra2.c:813
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCheckPOs_rec()

int Gia_ManCheckPOs_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj )

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

Synopsis [Counts maximum support of primary outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1452 of file giaEra2.c.

1453{
1454 if ( Gia_ObjIsTravIdCurrent(p, pObj) )
1455 return 0;
1456 Gia_ObjSetTravIdCurrent(p, pObj);
1457 if ( Gia_ObjIsCi(pObj) )
1458 return 1;
1459 assert( Gia_ObjIsAnd(pObj) );
1460 return Gia_ManCheckPOs_rec( p, Gia_ObjFanin0(pObj) ) +
1461 Gia_ManCheckPOs_rec( p, Gia_ObjFanin1(pObj) );
1462}
int Gia_ManCheckPOs_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaEra2.c:1452
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCountMinterms()

int Gia_ManCountMinterms ( Gia_ManAre_t * p)

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

Synopsis [Count state minterms contains in the used cubes.]

Description []

SideEffects []

SeeAlso []

Definition at line 223 of file giaEra2.c.

224{
225 Gia_StaAre_t * pCube;
226 unsigned * pMemory;
227 int i, nMemSize, Counter = 0;
228 if ( Gia_ManRegNum(p->pAig) > 30 )
229 return -1;
230 nMemSize = Abc_BitWordNum( 1 << Gia_ManRegNum(p->pAig) );
231 pMemory = ABC_CALLOC( unsigned, nMemSize );
232 Gia_ManAreForEachCubeStore( p, pCube, i )
233 if ( Gia_StaIsUsed(pCube) )
234 Gia_ManCountMintermsInCube( pCube, Gia_ManRegNum(p->pAig), pMemory );
235 for ( i = 0; i < nMemSize; i++ )
236 Counter += Gia_WordCountOnes( pMemory[i] );
237 ABC_FREE( pMemory );
238 return Counter;
239}
#define Gia_ManAreForEachCubeStore(p, pCube, i)
Definition giaEra2.c:166
void Gia_ManCountMintermsInCube(Gia_StaAre_t *pCube, int nVars, unsigned *pStore)
FUNCTION DEFINITIONS ///.
Definition giaEra2.c:186
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCountMintermsInCube()

void Gia_ManCountMintermsInCube ( Gia_StaAre_t * pCube,
int nVars,
unsigned * pStore )

FUNCTION DEFINITIONS ///.

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

Synopsis [Count state minterms contained in a cube.]

Description []

SideEffects []

SeeAlso []

Definition at line 186 of file giaEra2.c.

187{
188 unsigned Mint, Mask = 0;
189 int i, m, nMints, nDashes = 0, Dashes[32];
190 // count the number of dashes
191 for ( i = 0; i < nVars; i++ )
192 {
193 if ( Gia_StaHasValue0( pCube, i ) )
194 continue;
195 if ( Gia_StaHasValue1( pCube, i ) )
196 Mask |= (1 << i);
197 else
198 Dashes[nDashes++] = i;
199 }
200 // fill in the miterms
201 nMints = (1 << nDashes);
202 for ( m = 0; m < nMints; m++ )
203 {
204 Mint = Mask;
205 for ( i = 0; i < nVars; i++ )
206 if ( m & (1 << i) )
207 Mint |= (1 << Dashes[i]);
208 Abc_InfoSetBit( pStore, Mint );
209 }
210}
Here is the caller graph for this function:

◆ Gia_ManDeriveCiTfo()

Vec_Vec_t * Gia_ManDeriveCiTfo ( Gia_Man_t * p)

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

Synopsis [Derives the TFO of each CI.]

Description []

SideEffects []

SeeAlso []

Definition at line 312 of file giaEra2.c.

313{
314 Vec_Ptr_t * vRes;
315 Gia_Obj_t * pPivot;
316 int i;
319 vRes = Vec_PtrAlloc( Gia_ManCiNum(p) );
320 Gia_ManForEachCi( p, pPivot, i )
321 Vec_PtrPush( vRes, Gia_ManDeriveCiTfoOne(p, pPivot) );
323 return (Vec_Vec_t *)vRes;
324}
Vec_Int_t * Gia_ManDeriveCiTfoOne(Gia_Man_t *p, Gia_Obj_t *pPivot)
Definition giaEra2.c:280
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition giaUtil.c:256
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDeriveCiTfo_rec()

int Gia_ManDeriveCiTfo_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj,
Vec_Int_t * vRes )

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

Synopsis [Derives the TFO of one CI.]

Description []

SideEffects []

SeeAlso []

Definition at line 252 of file giaEra2.c.

253{
254 if ( Gia_ObjIsCi(pObj) )
255 return pObj->fMark0;
256 if ( Gia_ObjIsTravIdCurrent(p, pObj) )
257 return pObj->fMark0;
258 Gia_ObjSetTravIdCurrent(p, pObj);
259 assert( Gia_ObjIsAnd(pObj) );
260 Gia_ManDeriveCiTfo_rec( p, Gia_ObjFanin0(pObj), vRes );
261 Gia_ManDeriveCiTfo_rec( p, Gia_ObjFanin1(pObj), vRes );
262 pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 | Gia_ObjFanin1(pObj)->fMark0;
263 if ( pObj->fMark0 )
264 Vec_IntPush( vRes, Gia_ObjId(p, pObj) );
265 return pObj->fMark0;
266}
int Gia_ManDeriveCiTfo_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vRes)
Definition giaEra2.c:252
unsigned fMark0
Definition gia.h:81
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDeriveCiTfoOne()

Vec_Int_t * Gia_ManDeriveCiTfoOne ( Gia_Man_t * p,
Gia_Obj_t * pPivot )

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

Synopsis [Derives the TFO of one CI.]

Description []

SideEffects []

SeeAlso []

Definition at line 280 of file giaEra2.c.

281{
282 Vec_Int_t * vRes;
283 Gia_Obj_t * pObj;
284 int i;
285 assert( pPivot->fMark0 == 0 );
286 pPivot->fMark0 = 1;
287 vRes = Vec_IntAlloc( 100 );
288 Vec_IntPush( vRes, Gia_ObjId(p, pPivot) );
290 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
291 Gia_ManForEachCo( p, pObj, i )
292 {
293 Gia_ManDeriveCiTfo_rec( p, Gia_ObjFanin0(pObj), vRes );
294 if ( Gia_ObjFanin0(pObj)->fMark0 )
295 Vec_IntPush( vRes, Gia_ObjId(p, pObj) );
296 }
297 pPivot->fMark0 = 0;
298 return vRes;
299}
Here is the call graph for this function:
Here is the caller graph for this function: