ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaCTas.c File Reference
#include "gia.h"
Include dependency graph for giaCTas.c:

Go to the source code of this file.

Classes

struct  Tas_Par_t_
 
struct  Tas_Cls_t_
 
struct  Tas_Sto_t_
 
struct  Tas_Que_t_
 
struct  Tas_Man_t_
 

Macros

#define Tas_QueForEachEntry(Que, pObj, i)
 
#define Tas_ClauseForEachVar(p, hClause, pObj)
 
#define Tas_ClauseForEachVar1(p, hClause, pObj)
 

Typedefs

typedef typedefABC_NAMESPACE_IMPL_START struct Tas_Par_t_ Tas_Par_t
 DECLARATIONS ///.
 
typedef struct Tas_Cls_t_ Tas_Cls_t
 
typedef struct Tas_Sto_t_ Tas_Sto_t
 
typedef struct Tas_Que_t_ Tas_Que_t
 

Functions

void Tas_SetDefaultParams (Tas_Par_t *pPars)
 FUNCTION DEFINITIONS ///.
 
Tas_Man_tTas_ManAlloc (Gia_Man_t *pAig, int nBTLimit)
 
void Tas_ManStop (Tas_Man_t *p)
 
Vec_Int_tTas_ReadModel (Tas_Man_t *p)
 
int Tas_ManPropagate (Tas_Man_t *p, int Level)
 
int Tas_ManSolve_rec (Tas_Man_t *p, int Level)
 
int Tas_ManSolve (Tas_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pObj2)
 
int Tas_ManSolveArray (Tas_Man_t *p, Vec_Ptr_t *vObjs)
 
void Tas_ManSatPrintStats (Tas_Man_t *p)
 
Vec_Int_tTas_ManSolveMiterNc (Gia_Man_t *pAig, int nConfs, Vec_Str_t **pvStatus, int fVerbose)
 
int Tas_StorePatternTry (Vec_Ptr_t *vInfo, Vec_Ptr_t *vPres, int iBit, int *pLits, int nLits)
 
int Tas_StorePattern (Vec_Ptr_t *vSimInfo, Vec_Ptr_t *vPres, Vec_Int_t *vCex)
 
void Tas_ManSolveMiterNc2 (Gia_Man_t *pAig, int nConfs, Gia_Man_t *pAigOld, Vec_Ptr_t *vOldRoots, Vec_Ptr_t *vSimInfo)
 

Variables

int s_Counter2 = 0
 
int s_Counter3 = 0
 
int s_Counter4 = 0
 

Macro Definition Documentation

◆ Tas_ClauseForEachVar

#define Tas_ClauseForEachVar ( p,
hClause,
pObj )
Value:
for ( (p)->pIter = (p)->pClauses.pData + hClause; (pObj = *pIter); (p)->pIter++ )
Cube * p
Definition exorList.c:222

Definition at line 142 of file giaCTas.c.

142#define Tas_ClauseForEachVar( p, hClause, pObj ) \
143 for ( (p)->pIter = (p)->pClauses.pData + hClause; (pObj = *pIter); (p)->pIter++ )

◆ Tas_ClauseForEachVar1

#define Tas_ClauseForEachVar1 ( p,
hClause,
pObj )
Value:
for ( (p)->pIter = (p)->pClauses.pData+hClause+1; (pObj = *pIter); (p)->pIter++ )

Definition at line 144 of file giaCTas.c.

144#define Tas_ClauseForEachVar1( p, hClause, pObj ) \
145 for ( (p)->pIter = (p)->pClauses.pData+hClause+1; (pObj = *pIter); (p)->pIter++ )

◆ Tas_QueForEachEntry

#define Tas_QueForEachEntry ( Que,
pObj,
i )
Value:
for ( i = (Que).iHead; (i < (Que).iTail) && ((pObj) = (Que).pData[i]); i++ )

Definition at line 139 of file giaCTas.c.

139#define Tas_QueForEachEntry( Que, pObj, i ) \
140 for ( i = (Que).iHead; (i < (Que).iTail) && ((pObj) = (Que).pData[i]); i++ )

Typedef Documentation

◆ Tas_Cls_t

typedef struct Tas_Cls_t_ Tas_Cls_t

Definition at line 57 of file giaCTas.c.

◆ Tas_Par_t

typedef typedefABC_NAMESPACE_IMPL_START struct Tas_Par_t_ Tas_Par_t

DECLARATIONS ///.

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

FileName [giaCSat.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [A simple circuit-based solver.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

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

FileName [giaCSat2.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Circuit-based SAT solver.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 33 of file giaCTas.c.

◆ Tas_Que_t

typedef struct Tas_Que_t_ Tas_Que_t

Definition at line 73 of file giaCTas.c.

◆ Tas_Sto_t

typedef struct Tas_Sto_t_ Tas_Sto_t

Definition at line 65 of file giaCTas.c.

Function Documentation

◆ Tas_ManAlloc()

Tas_Man_t * Tas_ManAlloc ( Gia_Man_t * pAig,
int nBTLimit )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file giaCTas.c.

188{
189 Tas_Man_t * p;
190 p = ABC_CALLOC( Tas_Man_t, 1 );
191 Tas_SetDefaultParams( &p->Pars );
192 p->pAig = pAig;
193 p->Pars.nBTLimit = nBTLimit;
194 p->pProp.nSize = p->pJust.nSize = p->pClauses.nSize = 10000;
195 p->pProp.pData = ABC_ALLOC( Gia_Obj_t *, p->pProp.nSize );
196 p->pJust.pData = ABC_ALLOC( Gia_Obj_t *, p->pJust.nSize );
197 p->pClauses.pData = ABC_ALLOC( Gia_Obj_t *, p->pClauses.nSize );
198 p->pClauses.iHead = p->pClauses.iTail = 1;
199 p->vModel = Vec_IntAlloc( 1000 );
200 p->vLevReas = Vec_IntAlloc( 1000 );
201 p->vTemp = Vec_PtrAlloc( 1000 );
202 p->pStore.iCur = 16;
203 p->pStore.nSize = 10000;
204 p->pStore.pData = ABC_ALLOC( int, p->pStore.nSize );
205 p->pWatches = ABC_CALLOC( int, 2 * Gia_ManObjNum(pAig) );
206 p->vWatchLits = Vec_IntAlloc( 100 );
207 p->pActivity = ABC_CALLOC( float, Gia_ManObjNum(pAig) );
208 p->vActiveVars = Vec_IntAlloc( 100 );
209 return p;
210}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
void Tas_SetDefaultParams(Tas_Par_t *pPars)
FUNCTION DEFINITIONS ///.
Definition giaCTas.c:162
struct Tas_Man_t_ Tas_Man_t
Definition gia.h:1821
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tas_ManPropagate()

int Tas_ManPropagate ( Tas_Man_t * p,
int Level )

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

Synopsis [Propagates all variables.]

Description [Returns 1 if conflict; 0 if no conflict.]

SideEffects []

SeeAlso []

Definition at line 1244 of file giaCTas.c.

1245{
1246 int hClause;
1247 Gia_Obj_t * pVar;
1248 int i, k;//, nIter = 0;
1249 while ( 1 )
1250 {
1251// nIter++;
1252 Tas_QueForEachEntry( p->pProp, pVar, i )
1253 {
1254 if ( (hClause = Tas_ManPropagateOne( p, pVar, Level )) )
1255 return hClause;
1256 }
1257 p->pProp.iHead = p->pProp.iTail;
1258 k = p->pJust.iHead;
1259 Tas_QueForEachEntry( p->pJust, pVar, i )
1260 {
1261 if ( Tas_VarIsJust( pVar ) )
1262 p->pJust.pData[k++] = pVar;
1263 else if ( (hClause = Tas_ManPropagateTwo( p, pVar, Level )) )
1264 return hClause;
1265 }
1266 if ( k == p->pJust.iTail )
1267 break;
1268 p->pJust.iTail = k;
1269 }
1270// printf( "%d ", nIter );
1271 return 0;
1272}
#define Tas_QueForEachEntry(Que, pObj, i)
Definition giaCTas.c:139
Here is the caller graph for this function:

◆ Tas_ManSatPrintStats()

void Tas_ManSatPrintStats ( Tas_Man_t * p)

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

Synopsis [Prints statistics of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1487 of file giaCTas.c.

1488{
1489 printf( "CO = %8d ", Gia_ManCoNum(p->pAig) );
1490 printf( "AND = %8d ", Gia_ManAndNum(p->pAig) );
1491 printf( "Conf = %6d ", p->Pars.nBTLimit );
1492 printf( "JustMax = %5d ", p->Pars.nJustLimit );
1493 printf( "\n" );
1494 printf( "Unsat calls %6d (%6.2f %%) Ave conf = %8.1f ",
1495 p->nSatUnsat, p->nSatTotal? 100.0*p->nSatUnsat/p->nSatTotal :0.0, p->nSatUnsat? 1.0*p->nConfUnsat/p->nSatUnsat :0.0 );
1496 ABC_PRTP( "Time", p->timeSatUnsat, p->timeTotal );
1497 printf( "Sat calls %6d (%6.2f %%) Ave conf = %8.1f ",
1498 p->nSatSat, p->nSatTotal? 100.0*p->nSatSat/p->nSatTotal :0.0, p->nSatSat? 1.0*p->nConfSat/p->nSatSat : 0.0 );
1499 ABC_PRTP( "Time", p->timeSatSat, p->timeTotal );
1500 printf( "Undef calls %6d (%6.2f %%) Ave conf = %8.1f ",
1501 p->nSatUndec, p->nSatTotal? 100.0*p->nSatUndec/p->nSatTotal :0.0, p->nSatUndec? 1.0*p->nConfUndec/p->nSatUndec : 0.0 );
1502 ABC_PRTP( "Time", p->timeSatUndec, p->timeTotal );
1503 ABC_PRT( "Total time", p->timeTotal );
1504}
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_PRTP(a, t, T)
Definition abc_global.h:258
Here is the caller graph for this function:

◆ Tas_ManSolve()

int Tas_ManSolve ( Tas_Man_t * p,
Gia_Obj_t * pObj,
Gia_Obj_t * pObj2 )

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

Synopsis [Looking for a satisfying assignment of the node.]

Description [Assumes that each node has flag pObj->fMark0 set to 0. Returns 1 if unsatisfiable, 0 if satisfiable, and -1 if undecided. The node may be complemented. ]

SideEffects []

SeeAlso []

Definition at line 1366 of file giaCTas.c.

1367{
1368 int i, Entry, RetValue = 0;
1369 s_Counter2 = 0;
1370 Vec_IntClear( p->vModel );
1371 if ( pObj == Gia_ManConst0(p->pAig) || pObj2 == Gia_ManConst0(p->pAig) || pObj == Gia_Not(pObj2) )
1372 return 1;
1373 if ( pObj == Gia_ManConst1(p->pAig) && (pObj2 == NULL || pObj2 == Gia_ManConst1(p->pAig)) )
1374 return 0;
1375 assert( !p->pProp.iHead && !p->pProp.iTail );
1376 assert( !p->pJust.iHead && !p->pJust.iTail );
1377 assert( p->pClauses.iHead == 1 && p->pClauses.iTail == 1 );
1378 p->Pars.nBTThis = p->Pars.nJustThis = p->Pars.nBTThisNc = 0;
1379 Tas_ManAssign( p, pObj, 0, NULL, NULL );
1380 if ( pObj2 && !Tas_VarIsAssigned(Gia_Regular(pObj2)) )
1381 Tas_ManAssign( p, pObj2, 0, NULL, NULL );
1382 if ( !Tas_ManSolve_rec(p, 0) && !Tas_ManCheckLimits(p) )
1383 Tas_ManSaveModel( p, p->vModel );
1384 else
1385 RetValue = 1;
1386 Tas_ManCancelUntil( p, 0 );
1387 p->pJust.iHead = p->pJust.iTail = 0;
1388 p->pClauses.iHead = p->pClauses.iTail = 1;
1389 // clauses
1390 if ( p->nClauses > 0 )
1391 {
1392 p->pStore.iCur = 16;
1393 Vec_IntForEachEntry( p->vWatchLits, Entry, i )
1394 p->pWatches[Entry] = 0;
1395 Vec_IntClear( p->vWatchLits );
1396 p->nClauses = 0;
1397 }
1398 // activity
1399 Vec_IntForEachEntry( p->vActiveVars, Entry, i )
1400 p->pActivity[Entry] = 0.0;
1401 Vec_IntClear( p->vActiveVars );
1402 // statistics
1403 p->Pars.nBTTotal += p->Pars.nBTThis;
1404 p->Pars.nJustTotal = Abc_MaxInt( p->Pars.nJustTotal, p->Pars.nJustThis );
1405 if ( Tas_ManCheckLimits( p ) )
1406 RetValue = -1;
1407 return RetValue;
1408}
int s_Counter2
Definition giaCTas.c:639
int Tas_ManSolve_rec(Tas_Man_t *p, int Level)
Definition giaCTas.c:1285
#define assert(ex)
Definition util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tas_ManSolve_rec()

int Tas_ManSolve_rec ( Tas_Man_t * p,
int Level )

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

Synopsis [Solve the problem recursively.]

Description [Returns learnt clause if unsat, NULL if sat or undecided.]

SideEffects []

SeeAlso []

Definition at line 1285 of file giaCTas.c.

1286{
1287 Tas_Que_t * pQue = &(p->pClauses);
1288 Gia_Obj_t * pVar = NULL, * pDecVar = NULL;
1289 int hClause, hLearn0, hLearn1;
1290 int iPropHead, iJustHead, iJustTail;
1291 // propagate assignments
1292 assert( !Tas_QueIsEmpty(&p->pProp) );
1293 if ( (hClause = Tas_ManPropagate( p, Level )) )
1294 {
1295 Tas_ManCreateCls( p, hClause );
1296 return hClause;
1297 }
1298 // check for satisfying assignment
1299 assert( Tas_QueIsEmpty(&p->pProp) );
1300 if ( Tas_QueIsEmpty(&p->pJust) )
1301 return 0;
1302 // quit using resource limits
1303 p->Pars.nJustThis = Abc_MaxInt( p->Pars.nJustThis, p->pJust.iTail - p->pJust.iHead );
1304 if ( Tas_ManCheckLimits( p ) )
1305 return 0;
1306 // remember the state before branching
1307 iPropHead = p->pProp.iHead;
1308 Tas_QueStore( &p->pJust, &iJustHead, &iJustTail );
1309 // find the decision variable
1310 if ( p->Pars.fUseActive )
1311 pVar = NULL, pDecVar = Tas_ManFindActive( p );
1312 else if ( p->Pars.fUseHighest )
1313// pVar = NULL, pDecVar = Tas_ManDecideHighestFanin( p );
1314 pVar = Tas_ManDecideHighest( p );
1315 else if ( p->Pars.fUseLowest )
1316 pVar = Tas_ManDecideLowest( p );
1317 else if ( p->Pars.fUseMaxFF )
1318 pVar = Tas_ManDecideMaxFF( p );
1319 else assert( 0 );
1320 // chose decision variable using fanout count
1321 if ( pVar != NULL )
1322 {
1323 assert( Tas_VarIsJust( pVar ) );
1324 if ( Gia_ObjRefNum(p->pAig, Gia_ObjFanin0(pVar)) > Gia_ObjRefNum(p->pAig, Gia_ObjFanin1(pVar)) )
1325 pDecVar = Gia_Not(Gia_ObjChild0(pVar));
1326 else
1327 pDecVar = Gia_Not(Gia_ObjChild1(pVar));
1328// pDecVar = Gia_NotCond( pDecVar, Gia_Regular(pDecVar)->fMark1 ^ !Gia_IsComplement(pDecVar) );
1329 }
1330 // decide on first fanin
1331 Tas_ManAssign( p, pDecVar, Level+1, NULL, NULL );
1332 if ( !(hLearn0 = Tas_ManSolve_rec( p, Level+1 )) )
1333 return 0;
1334 if ( pQue->pData[hLearn0] != Gia_Regular(pDecVar) )
1335 return hLearn0;
1336 Tas_ManCancelUntil( p, iPropHead );
1337 Tas_QueRestore( &p->pJust, iJustHead, iJustTail );
1338 // decide on second fanin
1339 Tas_ManAssign( p, Gia_Not(pDecVar), Level+1, NULL, NULL );
1340 if ( !(hLearn1 = Tas_ManSolve_rec( p, Level+1 )) )
1341 return 0;
1342 if ( pQue->pData[hLearn1] != Gia_Regular(pDecVar) )
1343 return hLearn1;
1344 hClause = Tas_ManResolve( p, Level, hLearn0, hLearn1 );
1345 Tas_ManCreateCls( p, hClause );
1346// Tas_ManPrintClauseNew( p, Level, hClause );
1347// if ( Level > Tas_ClauseDecLevel(p, hClause) )
1348// p->Pars.nBTThisNc++;
1349 p->Pars.nBTThis++;
1350 return hClause;
1351}
int Tas_ManPropagate(Tas_Man_t *p, int Level)
Definition giaCTas.c:1244
struct Tas_Que_t_ Tas_Que_t
Definition giaCTas.c:73
Gia_Obj_t ** pData
Definition giaCTas.c:79
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tas_ManSolveArray()

int Tas_ManSolveArray ( Tas_Man_t * p,
Vec_Ptr_t * vObjs )

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

Synopsis [Looking for a satisfying assignment of the node.]

Description [Assumes that each node has flag pObj->fMark0 set to 0. Returns 1 if unsatisfiable, 0 if satisfiable, and -1 if undecided. The node may be complemented. ]

SideEffects []

SeeAlso []

Definition at line 1423 of file giaCTas.c.

1424{
1425 Gia_Obj_t * pObj;
1426 int i, Entry, RetValue = 0;
1427 s_Counter2 = 0;
1428 s_Counter3 = 0;
1429 s_Counter4 = 0;
1430 Vec_IntClear( p->vModel );
1431 Vec_PtrForEachEntry( Gia_Obj_t *, vObjs, pObj, i )
1432 if ( pObj == Gia_ManConst0(p->pAig) )
1433 return 1;
1434 assert( !p->pProp.iHead && !p->pProp.iTail );
1435 assert( !p->pJust.iHead && !p->pJust.iTail );
1436 assert( p->pClauses.iHead == 1 && p->pClauses.iTail == 1 );
1437 p->Pars.nBTThis = p->Pars.nJustThis = p->Pars.nBTThisNc = 0;
1438 Vec_PtrForEachEntry( Gia_Obj_t *, vObjs, pObj, i )
1439 if ( pObj != Gia_ManConst1(p->pAig) && !Tas_VarIsAssigned(Gia_Regular(pObj)) )
1440 Tas_ManAssign( p, pObj, 0, NULL, NULL );
1441 if ( !Tas_ManSolve_rec(p, 0) && !Tas_ManCheckLimits(p) )
1442 Tas_ManSaveModel( p, p->vModel );
1443 else
1444 RetValue = 1;
1445 Tas_ManCancelUntil( p, 0 );
1446 p->pJust.iHead = p->pJust.iTail = 0;
1447 p->pClauses.iHead = p->pClauses.iTail = 1;
1448 // clauses
1449 if ( p->nClauses > 0 )
1450 {
1451 p->pStore.iCur = 16;
1452 Vec_IntForEachEntry( p->vWatchLits, Entry, i )
1453 p->pWatches[Entry] = 0;
1454 Vec_IntClear( p->vWatchLits );
1455 p->nClauses = 0;
1456 }
1457 // activity
1458 Vec_IntForEachEntry( p->vActiveVars, Entry, i )
1459 p->pActivity[Entry] = 0.0;
1460 Vec_IntClear( p->vActiveVars );
1461 // statistics
1462 p->Pars.nBTTotal += p->Pars.nBTThis;
1463 p->Pars.nJustTotal = Abc_MaxInt( p->Pars.nJustTotal, p->Pars.nJustThis );
1464 if ( Tas_ManCheckLimits( p ) )
1465 RetValue = -1;
1466
1467// printf( "%d ", Gia_ManObjNum(p->pAig) );
1468// printf( "%d ", p->Pars.nBTThis );
1469// printf( "%d ", p->Pars.nJustThis );
1470// printf( "%d ", s_Counter2 );
1471// printf( "%d ", s_Counter3 );
1472// printf( "%d ", s_Counter4 );
1473 return RetValue;
1474}
int s_Counter4
Definition giaCTas.c:641
int s_Counter3
Definition giaCTas.c:640
#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:

◆ Tas_ManSolveMiterNc()

Vec_Int_t * Tas_ManSolveMiterNc ( Gia_Man_t * pAig,
int nConfs,
Vec_Str_t ** pvStatus,
int fVerbose )

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

Synopsis [Procedure to test the new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 1517 of file giaCTas.c.

1518{
1519 extern void Gia_ManCollectTest( Gia_Man_t * pAig );
1520 extern void Cec_ManSatAddToStore( Vec_Int_t * vCexStore, Vec_Int_t * vCex, int Out );
1521 Tas_Man_t * p;
1522 Vec_Int_t * vCex, * vVisit, * vCexStore;
1523 Vec_Str_t * vStatus;
1524 Gia_Obj_t * pRoot;//, * pRootCopy;
1525// Gia_Man_t * pAigCopy = Gia_ManDup( pAig ), * pAigTemp;
1526
1527 int i, status;
1528 abctime clk, clkTotal = Abc_Clock();
1529 assert( Gia_ManRegNum(pAig) == 0 );
1530// Gia_ManCollectTest( pAig );
1531 // prepare AIG
1532 Gia_ManCreateRefs( pAig );
1533 Gia_ManCleanMark0( pAig );
1534 Gia_ManCleanMark1( pAig );
1535 Gia_ManFillValue( pAig ); // maps nodes into trail ids
1536 Gia_ManCleanPhase( pAig ); // maps nodes into trail ids
1537 // create logic network
1538 p = Tas_ManAlloc( pAig, nConfs );
1539 p->pAig = pAig;
1540 // create resulting data-structures
1541 vStatus = Vec_StrAlloc( Gia_ManPoNum(pAig) );
1542 vCexStore = Vec_IntAlloc( 10000 );
1543 vVisit = Vec_IntAlloc( 100 );
1544 vCex = Tas_ReadModel( p );
1545 // solve for each output
1546 Gia_ManForEachCo( pAig, pRoot, i )
1547 {
1548// printf( "%d=", i );
1549
1550 Vec_IntClear( vCex );
1551 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pRoot)) )
1552 {
1553 if ( Gia_ObjFaninC0(pRoot) )
1554 {
1555// printf( "Constant 1 output of SRM!!!\n" );
1556 Cec_ManSatAddToStore( vCexStore, vCex, i ); // trivial counter-example
1557 Vec_StrPush( vStatus, 0 );
1558 }
1559 else
1560 {
1561// printf( "Constant 0 output of SRM!!!\n" );
1562 Vec_StrPush( vStatus, 1 );
1563 }
1564 continue;
1565 }
1566 clk = Abc_Clock();
1567// p->Pars.fUseActive = 1;
1568 p->Pars.fUseHighest = 1;
1569 p->Pars.fUseLowest = 0;
1570 status = Tas_ManSolve( p, Gia_ObjChild0(pRoot), NULL );
1571// printf( "\n" );
1572/*
1573 if ( status == -1 )
1574 {
1575 p->Pars.fUseHighest = 0;
1576 p->Pars.fUseLowest = 1;
1577 status = Tas_ManSolve( p, Gia_ObjChild0(pRoot) );
1578 }
1579*/
1580 Vec_StrPush( vStatus, (char)status );
1581 if ( status == -1 )
1582 {
1583// printf( "Unsolved %d.\n", i );
1584
1585 p->nSatUndec++;
1586 p->nConfUndec += p->Pars.nBTThis;
1587 Cec_ManSatAddToStore( vCexStore, NULL, i ); // timeout
1588 p->timeSatUndec += Abc_Clock() - clk;
1589 continue;
1590 }
1591
1592// pRootCopy = Gia_ManCo( pAigCopy, i );
1593// pRootCopy->iDiff0 = Gia_ObjId( pAigCopy, pRootCopy );
1594// pRootCopy->fCompl0 = 0;
1595
1596 if ( status == 1 )
1597 {
1598 p->nSatUnsat++;
1599 p->nConfUnsat += p->Pars.nBTThis;
1600 p->timeSatUnsat += Abc_Clock() - clk;
1601 continue;
1602 }
1603 p->nSatSat++;
1604 p->nConfSat += p->Pars.nBTThis;
1605// Gia_SatVerifyPattern( pAig, pRoot, vCex, vVisit );
1606 Cec_ManSatAddToStore( vCexStore, vCex, i );
1607 p->timeSatSat += Abc_Clock() - clk;
1608
1609// printf( "%d ", Vec_IntSize(vCex) );
1610 }
1611// pAigCopy = Gia_ManCleanup( pAigTemp = pAigCopy );
1612// Gia_ManStop( pAigTemp );
1613// Gia_DumpAiger( pAigCopy, "test", 0, 2 );
1614// Gia_ManStop( pAigCopy );
1615
1616 Vec_IntFree( vVisit );
1617 p->nSatTotal = Gia_ManPoNum(pAig);
1618 p->timeTotal = Abc_Clock() - clkTotal;
1619 if ( fVerbose )
1621// printf( "RecCalls = %8d. RecClause = %8d. RecNonChro = %8d.\n", p->nRecCall, p->nRecClause, p->nRecNonChro );
1622 Tas_ManStop( p );
1623 *pvStatus = vStatus;
1624
1625// printf( "Total number of cex literals = %d. (Ave = %d)\n",
1626// Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat,
1627// (Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat)/p->nSatSat );
1628 return vCexStore;
1629}
ABC_INT64_T abctime
Definition abc_global.h:332
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
void Cec_ManSatAddToStore(Vec_Int_t *vCexStore, Vec_Int_t *vCex, int Out)
Definition cecSolve.c:996
void Tas_ManSatPrintStats(Tas_Man_t *p)
Definition giaCTas.c:1487
Tas_Man_t * Tas_ManAlloc(Gia_Man_t *pAig, int nBTLimit)
Definition giaCTas.c:187
Vec_Int_t * Tas_ReadModel(Tas_Man_t *p)
Definition giaCTas.c:250
void Tas_ManStop(Tas_Man_t *p)
Definition giaCTas.c:223
int Tas_ManSolve(Tas_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pObj2)
Definition giaCTas.c:1366
void Gia_ManCollectTest(Gia_Man_t *p)
Definition giaDfs.c:232
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
void Gia_ManCleanPhase(Gia_Man_t *p)
Definition giaUtil.c:472
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition giaUtil.c:256
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition giaUtil.c:779
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition giaUtil.c:313
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tas_ManSolveMiterNc2()

void Tas_ManSolveMiterNc2 ( Gia_Man_t * pAig,
int nConfs,
Gia_Man_t * pAigOld,
Vec_Ptr_t * vOldRoots,
Vec_Ptr_t * vSimInfo )

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

Synopsis [Procedure to test the new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 1696 of file giaCTas.c.

1697{
1698 int nPatMax = 1000;
1699 int fVerbose = 1;
1700 extern void Gia_ManCollectTest( Gia_Man_t * pAig );
1701 extern void Cec_ManSatAddToStore( Vec_Int_t * vCexStore, Vec_Int_t * vCex, int Out );
1702 Tas_Man_t * p;
1703 Vec_Ptr_t * vPres;
1704 Vec_Int_t * vCex, * vVisit, * vCexStore;
1705 Vec_Str_t * vStatus;
1706 Gia_Obj_t * pRoot, * pOldRoot;
1707 int i, status;
1708 abctime clk, clkTotal = Abc_Clock();
1709 int Tried = 0, Stored = 0, Step = Gia_ManCoNum(pAig) / nPatMax;
1710 assert( Gia_ManRegNum(pAig) == 0 );
1711// Gia_ManCollectTest( pAig );
1712 // prepare AIG
1713 Gia_ManCreateRefs( pAig );
1714 Gia_ManCleanMark0( pAig );
1715 Gia_ManCleanMark1( pAig );
1716 Gia_ManFillValue( pAig ); // maps nodes into trail ids
1717 Gia_ManCleanPhase( pAig ); // maps nodes into trail ids
1718 // create logic network
1719 p = Tas_ManAlloc( pAig, nConfs );
1720 p->pAig = pAig;
1721 // create resulting data-structures
1722 vStatus = Vec_StrAlloc( Gia_ManPoNum(pAig) );
1723 vCexStore = Vec_IntAlloc( 10000 );
1724 vVisit = Vec_IntAlloc( 100 );
1725 vCex = Tas_ReadModel( p );
1726 // solve for each output
1727 vPres = Vec_PtrAllocSimInfo( Gia_ManCiNum(pAig), 1 );
1728 Vec_PtrCleanSimInfo( vPres, 0, 1 );
1729
1730 Gia_ManForEachCo( pAig, pRoot, i )
1731 {
1732 assert( !Gia_ObjIsConst0(Gia_ObjFanin0(pRoot)) );
1733 Vec_IntClear( vCex );
1734 clk = Abc_Clock();
1735 p->Pars.fUseHighest = 1;
1736 p->Pars.fUseLowest = 0;
1737 status = Tas_ManSolve( p, Gia_ObjChild0(pRoot), NULL );
1738 Vec_StrPush( vStatus, (char)status );
1739 if ( status == -1 )
1740 {
1741 p->nSatUndec++;
1742 p->nConfUndec += p->Pars.nBTThis;
1743// Cec_ManSatAddToStore( vCexStore, NULL, i ); // timeout
1744 p->timeSatUndec += Abc_Clock() - clk;
1745
1746 i += Step;
1747 continue;
1748 }
1749 if ( status == 1 )
1750 {
1751 p->nSatUnsat++;
1752 p->nConfUnsat += p->Pars.nBTThis;
1753 p->timeSatUnsat += Abc_Clock() - clk;
1754 // record proved
1755 pOldRoot = (Gia_Obj_t *)Vec_PtrEntry( vOldRoots, i );
1756 assert( !Gia_ObjProved( pAigOld, Gia_ObjId(pAigOld, pOldRoot) ) );
1757 Gia_ObjSetProved( pAigOld, Gia_ObjId(pAigOld, pOldRoot) );
1758
1759 i += Step;
1760 continue;
1761 }
1762 p->nSatSat++;
1763 p->nConfSat += p->Pars.nBTThis;
1764// Gia_SatVerifyPattern( pAig, pRoot, vCex, vVisit );
1765// Cec_ManSatAddToStore( vCexStore, vCex, i );
1766
1767 // save pattern
1768 Tried++;
1769 Stored += Tas_StorePattern( vSimInfo, vPres, vCex );
1770 p->timeSatSat += Abc_Clock() - clk;
1771 i += Step;
1772 }
1773 printf( "Tried = %d Stored = %d\n", Tried, Stored );
1774 Vec_IntFree( vVisit );
1775 p->nSatTotal = Gia_ManPoNum(pAig);
1776 p->timeTotal = Abc_Clock() - clkTotal;
1777 if ( fVerbose )
1779 Tas_ManStop( p );
1780 Vec_PtrFree( vPres );
1781 Vec_StrFree( vStatus );
1782}
int Tas_StorePattern(Vec_Ptr_t *vSimInfo, Vec_Ptr_t *vPres, Vec_Int_t *vCex)
Definition giaCTas.c:1676
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:

◆ Tas_ManStop()

void Tas_ManStop ( Tas_Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 223 of file giaCTas.c.

224{
225 Vec_IntFree( p->vActiveVars );
226 Vec_IntFree( p->vWatchLits );
227 Vec_IntFree( p->vLevReas );
228 Vec_IntFree( p->vModel );
229 Vec_PtrFree( p->vTemp );
230 ABC_FREE( p->pActivity );
231 ABC_FREE( p->pWatches );
232 ABC_FREE( p->pStore.pData );
233 ABC_FREE( p->pClauses.pData );
234 ABC_FREE( p->pProp.pData );
235 ABC_FREE( p->pJust.pData );
236 ABC_FREE( p );
237}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Tas_ReadModel()

Vec_Int_t * Tas_ReadModel ( Tas_Man_t * p)

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

Synopsis [Returns satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 250 of file giaCTas.c.

251{
252 return p->vModel;
253}
Here is the caller graph for this function:

◆ Tas_SetDefaultParams()

void Tas_SetDefaultParams ( Tas_Par_t * pPars)

FUNCTION DEFINITIONS ///.

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

Synopsis [Sets default values of the parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file giaCTas.c.

163{
164 memset( pPars, 0, sizeof(Tas_Par_t) );
165 pPars->nBTLimit = 2000; // limit on the number of conflicts
166 pPars->nJustLimit = 2000; // limit on the size of justification queue
167 pPars->fUseActive = 0; // use node with the highest activity
168 pPars->fUseHighest = 1; // use node with the highest ID
169 pPars->fUseLowest = 0; // use node with the lowest ID
170 pPars->fUseMaxFF = 0; // use node with the largest fanin fanout
171 pPars->fVerbose = 1; // print detailed statistics
172 pPars->VarDecay = (float)0.95; // variable decay
173 pPars->VarInc = 1.0; // variable increment
174}
typedefABC_NAMESPACE_IMPL_START struct Tas_Par_t_ Tas_Par_t
DECLARATIONS ///.
Definition giaCTas.c:33
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tas_StorePattern()

int Tas_StorePattern ( Vec_Ptr_t * vSimInfo,
Vec_Ptr_t * vPres,
Vec_Int_t * vCex )

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

Synopsis [Procedure to test the new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 1676 of file giaCTas.c.

1677{
1678 int k;
1679 for ( k = 1; k < 32; k++ )
1680 if ( Tas_StorePatternTry( vSimInfo, vPres, k, (int *)Vec_IntArray(vCex), Vec_IntSize(vCex) ) )
1681 break;
1682 return (int)(k < 32);
1683}
int Tas_StorePatternTry(Vec_Ptr_t *vInfo, Vec_Ptr_t *vPres, int iBit, int *pLits, int nLits)
Definition giaCTas.c:1642
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tas_StorePatternTry()

int Tas_StorePatternTry ( Vec_Ptr_t * vInfo,
Vec_Ptr_t * vPres,
int iBit,
int * pLits,
int nLits )

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

Synopsis [Packs patterns into array of simulation info.]

Description []

SideEffects []

SeeAlso []

                               `

Definition at line 1642 of file giaCTas.c.

1643{
1644 unsigned * pInfo, * pPres;
1645 int i;
1646 for ( i = 0; i < nLits; i++ )
1647 {
1648 pInfo = (unsigned *)Vec_PtrEntry(vInfo, Abc_Lit2Var(pLits[i]));
1649 pPres = (unsigned *)Vec_PtrEntry(vPres, Abc_Lit2Var(pLits[i]));
1650 if ( Abc_InfoHasBit( pPres, iBit ) &&
1651 Abc_InfoHasBit( pInfo, iBit ) == Abc_LitIsCompl(pLits[i]) )
1652 return 0;
1653 }
1654 for ( i = 0; i < nLits; i++ )
1655 {
1656 pInfo = (unsigned *)Vec_PtrEntry(vInfo, Abc_Lit2Var(pLits[i]));
1657 pPres = (unsigned *)Vec_PtrEntry(vPres, Abc_Lit2Var(pLits[i]));
1658 Abc_InfoSetBit( pPres, iBit );
1659 if ( Abc_InfoHasBit( pInfo, iBit ) == Abc_LitIsCompl(pLits[i]) )
1660 Abc_InfoXorBit( pInfo, iBit );
1661 }
1662 return 1;
1663}
Here is the caller graph for this function:

Variable Documentation

◆ s_Counter2

int s_Counter2 = 0

Definition at line 639 of file giaCTas.c.

◆ s_Counter3

int s_Counter3 = 0

Definition at line 640 of file giaCTas.c.

◆ s_Counter4

int s_Counter4 = 0

Definition at line 641 of file giaCTas.c.