ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sswInt.h File Reference
#include "aig/saig/saig.h"
#include "sat/bsat/satSolver.h"
#include "ssw.h"
#include "aig/ioa/ioa.h"
Include dependency graph for sswInt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Ssw_Man_t_
 
struct  Ssw_Sat_t_
 
struct  Ssw_Frm_t_
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Ssw_Man_t_ Ssw_Man_t
 INCLUDES ///.
 
typedef struct Ssw_Frm_t_ Ssw_Frm_t
 
typedef struct Ssw_Sat_t_ Ssw_Sat_t
 
typedef struct Ssw_Cla_t_ Ssw_Cla_t
 

Functions

Ssw_Frm_tSsw_FrmStart (Aig_Man_t *pAig)
 FUNCTION DECLARATIONS ///.
 
void Ssw_FrmStop (Ssw_Frm_t *p)
 
Aig_Man_tSsw_FramesWithClasses (Ssw_Man_t *p)
 
Aig_Man_tSsw_SpeculativeReduction (Ssw_Man_t *p)
 
Ssw_Cla_tSsw_ClassesStart (Aig_Man_t *pAig)
 
void Ssw_ClassesSetData (Ssw_Cla_t *p, void *pManData, unsigned(*pFuncNodeHash)(void *, Aig_Obj_t *), int(*pFuncNodeIsConst)(void *, Aig_Obj_t *), int(*pFuncNodesAreEqual)(void *, Aig_Obj_t *, Aig_Obj_t *))
 
void Ssw_ClassesStop (Ssw_Cla_t *p)
 
Aig_Man_tSsw_ClassesReadAig (Ssw_Cla_t *p)
 
Vec_Ptr_tSsw_ClassesGetRefined (Ssw_Cla_t *p)
 
void Ssw_ClassesClearRefined (Ssw_Cla_t *p)
 
int Ssw_ClassesCand1Num (Ssw_Cla_t *p)
 
int Ssw_ClassesClassNum (Ssw_Cla_t *p)
 
int Ssw_ClassesLitNum (Ssw_Cla_t *p)
 
Aig_Obj_t ** Ssw_ClassesReadClass (Ssw_Cla_t *p, Aig_Obj_t *pRepr, int *pnSize)
 
void Ssw_ClassesCollectClass (Ssw_Cla_t *p, Aig_Obj_t *pRepr, Vec_Ptr_t *vClass)
 
void Ssw_ClassesCheck (Ssw_Cla_t *p)
 
void Ssw_ClassesPrint (Ssw_Cla_t *p, int fVeryVerbose)
 
void Ssw_ClassesRemoveNode (Ssw_Cla_t *p, Aig_Obj_t *pObj)
 
Ssw_Cla_tSsw_ClassesPrepare (Aig_Man_t *pAig, int nFramesK, int fLatchCorr, int fConstCorr, int fOutputCorr, int nMaxLevs, int fVerbose)
 
Ssw_Cla_tSsw_ClassesPrepareSimple (Aig_Man_t *pAig, int fLatchCorr, int nMaxLevs)
 
Ssw_Cla_tSsw_ClassesPrepareFromReprs (Aig_Man_t *pAig)
 
Ssw_Cla_tSsw_ClassesPrepareTargets (Aig_Man_t *pAig)
 
Ssw_Cla_tSsw_ClassesPreparePairs (Aig_Man_t *pAig, Vec_Int_t **pvClasses)
 
Ssw_Cla_tSsw_ClassesPreparePairsSimple (Aig_Man_t *pMiter, Vec_Int_t *vPairs)
 
int Ssw_ClassesRefine (Ssw_Cla_t *p, int fRecursive)
 
int Ssw_ClassesRefineGroup (Ssw_Cla_t *p, Vec_Ptr_t *vReprs, int fRecursive)
 
int Ssw_ClassesRefineOneClass (Ssw_Cla_t *p, Aig_Obj_t *pRepr, int fRecursive)
 
int Ssw_ClassesRefineConst1Group (Ssw_Cla_t *p, Vec_Ptr_t *vRoots, int fRecursive)
 
int Ssw_ClassesRefineConst1 (Ssw_Cla_t *p, int fRecursive)
 
int Ssw_ClassesPrepareRehash (Ssw_Cla_t *p, Vec_Ptr_t *vCands, int fConstCorr)
 
Ssw_Sat_tSsw_SatStart (int fPolarFlip)
 DECLARATIONS ///.
 
void Ssw_SatStop (Ssw_Sat_t *p)
 
void Ssw_CnfNodeAddToSolver (Ssw_Sat_t *p, Aig_Obj_t *pObj)
 
int Ssw_CnfGetNodeValue (Ssw_Sat_t *p, Aig_Obj_t *pObjFraig)
 
int Ssw_ManSweepBmcConstr (Ssw_Man_t *p)
 
int Ssw_ManSweepConstr (Ssw_Man_t *p)
 
void Ssw_ManRefineByConstrSim (Ssw_Man_t *p)
 
Aig_Man_tSsw_SignalCorrespondenceRefine (Ssw_Man_t *p)
 
void Ssw_ManLoadSolver (Ssw_Man_t *p, Aig_Obj_t *pRepr, Aig_Obj_t *pObj)
 
int Ssw_ManSweepDyn (Ssw_Man_t *p)
 
int Ssw_ManSweepLatch (Ssw_Man_t *p)
 
Ssw_Man_tSsw_ManCreate (Aig_Man_t *pAig, Ssw_Pars_t *pPars)
 DECLARATIONS ///.
 
void Ssw_ManCleanup (Ssw_Man_t *p)
 
void Ssw_ManStop (Ssw_Man_t *p)
 
int Ssw_NodesAreEquiv (Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
 DECLARATIONS ///.
 
int Ssw_NodesAreConstrained (Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
 
int Ssw_NodeIsConstrained (Ssw_Man_t *p, Aig_Obj_t *pPoObj)
 
int Ssw_FilterUsingSemi (Ssw_Man_t *pMan, int fCheckTargets, int nConfMax, int fVerbose)
 
unsigned Ssw_SmlObjHashWord (Ssw_Sml_t *p, Aig_Obj_t *pObj)
 FUNCTION DEFINITIONS ///.
 
int Ssw_SmlObjIsConstWord (Ssw_Sml_t *p, Aig_Obj_t *pObj)
 
int Ssw_SmlObjsAreEqualWord (Ssw_Sml_t *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
 
int Ssw_SmlObjIsConstBit (void *p, Aig_Obj_t *pObj)
 
int Ssw_SmlObjsAreEqualBit (void *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
 
void Ssw_SmlAssignRandomFrame (Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
 
Ssw_Sml_tSsw_SmlStart (Aig_Man_t *pAig, int nPref, int nFrames, int nWordsFrame)
 
void Ssw_SmlClean (Ssw_Sml_t *p)
 
void Ssw_SmlStop (Ssw_Sml_t *p)
 
void Ssw_SmlObjAssignConst (Ssw_Sml_t *p, Aig_Obj_t *pObj, int fConst1, int iFrame)
 
void Ssw_SmlObjSetWord (Ssw_Sml_t *p, Aig_Obj_t *pObj, unsigned Word, int iWord, int iFrame)
 
void Ssw_SmlAssignDist1Plus (Ssw_Sml_t *p, unsigned *pPat)
 
void Ssw_SmlSimulateOne (Ssw_Sml_t *p)
 
void Ssw_SmlSimulateOneFrame (Ssw_Sml_t *p)
 
void Ssw_SmlSimulateOneDyn_rec (Ssw_Sml_t *p, Aig_Obj_t *pObj, int f, int *pVisited, int nVisCounter)
 
void Ssw_SmlResimulateSeq (Ssw_Sml_t *p)
 
void Ssw_ManResimulateBit (Ssw_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
 DECLARATIONS ///.
 
void Ssw_ManResimulateWord (Ssw_Man_t *p, Aig_Obj_t *pCand, Aig_Obj_t *pRepr, int f)
 
int Ssw_ManGetSatVarValue (Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
 DECLARATIONS ///.
 
void Ssw_SmlSavePatternAig (Ssw_Man_t *p, int f)
 
int Ssw_ManSweepNode (Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc, Vec_Int_t *vPairs)
 
int Ssw_ManSweepBmc (Ssw_Man_t *p)
 
int Ssw_ManSweep (Ssw_Man_t *p)
 
void Ssw_UniqueRegisterPairInfo (Ssw_Man_t *p)
 DECLARATIONS ///.
 
int Ssw_ManUniqueOne (Ssw_Man_t *p, Aig_Obj_t *pRepr, Aig_Obj_t *pObj, int fVerbose)
 
int Ssw_ManUniqueAddConstraint (Ssw_Man_t *p, Vec_Ptr_t *vCommon, int f1, int f2)
 

Typedef Documentation

◆ Ssw_Cla_t

typedef struct Ssw_Cla_t_ Ssw_Cla_t

Definition at line 50 of file sswInt.h.

◆ Ssw_Frm_t

typedef struct Ssw_Frm_t_ Ssw_Frm_t

Definition at line 48 of file sswInt.h.

◆ Ssw_Man_t

typedef typedefABC_NAMESPACE_HEADER_START struct Ssw_Man_t_ Ssw_Man_t

INCLUDES ///.

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

FileName [sswInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id
sswInt.h,v 1.00 2008/09/01 00:00:00 alanmi Exp

] PARAMETERS /// BASIC TYPES ///

Definition at line 47 of file sswInt.h.

◆ Ssw_Sat_t

typedef struct Ssw_Sat_t_ Ssw_Sat_t

Definition at line 49 of file sswInt.h.

Function Documentation

◆ Ssw_ClassesCand1Num()

int Ssw_ClassesCand1Num ( Ssw_Cla_t * p)
extern

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 259 of file sswClass.c.

260{
261 return p->nCands1;
262}
Cube * p
Definition exorList.c:222
Here is the caller graph for this function:

◆ Ssw_ClassesCheck()

void Ssw_ClassesCheck ( Ssw_Cla_t * p)
extern

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

Synopsis [Checks candidate equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 350 of file sswClass.c.

351{
352 Aig_Obj_t * pObj, * pPrev, ** ppClass;
353 int i, k, nLits, nClasses, nCands1;
354 nClasses = nLits = 0;
355 Ssw_ManForEachClass( p, ppClass, k )
356 {
357 pPrev = NULL;
358 assert( p->pClassSizes[ppClass[0]->Id] >= 2 );
359 Ssw_ClassForEachNode( p, ppClass[0], pObj, i )
360 {
361 if ( i == 0 )
362 assert( Aig_ObjRepr(p->pAig, pObj) == NULL );
363 else
364 {
365 assert( Aig_ObjRepr(p->pAig, pObj) == ppClass[0] );
366 assert( pPrev->Id < pObj->Id );
367 nLits++;
368 }
369 pPrev = pObj;
370 }
371 nClasses++;
372 }
373 nCands1 = 0;
374 Aig_ManForEachObj( p->pAig, pObj, i )
375 nCands1 += Ssw_ObjIsConst1Cand( p->pAig, pObj );
376 assert( p->nLits == nLits );
377 assert( p->nCands1 == nCands1 );
378 assert( p->nClasses == nClasses );
379}
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
#define Ssw_ManForEachClass(p, ppClass, i)
Definition sswClass.c:69
#define Ssw_ClassForEachNode(p, pRepr, pNode, i)
Definition sswClass.c:73
int Id
Definition aig.h:85
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Ssw_ClassesClassNum()

int Ssw_ClassesClassNum ( Ssw_Cla_t * p)
extern

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 275 of file sswClass.c.

276{
277 return p->nClasses;
278}
Here is the caller graph for this function:

◆ Ssw_ClassesClearRefined()

void Ssw_ClassesClearRefined ( Ssw_Cla_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 243 of file sswClass.c.

244{
245 Vec_PtrClear( p->vRefined );
246}
Here is the caller graph for this function:

◆ Ssw_ClassesCollectClass()

void Ssw_ClassesCollectClass ( Ssw_Cla_t * p,
Aig_Obj_t * pRepr,
Vec_Ptr_t * vClass )
extern

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 328 of file sswClass.c.

329{
330 int i;
331 Vec_PtrClear( vClass );
332 if ( p->pId2Class[pRepr->Id] == NULL )
333 return;
334 assert( p->pClassSizes[pRepr->Id] > 1 );
335 for ( i = 1; i < p->pClassSizes[pRepr->Id]; i++ )
336 Vec_PtrPush( vClass, p->pId2Class[pRepr->Id][i] );
337}
Here is the caller graph for this function:

◆ Ssw_ClassesGetRefined()

Vec_Ptr_t * Ssw_ClassesGetRefined ( Ssw_Cla_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 227 of file sswClass.c.

228{
229 return p->vRefined;
230}

◆ Ssw_ClassesLitNum()

int Ssw_ClassesLitNum ( Ssw_Cla_t * p)
extern

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 291 of file sswClass.c.

292{
293 return p->nLits;
294}
Here is the caller graph for this function:

◆ Ssw_ClassesPrepare()

Ssw_Cla_t * Ssw_ClassesPrepare ( Aig_Man_t * pAig,
int nFramesK,
int fLatchCorr,
int fConstCorr,
int fOutputCorr,
int nMaxLevs,
int fVerbose )
extern

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

Synopsis [Creates initial simulation classes.]

Description [Assumes that simulation info is assigned.]

SideEffects []

SeeAlso []

Definition at line 596 of file sswClass.c.

597{
598// int nFrames = 4;
599// int nWords = 1;
600// int nIters = 16;
601
602// int nFrames = 32;
603// int nWords = 4;
604// int nIters = 0;
605
606 int nFrames = Abc_MaxInt( nFramesK, 4 );
607 int nWords = 2;
608 int nIters = 16;
609 Ssw_Cla_t * p;
610 Ssw_Sml_t * pSml;
611 Vec_Ptr_t * vCands;
612 Aig_Obj_t * pObj;
613 int i, k, RetValue;
614 abctime clk;
615
616 // start the classes
617 p = Ssw_ClassesStart( pAig );
618 p->fConstCorr = fConstCorr;
619
620 // perform sequential simulation
621clk = Abc_Clock();
622 pSml = Ssw_SmlSimulateSeq( pAig, 0, nFrames, nWords );
623if ( fVerbose )
624{
625 Abc_Print( 1, "Allocated %.2f MB to store simulation information.\n",
626 1.0*(sizeof(unsigned) * Aig_ManObjNumMax(pAig) * nFrames * nWords)/(1<<20) );
627 Abc_Print( 1, "Initial simulation of %d frames with %d words. ", nFrames, nWords );
628 ABC_PRT( "Time", Abc_Clock() - clk );
629}
630
631 // set comparison procedures
632clk = Abc_Clock();
633 Ssw_ClassesSetData( p, pSml, (unsigned(*)(void *,Aig_Obj_t *))Ssw_SmlObjHashWord, (int(*)(void *,Aig_Obj_t *))Ssw_SmlObjIsConstWord, (int(*)(void *,Aig_Obj_t *,Aig_Obj_t *))Ssw_SmlObjsAreEqualWord );
634
635 // collect nodes to be considered as candidates
636 vCands = Vec_PtrAlloc( 1000 );
637 Aig_ManForEachObj( p->pAig, pObj, i )
638 {
639 if ( fLatchCorr )
640 {
641 if ( !Saig_ObjIsLo(p->pAig, pObj) )
642 continue;
643 }
644 else
645 {
646 if ( !Aig_ObjIsNode(pObj) && !Aig_ObjIsCi(pObj) )
647 continue;
648 // skip the node with more that the given number of levels
649 if ( nMaxLevs && (int)pObj->Level > nMaxLevs )
650 continue;
651 }
652 Vec_PtrPush( vCands, pObj );
653 }
654
655 // this change will consider all PO drivers
656 if ( fOutputCorr )
657 {
658 Vec_PtrClear( vCands );
659 Aig_ManForEachObj( p->pAig, pObj, i )
660 pObj->fMarkB = 0;
661 Saig_ManForEachPo( p->pAig, pObj, i )
662 if ( Aig_ObjIsCand(Aig_ObjFanin0(pObj)) )
663 Aig_ObjFanin0(pObj)->fMarkB = 1;
664 Aig_ManForEachObj( p->pAig, pObj, i )
665 if ( pObj->fMarkB )
666 Vec_PtrPush( vCands, pObj );
667 Aig_ManForEachObj( p->pAig, pObj, i )
668 pObj->fMarkB = 0;
669 }
670
671 // allocate room for classes
672 p->pMemClasses = ABC_ALLOC( Aig_Obj_t *, Vec_PtrSize(vCands) );
673 p->pMemClassesFree = p->pMemClasses;
674
675 // now it is time to refine the classes
676 Ssw_ClassesPrepareRehash( p, vCands, fConstCorr );
677if ( fVerbose )
678{
679 Abc_Print( 1, "Collecting candidate equivalence classes. " );
680ABC_PRT( "Time", Abc_Clock() - clk );
681}
682
683clk = Abc_Clock();
684 // perform iterative refinement using simulation
685 for ( i = 1; i < nIters; i++ )
686 {
687 // collect const1 candidates
688 Vec_PtrClear( vCands );
689 Aig_ManForEachObj( p->pAig, pObj, k )
690 if ( Ssw_ObjIsConst1Cand( p->pAig, pObj ) )
691 Vec_PtrPush( vCands, pObj );
692 assert( Vec_PtrSize(vCands) == p->nCands1 );
693 // perform new round of simulation
694 Ssw_SmlResimulateSeq( pSml );
695 // check equivalence classes
696 RetValue = Ssw_ClassesPrepareRehash( p, vCands, fConstCorr );
697 if ( RetValue == 0 )
698 break;
699 }
700 Ssw_SmlStop( pSml );
701 Vec_PtrFree( vCands );
702if ( fVerbose )
703{
704 Abc_Print( 1, "Simulation of %d frames with %d words (%2d rounds). ",
705 nFrames, nWords, i-1 );
706 ABC_PRT( "Time", Abc_Clock() - clk );
707}
709// Ssw_ClassesPrint( p, 0 );
710 return p;
711}
int nWords
Definition abcNpn.c:127
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define Saig_ManForEachPo(p, pObj, i)
Definition saig.h:93
int Ssw_ClassesPrepareRehash(Ssw_Cla_t *p, Vec_Ptr_t *vCands, int fConstCorr)
Definition sswClass.c:500
void Ssw_ClassesCheck(Ssw_Cla_t *p)
Definition sswClass.c:350
Ssw_Cla_t * Ssw_ClassesStart(Aig_Man_t *pAig)
Definition sswClass.c:140
void Ssw_ClassesSetData(Ssw_Cla_t *p, void *pManData, unsigned(*pFuncNodeHash)(void *, Aig_Obj_t *), int(*pFuncNodeIsConst)(void *, Aig_Obj_t *), int(*pFuncNodesAreEqual)(void *, Aig_Obj_t *, Aig_Obj_t *))
Definition sswClass.c:167
struct Ssw_Cla_t_ Ssw_Cla_t
Definition sswInt.h:50
void Ssw_SmlResimulateSeq(Ssw_Sml_t *p)
Definition sswSim.c:1269
unsigned Ssw_SmlObjHashWord(Ssw_Sml_t *p, Aig_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition sswSim.c:63
int Ssw_SmlObjIsConstWord(Ssw_Sml_t *p, Aig_Obj_t *pObj)
Definition sswSim.c:102
struct Ssw_Sml_t_ Ssw_Sml_t
Definition ssw.h:120
int Ssw_SmlObjsAreEqualWord(Ssw_Sml_t *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition sswSim.c:124
Ssw_Sml_t * Ssw_SmlSimulateSeq(Aig_Man_t *pAig, int nPref, int nFrames, int nWords)
Definition sswSim.c:1248
void Ssw_SmlStop(Ssw_Sml_t *p)
Definition sswSim.c:1211
unsigned int fMarkB
Definition aig.h:80
unsigned Level
Definition aig.h:82
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesPrepareFromReprs()

Ssw_Cla_t * Ssw_ClassesPrepareFromReprs ( Aig_Man_t * pAig)
extern

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

Synopsis [Creates initial simulation classes.]

Description [Assumes that simulation info is assigned.]

SideEffects []

SeeAlso []

Definition at line 768 of file sswClass.c.

769{
770 Ssw_Cla_t * p;
771 Aig_Obj_t * pObj, * pRepr;
772 int * pClassSizes, nEntries, i;
773 // start the classes
774 p = Ssw_ClassesStart( pAig );
775 // allocate memory for classes
776 p->pMemClasses = ABC_CALLOC( Aig_Obj_t *, Aig_ManObjNumMax(pAig) );
777 // count classes
778 p->nCands1 = 0;
779 Aig_ManForEachObj( pAig, pObj, i )
780 {
781 if ( Ssw_ObjIsConst1Cand(pAig, pObj) )
782 {
783 p->nCands1++;
784 continue;
785 }
786 if ( (pRepr = Aig_ObjRepr(pAig, pObj)) )
787 {
788 if ( p->pClassSizes[pRepr->Id]++ == 0 )
789 p->pClassSizes[pRepr->Id]++;
790 }
791 }
792 // add nodes
793 nEntries = 0;
794 p->nClasses = 0;
795 pClassSizes = ABC_CALLOC( int, Aig_ManObjNumMax(pAig) );
796 Aig_ManForEachObj( pAig, pObj, i )
797 {
798 if ( p->pClassSizes[i] )
799 {
800 p->pId2Class[i] = p->pMemClasses + nEntries;
801 nEntries += p->pClassSizes[i];
802 p->pId2Class[i][pClassSizes[i]++] = pObj;
803 p->nClasses++;
804 continue;
805 }
806 if ( Ssw_ObjIsConst1Cand(pAig, pObj) )
807 continue;
808 if ( (pRepr = Aig_ObjRepr(pAig, pObj)) )
809 p->pId2Class[pRepr->Id][pClassSizes[pRepr->Id]++] = pObj;
810 }
811 p->pMemClassesFree = p->pMemClasses + nEntries;
812 p->nLits = nEntries - p->nClasses;
813 assert( memcmp(pClassSizes, p->pClassSizes, sizeof(int)*Aig_ManObjNumMax(pAig)) == 0 );
814 ABC_FREE( pClassSizes );
815// Abc_Print( 1, "After converting:\n" );
816// Ssw_ClassesPrint( p, 0 );
817 return p;
818}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
int memcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesPreparePairs()

Ssw_Cla_t * Ssw_ClassesPreparePairs ( Aig_Man_t * pAig,
Vec_Int_t ** pvClasses )
extern

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

Synopsis [Creates classes from the temporary representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 862 of file sswClass.c.

863{
864 Ssw_Cla_t * p;
865 Aig_Obj_t ** ppClassNew;
866 Aig_Obj_t * pObj, * pRepr, * pPrev;
867 int i, k, nTotalObjs, nEntries, Entry;
868 // start the classes
869 p = Ssw_ClassesStart( pAig );
870 // count the number of entries in the classes
871 nTotalObjs = 0;
872 for ( i = 0; i < Aig_ManObjNumMax(pAig); i++ )
873 nTotalObjs += pvClasses[i] ? Vec_IntSize(pvClasses[i]) : 0;
874 // allocate memory for classes
875 p->pMemClasses = ABC_ALLOC( Aig_Obj_t *, nTotalObjs );
876 // create constant-1 class
877 if ( pvClasses[0] )
878 Vec_IntForEachEntry( pvClasses[0], Entry, i )
879 {
880 assert( (i == 0) == (Entry == 0) );
881 if ( i == 0 )
882 continue;
883 pObj = Aig_ManObj( pAig, Entry );
884 Ssw_ObjSetConst1Cand( pAig, pObj );
885 p->nCands1++;
886 }
887 // create classes
888 nEntries = 0;
889 for ( i = 1; i < Aig_ManObjNumMax(pAig); i++ )
890 {
891 if ( pvClasses[i] == NULL )
892 continue;
893 // get room for storing the class
894 ppClassNew = p->pMemClasses + nEntries;
895 nEntries += Vec_IntSize( pvClasses[i] );
896 // store the nodes of the class
897 pPrev = pRepr = Aig_ManObj( pAig, Vec_IntEntry(pvClasses[i],0) );
898 ppClassNew[0] = pRepr;
899 Vec_IntForEachEntryStart( pvClasses[i], Entry, k, 1 )
900 {
901 pObj = Aig_ManObj( pAig, Entry );
902 assert( pPrev->Id < pObj->Id );
903 pPrev = pObj;
904 ppClassNew[k] = pObj;
905 Aig_ObjSetRepr( pAig, pObj, pRepr );
906 }
907 // create new class
908 Ssw_ObjAddClass( p, pRepr, ppClassNew, Vec_IntSize(pvClasses[i]) );
909 }
910 // prepare room for new classes
911 p->pMemClassesFree = p->pMemClasses + nEntries;
913// Ssw_ClassesPrint( p, 0 );
914 return p;
915}
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition vecInt.h:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesPreparePairsSimple()

Ssw_Cla_t * Ssw_ClassesPreparePairsSimple ( Aig_Man_t * pMiter,
Vec_Int_t * vPairs )
extern

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

Synopsis [Creates classes from the temporary representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 928 of file sswClass.c.

929{
930 Ssw_Cla_t * p;
931 Aig_Obj_t ** ppClassNew;
932 Aig_Obj_t * pObj, * pRepr;
933 int i;
934 // start the classes
935 p = Ssw_ClassesStart( pMiter );
936 // allocate memory for classes
937 p->pMemClasses = ABC_ALLOC( Aig_Obj_t *, Vec_IntSize(vPairs) );
938 // create classes
939 for ( i = 0; i < Vec_IntSize(vPairs); i += 2 )
940 {
941 pRepr = Aig_ManObj( pMiter, Vec_IntEntry(vPairs, i) );
942 pObj = Aig_ManObj( pMiter, Vec_IntEntry(vPairs, i+1) );
943 assert( Aig_ObjId(pRepr) < Aig_ObjId(pObj) );
944 Aig_ObjSetRepr( pMiter, pObj, pRepr );
945 // get room for storing the class
946 ppClassNew = p->pMemClasses + i;
947 ppClassNew[0] = pRepr;
948 ppClassNew[1] = pObj;
949 // create new class
950 Ssw_ObjAddClass( p, pRepr, ppClassNew, 2 );
951 }
952 // prepare room for new classes
953 p->pMemClassesFree = NULL;
955// Ssw_ClassesPrint( p, 0 );
956 return p;
957}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesPrepareRehash()

int Ssw_ClassesPrepareRehash ( Ssw_Cla_t * p,
Vec_Ptr_t * vCands,
int fConstCorr )
extern

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

Synopsis [Takes the set of const1 cands and rehashes them using sim info.]

Description []

SideEffects []

SeeAlso []

Definition at line 500 of file sswClass.c.

501{
502// Aig_Man_t * pAig = p->pAig;
503 Aig_Obj_t ** ppTable, ** ppNexts, ** ppClassNew;
504 Aig_Obj_t * pObj, * pTemp, * pRepr;
505 int i, k, nTableSize, nNodes, iEntry, nEntries, nEntries2;
506
507 // allocate the hash table hashing simulation info into nodes
508 nTableSize = Abc_PrimeCudd( Vec_PtrSize(vCands)/2 );
509 ppTable = ABC_CALLOC( Aig_Obj_t *, nTableSize );
510 ppNexts = ABC_CALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p->pAig) );
511
512 // sort through the candidates
513 nEntries = 0;
514 p->nCands1 = 0;
515 Vec_PtrForEachEntry( Aig_Obj_t *, vCands, pObj, i )
516 {
517 assert( p->pClassSizes[pObj->Id] == 0 );
518 Aig_ObjSetRepr( p->pAig, pObj, NULL );
519 // check if the node belongs to the class of constant 1
520 if ( p->pFuncNodeIsConst( p->pManData, pObj ) )
521 {
522 Ssw_ObjSetConst1Cand( p->pAig, pObj );
523 p->nCands1++;
524 continue;
525 }
526 if ( fConstCorr )
527 continue;
528 // hash the node by its simulation info
529 iEntry = p->pFuncNodeHash( p->pManData, pObj ) % nTableSize;
530 // add the node to the class
531 if ( ppTable[iEntry] == NULL )
532 {
533 ppTable[iEntry] = pObj;
534 }
535 else
536 {
537 // set the representative of this node
538 pRepr = ppTable[iEntry];
539 Aig_ObjSetRepr( p->pAig, pObj, pRepr );
540 // add node to the table
541 if ( Ssw_ObjNext( ppNexts, pRepr ) == NULL )
542 { // this will be the second entry
543 p->pClassSizes[pRepr->Id]++;
544 nEntries++;
545 }
546 // add the entry to the list
547 Ssw_ObjSetNext( ppNexts, pObj, Ssw_ObjNext( ppNexts, pRepr ) );
548 Ssw_ObjSetNext( ppNexts, pRepr, pObj );
549 p->pClassSizes[pRepr->Id]++;
550 nEntries++;
551 }
552 }
553
554 // copy the entries into storage in the topological order
555 nEntries2 = 0;
556 Vec_PtrForEachEntry( Aig_Obj_t *, vCands, pObj, i )
557 {
558 nNodes = p->pClassSizes[pObj->Id];
559 // skip the nodes that are not representatives of non-trivial classes
560 if ( nNodes == 0 )
561 continue;
562 assert( nNodes > 1 );
563 // add the nodes to the class in the topological order
564 ppClassNew = p->pMemClassesFree + nEntries2;
565 ppClassNew[0] = pObj;
566 for ( pTemp = Ssw_ObjNext(ppNexts, pObj), k = 1; pTemp;
567 pTemp = Ssw_ObjNext(ppNexts, pTemp), k++ )
568 {
569 ppClassNew[nNodes-k] = pTemp;
570 }
571 // add the class of nodes
572 p->pClassSizes[pObj->Id] = 0;
573 Ssw_ObjAddClass( p, pObj, ppClassNew, nNodes );
574 // increment the number of entries
575 nEntries2 += nNodes;
576 }
577 p->pMemClassesFree += nEntries2;
578 assert( nEntries == nEntries2 );
579 ABC_FREE( ppTable );
580 ABC_FREE( ppNexts );
581 // now it is time to refine the classes
582 return Ssw_ClassesRefine( p, 1 );
583}
int Ssw_ClassesRefine(Ssw_Cla_t *p, int fRecursive)
Definition sswClass.c:1034
#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:

◆ Ssw_ClassesPrepareSimple()

Ssw_Cla_t * Ssw_ClassesPrepareSimple ( Aig_Man_t * pAig,
int fLatchCorr,
int nMaxLevs )
extern

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

Synopsis [Creates initial simulation classes.]

Description [Assumes that simulation info is assigned.]

SideEffects []

SeeAlso []

Definition at line 724 of file sswClass.c.

725{
726 Ssw_Cla_t * p;
727 Aig_Obj_t * pObj;
728 int i;
729 // start the classes
730 p = Ssw_ClassesStart( pAig );
731 // go through the nodes
732 p->nCands1 = 0;
733 Aig_ManForEachObj( pAig, pObj, i )
734 {
735 if ( fLatchCorr )
736 {
737 if ( !Saig_ObjIsLo(pAig, pObj) )
738 continue;
739 }
740 else
741 {
742 if ( !Aig_ObjIsNode(pObj) && !Saig_ObjIsLo(pAig, pObj) )
743 continue;
744 // skip the node with more that the given number of levels
745 if ( nMaxLevs && (int)pObj->Level > nMaxLevs )
746 continue;
747 }
748 Ssw_ObjSetConst1Cand( pAig, pObj );
749 p->nCands1++;
750 }
751 // allocate room for classes
752 p->pMemClassesFree = p->pMemClasses = ABC_ALLOC( Aig_Obj_t *, p->nCands1 );
753// Ssw_ClassesPrint( p, 0 );
754 return p;
755}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesPrepareTargets()

Ssw_Cla_t * Ssw_ClassesPrepareTargets ( Aig_Man_t * pAig)
extern

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

Synopsis [Creates initial simulation classes.]

Description [Assumes that simulation info is assigned.]

SideEffects []

SeeAlso []

Definition at line 831 of file sswClass.c.

832{
833 Ssw_Cla_t * p;
834 Aig_Obj_t * pObj;
835 int i;
836 // start the classes
837 p = Ssw_ClassesStart( pAig );
838 // go through the nodes
839 p->nCands1 = 0;
840 Saig_ManForEachPo( pAig, pObj, i )
841 {
842 Ssw_ObjSetConst1Cand( pAig, Aig_ObjFanin0(pObj) );
843 p->nCands1++;
844 }
845 // allocate room for classes
846 p->pMemClassesFree = p->pMemClasses = ABC_ALLOC( Aig_Obj_t *, p->nCands1 );
847// Ssw_ClassesPrint( p, 0 );
848 return p;
849}
Here is the call graph for this function:

◆ Ssw_ClassesPrint()

void Ssw_ClassesPrint ( Ssw_Cla_t * p,
int fVeryVerbose )
extern

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

Synopsis [Prints simulation classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 414 of file sswClass.c.

415{
416 Aig_Obj_t ** ppClass;
417 Aig_Obj_t * pObj;
418 int i;
419 Abc_Print( 1, "Equiv classes: Const1 = %5d. Class = %5d. Lit = %5d.\n",
420 p->nCands1, p->nClasses, p->nCands1+p->nLits );
421 if ( !fVeryVerbose )
422 return;
423 Abc_Print( 1, "Constants { " );
424 Aig_ManForEachObj( p->pAig, pObj, i )
425 if ( Ssw_ObjIsConst1Cand( p->pAig, pObj ) )
426 Abc_Print( 1, "%d(%d,%d,%d) ", pObj->Id, pObj->Level,
427 Aig_SupportSize(p->pAig,pObj), Aig_NodeMffcSupp(p->pAig,pObj,0,NULL) );
428 Abc_Print( 1, "}\n" );
429 Ssw_ManForEachClass( p, ppClass, i )
430 {
431 Abc_Print( 1, "%3d (%3d) : ", i, p->pClassSizes[i] );
432 Ssw_ClassesPrintOne( p, ppClass[0] );
433 }
434 Abc_Print( 1, "\n" );
435}
int Aig_SupportSize(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition aigDfs.c:772
int Aig_NodeMffcSupp(Aig_Man_t *p, Aig_Obj_t *pNode, int LevelMin, Vec_Ptr_t *vSupp)
Definition aigMffc.c:179
void Ssw_ClassesPrintOne(Ssw_Cla_t *p, Aig_Obj_t *pRepr)
Definition sswClass.c:392
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesReadAig()

Aig_Man_t * Ssw_ClassesReadAig ( Ssw_Cla_t * p)
extern

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 211 of file sswClass.c.

212{
213 return p->pAig;
214}

◆ Ssw_ClassesReadClass()

Aig_Obj_t ** Ssw_ClassesReadClass ( Ssw_Cla_t * p,
Aig_Obj_t * pRepr,
int * pnSize )
extern

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file sswClass.c.

308{
309 if ( p->pId2Class[pRepr->Id] == NULL )
310 return NULL;
311 assert( p->pId2Class[pRepr->Id] != NULL );
312 assert( p->pClassSizes[pRepr->Id] > 1 );
313 *pnSize = p->pClassSizes[pRepr->Id];
314 return p->pId2Class[pRepr->Id];
315}
Here is the caller graph for this function:

◆ Ssw_ClassesRefine()

int Ssw_ClassesRefine ( Ssw_Cla_t * p,
int fRecursive )
extern

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

Synopsis [Refines the classes after simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 1034 of file sswClass.c.

1035{
1036 Aig_Obj_t ** ppClass;
1037 int i, nRefis = 0;
1038 Ssw_ManForEachClass( p, ppClass, i )
1039 nRefis += Ssw_ClassesRefineOneClass( p, ppClass[0], fRecursive );
1040 return nRefis;
1041}
int Ssw_ClassesRefineOneClass(Ssw_Cla_t *p, Aig_Obj_t *pReprOld, int fRecursive)
Definition sswClass.c:970
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesRefineConst1()

int Ssw_ClassesRefineConst1 ( Ssw_Cla_t * p,
int fRecursive )
extern

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

Synopsis [Refine the group of constant 1 nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1119 of file sswClass.c.

1120{
1121 Aig_Obj_t * pObj, * pReprNew, ** ppClassNew;
1122 int i;
1123 // collect the nodes to be refined
1124 Vec_PtrClear( p->vClassNew );
1125 for ( i = 0; i < Vec_PtrSize(p->pAig->vObjs); i++ )
1126 if ( p->pAig->pReprs[i] == Aig_ManConst1(p->pAig) )
1127 {
1128 pObj = Aig_ManObj( p->pAig, i );
1129 if ( !p->pFuncNodeIsConst( p->pManData, pObj ) )
1130 {
1131 Vec_PtrPush( p->vClassNew, pObj );
1132// Vec_PtrPush( p->vRefined, pObj );
1133 }
1134 }
1135 // check if there is a new class
1136 if ( Vec_PtrSize(p->vClassNew) == 0 )
1137 return 0;
1138 if ( p->fConstCorr )
1139 {
1140 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClassNew, pObj, i )
1141 Aig_ObjSetRepr( p->pAig, pObj, NULL );
1142 return 1;
1143 }
1144 p->nCands1 -= Vec_PtrSize(p->vClassNew);
1145 pReprNew = (Aig_Obj_t *)Vec_PtrEntry( p->vClassNew, 0 );
1146 Aig_ObjSetRepr( p->pAig, pReprNew, NULL );
1147 if ( Vec_PtrSize(p->vClassNew) == 1 )
1148 return 1;
1149 // create a new class composed of these nodes
1150 ppClassNew = p->pMemClassesFree;
1151 p->pMemClassesFree += Vec_PtrSize(p->vClassNew);
1152 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClassNew, pObj, i )
1153 {
1154 ppClassNew[i] = pObj;
1155 Aig_ObjSetRepr( p->pAig, pObj, i? pReprNew : NULL );
1156 }
1157 Ssw_ObjAddClass( p, pReprNew, ppClassNew, Vec_PtrSize(p->vClassNew) );
1158 // refine them recursively
1159 if ( fRecursive )
1160 return 1 + Ssw_ClassesRefineOneClass( p, pReprNew, 1 );
1161 return 1;
1162}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesRefineConst1Group()

int Ssw_ClassesRefineConst1Group ( Ssw_Cla_t * p,
Vec_Ptr_t * vRoots,
int fRecursive )
extern

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

Synopsis [Refine the group of constant 1 nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1074 of file sswClass.c.

1075{
1076 Aig_Obj_t * pObj, * pReprNew, ** ppClassNew;
1077 int i;
1078 if ( Vec_PtrSize(vRoots) == 0 )
1079 return 0;
1080 // collect the nodes to be refined
1081 Vec_PtrClear( p->vClassNew );
1082 Vec_PtrForEachEntry( Aig_Obj_t *, vRoots, pObj, i )
1083 if ( !p->pFuncNodeIsConst( p->pManData, pObj ) )
1084 Vec_PtrPush( p->vClassNew, pObj );
1085 // check if there is a new class
1086 if ( Vec_PtrSize(p->vClassNew) == 0 )
1087 return 0;
1088 p->nCands1 -= Vec_PtrSize(p->vClassNew);
1089 pReprNew = (Aig_Obj_t *)Vec_PtrEntry( p->vClassNew, 0 );
1090 Aig_ObjSetRepr( p->pAig, pReprNew, NULL );
1091 if ( Vec_PtrSize(p->vClassNew) == 1 )
1092 return 1;
1093 // create a new class composed of these nodes
1094 ppClassNew = p->pMemClassesFree;
1095 p->pMemClassesFree += Vec_PtrSize(p->vClassNew);
1096 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClassNew, pObj, i )
1097 {
1098 ppClassNew[i] = pObj;
1099 Aig_ObjSetRepr( p->pAig, pObj, i? pReprNew : NULL );
1100 }
1101 Ssw_ObjAddClass( p, pReprNew, ppClassNew, Vec_PtrSize(p->vClassNew) );
1102 // refine them recursively
1103 if ( fRecursive )
1104 return 1 + Ssw_ClassesRefineOneClass( p, pReprNew, 1 );
1105 return 1;
1106}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesRefineGroup()

int Ssw_ClassesRefineGroup ( Ssw_Cla_t * p,
Vec_Ptr_t * vReprs,
int fRecursive )
extern

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

Synopsis [Refines the classes after simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 1054 of file sswClass.c.

1055{
1056 Aig_Obj_t * pObj;
1057 int i, nRefis = 0;
1058 Vec_PtrForEachEntry( Aig_Obj_t *, vReprs, pObj, i )
1059 nRefis += Ssw_ClassesRefineOneClass( p, pObj, fRecursive );
1060 return nRefis;
1061}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesRefineOneClass()

int Ssw_ClassesRefineOneClass ( Ssw_Cla_t * p,
Aig_Obj_t * pReprOld,
int fRecursive )
extern

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

Synopsis [Iteratively refines the classes after simulation.]

Description [Returns the number of refinements performed.]

SideEffects []

SeeAlso []

Definition at line 970 of file sswClass.c.

971{
972 Aig_Obj_t ** pClassOld, ** pClassNew;
973 Aig_Obj_t * pObj, * pReprNew;
974 int i;
975
976 // split the class
977 Vec_PtrClear( p->vClassOld );
978 Vec_PtrClear( p->vClassNew );
979 Ssw_ClassForEachNode( p, pReprOld, pObj, i )
980 if ( p->pFuncNodesAreEqual(p->pManData, pReprOld, pObj) )
981 Vec_PtrPush( p->vClassOld, pObj );
982 else
983 Vec_PtrPush( p->vClassNew, pObj );
984 // check if splitting happened
985 if ( Vec_PtrSize(p->vClassNew) == 0 )
986 return 0;
987 // remember that this class is refined
988// Ssw_ClassForEachNode( p, pReprOld, pObj, i )
989// Vec_PtrPush( p->vRefined, pObj );
990
991 // get the new representative
992 pReprNew = (Aig_Obj_t *)Vec_PtrEntry( p->vClassNew, 0 );
993 assert( Vec_PtrSize(p->vClassOld) > 0 );
994 assert( Vec_PtrSize(p->vClassNew) > 0 );
995
996 // create old class
997 pClassOld = Ssw_ObjRemoveClass( p, pReprOld );
998 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClassOld, pObj, i )
999 {
1000 pClassOld[i] = pObj;
1001 Aig_ObjSetRepr( p->pAig, pObj, i? pReprOld : NULL );
1002 }
1003 // create new class
1004 pClassNew = pClassOld + i;
1005 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClassNew, pObj, i )
1006 {
1007 pClassNew[i] = pObj;
1008 Aig_ObjSetRepr( p->pAig, pObj, i? pReprNew : NULL );
1009 }
1010
1011 // put classes back
1012 if ( Vec_PtrSize(p->vClassOld) > 1 )
1013 Ssw_ObjAddClass( p, pReprOld, pClassOld, Vec_PtrSize(p->vClassOld) );
1014 if ( Vec_PtrSize(p->vClassNew) > 1 )
1015 Ssw_ObjAddClass( p, pReprNew, pClassNew, Vec_PtrSize(p->vClassNew) );
1016
1017 // check if the class should be recursively refined
1018 if ( fRecursive && Vec_PtrSize(p->vClassNew) > 1 )
1019 return 1 + Ssw_ClassesRefineOneClass( p, pReprNew, 1 );
1020 return 1;
1021}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesRemoveNode()

void Ssw_ClassesRemoveNode ( Ssw_Cla_t * p,
Aig_Obj_t * pObj )
extern

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

Synopsis [Prints simulation classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 448 of file sswClass.c.

449{
450 Aig_Obj_t * pRepr, * pTemp;
451 assert( p->pClassSizes[pObj->Id] == 0 );
452 assert( p->pId2Class[pObj->Id] == NULL );
453 pRepr = Aig_ObjRepr( p->pAig, pObj );
454 assert( pRepr != NULL );
455// Vec_PtrPush( p->vRefined, pObj );
456 if ( Ssw_ObjIsConst1Cand( p->pAig, pObj ) )
457 {
458 assert( p->pClassSizes[pRepr->Id] == 0 );
459 assert( p->pId2Class[pRepr->Id] == NULL );
460 Aig_ObjSetRepr( p->pAig, pObj, NULL );
461 p->nCands1--;
462 return;
463 }
464// Vec_PtrPush( p->vRefined, pRepr );
465 Aig_ObjSetRepr( p->pAig, pObj, NULL );
466 assert( p->pId2Class[pRepr->Id][0] == pRepr );
467 assert( p->pClassSizes[pRepr->Id] >= 2 );
468 if ( p->pClassSizes[pRepr->Id] == 2 )
469 {
470 p->pId2Class[pRepr->Id] = NULL;
471 p->nClasses--;
472 p->pClassSizes[pRepr->Id] = 0;
473 p->nLits--;
474 }
475 else
476 {
477 int i, k = 0;
478 // remove the entry from the class
479 Ssw_ClassForEachNode( p, pRepr, pTemp, i )
480 if ( pTemp != pObj )
481 p->pId2Class[pRepr->Id][k++] = pTemp;
482 assert( k + 1 == p->pClassSizes[pRepr->Id] );
483 // reduce the class
484 p->pClassSizes[pRepr->Id]--;
485 p->nLits--;
486 }
487}
Here is the caller graph for this function:

◆ Ssw_ClassesSetData()

void Ssw_ClassesSetData ( Ssw_Cla_t * p,
void * pManData,
unsigned(* pFuncNodeHash )(void *, Aig_Obj_t *),
int(* pFuncNodeIsConst )(void *, Aig_Obj_t *),
int(* pFuncNodesAreEqual )(void *, Aig_Obj_t *, Aig_Obj_t *) )
extern

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

Synopsis [Starts representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 167 of file sswClass.c.

171{
172 p->pManData = pManData;
173 p->pFuncNodeHash = pFuncNodeHash;
174 p->pFuncNodeIsConst = pFuncNodeIsConst;
175 p->pFuncNodesAreEqual = pFuncNodesAreEqual;
176}
Here is the caller graph for this function:

◆ Ssw_ClassesStart()

Ssw_Cla_t * Ssw_ClassesStart ( Aig_Man_t * pAig)
extern

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

Synopsis [Starts representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 140 of file sswClass.c.

141{
142 Ssw_Cla_t * p;
143 p = ABC_ALLOC( Ssw_Cla_t, 1 );
144 memset( p, 0, sizeof(Ssw_Cla_t) );
145 p->pAig = pAig;
146 p->pId2Class = ABC_CALLOC( Aig_Obj_t **, Aig_ManObjNumMax(pAig) );
147 p->pClassSizes = ABC_CALLOC( int, Aig_ManObjNumMax(pAig) );
148 p->vClassOld = Vec_PtrAlloc( 100 );
149 p->vClassNew = Vec_PtrAlloc( 100 );
150 p->vRefined = Vec_PtrAlloc( 1000 );
151 if ( pAig->pReprs == NULL )
152 Aig_ManReprStart( pAig, Aig_ManObjNumMax(pAig) );
153 return p;
154}
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition aigRepr.c:45
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ClassesStop()

void Ssw_ClassesStop ( Ssw_Cla_t * p)
extern

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 189 of file sswClass.c.

190{
191 if ( p->vClassNew ) Vec_PtrFree( p->vClassNew );
192 if ( p->vClassOld ) Vec_PtrFree( p->vClassOld );
193 Vec_PtrFree( p->vRefined );
194 ABC_FREE( p->pId2Class );
195 ABC_FREE( p->pClassSizes );
196 ABC_FREE( p->pMemClasses );
197 ABC_FREE( p );
198}
Here is the caller graph for this function:

◆ Ssw_CnfGetNodeValue()

int Ssw_CnfGetNodeValue ( Ssw_Sat_t * p,
Aig_Obj_t * pObj )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 402 of file sswCnf.c.

403{
404 int Value0, Value1, nVarNum;
405 assert( !Aig_IsComplement(pObj) );
406 nVarNum = Ssw_ObjSatNum( p, pObj );
407 if ( nVarNum > 0 )
408 return sat_solver_var_value( p->pSat, nVarNum );
409// if ( pObj->fMarkA == 1 )
410// return 0;
411 if ( Aig_ObjIsCi(pObj) )
412 return 0;
413 assert( Aig_ObjIsNode(pObj) );
414 Value0 = Ssw_CnfGetNodeValue( p, Aig_ObjFanin0(pObj) );
415 Value0 ^= Aig_ObjFaninC0(pObj);
416 Value1 = Ssw_CnfGetNodeValue( p, Aig_ObjFanin1(pObj) );
417 Value1 ^= Aig_ObjFaninC1(pObj);
418 return Value0 & Value1;
419}
int Ssw_CnfGetNodeValue(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition sswCnf.c:402
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_CnfNodeAddToSolver()

void Ssw_CnfNodeAddToSolver ( Ssw_Sat_t * p,
Aig_Obj_t * pObj )
extern

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

Synopsis [Updates the solver clause database.]

Description []

SideEffects []

SeeAlso []

Definition at line 351 of file sswCnf.c.

352{
353 Vec_Ptr_t * vFrontier;
354 Aig_Obj_t * pNode, * pFanin;
355 int i, k, fUseMuxes = 1;
356 // quit if CNF is ready
357 if ( Ssw_ObjSatNum(p,pObj) )
358 return;
359 // start the frontier
360 vFrontier = Vec_PtrAlloc( 100 );
361 Ssw_ObjAddToFrontier( p, pObj, vFrontier );
362 // explore nodes in the frontier
363 Vec_PtrForEachEntry( Aig_Obj_t *, vFrontier, pNode, i )
364 {
365 // create the supergate
366 assert( Ssw_ObjSatNum(p,pNode) );
367 if ( fUseMuxes && Aig_ObjIsMuxType(pNode) )
368 {
369 Vec_PtrClear( p->vFanins );
370 Vec_PtrPushUnique( p->vFanins, Aig_ObjFanin0( Aig_ObjFanin0(pNode) ) );
371 Vec_PtrPushUnique( p->vFanins, Aig_ObjFanin0( Aig_ObjFanin1(pNode) ) );
372 Vec_PtrPushUnique( p->vFanins, Aig_ObjFanin1( Aig_ObjFanin0(pNode) ) );
373 Vec_PtrPushUnique( p->vFanins, Aig_ObjFanin1( Aig_ObjFanin1(pNode) ) );
374 Vec_PtrForEachEntry( Aig_Obj_t *, p->vFanins, pFanin, k )
375 Ssw_ObjAddToFrontier( p, Aig_Regular(pFanin), vFrontier );
376 Ssw_AddClausesMux( p, pNode );
377 }
378 else
379 {
380 Ssw_CollectSuper( pNode, fUseMuxes, p->vFanins );
381 Vec_PtrForEachEntry( Aig_Obj_t *, p->vFanins, pFanin, k )
382 Ssw_ObjAddToFrontier( p, Aig_Regular(pFanin), vFrontier );
383 Ssw_AddClausesSuper( p, pNode, p->vFanins );
384 }
385 assert( Vec_PtrSize(p->vFanins) > 1 );
386 }
387 Vec_PtrFree( vFrontier );
388}
int Aig_ObjIsMuxType(Aig_Obj_t *pObj)
Definition aigUtil.c:307
void Ssw_CollectSuper(Aig_Obj_t *pObj, int fUseMuxes, Vec_Ptr_t *vSuper)
Definition sswCnf.c:303
void Ssw_AddClausesSuper(Ssw_Sat_t *p, Aig_Obj_t *pNode, Vec_Ptr_t *vSuper)
Definition sswCnf.c:223
void Ssw_ObjAddToFrontier(Ssw_Sat_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vFrontier)
Definition sswCnf.c:322
void Ssw_AddClausesMux(Ssw_Sat_t *p, Aig_Obj_t *pNode)
Definition sswCnf.c:104
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_FilterUsingSemi()

int Ssw_FilterUsingSemi ( Ssw_Man_t * pMan,
int fCheckTargets,
int nConfMax,
int fVerbose )
extern

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

Synopsis [Returns 1 if one of the targets has failed.]

Description []

SideEffects []

SeeAlso []

Definition at line 261 of file sswSemi.c.

262{
263 Ssw_Sem_t * p;
264 int RetValue, Frames, Iter;
265 abctime clk = Abc_Clock();
266 p = Ssw_SemManStart( pMan, nConfMax, fVerbose );
267 if ( fCheckTargets && Ssw_SemCheckTargets( p ) )
268 {
269 assert( 0 );
270 Ssw_SemManStop( p );
271 return 1;
272 }
273 if ( fVerbose )
274 {
275 Abc_Print( 1, "AIG : C = %6d. Cl = %6d. Nodes = %6d. ConfMax = %6d. FramesMax = %6d.\n",
276 Ssw_ClassesCand1Num(p->pMan->ppClasses), Ssw_ClassesClassNum(p->pMan->ppClasses),
277 Aig_ManNodeNum(p->pMan->pAig), p->nConfMax, p->nFramesSweep );
278 }
279 RetValue = 0;
280 for ( Iter = 0; Iter < p->nPatterns; Iter++ )
281 {
282clk = Abc_Clock();
283 pMan->pMSat = Ssw_SatStart( 0 );
284 Frames = Ssw_ManFilterBmc( p, Iter, fCheckTargets );
285 if ( fVerbose )
286 {
287 Abc_Print( 1, "%3d : C = %6d. Cl = %6d. NR = %6d. F = %3d. C = %5d. P = %3d. %s ",
288 Iter, Ssw_ClassesCand1Num(p->pMan->ppClasses), Ssw_ClassesClassNum(p->pMan->ppClasses),
289 Aig_ManNodeNum(p->pMan->pFrames), Frames, (int)p->pMan->pMSat->pSat->stats.conflicts, p->nPatterns,
290 p->pMan->nSatFailsReal? "f" : " " );
291 ABC_PRT( "T", Abc_Clock() - clk );
292 }
293 Ssw_ManCleanup( p->pMan );
294 if ( fCheckTargets && Ssw_SemCheckTargets( p ) )
295 {
296 Abc_Print( 1, "Target is hit!!!\n" );
297 RetValue = 1;
298 }
299 if ( p->nPatterns >= p->nPatternsAlloc )
300 break;
301 }
302 Ssw_SemManStop( p );
303
304 pMan->nStrangers = 0;
305 pMan->nSatCalls = 0;
306 pMan->nSatProof = 0;
307 pMan->nSatFailsReal = 0;
308 pMan->nSatCallsUnsat = 0;
309 pMan->nSatCallsSat = 0;
310 pMan->timeSimSat = 0;
311 pMan->timeSat = 0;
312 pMan->timeSatSat = 0;
313 pMan->timeSatUnsat = 0;
314 pMan->timeSatUndec = 0;
315 return RetValue;
316}
int Ssw_ClassesCand1Num(Ssw_Cla_t *p)
Definition sswClass.c:259
int Ssw_ClassesClassNum(Ssw_Cla_t *p)
Definition sswClass.c:275
ABC_NAMESPACE_IMPL_START Ssw_Sat_t * Ssw_SatStart(int fPolarFlip)
DECLARATIONS ///.
Definition sswCnf.c:45
void Ssw_ManCleanup(Ssw_Man_t *p)
Definition sswMan.c:158
Ssw_Sem_t * Ssw_SemManStart(Ssw_Man_t *pMan, int nConfMax, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition sswSemi.c:64
int Ssw_SemCheckTargets(Ssw_Sem_t *p)
Definition sswSemi.c:129
typedefABC_NAMESPACE_IMPL_START struct Ssw_Sem_t_ Ssw_Sem_t
DECLARATIONS ///.
Definition sswSemi.c:30
void Ssw_SemManStop(Ssw_Sem_t *p)
Definition sswSemi.c:110
int Ssw_ManFilterBmc(Ssw_Sem_t *pBmc, int iPat, int fCheckTargets)
Definition sswSemi.c:177
Here is the call graph for this function:

◆ Ssw_FramesWithClasses()

Aig_Man_t * Ssw_FramesWithClasses ( Ssw_Man_t * p)
extern

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

Synopsis [Prepares the inductive case with speculative reduction.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file sswAig.c.

204{
205 Aig_Man_t * pFrames;
206 Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pObjNew;
207 int i, f, iLits;
208 assert( p->pFrames == NULL );
209 assert( Aig_ManRegNum(p->pAig) > 0 );
210 assert( Aig_ManRegNum(p->pAig) < Aig_ManCiNum(p->pAig) );
211 p->nConstrTotal = p->nConstrReduced = 0;
212
213 // start the fraig package
214 pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->nFrames );
215 // create latches for the first frame
216 Saig_ManForEachLo( p->pAig, pObj, i )
217 Ssw_ObjSetFrame( p, pObj, 0, Aig_ObjCreateCi(pFrames) );
218 // add timeframes
219 iLits = 0;
220 if ( p->pPars->nSkip )
221 srand(1);
222 for ( f = 0; f < p->pPars->nFramesK; f++ )
223 {
224 // map constants and PIs
225 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(pFrames) );
226 Saig_ManForEachPi( p->pAig, pObj, i )
227 {
228 pObjNew = Aig_ObjCreateCi(pFrames);
229 pObjNew->fPhase = (p->vInits != NULL) && Vec_IntEntry(p->vInits, iLits++);
230 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
231 }
232 // set the constraints on the latch outputs
233 Saig_ManForEachLo( p->pAig, pObj, i )
234 Ssw_FramesConstrainNode( p, pFrames, p->pAig, pObj, f, 1 );
235 // add internal nodes of this frame
236 Aig_ManForEachNode( p->pAig, pObj, i )
237 {
238 pObjNew = Aig_And( pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
239 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
240 Ssw_FramesConstrainNode( p, pFrames, p->pAig, pObj, f, 1 );
241 }
242 // transfer to the primary outputs
243 Aig_ManForEachCo( p->pAig, pObj, i )
244 Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj,f) );
245 // transfer latch input to the latch outputs
246 Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
247 Ssw_ObjSetFrame( p, pObjLo, f+1, Ssw_ObjFrame(p, pObjLi,f) );
248 }
249 assert( p->vInits == NULL || Vec_IntSize(p->vInits) == iLits + Saig_ManPiNum(p->pAig) );
250 // add the POs for the latch outputs of the last frame
251 Saig_ManForEachLo( p->pAig, pObj, i )
252 Aig_ObjCreateCo( pFrames, Ssw_ObjFrame( p, pObj, p->pPars->nFramesK ) );
253 // remove dangling nodes
254 Aig_ManCleanup( pFrames );
255 // make sure the satisfying assignment is node assigned
256 assert( pFrames->pData == NULL );
257//Aig_ManShow( pFrames, 0, NULL );
258 return pFrames;
259}
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition aigObj.c:66
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
int Aig_ManCleanup(Aig_Man_t *p)
Definition aigMan.c:265
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigObj.c:45
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition saig.h:101
#define Saig_ManForEachLo(p, pObj, i)
Definition saig.h:96
#define Saig_ManForEachPi(p, pObj, i)
Definition saig.h:91
unsigned int fPhase
Definition aig.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_FrmStart()

Ssw_Frm_t * Ssw_FrmStart ( Aig_Man_t * pAig)
extern

FUNCTION DECLARATIONS ///.

FUNCTION DECLARATIONS ///.

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

FileName [sswAig.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [AIG manipulation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id
sswAig.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

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

Synopsis [Starts the SAT manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file sswAig.c.

46{
47 Ssw_Frm_t * p;
48 p = ABC_ALLOC( Ssw_Frm_t, 1 );
49 memset( p, 0, sizeof(Ssw_Frm_t) );
50 p->pAig = pAig;
51 p->nObjs = Aig_ManObjNumMax( pAig );
52 p->nFrames = 0;
53 p->pFrames = NULL;
54 p->vAig2Frm = Vec_PtrAlloc( 0 );
55 Vec_PtrFill( p->vAig2Frm, 2 * p->nObjs, NULL );
56 return p;
57}
struct Ssw_Frm_t_ Ssw_Frm_t
Definition sswInt.h:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_FrmStop()

void Ssw_FrmStop ( Ssw_Frm_t * p)
extern

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

Synopsis [Starts the SAT manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file sswAig.c.

71{
72 if ( p->pFrames )
73 Aig_ManStop( p->pFrames );
74 Vec_PtrFree( p->vAig2Frm );
75 ABC_FREE( p );
76}
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManCleanup()

void Ssw_ManCleanup ( Ssw_Man_t * p)
extern

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

Synopsis [Frees the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 158 of file sswMan.c.

159{
160// Aig_ManCleanMarkAB( p->pAig );
161 assert( p->pMSat == NULL );
162 if ( p->pFrames )
163 {
164 Aig_ManCleanMarkAB( p->pFrames );
165 Aig_ManStop( p->pFrames );
166 p->pFrames = NULL;
167 memset( p->pNodeToFrames, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p->pAig) * p->nFrames );
168 }
169 if ( p->vSimInfo )
170 {
171 Vec_PtrFree( p->vSimInfo );
172 p->vSimInfo = NULL;
173 }
174 p->nConstrTotal = 0;
175 p->nConstrReduced = 0;
176}
void Aig_ManCleanMarkAB(Aig_Man_t *p)
Definition aigUtil.c:186
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManCreate()

Ssw_Man_t * Ssw_ManCreate ( Aig_Man_t * pAig,
Ssw_Pars_t * pPars )
extern

DECLARATIONS ///.

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

FileName [sswMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [Calls to the SAT solver.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id
sswMan.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

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

Synopsis [Creates the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file sswMan.c.

46{
47 Ssw_Man_t * p;
48 // prepare the sequential AIG
49 assert( Saig_ManRegNum(pAig) > 0 );
50 Aig_ManFanoutStart( pAig );
51 Aig_ManSetCioIds( pAig );
52 // create interpolation manager
53 p = ABC_ALLOC( Ssw_Man_t, 1 );
54 memset( p, 0, sizeof(Ssw_Man_t) );
55 p->pPars = pPars;
56 p->pAig = pAig;
57 p->nFrames = pPars->nFramesK + 1;
58 p->pNodeToFrames = ABC_CALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p->pAig) * p->nFrames );
59 p->vCommon = Vec_PtrAlloc( 100 );
60 p->iOutputLit = -1;
61 // allocate storage for sim pattern
62 p->nPatWords = Abc_BitWordNum( Saig_ManPiNum(pAig) * p->nFrames + Saig_ManRegNum(pAig) );
63 p->pPatWords = ABC_CALLOC( unsigned, p->nPatWords );
64 // other
65 p->vNewLos = Vec_PtrAlloc( 100 );
66 p->vNewPos = Vec_IntAlloc( 100 );
67 p->vResimConsts = Vec_PtrAlloc( 100 );
68 p->vResimClasses = Vec_PtrAlloc( 100 );
69// p->pPars->fVerbose = 1;
70 return p;
71}
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition aigFanout.c:56
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition aigUtil.c:978
typedefABC_NAMESPACE_HEADER_START struct Ssw_Man_t_ Ssw_Man_t
INCLUDES ///.
Definition sswInt.h:47
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManGetSatVarValue()

int Ssw_ManGetSatVarValue ( Ssw_Man_t * p,
Aig_Obj_t * pObj,
int f )
extern

DECLARATIONS ///.

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

FileName [sswSweep.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [One round of SAT sweeping.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id
sswSweep.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

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

Synopsis [Retrives value of the PI in the original AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file sswSweep.c.

47{
48 int fUseNoBoundary = 0;
49 Aig_Obj_t * pObjFraig;
50 int Value;
51// assert( Aig_ObjIsCi(pObj) );
52 pObjFraig = Ssw_ObjFrame( p, pObj, f );
53 if ( fUseNoBoundary )
54 {
55 Value = Ssw_CnfGetNodeValue( p->pMSat, Aig_Regular(pObjFraig) );
56 Value ^= Aig_IsComplement(pObjFraig);
57 }
58 else
59 {
60 int nVarNum = Ssw_ObjSatNum( p->pMSat, Aig_Regular(pObjFraig) );
61 Value = (!nVarNum)? 0 : (Aig_IsComplement(pObjFraig) ^ sat_solver_var_value( p->pMSat->pSat, nVarNum ));
62 }
63
64// Value = (Aig_IsComplement(pObjFraig) ^ ((!nVarNum)? 0 : sat_solver_var_value( p->pSat, nVarNum )));
65// Value = (!nVarNum)? Aig_ManRandom(0) & 1 : (Aig_IsComplement(pObjFraig) ^ sat_solver_var_value( p->pSat, nVarNum ));
66 if ( p->pPars->fPolarFlip )
67 {
68 if ( Aig_Regular(pObjFraig)->fPhase ) Value ^= 1;
69 }
70 return Value;
71}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManLoadSolver()

void Ssw_ManLoadSolver ( Ssw_Man_t * p,
Aig_Obj_t * pRepr,
Aig_Obj_t * pObj )
extern

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

Synopsis [Loads logic cones and relevant constraints.]

Description [Both pRepr and pObj are objects of the AIG. The result is the current SAT solver loaded with the logic cones for pRepr and pObj corresponding to them in the frames, as well as all the relevant constraints.]

SideEffects []

SeeAlso []

Definition at line 142 of file sswDyn.c.

143{
144 Aig_Obj_t * pObjFrames, * pReprFrames;
145 Aig_Obj_t * pTemp, * pObj0, * pObj1;
146 int i, iConstr, RetValue;
147
148 assert( pRepr != pObj );
149 // get the corresponding frames nodes
150 pReprFrames = Aig_Regular( Ssw_ObjFrame( p, pRepr, p->pPars->nFramesK ) );
151 pObjFrames = Aig_Regular( Ssw_ObjFrame( p, pObj, p->pPars->nFramesK ) );
152 assert( pReprFrames != pObjFrames );
153 /*
154 // compute the AIG support
155 Vec_PtrClear( p->vNewLos );
156 Ssw_ManCollectPis_rec( pRepr, p->vNewLos );
157 Ssw_ManCollectPis_rec( pObj, p->vNewLos );
158 // add logic cones for register outputs
159 Vec_PtrForEachEntry( Aig_Obj_t *, p->vNewLos, pTemp, i )
160 {
161 pObj0 = Aig_Regular( Ssw_ObjFrame( p, pTemp, p->pPars->nFramesK ) );
162 Ssw_CnfNodeAddToSolver( p->pMSat, pObj0 );
163 }
164*/
165 // add cones for the nodes
166 Ssw_CnfNodeAddToSolver( p->pMSat, pReprFrames );
167 Ssw_CnfNodeAddToSolver( p->pMSat, pObjFrames );
168
169 // compute the frames support
170 Vec_PtrClear( p->vNewLos );
171 Ssw_ManCollectPis_rec( pReprFrames, p->vNewLos );
172 Ssw_ManCollectPis_rec( pObjFrames, p->vNewLos );
173 // these nodes include both nodes corresponding to PIs and LOs
174 // (the nodes corresponding to PIs should be labeled with fMarkB!)
175
176 // collect the related constraint POs
177 Vec_IntClear( p->vNewPos );
178 Vec_PtrForEachEntry( Aig_Obj_t *, p->vNewLos, pTemp, i )
179 Ssw_ManCollectPos_rec( p, pTemp, p->vNewPos );
180 // check if the corresponding pairs are added
181 Vec_IntForEachEntry( p->vNewPos, iConstr, i )
182 {
183 pObj0 = Aig_ManCo( p->pFrames, 2*iConstr );
184 pObj1 = Aig_ManCo( p->pFrames, 2*iConstr+1 );
185// if ( pObj0->fMarkB && pObj1->fMarkB )
186 if ( pObj0->fMarkB || pObj1->fMarkB )
187 {
188 pObj0->fMarkB = 1;
189 pObj1->fMarkB = 1;
190 Ssw_NodesAreConstrained( p, Aig_ObjChild0(pObj0), Aig_ObjChild0(pObj1) );
191 }
192 }
193 if ( p->pMSat->pSat->qtail != p->pMSat->pSat->qhead )
194 {
195 RetValue = sat_solver_simplify(p->pMSat->pSat);
196 assert( RetValue != 0 );
197 }
198}
int sat_solver_simplify(sat_solver *s)
Definition satSolver.c:1515
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition sswCnf.c:351
void Ssw_ManCollectPis_rec(Aig_Obj_t *pObj, Vec_Ptr_t *vNewPis)
Definition sswDyn.c:76
void Ssw_ManCollectPos_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, Vec_Int_t *vNewPos)
Definition sswDyn.c:103
int Ssw_NodesAreConstrained(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
Definition sswSat.c:196
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManRefineByConstrSim()

void Ssw_ManRefineByConstrSim ( Ssw_Man_t * p)
extern

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

Synopsis [Performs fraiging for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 247 of file sswConstr.c.

248{
249 Aig_Obj_t * pObj, * pObjLi;
250 int f, i, iLits, RetValue1, RetValue2;
251 int nFrames = Vec_IntSize(p->vInits) / Saig_ManPiNum(p->pAig);
252 assert( Vec_IntSize(p->vInits) % Saig_ManPiNum(p->pAig) == 0 );
253 // assign register outputs
254 Saig_ManForEachLi( p->pAig, pObj, i )
255 pObj->fMarkB = 0;
256 // simulate the timeframes
257 iLits = 0;
258 for ( f = 0; f < nFrames; f++ )
259 {
260 // set the PI simulation information
261 Aig_ManConst1(p->pAig)->fMarkB = 1;
262 Saig_ManForEachPi( p->pAig, pObj, i )
263 pObj->fMarkB = Vec_IntEntry( p->vInits, iLits++ );
264 Saig_ManForEachLiLo( p->pAig, pObjLi, pObj, i )
265 pObj->fMarkB = pObjLi->fMarkB;
266 // simulate internal nodes
267 Aig_ManForEachNode( p->pAig, pObj, i )
268 pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
269 & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
270 // assign the COs
271 Aig_ManForEachCo( p->pAig, pObj, i )
272 pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) );
273 // check the outputs
274 Saig_ManForEachPo( p->pAig, pObj, i )
275 {
276 if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
277 {
278 if ( pObj->fMarkB && Saig_ManConstrNum(p->pAig) )
279 Abc_Print( 1, "output %d failed in frame %d.\n", i, f );
280 }
281 else
282 {
283 if ( pObj->fMarkB && Saig_ManConstrNum(p->pAig) )
284 Abc_Print( 1, "constraint %d failed in frame %d.\n", i, f );
285 }
286 }
287 // transfer
288 if ( f == 0 )
289 { // copy markB into phase
290 Aig_ManForEachObj( p->pAig, pObj, i )
291 pObj->fPhase = pObj->fMarkB;
292 }
293 else
294 { // refine classes
295 RetValue1 = Ssw_ClassesRefineConst1( p->ppClasses, 0 );
296 RetValue2 = Ssw_ClassesRefine( p->ppClasses, 0 );
297 }
298 }
299 assert( iLits == Vec_IntSize(p->vInits) );
300}
#define Saig_ManForEachLi(p, pObj, i)
Definition saig.h:98
int Ssw_ClassesRefineConst1(Ssw_Cla_t *p, int fRecursive)
Definition sswClass.c:1119
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManResimulateBit()

void Ssw_ManResimulateBit ( Ssw_Man_t * p,
Aig_Obj_t * pCand,
Aig_Obj_t * pRepr )
extern

DECLARATIONS ///.

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

FileName [sswSimSat.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [Performs resimulation using counter-examples.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id
sswSimSat.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

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

Synopsis [Handle the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file sswSimSat.c.

46{
47 Aig_Obj_t * pObj;
48 int i, RetValue1, RetValue2;
49 abctime clk = Abc_Clock();
50 // set the PI simulation information
51 Aig_ManConst1(p->pAig)->fMarkB = 1;
52 Aig_ManForEachCi( p->pAig, pObj, i )
53 pObj->fMarkB = Abc_InfoHasBit( p->pPatWords, i );
54 // simulate internal nodes
55 Aig_ManForEachNode( p->pAig, pObj, i )
56 pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
57 & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
58 // if repr is given, perform refinement
59 if ( pRepr )
60 {
61 // check equivalence classes
62 RetValue1 = Ssw_ClassesRefineConst1( p->ppClasses, 0 );
63 RetValue2 = Ssw_ClassesRefine( p->ppClasses, 0 );
64 // make sure refinement happened
65 if ( Aig_ObjIsConst1(pRepr) )
66 {
67 assert( RetValue1 );
68 if ( RetValue1 == 0 )
69 Abc_Print( 1, "\nSsw_ManResimulateBit() Error: RetValue1 does not hold.\n" );
70 }
71 else
72 {
73 assert( RetValue2 );
74 if ( RetValue2 == 0 )
75 Abc_Print( 1, "\nSsw_ManResimulateBit() Error: RetValue2 does not hold.\n" );
76 }
77 }
78p->timeSimSat += Abc_Clock() - clk;
79}
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManResimulateWord()

void Ssw_ManResimulateWord ( Ssw_Man_t * p,
Aig_Obj_t * pCand,
Aig_Obj_t * pRepr,
int f )
extern

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

Synopsis [Handle the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 92 of file sswSimSat.c.

93{
94 int RetValue1, RetValue2;
95 abctime clk = Abc_Clock();
96 // set the PI simulation information
97 Ssw_SmlAssignDist1Plus( p->pSml, p->pPatWords );
98 // simulate internal nodes
99 Ssw_SmlSimulateOne( p->pSml );
100 // check equivalence classes
101 RetValue1 = Ssw_ClassesRefineConst1( p->ppClasses, 1 );
102 RetValue2 = Ssw_ClassesRefine( p->ppClasses, 1 );
103 // make sure refinement happened
104 if ( Aig_ObjIsConst1(pRepr) )
105 {
106 assert( RetValue1 );
107 if ( RetValue1 == 0 )
108 Abc_Print( 1, "\nSsw_ManResimulateWord() Error: RetValue1 does not hold.\n" );
109 }
110 else
111 {
112 assert( RetValue2 );
113 if ( RetValue2 == 0 )
114 Abc_Print( 1, "\nSsw_ManResimulateWord() Error: RetValue2 does not hold.\n" );
115 }
116p->timeSimSat += Abc_Clock() - clk;
117}
void Ssw_SmlSimulateOne(Ssw_Sml_t *p)
Definition sswSim.c:1005
void Ssw_SmlAssignDist1Plus(Ssw_Sml_t *p, unsigned *pPat)
Definition sswSim.c:674
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManStop()

void Ssw_ManStop ( Ssw_Man_t * p)
extern

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

Synopsis [Frees the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 189 of file sswMan.c.

190{
191 ABC_FREE( p->pVisited );
192 if ( p->pPars->fVerbose )//&& p->pPars->nStepsMax == -1 )
194 if ( p->ppClasses )
195 Ssw_ClassesStop( p->ppClasses );
196 if ( p->pSml )
197 Ssw_SmlStop( p->pSml );
198 if ( p->vDiffPairs )
199 Vec_IntFree( p->vDiffPairs );
200 if ( p->vInits )
201 Vec_IntFree( p->vInits );
202 Vec_PtrFree( p->vResimConsts );
203 Vec_PtrFree( p->vResimClasses );
204 Vec_PtrFree( p->vNewLos );
205 Vec_IntFree( p->vNewPos );
206 Vec_PtrFree( p->vCommon );
207 ABC_FREE( p->pNodeToFrames );
208 ABC_FREE( p->pPatWords );
209 ABC_FREE( p );
210}
void Ssw_ClassesStop(Ssw_Cla_t *p)
Definition sswClass.c:189
void Ssw_ManPrintStats(Ssw_Man_t *p)
Definition sswMan.c:104
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManSweep()

int Ssw_ManSweep ( Ssw_Man_t * p)
extern

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 373 of file sswSweep.c.

374{
375 static int Counter;
376 Bar_Progress_t * pProgress = NULL;
377 Aig_Obj_t * pObj, * pObj2, * pObjNew;
378 int nConstrPairs, i, f;
379 abctime clk;
380 Vec_Int_t * vObjPairs;
381
382 // perform speculative reduction
383clk = Abc_Clock();
384 // create timeframes
385 p->pFrames = Ssw_FramesWithClasses( p );
386 // add constants
387 nConstrPairs = Aig_ManCoNum(p->pFrames)-Aig_ManRegNum(p->pAig);
388 assert( (nConstrPairs & 1) == 0 );
389 for ( i = 0; i < nConstrPairs; i += 2 )
390 {
391 pObj = Aig_ManCo( p->pFrames, i );
392 pObj2 = Aig_ManCo( p->pFrames, i+1 );
393 Ssw_NodesAreConstrained( p, Aig_ObjChild0(pObj), Aig_ObjChild0(pObj2) );
394 }
395 // build logic cones for register inputs
396 for ( i = 0; i < Aig_ManRegNum(p->pAig); i++ )
397 {
398 pObj = Aig_ManCo( p->pFrames, nConstrPairs + i );
399 Ssw_CnfNodeAddToSolver( p->pMSat, Aig_ObjFanin0(pObj) );//
400 }
401 sat_solver_simplify( p->pMSat->pSat );
402
403 // map constants and PIs of the last frame
404 f = p->pPars->nFramesK;
405 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
406 Saig_ManForEachPi( p->pAig, pObj, i )
407 Ssw_ObjSetFrame( p, pObj, f, Aig_ObjCreateCi(p->pFrames) );
408p->timeReduce += Abc_Clock() - clk;
409
410 // sweep internal nodes
411 p->fRefined = 0;
412 Ssw_ClassesClearRefined( p->ppClasses );
413 if ( p->pPars->fVerbose )
414 pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAig) );
415 vObjPairs = (p->pPars->fEquivDump || p->pPars->fEquivDump2)? Vec_IntAlloc(1000) : NULL;
416 Aig_ManForEachObj( p->pAig, pObj, i )
417 {
418 if ( p->pPars->fVerbose )
419 Bar_ProgressUpdate( pProgress, i, NULL );
420 if ( Saig_ObjIsLo(p->pAig, pObj) )
421 p->fRefined |= Ssw_ManSweepNode( p, pObj, f, 0, vObjPairs );
422 else if ( Aig_ObjIsNode(pObj) )
423 {
424 pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
425 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
426 p->fRefined |= Ssw_ManSweepNode( p, pObj, f, 0, vObjPairs );
427 }
428 }
429 if ( p->pPars->fVerbose )
430 Bar_ProgressStop( pProgress );
431
432 // cleanup
433// Ssw_ClassesCheck( p->ppClasses );
434 if ( p->pPars->fEquivDump )
435 Ssw_ManDumpEquivMiter( p->pAig, vObjPairs, Counter++, 1 );
436 if ( p->pPars->fEquivDump2 && !p->fRefined )
437 Ssw_ManDumpEquivMiter( p->pAig, vObjPairs, 0, 0 );
438 Vec_IntFreeP( &vObjPairs );
439 return p->fRefined;
440}
void Bar_ProgressStop(Bar_Progress_t *p)
Definition bar.c:126
Bar_Progress_t * Bar_ProgressStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Definition bar.c:66
struct Bar_Progress_t_ Bar_Progress_t
BASIC TYPES ///.
Definition bar.h:48
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Aig_Man_t * Ssw_FramesWithClasses(Ssw_Man_t *p)
Definition sswAig.c:203
void Ssw_ClassesClearRefined(Ssw_Cla_t *p)
Definition sswClass.c:243
void Ssw_ManDumpEquivMiter(Aig_Man_t *p, Vec_Int_t *vPairs, int Num, int fAddOuts)
Definition sswSweep.c:342
int Ssw_ManSweepNode(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc, Vec_Int_t *vPairs)
Definition sswSweep.c:187
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManSweepBmc()

int Ssw_ManSweepBmc ( Ssw_Man_t * p)
extern

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 272 of file sswSweep.c.

273{
274 Bar_Progress_t * pProgress = NULL;
275 Aig_Obj_t * pObj, * pObjNew, * pObjLi, * pObjLo;
276 int i, f;
277 abctime clk;
278clk = Abc_Clock();
279
280 // start initialized timeframes
281 p->pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
282 Saig_ManForEachLo( p->pAig, pObj, i )
283 Ssw_ObjSetFrame( p, pObj, 0, Aig_ManConst0(p->pFrames) );
284
285 // sweep internal nodes
286 p->fRefined = 0;
287 if ( p->pPars->fVerbose )
288 pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
289 for ( f = 0; f < p->pPars->nFramesK; f++ )
290 {
291 // map constants and PIs
292 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
293 Saig_ManForEachPi( p->pAig, pObj, i )
294 Ssw_ObjSetFrame( p, pObj, f, Aig_ObjCreateCi(p->pFrames) );
295 // sweep flops
296 Saig_ManForEachLo( p->pAig, pObj, i )
297 p->fRefined |= Ssw_ManSweepNode( p, pObj, f, 1, NULL );
298 // sweep internal nodes
299 Aig_ManForEachNode( p->pAig, pObj, i )
300 {
301 if ( p->pPars->fVerbose )
302 Bar_ProgressUpdate( pProgress, Aig_ManObjNumMax(p->pAig) * f + i, NULL );
303 pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
304 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
305 p->fRefined |= Ssw_ManSweepNode( p, pObj, f, 1, NULL );
306 }
307 // quit if this is the last timeframe
308 if ( f == p->pPars->nFramesK - 1 )
309 break;
310 // transfer latch input to the latch outputs
311 Aig_ManForEachCo( p->pAig, pObj, i )
312 Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj, f) );
313 // build logic cones for register outputs
314 Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
315 {
316 pObjNew = Ssw_ObjFrame( p, pObjLi, f );
317 Ssw_ObjSetFrame( p, pObjLo, f+1, pObjNew );
318 Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pObjNew) );//
319 }
320 }
321 if ( p->pPars->fVerbose )
322 Bar_ProgressStop( pProgress );
323
324 // cleanup
325// Ssw_ClassesCheck( p->ppClasses );
326p->timeBmc += Abc_Clock() - clk;
327 return p->fRefined;
328}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManSweepBmcConstr()

int Ssw_ManSweepBmcConstr ( Ssw_Man_t * p)
extern

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 498 of file sswConstr.c.

499{
500 Aig_Obj_t * pObj, * pObjNew, * pObjLi, * pObjLo;
501 int i, f, iLits;
502 abctime clk;
503clk = Abc_Clock();
504
505 // start initialized timeframes
506 p->pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
507 Saig_ManForEachLo( p->pAig, pObj, i )
508 Ssw_ObjSetFrame( p, pObj, 0, Aig_ManConst0(p->pFrames) );
509
510 // build the constraint outputs
511 iLits = 0;
512 p->fRefined = 0;
513 for ( f = 0; f < p->pPars->nFramesK; f++ )
514 {
515 // map constants and PIs
516 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
517 Saig_ManForEachPi( p->pAig, pObj, i )
518 {
519 pObjNew = Aig_ObjCreateCi(p->pFrames);
520 pObjNew->fPhase = Vec_IntEntry( p->vInits, iLits++ );
521 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
522 }
523 // build the constraint cones
524 Saig_ManForEachPo( p->pAig, pObj, i )
525 {
526 if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
527 continue;
528 pObjNew = Ssw_ManSweepBmcConstr_rec( p, Aig_ObjFanin0(pObj), f );
529 pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObj) );
530 if ( Aig_Regular(pObjNew) == Aig_ManConst1(p->pFrames) )
531 {
532 assert( Aig_IsComplement(pObjNew) );
533 continue;
534 }
535 Ssw_NodesAreConstrained( p, pObjNew, Aig_ManConst0(p->pFrames) );
536 }
537 // sweep flops
538 Saig_ManForEachLo( p->pAig, pObj, i )
539 p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 1 );
540 // sweep internal nodes
541 Aig_ManForEachNode( p->pAig, pObj, i )
542 {
543 pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
544 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
545 p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 1 );
546 }
547 // quit if this is the last timeframe
548 if ( f == p->pPars->nFramesK - 1 )
549 break;
550 // transfer latch input to the latch outputs
551 Aig_ManForEachCo( p->pAig, pObj, i )
552 Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj, f) );
553 // build logic cones for register outputs
554 Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
555 {
556 pObjNew = Ssw_ObjFrame( p, pObjLi, f );
557 Ssw_ObjSetFrame( p, pObjLo, f+1, pObjNew );
558 Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pObjNew) );//
559 }
560 }
561 assert( Vec_IntSize(p->vInits) == iLits + Saig_ManPiNum(p->pAig) );
562
563 // cleanup
564// Ssw_ClassesCheck( p->ppClasses );
565p->timeBmc += Abc_Clock() - clk;
566 return p->fRefined;
567}
int Ssw_ManSweepNodeConstr(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc)
Definition sswConstr.c:314
Aig_Obj_t * Ssw_ManSweepBmcConstr_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition sswConstr.c:370
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManSweepConstr()

int Ssw_ManSweepConstr ( Ssw_Man_t * p)
extern

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 621 of file sswConstr.c.

622{
623 Bar_Progress_t * pProgress = NULL;
624 Aig_Obj_t * pObj, * pObj2, * pObjNew;
625 int nConstrPairs, i, f, iLits;
626 abctime clk;
627//Ssw_ManPrintPolarity( p->pAig );
628
629 // perform speculative reduction
630clk = Abc_Clock();
631 // create timeframes
632 p->pFrames = Ssw_FramesWithClasses( p );
633 // add constants
634 nConstrPairs = Aig_ManCoNum(p->pFrames)-Aig_ManRegNum(p->pAig);
635 assert( (nConstrPairs & 1) == 0 );
636 for ( i = 0; i < nConstrPairs; i += 2 )
637 {
638 pObj = Aig_ManCo( p->pFrames, i );
639 pObj2 = Aig_ManCo( p->pFrames, i+1 );
640 Ssw_NodesAreConstrained( p, Aig_ObjChild0(pObj), Aig_ObjChild0(pObj2) );
641 }
642 // build logic cones for register inputs
643 for ( i = 0; i < Aig_ManRegNum(p->pAig); i++ )
644 {
645 pObj = Aig_ManCo( p->pFrames, nConstrPairs + i );
646 Ssw_CnfNodeAddToSolver( p->pMSat, Aig_ObjFanin0(pObj) );//
647 }
648
649 // map constants and PIs of the last frame
650 f = p->pPars->nFramesK;
651// iLits = 0;
652 iLits = f * Saig_ManPiNum(p->pAig);
653 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
654 Saig_ManForEachPi( p->pAig, pObj, i )
655 {
656 pObjNew = Aig_ObjCreateCi(p->pFrames);
657 pObjNew->fPhase = (p->vInits != NULL) && Vec_IntEntry(p->vInits, iLits++);
658 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
659 }
660 assert( Vec_IntSize(p->vInits) == iLits );
661p->timeReduce += Abc_Clock() - clk;
662
663 // add constraints to all timeframes
664 for ( f = 0; f <= p->pPars->nFramesK; f++ )
665 {
666 Saig_ManForEachPo( p->pAig, pObj, i )
667 {
668 if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
669 continue;
670 Ssw_FramesWithClasses_rec( p, Aig_ObjFanin0(pObj), f );
671// if ( Aig_Regular(Ssw_ObjChild0Fra(p,pObj,f)) == Aig_ManConst1(p->pFrames) )
672 if ( Ssw_ObjChild0Fra(p,pObj,f) == Aig_ManConst0(p->pFrames) )
673 continue;
674 assert( Ssw_ObjChild0Fra(p,pObj,f) != Aig_ManConst1(p->pFrames) );
675 if ( Ssw_ObjChild0Fra(p,pObj,f) == Aig_ManConst1(p->pFrames) )
676 {
677 Abc_Print( 1, "Polarity violation.\n" );
678 continue;
679 }
680 Ssw_NodesAreConstrained( p, Ssw_ObjChild0Fra(p,pObj,f), Aig_ManConst0(p->pFrames) );
681 }
682 }
683 f = p->pPars->nFramesK;
684 // clean the solver
685 sat_solver_simplify( p->pMSat->pSat );
686
687
688 // sweep internal nodes
689 p->fRefined = 0;
690 Ssw_ClassesClearRefined( p->ppClasses );
691 if ( p->pPars->fVerbose )
692 pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAig) );
693 Aig_ManForEachObj( p->pAig, pObj, i )
694 {
695 if ( p->pPars->fVerbose )
696 Bar_ProgressUpdate( pProgress, i, NULL );
697 if ( Saig_ObjIsLo(p->pAig, pObj) )
698 p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 0 );
699 else if ( Aig_ObjIsNode(pObj) )
700 {
701 pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
702 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
703 p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 0 );
704 }
705 }
706 if ( p->pPars->fVerbose )
707 Bar_ProgressStop( pProgress );
708 // cleanup
709// Ssw_ClassesCheck( p->ppClasses );
710 return p->fRefined;
711}
Aig_Obj_t * Ssw_FramesWithClasses_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition sswConstr.c:583
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManSweepDyn()

int Ssw_ManSweepDyn ( Ssw_Man_t * p)
extern

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 373 of file sswDyn.c.

374{
375 Bar_Progress_t * pProgress = NULL;
376 Aig_Obj_t * pObj, * pObjNew;
377 int i, f;
378 abctime clk;
379
380 // perform speculative reduction
381clk = Abc_Clock();
382 // create timeframes
383 p->pFrames = Ssw_FramesWithClasses( p );
384 Aig_ManFanoutStart( p->pFrames );
385 p->nSRMiterMaxId = Aig_ManObjNumMax( p->pFrames );
386
387 // map constants and PIs of the last frame
388 f = p->pPars->nFramesK;
389 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
390 Saig_ManForEachPi( p->pAig, pObj, i )
391 Ssw_ObjSetFrame( p, pObj, f, Aig_ObjCreateCi(p->pFrames) );
392 Aig_ManSetCioIds( p->pFrames );
393 // label nodes corresponding to primary inputs
395p->timeReduce += Abc_Clock() - clk;
396
397 // prepare simulation info
398 assert( p->vSimInfo == NULL );
399 p->vSimInfo = Vec_PtrAllocSimInfo( Aig_ManCiNum(p->pFrames), 1 );
400 Vec_PtrCleanSimInfo( p->vSimInfo, 0, 1 );
401
402 // sweep internal nodes
403 p->fRefined = 0;
404 Ssw_ClassesClearRefined( p->ppClasses );
405 if ( p->pPars->fVerbose )
406 pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAig) );
407 p->iNodeStart = 0;
408 Aig_ManForEachObj( p->pAig, pObj, i )
409 {
410 if ( p->iNodeStart == 0 )
411 p->iNodeStart = i;
412 if ( p->pPars->fVerbose )
413 Bar_ProgressUpdate( pProgress, i, NULL );
414 if ( Saig_ObjIsLo(p->pAig, pObj) )
415 p->fRefined |= Ssw_ManSweepNode( p, pObj, f, 0, NULL );
416 else if ( Aig_ObjIsNode(pObj) )
417 {
418 pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
419 Ssw_ObjSetFrame( p, pObj, f, pObjNew );
420 p->fRefined |= Ssw_ManSweepNode( p, pObj, f, 0, NULL );
421 }
422 // check if it is time to recycle the solver
423 if ( p->pMSat->pSat == NULL ||
424 (p->pPars->nSatVarMax2 &&
425 p->pMSat->nSatVars > p->pPars->nSatVarMax2 &&
426 p->nRecycleCalls > p->pPars->nRecycleCalls2) )
427 {
428 // resimulate
429 if ( p->nPatterns > 0 )
430 {
431 p->iNodeLast = i;
432 if ( p->pPars->fLocalSim )
434 else
436 p->iNodeStart = i+1;
437 }
438// Abc_Print( 1, "Recycling SAT solver with %d vars and %d calls.\n",
439// p->pMSat->nSatVars, p->nRecycleCalls );
440// Aig_ManCleanMarkAB( p->pAig );
441 Aig_ManCleanMarkAB( p->pFrames );
442 // label nodes corresponding to primary inputs
444 // replace the solver
445 if ( p->pMSat )
446 {
447 p->nVarsMax = Abc_MaxInt( p->nVarsMax, p->pMSat->nSatVars );
448 p->nCallsMax = Abc_MaxInt( p->nCallsMax, p->pMSat->nSolverCalls );
449 Ssw_SatStop( p->pMSat );
450 p->nRecycles++;
451 p->nRecyclesTotal++;
452 p->nRecycleCalls = 0;
453 }
454 p->pMSat = Ssw_SatStart( 0 );
455 assert( p->nPatterns == 0 );
456 }
457 // resimulate
458 if ( p->nPatterns == 32 )
459 {
460 p->iNodeLast = i;
461 if ( p->pPars->fLocalSim )
463 else
465 p->iNodeStart = i+1;
466 }
467 }
468 // resimulate
469 if ( p->nPatterns > 0 )
470 {
471 p->iNodeLast = i;
472 if ( p->pPars->fLocalSim )
474 else
476 }
477 // collect stats
478 if ( p->pPars->fVerbose )
479 Bar_ProgressStop( pProgress );
480
481 // cleanup
482// Ssw_ClassesCheck( p->ppClasses );
483 return p->fRefined;
484}
void Ssw_SatStop(Ssw_Sat_t *p)
Definition sswCnf.c:81
int Ssw_ManSweepResimulateDynLocal(Ssw_Man_t *p, int f)
Definition sswDyn.c:295
int Ssw_ManSweepResimulateDyn(Ssw_Man_t *p, int f)
Definition sswDyn.c:263
ABC_NAMESPACE_IMPL_START void Ssw_ManLabelPiNodes(Ssw_Man_t *p)
DECLARATIONS ///.
Definition sswDyn.c:46
int Ssw_ManSweepNode(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc, Vec_Int_t *vPairs)
Definition sswSweep.c:187
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManSweepLatch()

int Ssw_ManSweepLatch ( Ssw_Man_t * p)
extern

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

Synopsis [Performs one iteration of sweeping latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 238 of file sswLcorr.c.

239{
240// Bar_Progress_t * pProgress = NULL;
241 Vec_Ptr_t * vClass;
242 Aig_Obj_t * pObj, * pRepr, * pTemp;
243 int i, k;
244
245 // start the timeframe
246 p->pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) );
247 // map constants and PIs
248 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), 0, Aig_ManConst1(p->pFrames) );
249 Saig_ManForEachPi( p->pAig, pObj, i )
250 Ssw_ObjSetFrame( p, pObj, 0, Aig_ObjCreateCi(p->pFrames) );
251
252 // implement equivalence classes
253 Saig_ManForEachLo( p->pAig, pObj, i )
254 {
255 pRepr = Aig_ObjRepr( p->pAig, pObj );
256 if ( pRepr == NULL )
257 {
258 pTemp = Aig_ObjCreateCi(p->pFrames);
259 pTemp->pData = pObj;
260 }
261 else
262 pTemp = Aig_NotCond( Ssw_ObjFrame(p, pRepr, 0), pRepr->fPhase ^ pObj->fPhase );
263 Ssw_ObjSetFrame( p, pObj, 0, pTemp );
264 }
265 Aig_ManSetCioIds( p->pFrames );
266
267 // prepare simulation info
268 assert( p->vSimInfo == NULL );
269 p->vSimInfo = Vec_PtrAllocSimInfo( Aig_ManCiNum(p->pFrames), 1 );
270 Vec_PtrCleanSimInfo( p->vSimInfo, 0, 1 );
271
272 // go through the registers
273// if ( p->pPars->fVerbose )
274// pProgress = Bar_ProgressStart( stdout, Aig_ManRegNum(p->pAig) );
275 vClass = Vec_PtrAlloc( 100 );
276 p->fRefined = 0;
277 p->nCallsCount = p->nCallsSat = p->nCallsUnsat = 0;
278 Saig_ManForEachLo( p->pAig, pObj, i )
279 {
280// if ( p->pPars->fVerbose )
281// Bar_ProgressUpdate( pProgress, i, NULL );
282 // consider the case of constant candidate
283 if ( Ssw_ObjIsConst1Cand( p->pAig, pObj ) )
284 Ssw_ManSweepLatchOne( p, Aig_ManConst1(p->pAig), pObj );
285 else
286 {
287 // consider the case of equivalence class
288 Ssw_ClassesCollectClass( p->ppClasses, pObj, vClass );
289 if ( Vec_PtrSize(vClass) == 0 )
290 continue;
291 // try to prove equivalences in this class
292 Vec_PtrForEachEntry( Aig_Obj_t *, vClass, pTemp, k )
293 if ( Aig_ObjRepr(p->pAig, pTemp) == pObj )
294 {
295 Ssw_ManSweepLatchOne( p, pObj, pTemp );
296 if ( p->nPatterns == 32 )
297 break;
298 }
299 }
300 // resimulate
301 if ( p->nPatterns == 32 )
303 // attempt recycling the SAT solver
304 if ( p->pPars->nSatVarMax &&
305 p->pMSat->nSatVars > p->pPars->nSatVarMax &&
306 p->nRecycleCalls > p->pPars->nRecycleCalls )
307 {
308 p->nVarsMax = Abc_MaxInt( p->nVarsMax, p->pMSat->nSatVars );
309 p->nCallsMax = Abc_MaxInt( p->nCallsMax, p->pMSat->nSolverCalls );
310 Ssw_SatStop( p->pMSat );
311 p->pMSat = Ssw_SatStart( 0 );
312 p->nRecycles++;
313 p->nRecycleCalls = 0;
314 }
315 }
316// ABC_PRT( "reduce", p->timeReduce );
317// Aig_TableProfile( p->pFrames );
318// Abc_Print( 1, "And gates = %d\n", Aig_ManNodeNum(p->pFrames) );
319 // resimulate
320 if ( p->nPatterns > 0 )
322 // cleanup
323 Vec_PtrFree( vClass );
324// if ( p->pPars->fVerbose )
325// Bar_ProgressStop( pProgress );
326
327 // cleanup
328// Ssw_ClassesCheck( p->ppClasses );
329 return p->fRefined;
330}
void Ssw_ClassesCollectClass(Ssw_Cla_t *p, Aig_Obj_t *pRepr, Vec_Ptr_t *vClass)
Definition sswClass.c:328
int Ssw_ManSweepResimulate(Ssw_Man_t *p)
Definition sswLcorr.c:78
void Ssw_ManSweepLatchOne(Ssw_Man_t *p, Aig_Obj_t *pObjRepr, Aig_Obj_t *pObj)
Definition sswLcorr.c:160
void * pData
Definition aig.h:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManSweepNode()

int Ssw_ManSweepNode ( Ssw_Man_t * p,
Aig_Obj_t * pObj,
int f,
int fBmc,
Vec_Int_t * vPairs )
extern

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

Synopsis [Performs fraiging for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 187 of file sswSweep.c.

188{
189 Aig_Obj_t * pObjRepr, * pObjFraig, * pObjFraig2, * pObjReprFraig;
190 int RetValue;
191 abctime clk;
192 // get representative of this class
193 pObjRepr = Aig_ObjRepr( p->pAig, pObj );
194 if ( pObjRepr == NULL )
195 return 0;
196 // get the fraiged node
197 pObjFraig = Ssw_ObjFrame( p, pObj, f );
198 // get the fraiged representative
199 pObjReprFraig = Ssw_ObjFrame( p, pObjRepr, f );
200 // check if constant 0 pattern distinquishes these nodes
201 assert( pObjFraig != NULL && pObjReprFraig != NULL );
202 assert( (pObj->fPhase == pObjRepr->fPhase) == (Aig_ObjPhaseReal(pObjFraig) == Aig_ObjPhaseReal(pObjReprFraig)) );
203 // if the fraiged nodes are the same, return
204 if ( Aig_Regular(pObjFraig) == Aig_Regular(pObjReprFraig) )
205 return 0;
206 // add constraints on demand
207 if ( !fBmc && p->pPars->fDynamic )
208 {
209clk = Abc_Clock();
210 Ssw_ManLoadSolver( p, pObjRepr, pObj );
211 p->nRecycleCalls++;
212p->timeMarkCones += Abc_Clock() - clk;
213 }
214 // call equivalence checking
215 if ( Aig_Regular(pObjFraig) != Aig_ManConst1(p->pFrames) )
216 RetValue = Ssw_NodesAreEquiv( p, Aig_Regular(pObjReprFraig), Aig_Regular(pObjFraig) );
217 else
218 RetValue = Ssw_NodesAreEquiv( p, Aig_Regular(pObjFraig), Aig_Regular(pObjReprFraig) );
219 if ( RetValue == 1 ) // proved equivalent
220 {
221 pObjFraig2 = Aig_NotCond( pObjReprFraig, pObj->fPhase ^ pObjRepr->fPhase );
222 Ssw_ObjSetFrame( p, pObj, f, pObjFraig2 );
223 if ( p->pPars->fEquivDump2 && vPairs )
224 {
225 Vec_IntPush( vPairs, pObjRepr->Id );
226 Vec_IntPush( vPairs, pObj->Id );
227 }
228 return 0;
229 }
230 if ( p->pPars->fEquivDump && vPairs )
231 {
232 Vec_IntPush( vPairs, pObjRepr->Id );
233 Vec_IntPush( vPairs, pObj->Id );
234 }
235 if ( RetValue == -1 ) // timed out
236 {
237 Ssw_ClassesRemoveNode( p->ppClasses, pObj );
238 return 1;
239 }
240 // disproved the equivalence
241 if ( !fBmc && p->pPars->fDynamic )
242 {
244 p->nPatterns++;
245 return 1;
246 }
247 else
249 if ( !p->pPars->fConstrs )
250 Ssw_ManResimulateWord( p, pObj, pObjRepr, f );
251 else
252 Ssw_ManResimulateBit( p, pObj, pObjRepr );
253 assert( Aig_ObjRepr( p->pAig, pObj ) != pObjRepr );
254 if ( Aig_ObjRepr( p->pAig, pObj ) == pObjRepr )
255 {
256 Abc_Print( 1, "Ssw_ManSweepNode(): Failed to refine representative.\n" );
257 }
258 return 1;
259}
void Ssw_ClassesRemoveNode(Ssw_Cla_t *p, Aig_Obj_t *pObj)
Definition sswClass.c:448
void Ssw_ManLoadSolver(Ssw_Man_t *p, Aig_Obj_t *pRepr, Aig_Obj_t *pObj)
Definition sswDyn.c:142
void Ssw_ManResimulateBit(Ssw_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
DECLARATIONS ///.
Definition sswSimSat.c:45
int Ssw_NodesAreEquiv(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
DECLARATIONS ///.
Definition sswSat.c:45
void Ssw_ManResimulateWord(Ssw_Man_t *p, Aig_Obj_t *pCand, Aig_Obj_t *pRepr, int f)
Definition sswSimSat.c:92
void Ssw_SmlSavePatternAig(Ssw_Man_t *p, int f)
Definition sswSweep.c:136
void Ssw_SmlAddPatternDyn(Ssw_Man_t *p)
Definition sswSweep.c:157
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_ManUniqueAddConstraint()

int Ssw_ManUniqueAddConstraint ( Ssw_Man_t * p,
Vec_Ptr_t * vCommon,
int f1,
int f2 )
extern

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

Synopsis [Returns the output of the uniqueness constraint.]

Description []

SideEffects []

SeeAlso []

Definition at line 151 of file sswUnique.c.

152{
153 Aig_Obj_t * pObj, * pObj1New, * pObj2New, * pMiter, * pTotal;
154 int i, pLits[2];
155// int RetValue;
156 assert( Vec_PtrSize(vCommon) > 0 );
157 // generate the constraint
158 pTotal = Aig_ManConst0(p->pFrames);
159 Vec_PtrForEachEntry( Aig_Obj_t *, vCommon, pObj, i )
160 {
161 assert( Saig_ObjIsLo(p->pAig, pObj) );
162 pObj1New = Ssw_ObjFrame( p, pObj, f1 );
163 pObj2New = Ssw_ObjFrame( p, pObj, f2 );
164 pMiter = Aig_Exor( p->pFrames, pObj1New, pObj2New );
165 pTotal = Aig_Or( p->pFrames, pTotal, pMiter );
166 }
167 if ( Aig_ObjIsConst1(Aig_Regular(pTotal)) )
168 {
169// Abc_Print( 1, "Skipped\n" );
170 return 0;
171 }
172 // create CNF
173 Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pTotal) );
174 // add output constraint
175 pLits[0] = toLitCond( Ssw_ObjSatNum(p->pMSat,Aig_Regular(pTotal)), Aig_IsComplement(pTotal) );
176/*
177 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 1 );
178 assert( RetValue );
179 // simplify the solver
180 if ( p->pSat->qtail != p->pSat->qhead )
181 {
182 RetValue = sat_solver_simplify(p->pSat);
183 assert( RetValue != 0 );
184 }
185*/
186 assert( p->iOutputLit == -1 );
187 p->iOutputLit = pLits[0];
188 return 1;
189}
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:220
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:259
Here is the call graph for this function:

◆ Ssw_ManUniqueOne()

int Ssw_ManUniqueOne ( Ssw_Man_t * p,
Aig_Obj_t * pRepr,
Aig_Obj_t * pObj,
int fVerbose )
extern

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

Synopsis [Returns 1 if uniqueness constraints can be added.]

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file sswUnique.c.

91{
92 Aig_Obj_t * ppObjs[2], * pTemp;
93 int i, k, Value0, Value1, RetValue, fFeasible;
94
95 assert( p->pPars->nFramesK > 1 );
96 assert( p->vDiffPairs && Vec_IntSize(p->vDiffPairs) == Saig_ManRegNum(p->pAig) );
97
98 // compute the first support in terms of LOs
99 ppObjs[0] = pRepr;
100 ppObjs[1] = pObj;
101 Aig_SupportNodes( p->pAig, ppObjs, 2, p->vCommon );
102 // keep only LOs
103 RetValue = Vec_PtrSize( p->vCommon );
104 fFeasible = 0;
105 k = 0;
106 Vec_PtrForEachEntry( Aig_Obj_t *, p->vCommon, pTemp, i )
107 {
108 assert( Aig_ObjIsCi(pTemp) );
109 if ( !Saig_ObjIsLo(p->pAig, pTemp) )
110 continue;
111 assert( Aig_ObjCioId(pTemp) > 0 );
112 Vec_PtrWriteEntry( p->vCommon, k++, pTemp );
113 if ( Vec_IntEntry(p->vDiffPairs, Aig_ObjCioId(pTemp) - Saig_ManPiNum(p->pAig)) )
114 fFeasible = 1;
115 }
116 Vec_PtrShrink( p->vCommon, k );
117
118 if ( fVerbose )
119 Abc_Print( 1, "Node = %5d : Supp = %3d. Regs = %3d. Feasible = %s. ",
120 Aig_ObjId(pObj), RetValue, Vec_PtrSize(p->vCommon),
121 fFeasible? "yes": "no " );
122
123 // check the current values
124 RetValue = 1;
125 Vec_PtrForEachEntry( Aig_Obj_t *, p->vCommon, pTemp, i )
126 {
127 Value0 = Ssw_ManGetSatVarValue( p, pTemp, 0 );
128 Value1 = Ssw_ManGetSatVarValue( p, pTemp, 1 );
129 if ( Value0 != Value1 )
130 RetValue = 0;
131 if ( fVerbose )
132 Abc_Print( 1, "%d", Value0 ^ Value1 );
133 }
134 if ( fVerbose )
135 Abc_Print( 1, "\n" );
136
137 return RetValue && fFeasible;
138}
void Aig_SupportNodes(Aig_Man_t *p, Aig_Obj_t **ppObjs, int nObjs, Vec_Ptr_t *vSupp)
Definition aigDfs.c:868
int Ssw_ManGetSatVarValue(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
DECLARATIONS ///.
Definition sswSweep.c:46
Here is the call graph for this function:

◆ Ssw_NodeIsConstrained()

int Ssw_NodeIsConstrained ( Ssw_Man_t * p,
Aig_Obj_t * pPoObj )
extern

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

Synopsis [Constrains one node in the SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 286 of file sswSat.c.

287{
288 int RetValue, Lit;
289 Ssw_CnfNodeAddToSolver( p->pMSat, Aig_ObjFanin0(pPoObj) );
290 // add constraint A = 1 ----> A
291 Lit = toLitCond( Ssw_ObjSatNum(p->pMSat,Aig_ObjFanin0(pPoObj)), !Aig_ObjFaninC0(pPoObj) );
292 if ( p->pPars->fPolarFlip )
293 {
294 if ( Aig_ObjFanin0(pPoObj)->fPhase ) Lit = lit_neg( Lit );
295 }
296 RetValue = sat_solver_addclause( p->pMSat->pSat, &Lit, &Lit + 1 );
297 assert( RetValue );
298 return 1;
299}
#define sat_solver_addclause
Definition cecSatG2.c:37
Here is the call graph for this function:

◆ Ssw_NodesAreConstrained()

int Ssw_NodesAreConstrained ( Ssw_Man_t * p,
Aig_Obj_t * pOld,
Aig_Obj_t * pNew )
extern

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

Synopsis [Constrains two nodes to be equivalent in the SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file sswSat.c.

197{
198 int pLits[2], RetValue, fComplNew;
199 Aig_Obj_t * pTemp;
200
201 // sanity checks
202 assert( Aig_Regular(pOld) != Aig_Regular(pNew) );
203 assert( p->pPars->fConstrs || Aig_ObjPhaseReal(pOld) == Aig_ObjPhaseReal(pNew) );
204
205 // move constant to the old node
206 if ( Aig_Regular(pNew) == Aig_ManConst1(p->pFrames) )
207 {
208 assert( Aig_Regular(pOld) != Aig_ManConst1(p->pFrames) );
209 pTemp = pOld;
210 pOld = pNew;
211 pNew = pTemp;
212 }
213
214 // move complement to the new node
215 if ( Aig_IsComplement(pOld) )
216 {
217 pOld = Aig_Regular(pOld);
218 pNew = Aig_Not(pNew);
219 }
220 assert( p->pMSat != NULL );
221
222 // if the nodes do not have SAT variables, allocate them
223 Ssw_CnfNodeAddToSolver( p->pMSat, pOld );
224 Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pNew) );
225
226 // transform the new node
227 fComplNew = Aig_IsComplement( pNew );
228 pNew = Aig_Regular( pNew );
229
230 // consider the constant 1 case
231 if ( pOld == Aig_ManConst1(p->pFrames) )
232 {
233 // add constraint A = 1 ----> A
234 pLits[0] = toLitCond( Ssw_ObjSatNum(p->pMSat,pNew), fComplNew );
235 if ( p->pPars->fPolarFlip )
236 {
237 if ( pNew->fPhase ) pLits[0] = lit_neg( pLits[0] );
238 }
239 RetValue = sat_solver_addclause( p->pMSat->pSat, pLits, pLits + 1 );
240 assert( RetValue );
241 }
242 else
243 {
244 // add constraint A = B ----> (A v !B)(!A v B)
245
246 // (A v !B)
247 pLits[0] = toLitCond( Ssw_ObjSatNum(p->pMSat,pOld), 0 );
248 pLits[1] = toLitCond( Ssw_ObjSatNum(p->pMSat,pNew), !fComplNew );
249 if ( p->pPars->fPolarFlip )
250 {
251 if ( pOld->fPhase ) pLits[0] = lit_neg( pLits[0] );
252 if ( pNew->fPhase ) pLits[1] = lit_neg( pLits[1] );
253 }
254 pLits[0] = lit_neg( pLits[0] );
255 pLits[1] = lit_neg( pLits[1] );
256 RetValue = sat_solver_addclause( p->pMSat->pSat, pLits, pLits + 2 );
257 assert( RetValue );
258
259 // (!A v B)
260 pLits[0] = toLitCond( Ssw_ObjSatNum(p->pMSat,pOld), 1 );
261 pLits[1] = toLitCond( Ssw_ObjSatNum(p->pMSat,pNew), fComplNew);
262 if ( p->pPars->fPolarFlip )
263 {
264 if ( pOld->fPhase ) pLits[0] = lit_neg( pLits[0] );
265 if ( pNew->fPhase ) pLits[1] = lit_neg( pLits[1] );
266 }
267 pLits[0] = lit_neg( pLits[0] );
268 pLits[1] = lit_neg( pLits[1] );
269 RetValue = sat_solver_addclause( p->pMSat->pSat, pLits, pLits + 2 );
270 assert( RetValue );
271 }
272 return 1;
273}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_NodesAreEquiv()

int Ssw_NodesAreEquiv ( Ssw_Man_t * p,
Aig_Obj_t * pOld,
Aig_Obj_t * pNew )
extern

DECLARATIONS ///.

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

FileName [sswSat.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [Calls to the SAT solver.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id
sswSat.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

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

Synopsis [Runs equivalence test for the two nodes.]

Description [Both nodes should be regular and different from each other.]

SideEffects []

SeeAlso []

Definition at line 45 of file sswSat.c.

46{
47 int nBTLimit = p->pPars->nBTLimit;
48 int pLits[3], nLits, RetValue, RetValue1;
49 abctime clk;//, status;
50 p->nSatCalls++;
51 p->pMSat->nSolverCalls++;
52
53 // sanity checks
54 assert( !Aig_IsComplement(pOld) );
55 assert( !Aig_IsComplement(pNew) );
56 assert( pOld != pNew );
57 assert( p->pMSat != NULL );
58
59 // if the nodes do not have SAT variables, allocate them
60 Ssw_CnfNodeAddToSolver( p->pMSat, pOld );
61 Ssw_CnfNodeAddToSolver( p->pMSat, pNew );
62
63 // solve under assumptions
64 // A = 1; B = 0 OR A = 1; B = 1
65 nLits = 2;
66 pLits[0] = toLitCond( Ssw_ObjSatNum(p->pMSat,pOld), 0 );
67 pLits[1] = toLitCond( Ssw_ObjSatNum(p->pMSat,pNew), pOld->fPhase == pNew->fPhase );
68 if ( p->iOutputLit > -1 )
69 pLits[nLits++] = p->iOutputLit;
70 if ( p->pPars->fPolarFlip )
71 {
72 if ( pOld->fPhase ) pLits[0] = lit_neg( pLits[0] );
73 if ( pNew->fPhase ) pLits[1] = lit_neg( pLits[1] );
74 }
75//Sat_SolverWriteDimacs( p->pSat, "temp.cnf", pLits, pLits + 2, 1 );
76
77 if ( p->pMSat->pSat->qtail != p->pMSat->pSat->qhead )
78 {
79 RetValue = sat_solver_simplify(p->pMSat->pSat);
80 //assert( RetValue != 0 );
81 }
82
83clk = Abc_Clock();
84 RetValue1 = sat_solver_solve( p->pMSat->pSat, pLits, pLits + nLits,
85 (ABC_INT64_T)nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
86p->timeSat += Abc_Clock() - clk;
87 if ( RetValue1 == l_False )
88 {
89p->timeSatUnsat += Abc_Clock() - clk;
90 if ( nLits == 2 )
91 {
92 pLits[0] = lit_neg( pLits[0] );
93 pLits[1] = lit_neg( pLits[1] );
94 RetValue = sat_solver_addclause( p->pMSat->pSat, pLits, pLits + 2 );
95 assert( RetValue );
96/*
97 if ( p->pMSat->pSat->qtail != p->pMSat->pSat->qhead )
98 {
99 RetValue = sat_solver_simplify(p->pMSat->pSat);
100 assert( RetValue != 0 );
101 }
102*/
103 }
104 p->nSatCallsUnsat++;
105 }
106 else if ( RetValue1 == l_True )
107 {
108p->timeSatSat += Abc_Clock() - clk;
109 p->nSatCallsSat++;
110 return 0;
111 }
112 else // if ( RetValue1 == l_Undef )
113 {
114p->timeSatUndec += Abc_Clock() - clk;
115 p->nSatFailsReal++;
116 return -1;
117 }
118
119 // if the old node was constant 0, we already know the answer
120 if ( pOld == Aig_ManConst1(p->pFrames) )
121 {
122 p->nSatProof++;
123 return 1;
124 }
125
126 // solve under assumptions
127 // A = 0; B = 1 OR A = 0; B = 0
128 nLits = 2;
129 pLits[0] = toLitCond( Ssw_ObjSatNum(p->pMSat,pOld), 1 );
130 pLits[1] = toLitCond( Ssw_ObjSatNum(p->pMSat,pNew), pOld->fPhase ^ pNew->fPhase );
131 if ( p->iOutputLit > -1 )
132 pLits[nLits++] = p->iOutputLit;
133 if ( p->pPars->fPolarFlip )
134 {
135 if ( pOld->fPhase ) pLits[0] = lit_neg( pLits[0] );
136 if ( pNew->fPhase ) pLits[1] = lit_neg( pLits[1] );
137 }
138
139 if ( p->pMSat->pSat->qtail != p->pMSat->pSat->qhead )
140 {
141 RetValue = sat_solver_simplify(p->pMSat->pSat);
142 //assert( RetValue != 0 );
143 }
144
145clk = Abc_Clock();
146 RetValue1 = sat_solver_solve( p->pMSat->pSat, pLits, pLits + nLits,
147 (ABC_INT64_T)nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
148p->timeSat += Abc_Clock() - clk;
149 if ( RetValue1 == l_False )
150 {
151p->timeSatUnsat += Abc_Clock() - clk;
152 if ( nLits == 2 )
153 {
154 pLits[0] = lit_neg( pLits[0] );
155 pLits[1] = lit_neg( pLits[1] );
156 RetValue = sat_solver_addclause( p->pMSat->pSat, pLits, pLits + 2 );
157 assert( RetValue );
158/*
159 if ( p->pMSat->pSat->qtail != p->pMSat->pSat->qhead )
160 {
161 RetValue = sat_solver_simplify(p->pMSat->pSat);
162 assert( RetValue != 0 );
163 }
164*/
165 }
166 p->nSatCallsUnsat++;
167 }
168 else if ( RetValue1 == l_True )
169 {
170p->timeSatSat += Abc_Clock() - clk;
171 p->nSatCallsSat++;
172 return 0;
173 }
174 else // if ( RetValue1 == l_Undef )
175 {
176p->timeSatUndec += Abc_Clock() - clk;
177 p->nSatFailsReal++;
178 return -1;
179 }
180 // return SAT proof
181 p->nSatProof++;
182 return 1;
183}
#define l_True
Definition bmcBmcS.c:35
#define l_False
Definition bmcBmcS.c:36
#define sat_solver_solve
Definition cecSatG2.c:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_SatStart()

Ssw_Sat_t * Ssw_SatStart ( int fPolarFlip)
extern

DECLARATIONS ///.

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

FileName [sswCnf.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [Computation of CNF.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id
sswCnf.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

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

Synopsis [Starts the SAT manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file sswCnf.c.

46{
47 Ssw_Sat_t * p;
48 int Lit;
49 p = ABC_ALLOC( Ssw_Sat_t, 1 );
50 memset( p, 0, sizeof(Ssw_Sat_t) );
51 p->pAig = NULL;
52 p->fPolarFlip = fPolarFlip;
53 p->vSatVars = Vec_IntStart( 10000 );
54 p->vFanins = Vec_PtrAlloc( 100 );
55 p->vUsedPis = Vec_PtrAlloc( 100 );
56 p->pSat = sat_solver_new();
57 sat_solver_setnvars( p->pSat, 1000 );
58 // var 0 is not used
59 // var 1 is reserved for const1 node - add the clause
60 p->nSatVars = 1;
61 Lit = toLit( p->nSatVars );
62 if ( fPolarFlip )
63 Lit = lit_neg( Lit );
64 sat_solver_addclause( p->pSat, &Lit, &Lit + 1 );
65// Ssw_ObjSetSatNum( p, Aig_ManConst1(p->pAig), p->nSatVars++ );
66 Vec_IntWriteEntry( p->vSatVars, 0, p->nSatVars++ );
67 return p;
68}
sat_solver * sat_solver_new(void)
Definition satSolver.c:1137
void sat_solver_setnvars(sat_solver *s, int n)
Definition satSolver.c:1272
struct Ssw_Sat_t_ Ssw_Sat_t
Definition sswInt.h:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_SatStop()

void Ssw_SatStop ( Ssw_Sat_t * p)
extern

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

Synopsis [Stop the SAT manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 81 of file sswCnf.c.

82{
83// Abc_Print( 1, "Recycling SAT solver with %d vars and %d restarts.\n",
84// p->pSat->size, p->pSat->stats.starts );
85 if ( p->pSat )
86 sat_solver_delete( p->pSat );
87 Vec_IntFree( p->vSatVars );
88 Vec_PtrFree( p->vFanins );
89 Vec_PtrFree( p->vUsedPis );
90 ABC_FREE( p );
91}
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:

◆ Ssw_SignalCorrespondenceRefine()

Aig_Man_t * Ssw_SignalCorrespondenceRefine ( Ssw_Man_t * p)
extern

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

Synopsis [Performs computation of signal correspondence with constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 235 of file sswCore.c.

236{
237 int nSatProof, nSatCallsSat, nRecycles, nSatFailsReal, nUniques;
238 Aig_Man_t * pAigNew;
239 int RetValue, nIter = -1, nPrev[4] = {0};
240 abctime clk, clkTotal = Abc_Clock();
241 // get the starting stats
242 p->nLitsBeg = Ssw_ClassesLitNum( p->ppClasses );
243 p->nNodesBeg = Aig_ManNodeNum(p->pAig);
244 p->nRegsBeg = Aig_ManRegNum(p->pAig);
245 // refine classes using BMC
246 if ( p->pPars->fVerbose )
247 {
248 Abc_Print( 1, "Before BMC: " );
249 Ssw_ClassesPrint( p->ppClasses, 0 );
250 }
251 if ( !p->pPars->fLatchCorr || p->pPars->nFramesK > 1 )
252 {
253 p->pMSat = Ssw_SatStart( 0 );
254 if ( p->pPars->fConstrs )
256 else
258 Ssw_SatStop( p->pMSat );
259 p->pMSat = NULL;
260 Ssw_ManCleanup( p );
261 }
262 if ( p->pPars->fVerbose )
263 {
264 Abc_Print( 1, "After BMC: " );
265 Ssw_ClassesPrint( p->ppClasses, 0 );
266 }
267 // apply semi-formal filtering
268/*
269 if ( p->pPars->fSemiFormal )
270 {
271 Aig_Man_t * pSRed;
272 Ssw_FilterUsingSemi( p, 0, 2000, p->pPars->fVerbose );
273// Ssw_FilterUsingSemi( p, 1, 100000, p->pPars->fVerbose );
274 pSRed = Ssw_SpeculativeReduction( p );
275 Aig_ManDumpBlif( pSRed, "srm.blif", NULL, NULL );
276 Aig_ManStop( pSRed );
277 }
278*/
279 if ( p->pPars->pFunc )
280 {
281 ((int (*)(void *))p->pPars->pFunc)( p->pPars->pData );
282 ((int (*)(void *))p->pPars->pFunc)( p->pPars->pData );
283 }
284 if ( p->pPars->nStepsMax == 0 )
285 {
286 Abc_Print( 1, "Stopped signal correspondence after BMC.\n" );
287 goto finalize;
288 }
289 // refine classes using induction
290 nSatProof = nSatCallsSat = nRecycles = nSatFailsReal = nUniques = 0;
291 for ( nIter = 0; ; nIter++ )
292 {
293 if ( p->pPars->nStepsMax == nIter )
294 {
295 Abc_Print( 1, "Stopped signal correspondence after %d refiment iterations.\n", nIter );
296 goto finalize;
297 }
298 if ( p->pPars->nItersStop >= 0 && p->pPars->nItersStop == nIter )
299 {
301 Aig_ManDumpBlif( pSRed, "srm.blif", NULL, NULL );
302 Aig_ManStop( pSRed );
303 Abc_Print( 1, "Iterative refinement is stopped before iteration %d.\n", nIter );
304 Abc_Print( 1, "The network is reduced using candidate equivalences.\n" );
305 Abc_Print( 1, "Speculatively reduced miter is saved in file \"%s\".\n", "srm.blif" );
306 Abc_Print( 1, "If the miter is SAT, the reduced result is incorrect.\n" );
307 break;
308 }
309
310clk = Abc_Clock();
311 p->pMSat = Ssw_SatStart( 0 );
312 if ( p->pPars->fLatchCorrOpt )
313 {
314 RetValue = Ssw_ManSweepLatch( p );
315 if ( p->pPars->fVerbose )
316 {
317 Abc_Print( 1, "%3d : C =%7d. Cl =%7d. Pr =%6d. Cex =%5d. R =%4d. F =%4d. ",
318 nIter, Ssw_ClassesCand1Num(p->ppClasses), Ssw_ClassesClassNum(p->ppClasses),
319 p->nSatProof-nSatProof, p->nSatCallsSat-nSatCallsSat,
320 p->nRecycles-nRecycles, p->nSatFailsReal-nSatFailsReal );
321 ABC_PRT( "T", Abc_Clock() - clk );
322 }
323 }
324 else
325 {
326 if ( p->pPars->fConstrs )
327 RetValue = Ssw_ManSweepConstr( p );
328 else if ( p->pPars->fDynamic )
329 RetValue = Ssw_ManSweepDyn( p );
330 else
331 RetValue = Ssw_ManSweep( p );
332
333 p->pPars->nConflicts += p->pMSat->pSat->stats.conflicts;
334 if ( p->pPars->fVerbose )
335 {
336 Abc_Print( 1, "%3d : C =%7d. Cl =%7d. LR =%6d. NR =%6d. ",
337 nIter, Ssw_ClassesCand1Num(p->ppClasses), Ssw_ClassesClassNum(p->ppClasses),
338 p->nConstrReduced, Aig_ManNodeNum(p->pFrames) );
339 if ( p->pPars->fDynamic )
340 {
341 Abc_Print( 1, "Cex =%5d. ", p->nSatCallsSat-nSatCallsSat );
342 Abc_Print( 1, "R =%4d. ", p->nRecycles-nRecycles );
343 }
344 Abc_Print( 1, "F =%5d. %s ", p->nSatFailsReal-nSatFailsReal,
345 (Saig_ManPoNum(p->pAig)==1 && Ssw_ObjIsConst1Cand(p->pAig,Aig_ObjFanin0(Aig_ManCo(p->pAig,0))))? "+" : "-" );
346 ABC_PRT( "T", Abc_Clock() - clk );
347 }
348// if ( p->pPars->fDynamic && p->nSatCallsSat-nSatCallsSat < 100 )
349// p->pPars->nBTLimit = 10000;
350
351 if ( p->pPars->fStopWhenGone && Saig_ManPoNum(p->pAig) == 1 && !Ssw_ObjIsConst1Cand(p->pAig,Aig_ObjFanin0(Aig_ManCo(p->pAig,0))) )
352 {
353 printf( "Iterative refinement is stopped after iteration %d\n", nIter );
354 printf( "because the property output is no longer a candidate constant.\n" );
355 // prepare to quit
356 p->nLitsEnd = p->nLitsBeg;
357 p->nNodesEnd = p->nNodesBeg;
358 p->nRegsEnd = p->nRegsBeg;
359 // cleanup
360 Ssw_SatStop( p->pMSat );
361 p->pMSat = NULL;
362 Ssw_ManCleanup( p );
363 // cleanup
364 Aig_ManSetPhase( p->pAig );
365 Aig_ManCleanMarkB( p->pAig );
366 return Aig_ManDupSimple( p->pAig );
367 }
368 }
369 nSatProof = p->nSatProof;
370 nSatCallsSat = p->nSatCallsSat;
371 nRecycles = p->nRecycles;
372 nSatFailsReal = p->nSatFailsReal;
373 nUniques = p->nUniques;
374
375 p->nVarsMax = Abc_MaxInt( p->nVarsMax, p->pMSat->nSatVars );
376 p->nCallsMax = Abc_MaxInt( p->nCallsMax, p->pMSat->nSolverCalls );
377 Ssw_SatStop( p->pMSat );
378 p->pMSat = NULL;
379 Ssw_ManCleanup( p );
380 if ( !RetValue )
381 break;
382 if ( p->pPars->pFunc )
383 ((int (*)(void *))p->pPars->pFunc)( p->pPars->pData );
384 if ( p->pPars->nLimitMax )
385 {
386 int nCur = Ssw_ClassesCand1Num(p->ppClasses);
387 if ( nIter > 4 && nPrev[0] - nCur <= 4*p->pPars->nLimitMax )
388 {
389 printf( "Iterative refinement is stopped after iteration %d\n", nIter );
390 printf( "because the refinment is very slow.\n" );
391 // prepare to quit
392 p->nLitsEnd = p->nLitsBeg;
393 p->nNodesEnd = p->nNodesBeg;
394 p->nRegsEnd = p->nRegsBeg;
395 // cleanup
396 Aig_ManSetPhase( p->pAig );
397 Aig_ManCleanMarkB( p->pAig );
398 return Aig_ManDupSimple( p->pAig );
399 }
400 nPrev[0] = nPrev[1];
401 nPrev[1] = nPrev[2];
402 nPrev[2] = nPrev[3];
403 nPrev[3] = nCur;
404 }
405 }
406
407finalize:
408 p->pPars->nIters = nIter + 1;
409p->timeTotal = Abc_Clock() - clkTotal;
410
411 Ssw_ManUpdateEquivs( p, p->pAig, p->pPars->fVerbose );
412 pAigNew = Aig_ManDupRepr( p->pAig, 0 );
413 Aig_ManSeqCleanup( pAigNew );
414//Ssw_ClassesPrint( p->ppClasses, 1 );
415 // get the final stats
416 p->nLitsEnd = Ssw_ClassesLitNum( p->ppClasses );
417 p->nNodesEnd = Aig_ManNodeNum(pAigNew);
418 p->nRegsEnd = Aig_ManRegNum(pAigNew);
419 // cleanup
420 Aig_ManSetPhase( p->pAig );
421 Aig_ManCleanMarkB( p->pAig );
422 return pAigNew;
423}
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition aigRepr.c:267
void Aig_ManCleanMarkB(Aig_Man_t *p)
Definition aigUtil.c:167
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition aigScl.c:158
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigDup.c:46
void Aig_ManSetPhase(Aig_Man_t *pAig)
Definition aigUtil.c:1449
void Aig_ManDumpBlif(Aig_Man_t *p, char *pFileName, Vec_Ptr_t *vPiNames, Vec_Ptr_t *vPoNames)
Definition aigUtil.c:746
Aig_Man_t * Ssw_SpeculativeReduction(Ssw_Man_t *p)
Definition sswAig.c:272
int Ssw_ClassesLitNum(Ssw_Cla_t *p)
Definition sswClass.c:291
void Ssw_ClassesPrint(Ssw_Cla_t *p, int fVeryVerbose)
Definition sswClass.c:414
int Ssw_ManSweepConstr(Ssw_Man_t *p)
Definition sswConstr.c:621
int Ssw_ManSweepBmcConstr(Ssw_Man_t *p)
Definition sswConstr.c:498
void Ssw_ManUpdateEquivs(Ssw_Man_t *p, Aig_Man_t *pAig, int fVerbose)
Definition sswCore.c:188
int Ssw_ManSweepDyn(Ssw_Man_t *p)
Definition sswDyn.c:373
int Ssw_ManSweepLatch(Ssw_Man_t *p)
Definition sswLcorr.c:238
int Ssw_ManSweepBmc(Ssw_Man_t *p)
Definition sswSweep.c:272
int Ssw_ManSweep(Ssw_Man_t *p)
Definition sswSweep.c:373
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_SmlAssignDist1Plus()

void Ssw_SmlAssignDist1Plus ( Ssw_Sml_t * p,
unsigned * pPat )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 674 of file sswSim.c.

675{
676 Aig_Obj_t * pObj;
677 int f, i, Limit;
678 assert( p->nFrames > 0 );
679
680 // copy the pattern into the primary inputs
681 Aig_ManForEachCi( p->pAig, pObj, i )
682 Ssw_SmlObjAssignConst( p, pObj, Abc_InfoHasBit(pPat, i), 0 );
683
684 // set distance one PIs for the first frame
685 Limit = Abc_MinInt( Saig_ManPiNum(p->pAig), p->nWordsFrame * 32 - 1 );
686 for ( i = 0; i < Limit; i++ )
687 Abc_InfoXorBit( Ssw_ObjSim( p, Aig_ManCi(p->pAig, i)->Id ), i+1 );
688
689 // create random info for the remaining timeframes
690 for ( f = 1; f < p->nFrames; f++ )
691 Saig_ManForEachPi( p->pAig, pObj, i )
692 Ssw_SmlAssignRandomFrame( p, pObj, f );
693}
void Ssw_SmlAssignRandomFrame(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
Definition sswSim.c:538
void Ssw_SmlObjAssignConst(Ssw_Sml_t *p, Aig_Obj_t *pObj, int fConst1, int iFrame)
Definition sswSim.c:560
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_SmlAssignRandomFrame()

void Ssw_SmlAssignRandomFrame ( Ssw_Sml_t * p,
Aig_Obj_t * pObj,
int iFrame )
extern

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

Synopsis [Assigns random patterns to the PI node.]

Description []

SideEffects []

SeeAlso []

Definition at line 538 of file sswSim.c.

539{
540 unsigned * pSims;
541 int i;
542 assert( iFrame < p->nFrames );
543 assert( Aig_ObjIsCi(pObj) );
544 pSims = Ssw_ObjSim( p, pObj->Id ) + p->nWordsFrame * iFrame;
545 for ( i = 0; i < p->nWordsFrame; i++ )
546 pSims[i] = Ssw_ObjRandomSim();
547}
Here is the caller graph for this function:

◆ Ssw_SmlClean()

void Ssw_SmlClean ( Ssw_Sml_t * p)
extern

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

Synopsis [Allocates simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1173 of file sswSim.c.

1174{
1175 memset( p->pData, 0, sizeof(unsigned) * Aig_ManObjNumMax(p->pAig) * p->nWordsTotal );
1176}
Here is the call graph for this function:

◆ Ssw_SmlObjAssignConst()

void Ssw_SmlObjAssignConst ( Ssw_Sml_t * p,
Aig_Obj_t * pObj,
int fConst1,
int iFrame )
extern

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

Synopsis [Assigns constant patterns to the PI node.]

Description []

SideEffects []

SeeAlso []

Definition at line 560 of file sswSim.c.

561{
562 unsigned * pSims;
563 int i;
564 assert( iFrame < p->nFrames );
565 assert( Aig_ObjIsCi(pObj) );
566 pSims = Ssw_ObjSim( p, pObj->Id ) + p->nWordsFrame * iFrame;
567 for ( i = 0; i < p->nWordsFrame; i++ )
568 pSims[i] = fConst1? ~(unsigned)0 : 0;
569}
Here is the caller graph for this function:

◆ Ssw_SmlObjHashWord()

unsigned Ssw_SmlObjHashWord ( Ssw_Sml_t * p,
Aig_Obj_t * pObj )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes hash value of the node using its simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file sswSim.c.

64{
65 static int s_SPrimes[128] = {
66 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
67 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
68 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
69 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
70 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
71 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
72 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
73 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
74 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
75 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
76 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
77 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
78 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
79 };
80 unsigned * pSims;
81 unsigned uHash;
82 int i;
83// assert( p->nWordsTotal <= 128 );
84 uHash = 0;
85 pSims = Ssw_ObjSim(p, pObj->Id);
86 for ( i = p->nWordsPref; i < p->nWordsTotal; i++ )
87 uHash ^= pSims[i] * s_SPrimes[i & 0x7F];
88 return uHash;
89}
Here is the caller graph for this function:

◆ Ssw_SmlObjIsConstBit()

int Ssw_SmlObjIsConstBit ( void * p,
Aig_Obj_t * pObj )
extern

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

Synopsis [Returns 1 if the node appears to be constant 1 candidate.]

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file sswSim.c.

148{
149 return pObj->fPhase == pObj->fMarkB;
150}
Here is the caller graph for this function:

◆ Ssw_SmlObjIsConstWord()

int Ssw_SmlObjIsConstWord ( Ssw_Sml_t * p,
Aig_Obj_t * pObj )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 102 of file sswSim.c.

103{
104 unsigned * pSims;
105 int i;
106 pSims = Ssw_ObjSim(p, pObj->Id);
107 for ( i = p->nWordsPref; i < p->nWordsTotal; i++ )
108 if ( pSims[i] )
109 return 0;
110 return 1;
111}
Here is the caller graph for this function:

◆ Ssw_SmlObjsAreEqualBit()

int Ssw_SmlObjsAreEqualBit ( void * p,
Aig_Obj_t * pObj0,
Aig_Obj_t * pObj1 )
extern

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

Synopsis [Returns 1 if the nodes appear equal.]

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file sswSim.c.

164{
165 return (pObj0->fPhase == pObj1->fPhase) == (pObj0->fMarkB == pObj1->fMarkB);
166}
Here is the caller graph for this function:

◆ Ssw_SmlObjsAreEqualWord()

int Ssw_SmlObjsAreEqualWord ( Ssw_Sml_t * p,
Aig_Obj_t * pObj0,
Aig_Obj_t * pObj1 )
extern

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

Synopsis [Returns 1 if simulation infos are equal.]

Description []

SideEffects []

SeeAlso []

Definition at line 124 of file sswSim.c.

125{
126 unsigned * pSims0, * pSims1;
127 int i;
128 pSims0 = Ssw_ObjSim(p, pObj0->Id);
129 pSims1 = Ssw_ObjSim(p, pObj1->Id);
130 for ( i = p->nWordsPref; i < p->nWordsTotal; i++ )
131 if ( pSims0[i] != pSims1[i] )
132 return 0;
133 return 1;
134}

◆ Ssw_SmlObjSetWord()

void Ssw_SmlObjSetWord ( Ssw_Sml_t * p,
Aig_Obj_t * pObj,
unsigned Word,
int iWord,
int iFrame )
extern

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

Synopsis [Assigns constant patterns to the PI node.]

Description []

SideEffects []

SeeAlso []

Definition at line 603 of file sswSim.c.

604{
605 unsigned * pSims;
606 assert( iFrame < p->nFrames );
607 assert( Aig_ObjIsCi(pObj) );
608 pSims = Ssw_ObjSim( p, pObj->Id ) + p->nWordsFrame * iFrame;
609 pSims[iWord] = Word;
610}
Here is the caller graph for this function:

◆ Ssw_SmlResimulateSeq()

void Ssw_SmlResimulateSeq ( Ssw_Sml_t * p)
extern

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

Synopsis [Performs next round of sequential simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 1269 of file sswSim.c.

1270{
1273 p->fNonConstOut = Ssw_SmlCheckNonConstOutputs( p );
1274}
void Ssw_SmlReinitialize(Ssw_Sml_t *p)
Definition sswSim.c:955
void Ssw_SmlSimulateOne(Ssw_Sml_t *p)
Definition sswSim.c:1005
int Ssw_SmlCheckNonConstOutputs(Ssw_Sml_t *p)
Definition sswSim.c:980
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_SmlSavePatternAig()

void Ssw_SmlSavePatternAig ( Ssw_Man_t * p,
int f )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 136 of file sswSweep.c.

137{
138 Aig_Obj_t * pObj;
139 int i;
140 memset( p->pPatWords, 0, sizeof(unsigned) * p->nPatWords );
141 Aig_ManForEachCi( p->pAig, pObj, i )
142 if ( Ssw_ManGetSatVarValue( p, pObj, f ) )
143 Abc_InfoSetBit( p->pPatWords, i );
144}
ABC_NAMESPACE_IMPL_START int Ssw_ManGetSatVarValue(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
DECLARATIONS ///.
Definition sswSweep.c:46
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_SmlSimulateOne()

void Ssw_SmlSimulateOne ( Ssw_Sml_t * p)
extern

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

Synopsis [Simulates AIG manager.]

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

SideEffects []

SeeAlso []

Definition at line 1005 of file sswSim.c.

1006{
1007 Aig_Obj_t * pObj, * pObjLi, * pObjLo;
1008 int f, i;
1009 abctime clk;
1010clk = Abc_Clock();
1011 for ( f = 0; f < p->nFrames; f++ )
1012 {
1013 // simulate the nodes
1014 Aig_ManForEachNode( p->pAig, pObj, i )
1015 Ssw_SmlNodeSimulate( p, pObj, f );
1016 // copy simulation info into outputs
1017 Saig_ManForEachPo( p->pAig, pObj, i )
1018 Ssw_SmlNodeCopyFanin( p, pObj, f );
1019 // copy simulation info into outputs
1020 Saig_ManForEachLi( p->pAig, pObj, i )
1021 Ssw_SmlNodeCopyFanin( p, pObj, f );
1022 // quit if this is the last timeframe
1023 if ( f == p->nFrames - 1 )
1024 break;
1025 // copy simulation info into the inputs
1026 Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
1027 Ssw_SmlNodeTransferNext( p, pObjLi, pObjLo, f );
1028 }
1029p->timeSim += Abc_Clock() - clk;
1030p->nSimRounds++;
1031}
void Ssw_SmlNodeTransferNext(Ssw_Sml_t *p, Aig_Obj_t *pOut, Aig_Obj_t *pIn, int iFrame)
Definition sswSim.c:837
void Ssw_SmlNodeSimulate(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
Definition sswSim.c:706
void Ssw_SmlNodeCopyFanin(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
Definition sswSim.c:803
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_SmlSimulateOneDyn_rec()

void Ssw_SmlSimulateOneDyn_rec ( Ssw_Sml_t * p,
Aig_Obj_t * pObj,
int f,
int * pVisited,
int nVisCounter )
extern

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

Synopsis [Simulates AIG manager.]

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

SideEffects []

SeeAlso []

Definition at line 1076 of file sswSim.c.

1077{
1078// if ( Aig_ObjIsTravIdCurrent(p->pAig, pObj) )
1079// return;
1080// Aig_ObjSetTravIdCurrent(p->pAig, pObj);
1081 if ( pVisited[p->nFrames*pObj->Id+f] == nVisCounter )
1082 return;
1083 pVisited[p->nFrames*pObj->Id+f] = nVisCounter;
1084 if ( Saig_ObjIsPi( p->pAig, pObj ) || Aig_ObjIsConst1(pObj) )
1085 return;
1086 if ( Saig_ObjIsLo( p->pAig, pObj ) )
1087 {
1088 if ( f == 0 )
1089 return;
1090 Ssw_SmlSimulateOneDyn_rec( p, Saig_ObjLoToLi(p->pAig, pObj), f-1, pVisited, nVisCounter );
1091 Ssw_SmlNodeTransferNext( p, Saig_ObjLoToLi(p->pAig, pObj), pObj, f-1 );
1092 return;
1093 }
1094 if ( Saig_ObjIsLi( p->pAig, pObj ) )
1095 {
1096 Ssw_SmlSimulateOneDyn_rec( p, Aig_ObjFanin0(pObj), f, pVisited, nVisCounter );
1097 Ssw_SmlNodeCopyFanin( p, pObj, f );
1098 return;
1099 }
1100 assert( Aig_ObjIsNode(pObj) );
1101 Ssw_SmlSimulateOneDyn_rec( p, Aig_ObjFanin0(pObj), f, pVisited, nVisCounter );
1102 Ssw_SmlSimulateOneDyn_rec( p, Aig_ObjFanin1(pObj), f, pVisited, nVisCounter );
1103 Ssw_SmlNodeSimulate( p, pObj, f );
1104}
void Ssw_SmlSimulateOneDyn_rec(Ssw_Sml_t *p, Aig_Obj_t *pObj, int f, int *pVisited, int nVisCounter)
Definition sswSim.c:1076
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_SmlSimulateOneFrame()

void Ssw_SmlSimulateOneFrame ( Ssw_Sml_t * p)
extern

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

Synopsis [Simulates AIG manager.]

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

SideEffects []

SeeAlso []

Definition at line 1117 of file sswSim.c.

1118{
1119 Aig_Obj_t * pObj, * pObjLi, * pObjLo;
1120 int i;
1121 abctime clk;
1122clk = Abc_Clock();
1123 // simulate the nodes
1124 Aig_ManForEachNode( p->pAig, pObj, i )
1125 Ssw_SmlNodeSimulate( p, pObj, 0 );
1126 // copy simulation info into outputs
1127 Saig_ManForEachLi( p->pAig, pObj, i )
1128 Ssw_SmlNodeCopyFanin( p, pObj, 0 );
1129 // copy simulation info into the inputs
1130 Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
1131 Ssw_SmlNodeTransferNext( p, pObjLi, pObjLo, 0 );
1132p->timeSim += Abc_Clock() - clk;
1133p->nSimRounds++;
1134}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_SmlStart()

Ssw_Sml_t * Ssw_SmlStart ( Aig_Man_t * pAig,
int nPref,
int nFrames,
int nWordsFrame )
extern

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

Synopsis [Allocates simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1148 of file sswSim.c.

1149{
1150 Ssw_Sml_t * p;
1151 p = (Ssw_Sml_t *)ABC_ALLOC( char, sizeof(Ssw_Sml_t) + sizeof(unsigned) * Aig_ManObjNumMax(pAig) * (nPref + nFrames) * nWordsFrame );
1152 memset( p, 0, sizeof(Ssw_Sml_t) + sizeof(unsigned) * (nPref + nFrames) * nWordsFrame );
1153 p->pAig = pAig;
1154 p->nPref = nPref;
1155 p->nFrames = nPref + nFrames;
1156 p->nWordsFrame = nWordsFrame;
1157 p->nWordsTotal = (nPref + nFrames) * nWordsFrame;
1158 p->nWordsPref = nPref * nWordsFrame;
1159 return p;
1160}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_SmlStop()

void Ssw_SmlStop ( Ssw_Sml_t * p)
extern

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

Synopsis [Deallocates simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1211 of file sswSim.c.

1212{
1213 ABC_FREE( p );
1214}

◆ Ssw_SpeculativeReduction()

Aig_Man_t * Ssw_SpeculativeReduction ( Ssw_Man_t * p)
extern

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

Synopsis [Prepares the inductive case with speculative reduction.]

Description []

SideEffects []

SeeAlso []

Definition at line 272 of file sswAig.c.

273{
274 Aig_Man_t * pFrames;
275 Aig_Obj_t * pObj, * pObjNew;
276 int i;
277 assert( p->pFrames == NULL );
278 assert( Aig_ManRegNum(p->pAig) > 0 );
279 assert( Aig_ManRegNum(p->pAig) < Aig_ManCiNum(p->pAig) );
280 p->nConstrTotal = p->nConstrReduced = 0;
281
282 // start the fraig package
283 pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->nFrames );
284 pFrames->pName = Abc_UtilStrsav( p->pAig->pName );
285 // map constants and PIs
286 Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), 0, Aig_ManConst1(pFrames) );
287 Saig_ManForEachPi( p->pAig, pObj, i )
288 Ssw_ObjSetFrame( p, pObj, 0, Aig_ObjCreateCi(pFrames) );
289 // create latches for the first frame
290 Saig_ManForEachLo( p->pAig, pObj, i )
291 Ssw_ObjSetFrame( p, pObj, 0, Aig_ObjCreateCi(pFrames) );
292 // set the constraints on the latch outputs
293 Saig_ManForEachLo( p->pAig, pObj, i )
294 Ssw_FramesConstrainNode( p, pFrames, p->pAig, pObj, 0, 0 );
295 // add internal nodes of this frame
296 Aig_ManForEachNode( p->pAig, pObj, i )
297 {
298 pObjNew = Aig_And( pFrames, Ssw_ObjChild0Fra(p, pObj, 0), Ssw_ObjChild1Fra(p, pObj, 0) );
299 Ssw_ObjSetFrame( p, pObj, 0, pObjNew );
300 Ssw_FramesConstrainNode( p, pFrames, p->pAig, pObj, 0, 0 );
301 }
302 // add the POs for the latch outputs of the last frame
303 Saig_ManForEachLi( p->pAig, pObj, i )
304 Aig_ObjCreateCo( pFrames, Ssw_ObjChild0Fra(p, pObj,0) );
305 // remove dangling nodes
306 Aig_ManCleanup( pFrames );
307 Aig_ManSetRegNum( pFrames, Aig_ManRegNum(p->pAig) );
308// Abc_Print( 1, "SpecRed: Total constraints = %d. Reduced constraints = %d.\n",
309// p->nConstrTotal, p->nConstrReduced );
310 return pFrames;
311}
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition aigMan.c:438
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ssw_UniqueRegisterPairInfo()

void Ssw_UniqueRegisterPairInfo ( Ssw_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [sswSat.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [On-demand uniqueness constraints.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id
sswSat.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

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

Synopsis [Performs computation of signal correspondence with constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file sswUnique.c.

46{
47 Aig_Obj_t * pObjLo, * pObj0, * pObj1;
48 int i, RetValue, Counter;
49 if ( p->vDiffPairs == NULL )
50 p->vDiffPairs = Vec_IntAlloc( Saig_ManRegNum(p->pAig) );
51 Vec_IntClear( p->vDiffPairs );
52 Saig_ManForEachLo( p->pAig, pObjLo, i )
53 {
54 pObj0 = Ssw_ObjFrame( p, pObjLo, 0 );
55 pObj1 = Ssw_ObjFrame( p, pObjLo, 1 );
56 if ( pObj0 == pObj1 )
57 Vec_IntPush( p->vDiffPairs, 0 );
58 else if ( pObj0 == Aig_Not(pObj1) )
59 Vec_IntPush( p->vDiffPairs, 1 );
60// else
61// Vec_IntPush( p->vDiffPairs, 1 );
62 else if ( Aig_ObjPhaseReal(pObj0) != Aig_ObjPhaseReal(pObj1) )
63 Vec_IntPush( p->vDiffPairs, 1 );
64 else
65 {
66 RetValue = Ssw_NodesAreEquiv( p, Aig_Regular(pObj0), Aig_Regular(pObj1) );
67 Vec_IntPush( p->vDiffPairs, RetValue!=1 );
68 }
69 }
70 assert( Vec_IntSize(p->vDiffPairs) == Saig_ManRegNum(p->pAig) );
71 // count the number of ones
72 Counter = 0;
73 Vec_IntForEachEntry( p->vDiffPairs, RetValue, i )
74 Counter += RetValue;
75// Abc_Print( 1, "The number of different register pairs = %d.\n", Counter );
76}
Here is the call graph for this function: