ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaSweeper.c File Reference
#include "gia.h"
#include "base/main/main.h"
#include "sat/bsat/satSolver.h"
#include "proof/ssc/ssc.h"
Include dependency graph for giaSweeper.c:

Go to the source code of this file.

Classes

struct  Swp_Man_t_
 

Typedefs

typedef typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
 DECLARATIONS ///.
 

Functions

Gia_Man_tGia_SweeperStart (Gia_Man_t *pGia)
 
void Gia_SweeperStop (Gia_Man_t *pGia)
 
int Gia_SweeperIsRunning (Gia_Man_t *pGia)
 
double Gia_SweeperMemUsage (Gia_Man_t *pGia)
 
void Gia_SweeperPrintStats (Gia_Man_t *pGia)
 
void Gia_SweeperSetConflictLimit (Gia_Man_t *p, int nConfMax)
 
void Gia_SweeperSetRuntimeLimit (Gia_Man_t *p, int nSeconds)
 
Vec_Int_tGia_SweeperGetCex (Gia_Man_t *p)
 
int Gia_SweeperProbeCreate (Gia_Man_t *p, int iLit)
 
int Gia_SweeperProbeDelete (Gia_Man_t *p, int ProbeId)
 
int Gia_SweeperProbeUpdate (Gia_Man_t *p, int ProbeId, int iLitNew)
 
int Gia_SweeperProbeLit (Gia_Man_t *p, int ProbeId)
 
Vec_Int_tGia_SweeperCollectValidProbeIds (Gia_Man_t *p)
 
void Gia_SweeperCondPush (Gia_Man_t *p, int ProbeId)
 
int Gia_SweeperCondPop (Gia_Man_t *p)
 
Vec_Int_tGia_SweeperCondVector (Gia_Man_t *p)
 
Gia_Man_tGia_SweeperExtractUserLogic (Gia_Man_t *p, Vec_Int_t *vProbeIds, Vec_Ptr_t *vInNames, Vec_Ptr_t *vOutNames)
 
void Gia_SweeperLogicDump (Gia_Man_t *p, Vec_Int_t *vProbeIds, int fDumpConds, char *pFileName)
 
Gia_Man_tGia_SweeperCleanup (Gia_Man_t *p, char *pCommLime)
 
int Gia_SweeperCheckEquiv (Gia_Man_t *pGia, int Probe1, int Probe2)
 
int Gia_SweeperCondCheckUnsat (Gia_Man_t *pGia)
 
Vec_Int_tGia_SweeperGraft (Gia_Man_t *pDst, Vec_Int_t *vProbes, Gia_Man_t *pSrc)
 
Gia_Man_tGia_SweeperSweep (Gia_Man_t *p, Vec_Int_t *vProbeOuts, int nWords, int nConfs, int fVerify, int fVerbose)
 
int Gia_SweeperFraig (Gia_Man_t *p, Vec_Int_t *vProbeIds, char *pCommLime, int nWords, int nConfs, int fVerify, int fVerbose)
 
int Gia_SweeperRun (Gia_Man_t *p, Vec_Int_t *vProbeIds, char *pCommLime, int fVerbose)
 
Gia_Man_tGia_SweeperFraigTest (Gia_Man_t *pInit, int nWords, int nConfs, int fVerbose)
 

Typedef Documentation

◆ Swp_Man_t

typedef typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t

DECLARATIONS ///.

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

FileName [giaSweeper.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Incremental SAT sweeper.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 56 of file giaSweeper.c.

Function Documentation

◆ Gia_SweeperCheckEquiv()

int Gia_SweeperCheckEquiv ( Gia_Man_t * pGia,
int Probe1,
int Probe2 )

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

Synopsis [Runs equivalence test for probes.]

Description []

SideEffects []

SeeAlso []

Definition at line 789 of file giaSweeper.c.

790{
791 Swp_Man_t * p = (Swp_Man_t *)pGia->pData;
792 int iLitOld, iLitNew, iLitAig, pLitsSat[2], RetValue, RetValue1, ProbeId, i;
793 abctime clk;
794 p->nSatCalls++;
795 assert( p->pSat != NULL );
796 p->vCexUser = NULL;
797
798 // get the literals
799 iLitOld = Gia_SweeperProbeLit( pGia, Probe1 );
800 iLitNew = Gia_SweeperProbeLit( pGia, Probe2 );
801 // if the literals are identical, the probes are equivalent
802 if ( iLitOld == iLitNew )
803 return 1;
804 // if the literals are opposites, the probes are not equivalent
805 if ( Abc_LitRegular(iLitOld) == Abc_LitRegular(iLitNew) )
806 {
807 Vec_IntFill( p->vCexSwp, Gia_ManPiNum(pGia), 2 );
808 p->vCexUser = p->vCexSwp;
809 return 0;
810 }
811 // order the literals
812 if ( iLitOld < iLitNew )
813 ABC_SWAP( int, iLitOld, iLitNew );
814 assert( iLitOld > iLitNew );
815
816 // create logic cones and the array of assumptions
817 Vec_IntClear( p->vCondAssump );
818 Vec_IntForEachEntry( p->vCondProbes, ProbeId, i )
819 {
820 iLitAig = Gia_SweeperProbeLit( pGia, ProbeId );
821 Gia_ManCnfNodeAddToSolver( p, Abc_Lit2Var(iLitAig) );
822 Vec_IntPush( p->vCondAssump, Abc_LitNot(Swp_ManLit2Lit(p, iLitAig)) );
823 }
824 Gia_ManCnfNodeAddToSolver( p, Abc_Lit2Var(iLitOld) );
825 Gia_ManCnfNodeAddToSolver( p, Abc_Lit2Var(iLitNew) );
826 sat_solver_compress( p->pSat );
827
828 // set the SAT literals
829 pLitsSat[0] = Swp_ManLit2Lit( p, iLitOld );
830 pLitsSat[1] = Swp_ManLit2Lit( p, iLitNew );
831
832 // solve under assumptions
833 // A = 1; B = 0 OR A = 1; B = 1
834 Vec_IntPush( p->vCondAssump, pLitsSat[0] );
835 Vec_IntPush( p->vCondAssump, Abc_LitNot(pLitsSat[1]) );
836
837 // set runtime limit for this call
838 if ( p->nTimeOut )
839 sat_solver_set_runtime_limit( p->pSat, p->nTimeOut * CLOCKS_PER_SEC + Abc_Clock() );
840
841clk = Abc_Clock();
842 RetValue1 = sat_solver_solve( p->pSat, Vec_IntArray(p->vCondAssump), Vec_IntArray(p->vCondAssump) + Vec_IntSize(p->vCondAssump),
843 (ABC_INT64_T)p->nConfMax, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
844 Vec_IntShrink( p->vCondAssump, Vec_IntSize(p->vCondAssump) - 2 );
845p->timeSat += Abc_Clock() - clk;
846 if ( RetValue1 == l_False )
847 {
848 pLitsSat[0] = Abc_LitNot( pLitsSat[0] );
849 RetValue = sat_solver_addclause( p->pSat, pLitsSat, pLitsSat + 2 );
850 assert( RetValue );
851 pLitsSat[0] = Abc_LitNot( pLitsSat[0] );
852p->timeSatUnsat += Abc_Clock() - clk;
853 p->nSatCallsUnsat++;
854 }
855 else if ( RetValue1 == l_True )
856 {
857 p->vCexUser = Gia_ManGetCex( p->pGia, p->vId2Lit, p->pSat, p->vCexSwp );
858p->timeSatSat += Abc_Clock() - clk;
859 p->nSatCallsSat++;
860 return 0;
861 }
862 else // if ( RetValue1 == l_Undef )
863 {
864p->timeSatUndec += Abc_Clock() - clk;
865 p->nSatCallsUndec++;
866 return -1;
867 }
868
869 // if the old node was constant 0, we already know the answer
870 if ( Gia_ManIsConstLit(iLitNew) )
871 {
872 p->nSatProofs++;
873 return 1;
874 }
875
876 // solve under assumptions
877 // A = 0; B = 1 OR A = 0; B = 0
878 Vec_IntPush( p->vCondAssump, Abc_LitNot(pLitsSat[0]) );
879 Vec_IntPush( p->vCondAssump, pLitsSat[1] );
880
881clk = Abc_Clock();
882 RetValue1 = sat_solver_solve( p->pSat, Vec_IntArray(p->vCondAssump), Vec_IntArray(p->vCondAssump) + Vec_IntSize(p->vCondAssump),
883 (ABC_INT64_T)p->nConfMax, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
884 Vec_IntShrink( p->vCondAssump, Vec_IntSize(p->vCondAssump) - 2 );
885p->timeSat += Abc_Clock() - clk;
886 if ( RetValue1 == l_False )
887 {
888 pLitsSat[1] = Abc_LitNot( pLitsSat[1] );
889 RetValue = sat_solver_addclause( p->pSat, pLitsSat, pLitsSat + 2 );
890 assert( RetValue );
891 pLitsSat[1] = Abc_LitNot( pLitsSat[1] );
892p->timeSatUnsat += Abc_Clock() - clk;
893 p->nSatCallsUnsat++;
894 }
895 else if ( RetValue1 == l_True )
896 {
897 p->vCexUser = Gia_ManGetCex( p->pGia, p->vId2Lit, p->pSat, p->vCexSwp );
898p->timeSatSat += Abc_Clock() - clk;
899 p->nSatCallsSat++;
900 return 0;
901 }
902 else // if ( RetValue1 == l_Undef )
903 {
904p->timeSatUndec += Abc_Clock() - clk;
905 p->nSatCallsUndec++;
906 return -1;
907 }
908 // return SAT proof
909 p->nSatProofs++;
910 return 1;
911}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
ABC_INT64_T abctime
Definition abc_global.h:332
#define l_True
Definition bmcBmcS.c:35
#define l_False
Definition bmcBmcS.c:36
#define sat_solver_addclause
Definition cecSatG2.c:37
#define sat_solver_solve
Definition cecSatG2.c:45
Cube * p
Definition exorList.c:222
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition giaSweeper.c:56
int Gia_SweeperProbeLit(Gia_Man_t *p, int ProbeId)
Definition giaSweeper.c:276
void * pData
Definition gia.h:198
#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:

◆ Gia_SweeperCleanup()

Gia_Man_t * Gia_SweeperCleanup ( Gia_Man_t * p,
char * pCommLime )

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

Synopsis [Sweeper cleanup.]

Description [Returns new GIA with sweeper defined, which is the same as the original sweeper, with all the dangling logic removed and SAT solver restarted. The probe IDs are guaranteed to have the same logic functions as in the original manager.]

SideEffects [The input manager is deleted inside this procedure.]

SeeAlso []

Definition at line 461 of file giaSweeper.c.

462{
463 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
464 Vec_Int_t * vObjIds;
465 Gia_Man_t * pNew, * pTemp;
466 Gia_Obj_t * pObj;
467 int i, iLit, ProbeId;
468
469 // collect all internal nodes pointed to by currently-used probes
471 vObjIds = Vec_IntAlloc( 1000 );
472 Vec_IntForEachEntry( pSwp->vProbes, iLit, ProbeId )
473 {
474 if ( iLit < 0 ) continue;
475 pObj = Gia_Lit2Obj( p, iLit );
476 Gia_ManExtract_rec( p, Gia_Regular(pObj), vObjIds );
477 }
478 // create new manager
479 pNew = Gia_ManStart( 1 + Gia_ManPiNum(p) + Vec_IntSize(vObjIds) + 100 );
480 pNew->pName = Abc_UtilStrsav( p->pName );
481 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
482 Gia_ManConst0(p)->Value = 0;
483 Gia_ManForEachPi( p, pObj, i )
484 pObj->Value = Gia_ManAppendCi(pNew);
485 // create internal nodes
486 Gia_ManHashStart( pNew );
487 Gia_ManForEachObjVec( vObjIds, p, pObj, i )
488 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
489 Gia_ManHashStop( pNew );
490 // create outputs
491 Vec_IntForEachEntry( pSwp->vProbes, iLit, ProbeId )
492 {
493 if ( iLit < 0 ) continue;
494 pObj = Gia_Lit2Obj( p, iLit );
495 iLit = Gia_Regular(pObj)->Value ^ Gia_IsComplement(pObj);
496 Vec_IntWriteEntry( pSwp->vProbes, ProbeId, iLit );
497 }
498 Vec_IntFree( vObjIds );
499 // duplicate if needed
500 if ( Gia_ManHasDangling(pNew) )
501 {
502 pNew = Gia_ManCleanup( pTemp = pNew );
503 Gia_ManStop( pTemp );
504 }
505 // execute command line
506 if ( pCommLime )
507 {
508 // set pNew to be current GIA in ABC
510 // execute command line pCommLine using Abc_CmdCommandExecute()
512 // get pNew to be current GIA in ABC
514 }
515 // restart the SAT solver
516 Vec_IntClear( pSwp->vId2Lit );
517 sat_solver_delete( pSwp->pSat );
518 pSwp->pSat = sat_solver_new();
519 pSwp->nSatVars = 1;
520 sat_solver_setnvars( pSwp->pSat, 1000 );
521 Swp_ManSetObj2Lit( pSwp, 0, (iLit = Abc_Var2Lit(pSwp->nSatVars++, 0)) );
522 iLit = Abc_LitNot(iLit);
523 sat_solver_addclause( pSwp->pSat, &iLit, &iLit + 1 );
524 pSwp->timeStart = Abc_Clock();
525 // return the result
526 pNew->pData = p->pData; p->pData = NULL;
527 Gia_ManStop( p );
528 return pNew;
529}
void Abc_FrameUpdateGia(Abc_Frame_t *pAbc, Gia_Man_t *pNew)
Definition abc.c:824
Gia_Man_t * Abc_FrameGetGia(Abc_Frame_t *pAbc)
Definition abc.c:869
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
Definition mainFrame.c:643
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
Definition cmdApi.c:193
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
void Gia_ManHashStart(Gia_Man_t *p)
Definition giaHash.c:125
int Gia_ManHasDangling(Gia_Man_t *p)
Definition giaUtil.c:1353
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
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
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
sat_solver * sat_solver_new(void)
Definition satSolver.c:1137
void sat_solver_setnvars(sat_solver *s, int n)
Definition satSolver.c:1272
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
char * pSpec
Definition gia.h:100
char * pName
Definition gia.h:99
unsigned Value
Definition gia.h:89
Here is the call graph for this function:

◆ Gia_SweeperCollectValidProbeIds()

Vec_Int_t * Gia_SweeperCollectValidProbeIds ( Gia_Man_t * p)

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

Synopsis [This procedure returns indexes of all currently defined valid probes.]

Description []

SideEffects []

SeeAlso []

Definition at line 295 of file giaSweeper.c.

296{
297 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
298 Vec_Int_t * vProbeIds = Vec_IntAlloc( 1000 );
299 int iLit, ProbeId;
300 Vec_IntForEachEntry( pSwp->vProbes, iLit, ProbeId )
301 {
302 if ( iLit < 0 ) continue;
303 Vec_IntPush( vProbeIds, ProbeId );
304 }
305 return vProbeIds;
306}

◆ Gia_SweeperCondCheckUnsat()

int Gia_SweeperCondCheckUnsat ( Gia_Man_t * pGia)

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

Synopsis [Returns 1 if the set of conditions is UNSAT (0 if SAT; -1 if undecided).]

Description []

SideEffects []

SeeAlso []

Definition at line 924 of file giaSweeper.c.

925{
926 Swp_Man_t * p = (Swp_Man_t *)pGia->pData;
927 int RetValue, ProbeId, iLitAig, i;
928 abctime clk;
929 assert( p->pSat != NULL );
930 p->nSatCalls++;
931 p->vCexUser = NULL;
932
933 // create logic cones and the array of assumptions
934 Vec_IntClear( p->vCondAssump );
935 Vec_IntForEachEntry( p->vCondProbes, ProbeId, i )
936 {
937 iLitAig = Gia_SweeperProbeLit( pGia, ProbeId );
938 Gia_ManCnfNodeAddToSolver( p, Abc_Lit2Var(iLitAig) );
939 Vec_IntPush( p->vCondAssump, Abc_LitNot(Swp_ManLit2Lit(p, iLitAig)) );
940 }
941 sat_solver_compress( p->pSat );
942
943 // set runtime limit for this call
944 if ( p->nTimeOut )
945 sat_solver_set_runtime_limit( p->pSat, p->nTimeOut * CLOCKS_PER_SEC + Abc_Clock() );
946
947clk = Abc_Clock();
948 RetValue = sat_solver_solve( p->pSat, Vec_IntArray(p->vCondAssump), Vec_IntArray(p->vCondAssump) + Vec_IntSize(p->vCondAssump),
949 (ABC_INT64_T)p->nConfMax, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
950p->timeSat += Abc_Clock() - clk;
951 if ( RetValue == l_False )
952 {
953 assert( Vec_IntSize(p->vCondProbes) > 0 );
954p->timeSatUnsat += Abc_Clock() - clk;
955 p->nSatCallsUnsat++;
956 p->nSatProofs++;
957 return 1;
958 }
959 else if ( RetValue == l_True )
960 {
961 p->vCexUser = Gia_ManGetCex( p->pGia, p->vId2Lit, p->pSat, p->vCexSwp );
962p->timeSatSat += Abc_Clock() - clk;
963 p->nSatCallsSat++;
964 return 0;
965 }
966 else // if ( RetValue1 == l_Undef )
967 {
968p->timeSatUndec += Abc_Clock() - clk;
969 p->nSatCallsUndec++;
970 return -1;
971 }
972}
Here is the call graph for this function:

◆ Gia_SweeperCondPop()

int Gia_SweeperCondPop ( Gia_Man_t * p)

Definition at line 324 of file giaSweeper.c.

325{
326 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
327 return Vec_IntPop( pSwp->vCondProbes );
328}

◆ Gia_SweeperCondPush()

void Gia_SweeperCondPush ( Gia_Man_t * p,
int ProbeId )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 319 of file giaSweeper.c.

320{
321 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
322 Vec_IntPush( pSwp->vCondProbes, ProbeId );
323}
Here is the caller graph for this function:

◆ Gia_SweeperCondVector()

Vec_Int_t * Gia_SweeperCondVector ( Gia_Man_t * p)

Definition at line 329 of file giaSweeper.c.

330{
331 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
332 return pSwp->vCondProbes;
333}
Here is the caller graph for this function:

◆ Gia_SweeperExtractUserLogic()

Gia_Man_t * Gia_SweeperExtractUserLogic ( Gia_Man_t * p,
Vec_Int_t * vProbeIds,
Vec_Ptr_t * vInNames,
Vec_Ptr_t * vOutNames )

Definition at line 358 of file giaSweeper.c.

359{
360 Vec_Int_t * vObjIds, * vValues;
361 Gia_Man_t * pNew, * pTemp;
362 Gia_Obj_t * pObj;
363 int i, ProbeId;
364 assert( vInNames == NULL || Gia_ManPiNum(p) == Vec_PtrSize(vInNames) );
365 assert( vOutNames == NULL || Vec_IntSize(vProbeIds) == Vec_PtrSize(vOutNames) );
366 // create new
368 vObjIds = Vec_IntAlloc( 1000 );
369 Vec_IntForEachEntry( vProbeIds, ProbeId, i )
370 {
371 pObj = Gia_Lit2Obj( p, Gia_SweeperProbeLit(p, ProbeId) );
372 Gia_ManExtract_rec( p, Gia_Regular(pObj), vObjIds );
373 }
374 // create new manager
375 pNew = Gia_ManStart( 1 + Gia_ManPiNum(p) + Vec_IntSize(vObjIds) + Vec_IntSize(vProbeIds) + 100 );
376 pNew->pName = Abc_UtilStrsav( p->pName );
377 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
378 Gia_ManConst0(p)->Value = 0;
379 Gia_ManForEachPi( p, pObj, i )
380 pObj->Value = Gia_ManAppendCi(pNew);
381 // create internal nodes
382 Gia_ManHashStart( pNew );
383 vValues = Vec_IntAlloc( Vec_IntSize(vObjIds) );
384 Gia_ManForEachObjVec( vObjIds, p, pObj, i )
385 {
386 Vec_IntPush( vValues, pObj->Value );
387 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
388 }
389 Gia_ManHashStop( pNew );
390 // create outputs
391 Vec_IntForEachEntry( vProbeIds, ProbeId, i )
392 {
393 pObj = Gia_Lit2Obj( p, Gia_SweeperProbeLit(p, ProbeId) );
394 Gia_ManAppendCo( pNew, Gia_Regular(pObj)->Value ^ Gia_IsComplement(pObj) );
395 }
396 // return the values back
397 Gia_ManForEachPi( p, pObj, i )
398 pObj->Value = 0;
399 Gia_ManForEachObjVec( vObjIds, p, pObj, i )
400 pObj->Value = Vec_IntEntry( vValues, i );
401 Vec_IntFree( vObjIds );
402 Vec_IntFree( vValues );
403 // duplicate if needed
404 if ( Gia_ManHasDangling(pNew) )
405 {
406 pNew = Gia_ManCleanup( pTemp = pNew );
407 Gia_ManStop( pTemp );
408 }
409 // copy names if present
410 if ( vInNames )
411 pNew->vNamesIn = Vec_PtrDupStr( vInNames );
412 if ( vOutNames )
413 pNew->vNamesOut = Vec_PtrDupStr( vOutNames );
414 return pNew;
415}
Vec_Ptr_t * vNamesIn
Definition gia.h:181
Vec_Ptr_t * vNamesOut
Definition gia.h:182
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_SweeperFraig()

int Gia_SweeperFraig ( Gia_Man_t * p,
Vec_Int_t * vProbeIds,
char * pCommLime,
int nWords,
int nConfs,
int fVerify,
int fVerbose )

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

Synopsis [Procedure to perform conditional fraig sweeping on separate logic cones.]

Description [The procedure takes GIA with the sweeper defined. The sweeper is assumed to have some conditions currently pushed, which will be used as constraints for fraig sweeping. The second argument (vProbes) contains the array of probe IDs pointing to the user's logic cones to be SAT swept. Finally, the optional command line (pCommLine) is an ABC command line to be applied to the resulting GIA after SAT sweeping before it is grafted back into the original GIA manager. The return value is the status (success/failure) and the array of original probes possibly pointing to the new literals in the original GIA manager, corresponding to the user's logic cones after sweeping, synthesis and grafting.]

SideEffects []

SeeAlso []

Definition at line 1064 of file giaSweeper.c.

1065{
1066 Gia_Man_t * pNew;
1067 Vec_Int_t * vLits;
1068 int ProbeId, i;
1069 // sweeper is running
1071 // sweep the logic
1072 pNew = Gia_SweeperSweep( p, vProbeIds, nWords, nConfs, fVerify, fVerbose );
1073 if ( pNew == NULL )
1074 return 0;
1075 // execute command line
1076 if ( pCommLime )
1077 {
1078 // set pNew to be current GIA in ABC
1080 // execute command line pCommLine using Abc_CmdCommandExecute()
1082 // get pNew to be current GIA in ABC
1084 }
1085 // return logic back into the main manager
1086 vLits = Gia_SweeperGraft( p, NULL, pNew );
1087 Gia_ManStop( pNew );
1088 // update the array of probes
1089 Vec_IntForEachEntry( vProbeIds, ProbeId, i )
1090 Gia_SweeperProbeUpdate( p, ProbeId, Vec_IntEntry(vLits, i) );
1091 Vec_IntFree( vLits );
1092 return 1;
1093}
int nWords
Definition abcNpn.c:127
int Gia_SweeperProbeUpdate(Gia_Man_t *p, int ProbeId, int iLitNew)
Definition giaSweeper.c:267
Gia_Man_t * Gia_SweeperSweep(Gia_Man_t *p, Vec_Int_t *vProbeOuts, int nWords, int nConfs, int fVerify, int fVerbose)
Vec_Int_t * Gia_SweeperGraft(Gia_Man_t *pDst, Vec_Int_t *vProbes, Gia_Man_t *pSrc)
Definition giaSweeper.c:985
int Gia_SweeperIsRunning(Gia_Man_t *pGia)
Definition giaSweeper.c:164
Here is the call graph for this function:

◆ Gia_SweeperFraigTest()

Gia_Man_t * Gia_SweeperFraigTest ( Gia_Man_t * pInit,
int nWords,
int nConfs,
int fVerbose )

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

Synopsis [Sweeper sweeper test.]

Description []

SideEffects []

SeeAlso []

Definition at line 1152 of file giaSweeper.c.

1153{
1154 Gia_Man_t * p, * pGia;
1155 Gia_Obj_t * pObj;
1156 Vec_Int_t * vOuts;
1157 int i;
1158 // add one-hotness constraints
1159 p = Gia_ManDupOneHot( pInit );
1160 // create sweeper
1162 // collect outputs and create conditions
1163 vOuts = Vec_IntAlloc( Gia_ManPoNum(p) );
1164 Gia_ManForEachPo( p, pObj, i )
1165 if ( i < Gia_ManPoNum(p) - p->nConstrs ) // this is the user's output
1166 Vec_IntPush( vOuts, Gia_SweeperProbeCreate( p, Gia_ObjFaninLit0p(p, pObj) ) );
1167 else // this is a constraint
1168 Gia_SweeperCondPush( p, Gia_SweeperProbeCreate( p, Gia_ObjFaninLit0p(p, pObj) ) );
1169 // perform the sweeping
1170 pGia = Gia_SweeperSweep( p, vOuts, nWords, nConfs, fVerbose, 0 );
1171// pGia = Gia_ManDup( p );
1172 Vec_IntFree( vOuts );
1173 // sop the sweeper
1174 Gia_SweeperStop( p );
1175 Gia_ManStop( p );
1176 return pGia;
1177}
void Gia_SweeperCondPush(Gia_Man_t *p, int ProbeId)
Definition giaSweeper.c:319
void Gia_SweeperStop(Gia_Man_t *pGia)
Definition giaSweeper.c:157
int Gia_SweeperProbeCreate(Gia_Man_t *p, int iLit)
Definition giaSweeper.c:249
Gia_Man_t * Gia_SweeperStart(Gia_Man_t *pGia)
Definition giaSweeper.c:145
#define Gia_ManForEachPo(p, pObj, i)
Definition gia.h:1250
Gia_Man_t * Gia_ManDupOneHot(Gia_Man_t *p)
Definition giaDup.c:4108
Here is the call graph for this function:

◆ Gia_SweeperGetCex()

Vec_Int_t * Gia_SweeperGetCex ( Gia_Man_t * p)

Definition at line 230 of file giaSweeper.c.

231{
232 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
233 assert( pSwp->vCexUser == NULL || Vec_IntSize(pSwp->vCexUser) == Gia_ManPiNum(p) );
234 return pSwp->vCexUser;
235}

◆ Gia_SweeperGraft()

Vec_Int_t * Gia_SweeperGraft ( Gia_Man_t * pDst,
Vec_Int_t * vProbes,
Gia_Man_t * pSrc )

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

Synopsis [Performs grafting from another manager.]

Description [Returns the array of resulting literals in the destination manager.]

SideEffects []

SeeAlso []

Definition at line 985 of file giaSweeper.c.

986{
987 Vec_Int_t * vOutLits;
988 Gia_Obj_t * pObj;
989 int i;
991 if ( vProbes )
992 assert( Vec_IntSize(vProbes) == Gia_ManPiNum(pSrc) );
993 else
994 assert( Gia_ManPiNum(pDst) == Gia_ManPiNum(pSrc) );
995 Gia_ManForEachPi( pSrc, pObj, i )
996 pObj->Value = vProbes ? Gia_SweeperProbeLit(pDst, Vec_IntEntry(vProbes, i)) : Gia_Obj2Lit(pDst,Gia_ManPi(pDst, i));
997 Gia_ManForEachAnd( pSrc, pObj, i )
998 pObj->Value = Gia_ManHashAnd( pDst, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
999 vOutLits = Vec_IntAlloc( Gia_ManPoNum(pSrc) );
1000 Gia_ManForEachPo( pSrc, pObj, i )
1001 Vec_IntPush( vOutLits, Gia_ObjFanin0Copy(pObj) );
1002 return vOutLits;
1003}
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_SweeperIsRunning()

int Gia_SweeperIsRunning ( Gia_Man_t * pGia)

Definition at line 164 of file giaSweeper.c.

165{
166 return (pGia->pData != NULL);
167}
Here is the caller graph for this function:

◆ Gia_SweeperLogicDump()

void Gia_SweeperLogicDump ( Gia_Man_t * p,
Vec_Int_t * vProbeIds,
int fDumpConds,
char * pFileName )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 428 of file giaSweeper.c.

429{
430 Gia_Man_t * pGiaOuts = Gia_SweeperExtractUserLogic( p, vProbeIds, NULL, NULL );
431 Vec_Int_t * vProbeConds = Gia_SweeperCondVector( p );
432 printf( "Dumping logic cones" );
433 if ( fDumpConds && Vec_IntSize(vProbeConds) > 0 )
434 {
435 Gia_Man_t * pGiaCond = Gia_SweeperExtractUserLogic( p, vProbeConds, NULL, NULL );
436 Gia_ManDupAppendShare( pGiaOuts, pGiaCond );
437 pGiaOuts->nConstrs = Gia_ManPoNum(pGiaCond);
438 Gia_ManHashStop( pGiaOuts );
439 Gia_ManStop( pGiaCond );
440 printf( " and conditions" );
441 }
442 Gia_AigerWrite( pGiaOuts, pFileName, 0, 0, 0 );
443 Gia_ManStop( pGiaOuts );
444 printf( " into file \"%s\".\n", pFileName );
445}
Gia_Man_t * Gia_SweeperExtractUserLogic(Gia_Man_t *p, Vec_Int_t *vProbeIds, Vec_Ptr_t *vInNames, Vec_Ptr_t *vOutNames)
Definition giaSweeper.c:358
Vec_Int_t * Gia_SweeperCondVector(Gia_Man_t *p)
Definition giaSweeper.c:329
void Gia_ManDupAppendShare(Gia_Man_t *p, Gia_Man_t *pTwo)
Definition giaDup.c:1156
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
Definition giaAiger.c:1595
int nConstrs
Definition gia.h:122
Here is the call graph for this function:

◆ Gia_SweeperMemUsage()

double Gia_SweeperMemUsage ( Gia_Man_t * pGia)

Definition at line 168 of file giaSweeper.c.

169{
170 Swp_Man_t * p = (Swp_Man_t *)pGia->pData;
171 double nMem = sizeof(Swp_Man_t);
172 nMem += Vec_IntCap(p->vProbes);
173 nMem += Vec_IntCap(p->vCondProbes);
174 nMem += Vec_IntCap(p->vCondAssump);
175 nMem += Vec_IntCap(p->vId2Lit);
176 nMem += Vec_IntCap(p->vFront);
177 nMem += Vec_IntCap(p->vFanins);
178 nMem += Vec_IntCap(p->vCexSwp);
179 return 4.0 * nMem;
180}
Here is the caller graph for this function:

◆ Gia_SweeperPrintStats()

void Gia_SweeperPrintStats ( Gia_Man_t * pGia)

Definition at line 181 of file giaSweeper.c.

182{
183 Swp_Man_t * p = (Swp_Man_t *)pGia->pData;
184 double nMemSwp = Gia_SweeperMemUsage(pGia);
185 double nMemGia = (double)Gia_ManObjNum(pGia)*(sizeof(Gia_Obj_t) + sizeof(int));
186 double nMemSat = sat_solver_memory(p->pSat);
187 double nMemTot = nMemSwp + nMemGia + nMemSat;
188 printf( "SAT sweeper statistics:\n" );
189 printf( "Memory usage:\n" );
190 ABC_PRMP( "Sweeper ", nMemSwp, nMemTot );
191 ABC_PRMP( "AIG manager ", nMemGia, nMemTot );
192 ABC_PRMP( "SAT solver ", nMemSat, nMemTot );
193 ABC_PRMP( "TOTAL ", nMemTot, nMemTot );
194 printf( "Runtime usage:\n" );
195 p->timeTotal = Abc_Clock() - p->timeStart;
196 ABC_PRTP( "CNF construction", p->timeCnf, p->timeTotal );
197 ABC_PRTP( "SAT solving ", p->timeSat, p->timeTotal );
198 ABC_PRTP( " Sat ", p->timeSatSat, p->timeTotal );
199 ABC_PRTP( " Unsat ", p->timeSatUnsat, p->timeTotal );
200 ABC_PRTP( " Undecided ", p->timeSatUndec, p->timeTotal );
201 ABC_PRTP( "TOTAL RUNTIME ", p->timeTotal, p->timeTotal );
202 printf( "GIA: " );
203 Gia_ManPrintStats( pGia, NULL );
204 printf( "SAT calls = %d. Sat = %d. Unsat = %d. Undecided = %d. Proofs = %d.\n",
205 p->nSatCalls, p->nSatCallsSat, p->nSatCallsUnsat, p->nSatCallsUndec, p->nSatProofs );
206 Sat_SolverPrintStats( stdout, p->pSat );
207}
#define ABC_PRTP(a, t, T)
Definition abc_global.h:258
#define ABC_PRMP(a, f, F)
Definition abc_global.h:262
double Gia_SweeperMemUsage(Gia_Man_t *pGia)
Definition giaSweeper.c:168
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition giaMan.c:495
double sat_solver_memory(sat_solver *s)
Definition satSolver.c:1479
void Sat_SolverPrintStats(FILE *pFile, sat_solver *p)
Definition satUtil.c:193
Here is the call graph for this function:

◆ Gia_SweeperProbeCreate()

int Gia_SweeperProbeCreate ( Gia_Man_t * p,
int iLit )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 249 of file giaSweeper.c.

250{
251 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
252 int ProbeId = Vec_IntSize(pSwp->vProbes);
253 assert( iLit >= 0 );
254 Vec_IntPush( pSwp->vProbes, iLit );
255 return ProbeId;
256}
Here is the caller graph for this function:

◆ Gia_SweeperProbeDelete()

int Gia_SweeperProbeDelete ( Gia_Man_t * p,
int ProbeId )

Definition at line 258 of file giaSweeper.c.

259{
260 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
261 int iLit = Vec_IntEntry(pSwp->vProbes, ProbeId);
262 assert( iLit >= 0 );
263 Vec_IntWriteEntry(pSwp->vProbes, ProbeId, -1);
264 return iLit;
265}

◆ Gia_SweeperProbeLit()

int Gia_SweeperProbeLit ( Gia_Man_t * p,
int ProbeId )

Definition at line 276 of file giaSweeper.c.

277{
278 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
279 int iLit = Vec_IntEntry(pSwp->vProbes, ProbeId);
280 assert( iLit >= 0 );
281 return iLit;
282}
Here is the caller graph for this function:

◆ Gia_SweeperProbeUpdate()

int Gia_SweeperProbeUpdate ( Gia_Man_t * p,
int ProbeId,
int iLitNew )

Definition at line 267 of file giaSweeper.c.

268{
269 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
270 int iLit = Vec_IntEntry(pSwp->vProbes, ProbeId);
271 assert( iLit >= 0 );
272 Vec_IntWriteEntry(pSwp->vProbes, ProbeId, iLitNew);
273 return iLit;
274}
Here is the caller graph for this function:

◆ Gia_SweeperRun()

int Gia_SweeperRun ( Gia_Man_t * p,
Vec_Int_t * vProbeIds,
char * pCommLime,
int fVerbose )

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

Synopsis [Executes given command line for the logic defined by the probes.]

Description [ ]

SideEffects []

SeeAlso []

Definition at line 1106 of file giaSweeper.c.

1107{
1108 Gia_Man_t * pNew;
1109 Vec_Int_t * vLits;
1110 int ProbeId, i;
1111 // sweeper is running
1113 // sweep the logic
1114 pNew = Gia_SweeperExtractUserLogic( p, vProbeIds, NULL, NULL );
1115 // execute command line
1116 if ( pCommLime )
1117 {
1118 if ( fVerbose )
1119 printf( "GIA manager statistics before and after applying \"%s\":\n", pCommLime );
1120 if ( fVerbose )
1121 Gia_ManPrintStats( pNew, NULL );
1122 // set pNew to be current GIA in ABC
1124 // execute command line pCommLine using Abc_CmdCommandExecute()
1126 // get pNew to be current GIA in ABC
1128 if ( fVerbose )
1129 Gia_ManPrintStats( pNew, NULL );
1130 }
1131 // return logic back into the main manager
1132 vLits = Gia_SweeperGraft( p, NULL, pNew );
1133 Gia_ManStop( pNew );
1134 // update the array of probes
1135 Vec_IntForEachEntry( vProbeIds, ProbeId, i )
1136 Gia_SweeperProbeUpdate( p, ProbeId, Vec_IntEntry(vLits, i) );
1137 Vec_IntFree( vLits );
1138 return 1;
1139}
Here is the call graph for this function:

◆ Gia_SweeperSetConflictLimit()

void Gia_SweeperSetConflictLimit ( Gia_Man_t * p,
int nConfMax )

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

Synopsis [Setting resource limits.]

Description []

SideEffects []

SeeAlso []

Definition at line 220 of file giaSweeper.c.

221{
222 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
223 pSwp->nConfMax = nConfMax;
224}

◆ Gia_SweeperSetRuntimeLimit()

void Gia_SweeperSetRuntimeLimit ( Gia_Man_t * p,
int nSeconds )

Definition at line 225 of file giaSweeper.c.

226{
227 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
228 pSwp->nTimeOut = nSeconds;
229}

◆ Gia_SweeperStart()

Gia_Man_t * Gia_SweeperStart ( Gia_Man_t * pGia)

Definition at line 145 of file giaSweeper.c.

146{
147 if ( pGia == NULL )
148 pGia = Gia_ManStart( 10000 );
149 if ( Vec_IntSize(&pGia->vHTable) == 0 )
150 Gia_ManHashStart( pGia );
151 // recompute fPhase and fMark1 to mark multiple fanout nodes if AIG is already defined!!!
152
153 Swp_ManStart( pGia );
154 pGia->fSweeper = 1;
155 return pGia;
156}
Vec_Int_t vHTable
Definition gia.h:113
int fSweeper
Definition gia.h:115
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_SweeperStop()

void Gia_SweeperStop ( Gia_Man_t * pGia)

Definition at line 157 of file giaSweeper.c.

158{
159 pGia->fSweeper = 0;
160 Swp_ManStop( pGia );
161 Gia_ManHashStop( pGia );
162// Gia_ManStop( pGia );
163}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_SweeperSweep()

Gia_Man_t * Gia_SweeperSweep ( Gia_Man_t * p,
Vec_Int_t * vProbeOuts,
int nWords,
int nConfs,
int fVerify,
int fVerbose )

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

Synopsis [Performs conditional sweeping of the cone.]

Description [Returns the result as a new GIA manager with as many inputs as the original manager and as many outputs as there are logic cones.]

SideEffects []

SeeAlso []

Definition at line 1017 of file giaSweeper.c.

1018{
1019 Vec_Int_t * vProbeConds;
1020 Gia_Man_t * pGiaCond, * pGiaOuts, * pGiaRes;
1021 Ssc_Pars_t Pars, * pPars = &Pars;
1022 Ssc_ManSetDefaultParams( pPars );
1023 pPars->nWords = nWords;
1024 pPars->nBTLimit = nConfs;
1025 pPars->fVerify = fVerify;
1026 pPars->fVerbose = fVerbose;
1027 // sweeper is running
1029 // extract conditions and logic cones
1030 vProbeConds = Gia_SweeperCondVector( p );
1031 pGiaCond = Gia_SweeperExtractUserLogic( p, vProbeConds, NULL, NULL );
1032 pGiaOuts = Gia_SweeperExtractUserLogic( p, vProbeOuts, NULL, NULL );
1033 Gia_ManSetPhase( pGiaOuts );
1034 // if there is no conditions, define constant true constraint (constant 0 output)
1035 if ( Gia_ManPoNum(pGiaCond) == 0 )
1036 Gia_ManAppendCo( pGiaCond, Gia_ManConst0Lit() );
1037 // perform sweeping under constraints
1038 pGiaRes = Ssc_PerformSweeping( pGiaOuts, pGiaCond, pPars );
1039 Gia_ManStop( pGiaCond );
1040 Gia_ManStop( pGiaOuts );
1041 return pGiaRes;
1042}
void Gia_ManSetPhase(Gia_Man_t *p)
Definition giaUtil.c:420
Gia_Man_t * Ssc_PerformSweeping(Gia_Man_t *pAig, Gia_Man_t *pCare, Ssc_Pars_t *pPars)
Definition sscCore.c:413
typedefABC_NAMESPACE_HEADER_START struct Ssc_Pars_t_ Ssc_Pars_t
INCLUDES ///.
Definition ssc.h:43
void Ssc_ManSetDefaultParams(Ssc_Pars_t *p)
MACRO DEFINITIONS ///.
Definition sscCore.c:46
Here is the call graph for this function:
Here is the caller graph for this function: