abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sswInt.h File Reference
#include "aig/saig/saig.h"
#include "sat/bsat/satSolver.h"
#include "ssw.h"
#include "aig/ioa/ioa.h"

Go to the source code of this file.

Data Structures

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 ///. More...
 
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

static int Ssw_ObjSatNum (Ssw_Sat_t *p, Aig_Obj_t *pObj)
 MACRO DEFINITIONS ///. More...
 
static void Ssw_ObjSetSatNum (Ssw_Sat_t *p, Aig_Obj_t *pObj, int Num)
 
static int Ssw_ObjIsConst1Cand (Aig_Man_t *pAig, Aig_Obj_t *pObj)
 
static void Ssw_ObjSetConst1Cand (Aig_Man_t *pAig, Aig_Obj_t *pObj)
 
static Aig_Obj_tSsw_ObjFrame (Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
 
static void Ssw_ObjSetFrame (Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
 
static Aig_Obj_tSsw_ObjChild0Fra (Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
 
static Aig_Obj_tSsw_ObjChild1Fra (Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
 
static Aig_Obj_tSsw_ObjFrame_ (Ssw_Frm_t *p, Aig_Obj_t *pObj, int i)
 
static void Ssw_ObjSetFrame_ (Ssw_Frm_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
 
static Aig_Obj_tSsw_ObjChild0Fra_ (Ssw_Frm_t *p, Aig_Obj_t *pObj, int i)
 
static Aig_Obj_tSsw_ObjChild1Fra_ (Ssw_Frm_t *p, Aig_Obj_t *pObj, int i)
 
Ssw_Frm_tSsw_FrmStart (Aig_Man_t *pAig)
 FUNCTION DECLARATIONS ///. More...
 
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 ///. More...
 
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 ///. More...
 
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 ///. More...
 
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 ///. More...
 
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 ///. More...
 
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 ///. More...
 
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 ///. More...
 
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

typedef struct Ssw_Cla_t_ Ssw_Cla_t

Definition at line 50 of file sswInt.h.

typedef struct Ssw_Frm_t_ Ssw_Frm_t

Definition at line 48 of file sswInt.h.

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.

typedef struct Ssw_Sat_t_ Ssw_Sat_t

Definition at line 49 of file sswInt.h.

Function Documentation

int Ssw_ClassesCand1Num ( Ssw_Cla_t p)

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 259 of file sswClass.c.

260 {
261  return p->nCands1;
262 }
int nCands1
Definition: sswClass.c:45
void Ssw_ClassesCheck ( Ssw_Cla_t p)

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 }
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
#define Ssw_ManForEachClass(p, ppClass, i)
Definition: sswClass.c:69
int * pClassSizes
Definition: sswClass.c:41
Aig_Man_t * pAig
Definition: sswClass.c:39
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define Ssw_ClassForEachNode(p, pRepr, pNode, i)
Definition: sswClass.c:73
static int Ssw_ObjIsConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:172
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
int Ssw_ClassesClassNum ( Ssw_Cla_t p)

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 275 of file sswClass.c.

276 {
277  return p->nClasses;
278 }
int nClasses
Definition: sswClass.c:44
void Ssw_ClassesClearRefined ( Ssw_Cla_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 243 of file sswClass.c.

244 {
245  Vec_PtrClear( p->vRefined );
246 }
Vec_Ptr_t * vRefined
Definition: sswClass.c:53
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
void Ssw_ClassesCollectClass ( Ssw_Cla_t p,
Aig_Obj_t pRepr,
Vec_Ptr_t vClass 
)

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 }
Aig_Obj_t *** pId2Class
Definition: sswClass.c:40
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
int * pClassSizes
Definition: sswClass.c:41
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
int Id
Definition: aig.h:85
Vec_Ptr_t* Ssw_ClassesGetRefined ( Ssw_Cla_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 227 of file sswClass.c.

228 {
229  return p->vRefined;
230 }
Vec_Ptr_t * vRefined
Definition: sswClass.c:53
int Ssw_ClassesLitNum ( Ssw_Cla_t p)

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 291 of file sswClass.c.

292 {
293  return p->nLits;
294 }
int nLits
Definition: sswClass.c:46
Ssw_Cla_t* Ssw_ClassesPrepare ( Aig_Man_t pAig,
int  nFramesK,
int  fLatchCorr,
int  fConstCorr,
int  fOutputCorr,
int  nMaxLevs,
int  fVerbose 
)

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
621 clk = Abc_Clock();
622  pSml = Ssw_SmlSimulateSeq( pAig, 0, nFrames, nWords );
623 if ( 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
632 clk = 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 );
677 if ( fVerbose )
678 {
679  Abc_Print( 1, "Collecting candidate equivalence classes. " );
680 ABC_PRT( "Time", Abc_Clock() - clk );
681 }
682 
683 clk = 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 );
702 if ( 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 }
708  Ssw_ClassesCheck( p );
709 // Ssw_ClassesPrint( p, 0 );
710  return p;
711 }
unsigned Ssw_SmlObjHashWord(Ssw_Sml_t *p, Aig_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition: sswSim.c:63
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
unsigned Level
Definition: aig.h:82
Ssw_Sml_t * Ssw_SmlSimulateSeq(Aig_Man_t *pAig, int nPref, int nFrames, int nWords)
Definition: sswSim.c:1248
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
int Ssw_ClassesPrepareRehash(Ssw_Cla_t *p, Vec_Ptr_t *vCands, int fConstCorr)
Definition: sswClass.c:500
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Ssw_SmlObjIsConstWord(Ssw_Sml_t *p, Aig_Obj_t *pObj)
Definition: sswSim.c:102
int nWords
Definition: abcNpn.c:127
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Aig_Man_t * pAig
Definition: sswClass.c:39
int fConstCorr
Definition: sswClass.c:42
int Ssw_SmlObjsAreEqualWord(Ssw_Sml_t *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition: sswSim.c:124
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
void Ssw_ClassesCheck(Ssw_Cla_t *p)
Definition: sswClass.c:350
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
void Ssw_SmlStop(Ssw_Sml_t *p)
Definition: sswSim.c:1211
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Ssw_Cla_t * Ssw_ClassesStart(Aig_Man_t *pAig)
Definition: sswClass.c:140
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static int Aig_ObjIsCand(Aig_Obj_t *pObj)
Definition: aig.h:284
static int Ssw_ObjIsConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:172
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
void Ssw_SmlResimulateSeq(Ssw_Sml_t *p)
Definition: sswSim.c:1269
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
ABC_INT64_T abctime
Definition: abc_global.h:278
DECLARATIONS ///.
Definition: sswSim.c:31
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Ssw_Cla_t* Ssw_ClassesPrepareFromReprs ( Aig_Man_t pAig)

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
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 }
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
Aig_Obj_t *** pId2Class
Definition: sswClass.c:40
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nLits
Definition: sswClass.c:46
int nCands1
Definition: sswClass.c:45
Aig_Obj_t ** pMemClassesFree
Definition: sswClass.c:49
int nClasses
Definition: sswClass.c:44
int * pClassSizes
Definition: sswClass.c:41
int memcmp()
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
Ssw_Cla_t * Ssw_ClassesStart(Aig_Man_t *pAig)
Definition: sswClass.c:140
Aig_Obj_t ** pMemClasses
Definition: sswClass.c:48
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Ssw_ObjIsConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:172
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
Ssw_Cla_t* Ssw_ClassesPreparePairs ( Aig_Man_t pAig,
Vec_Int_t **  pvClasses 
)

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;
912  Ssw_ClassesCheck( p );
913 // Ssw_ClassesPrint( p, 0 );
914  return p;
915 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Ssw_ObjAddClass(Ssw_Cla_t *p, Aig_Obj_t *pRepr, Aig_Obj_t **pClass, int nSize)
FUNCTION DEFINITIONS ///.
Definition: sswClass.c:92
static void Ssw_ObjSetConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:176
int nCands1
Definition: sswClass.c:45
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
Aig_Obj_t ** pMemClassesFree
Definition: sswClass.c:49
static void Aig_ObjSetRepr(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition: aig.h:331
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
void Ssw_ClassesCheck(Ssw_Cla_t *p)
Definition: sswClass.c:350
Definition: aig.h:69
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Ssw_Cla_t * Ssw_ClassesStart(Aig_Man_t *pAig)
Definition: sswClass.c:140
Aig_Obj_t ** pMemClasses
Definition: sswClass.c:48
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Id
Definition: aig.h:85
Ssw_Cla_t* Ssw_ClassesPreparePairsSimple ( Aig_Man_t pMiter,
Vec_Int_t vPairs 
)

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;
954  Ssw_ClassesCheck( p );
955 // Ssw_ClassesPrint( p, 0 );
956  return p;
957 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Ssw_ObjAddClass(Ssw_Cla_t *p, Aig_Obj_t *pRepr, Aig_Obj_t **pClass, int nSize)
FUNCTION DEFINITIONS ///.
Definition: sswClass.c:92
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
Aig_Obj_t ** pMemClassesFree
Definition: sswClass.c:49
static void Aig_ObjSetRepr(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition: aig.h:331
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
void Ssw_ClassesCheck(Ssw_Cla_t *p)
Definition: sswClass.c:350
Definition: aig.h:69
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Ssw_Cla_t * Ssw_ClassesStart(Aig_Man_t *pAig)
Definition: sswClass.c:140
Aig_Obj_t ** pMemClasses
Definition: sswClass.c:48
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
int Ssw_ClassesPrepareRehash ( Ssw_Cla_t p,
Vec_Ptr_t vCands,
int  fConstCorr 
)

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 }
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
unsigned(* pFuncNodeHash)(void *, Aig_Obj_t *)
Definition: sswClass.c:56
static void Ssw_ObjAddClass(Ssw_Cla_t *p, Aig_Obj_t *pRepr, Aig_Obj_t **pClass, int nSize)
FUNCTION DEFINITIONS ///.
Definition: sswClass.c:92
static void Ssw_ObjSetConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:176
int nCands1
Definition: sswClass.c:45
int Ssw_ClassesRefine(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1034
Aig_Obj_t ** pMemClassesFree
Definition: sswClass.c:49
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void * pManData
Definition: sswClass.c:55
int * pClassSizes
Definition: sswClass.c:41
Aig_Man_t * pAig
Definition: sswClass.c:39
static void Aig_ObjSetRepr(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition: aig.h:331
Definition: aig.h:69
int(* pFuncNodeIsConst)(void *, Aig_Obj_t *)
Definition: sswClass.c:57
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static void Ssw_ObjSetNext(Aig_Obj_t **ppNexts, Aig_Obj_t *pObj, Aig_Obj_t *pNext)
Definition: sswClass.c:66
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static Aig_Obj_t * Ssw_ObjNext(Aig_Obj_t **ppNexts, Aig_Obj_t *pObj)
DECLARATIONS ///.
Definition: sswClass.c:65
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Id
Definition: aig.h:85
Ssw_Cla_t* Ssw_ClassesPrepareSimple ( Aig_Man_t pAig,
int  fLatchCorr,
int  nMaxLevs 
)

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
753 // Ssw_ClassesPrint( p, 0 );
754  return p;
755 }
unsigned Level
Definition: aig.h:82
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Ssw_ObjSetConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:176
int nCands1
Definition: sswClass.c:45
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Aig_Obj_t ** pMemClassesFree
Definition: sswClass.c:49
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
Ssw_Cla_t * Ssw_ClassesStart(Aig_Man_t *pAig)
Definition: sswClass.c:140
Aig_Obj_t ** pMemClasses
Definition: sswClass.c:48
Ssw_Cla_t* Ssw_ClassesPrepareTargets ( Aig_Man_t pAig)

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
847 // Ssw_ClassesPrint( p, 0 );
848  return p;
849 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Ssw_ObjSetConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:176
int nCands1
Definition: sswClass.c:45
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Aig_Obj_t ** pMemClassesFree
Definition: sswClass.c:49
Definition: aig.h:69
Ssw_Cla_t * Ssw_ClassesStart(Aig_Man_t *pAig)
Definition: sswClass.c:140
Aig_Obj_t ** pMemClasses
Definition: sswClass.c:48
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
void Ssw_ClassesPrint ( Ssw_Cla_t p,
int  fVeryVerbose 
)

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 nLits
Definition: sswClass.c:46
int nCands1
Definition: sswClass.c:45
#define Ssw_ManForEachClass(p, ppClass, i)
Definition: sswClass.c:69
int Aig_SupportSize(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDfs.c:758
int nClasses
Definition: sswClass.c:44
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
Aig_Man_t * pAig
Definition: sswClass.c:39
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Ssw_ObjIsConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:172
Aig_Man_t* Ssw_ClassesReadAig ( Ssw_Cla_t p)

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 211 of file sswClass.c.

212 {
213  return p->pAig;
214 }
Aig_Man_t * pAig
Definition: sswClass.c:39
Aig_Obj_t** Ssw_ClassesReadClass ( Ssw_Cla_t p,
Aig_Obj_t pRepr,
int *  pnSize 
)

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 }
Aig_Obj_t *** pId2Class
Definition: sswClass.c:40
int * pClassSizes
Definition: sswClass.c:41
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
int Ssw_ClassesRefine ( Ssw_Cla_t p,
int  fRecursive 
)

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 }
#define Ssw_ManForEachClass(p, ppClass, i)
Definition: sswClass.c:69
int Ssw_ClassesRefineOneClass(Ssw_Cla_t *p, Aig_Obj_t *pReprOld, int fRecursive)
Definition: sswClass.c:970
Definition: aig.h:69
int Ssw_ClassesRefineConst1 ( Ssw_Cla_t p,
int  fRecursive 
)

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 }
static void Ssw_ObjAddClass(Ssw_Cla_t *p, Aig_Obj_t *pRepr, Aig_Obj_t **pClass, int nSize)
FUNCTION DEFINITIONS ///.
Definition: sswClass.c:92
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void * pManData
Definition: sswClass.c:55
Aig_Man_t * pAig
Definition: sswClass.c:39
static void Aig_ObjSetRepr(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition: aig.h:331
int fConstCorr
Definition: sswClass.c:42
int Ssw_ClassesRefineOneClass(Ssw_Cla_t *p, Aig_Obj_t *pReprOld, int fRecursive)
Definition: sswClass.c:970
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
Vec_Ptr_t * vClassNew
Definition: sswClass.c:52
int(* pFuncNodeIsConst)(void *, Aig_Obj_t *)
Definition: sswClass.c:57
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Ssw_ClassesRefineConst1Group ( Ssw_Cla_t p,
Vec_Ptr_t vRoots,
int  fRecursive 
)

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 }
static void Ssw_ObjAddClass(Ssw_Cla_t *p, Aig_Obj_t *pRepr, Aig_Obj_t **pClass, int nSize)
FUNCTION DEFINITIONS ///.
Definition: sswClass.c:92
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Aig_Man_t * pAig
Definition: sswClass.c:39
static void Aig_ObjSetRepr(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition: aig.h:331
int Ssw_ClassesRefineOneClass(Ssw_Cla_t *p, Aig_Obj_t *pReprOld, int fRecursive)
Definition: sswClass.c:970
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
Vec_Ptr_t * vClassNew
Definition: sswClass.c:52
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Ssw_ClassesRefineGroup ( Ssw_Cla_t p,
Vec_Ptr_t vReprs,
int  fRecursive 
)

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 }
int Ssw_ClassesRefineOneClass(Ssw_Cla_t *p, Aig_Obj_t *pReprOld, int fRecursive)
Definition: sswClass.c:970
Definition: aig.h:69
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Ssw_ClassesRefineOneClass ( Ssw_Cla_t p,
Aig_Obj_t pReprOld,
int  fRecursive 
)

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 }
static void Ssw_ObjAddClass(Ssw_Cla_t *p, Aig_Obj_t *pRepr, Aig_Obj_t **pClass, int nSize)
FUNCTION DEFINITIONS ///.
Definition: sswClass.c:92
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Aig_Man_t * pAig
Definition: sswClass.c:39
static void Aig_ObjSetRepr(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition: aig.h:331
int Ssw_ClassesRefineOneClass(Ssw_Cla_t *p, Aig_Obj_t *pReprOld, int fRecursive)
Definition: sswClass.c:970
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
Vec_Ptr_t * vClassNew
Definition: sswClass.c:52
Vec_Ptr_t * vClassOld
Definition: sswClass.c:51
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define Ssw_ClassForEachNode(p, pRepr, pNode, i)
Definition: sswClass.c:73
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
static Aig_Obj_t ** Ssw_ObjRemoveClass(Ssw_Cla_t *p, Aig_Obj_t *pRepr)
Definition: sswClass.c:115
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Ssw_ClassesRemoveNode ( Ssw_Cla_t p,
Aig_Obj_t pObj 
)

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 }
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
Aig_Obj_t *** pId2Class
Definition: sswClass.c:40
int nLits
Definition: sswClass.c:46
int nCands1
Definition: sswClass.c:45
int nClasses
Definition: sswClass.c:44
int * pClassSizes
Definition: sswClass.c:41
Aig_Man_t * pAig
Definition: sswClass.c:39
static void Aig_ObjSetRepr(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition: aig.h:331
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Ssw_ClassForEachNode(p, pRepr, pNode, i)
Definition: sswClass.c:73
static int Ssw_ObjIsConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:172
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
void Ssw_ClassesSetData ( Ssw_Cla_t p,
void *  pManData,
unsigned(*)(void *, Aig_Obj_t *)  pFuncNodeHash,
int(*)(void *, Aig_Obj_t *)  pFuncNodeIsConst,
int(*)(void *, Aig_Obj_t *, Aig_Obj_t *)  pFuncNodesAreEqual 
)

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 }
unsigned(* pFuncNodeHash)(void *, Aig_Obj_t *)
Definition: sswClass.c:56
int(* pFuncNodesAreEqual)(void *, Aig_Obj_t *, Aig_Obj_t *)
Definition: sswClass.c:58
void * pManData
Definition: sswClass.c:55
int(* pFuncNodeIsConst)(void *, Aig_Obj_t *)
Definition: sswClass.c:57
Ssw_Cla_t* Ssw_ClassesStart ( Aig_Man_t pAig)

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;
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 }
char * memset()
Aig_Obj_t *** pId2Class
Definition: sswClass.c:40
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int * pClassSizes
Definition: sswClass.c:41
Aig_Man_t * pAig
Definition: sswClass.c:39
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition: aigRepr.c:45
Definition: aig.h:69
Vec_Ptr_t * vRefined
Definition: sswClass.c:53
Vec_Ptr_t * vClassNew
Definition: sswClass.c:52
Vec_Ptr_t * vClassOld
Definition: sswClass.c:51
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
void Ssw_ClassesStop ( Ssw_Cla_t p)

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 }
Aig_Obj_t *** pId2Class
Definition: sswClass.c:40
int * pClassSizes
Definition: sswClass.c:41
Vec_Ptr_t * vRefined
Definition: sswClass.c:53
Vec_Ptr_t * vClassNew
Definition: sswClass.c:52
Vec_Ptr_t * vClassOld
Definition: sswClass.c:51
Aig_Obj_t ** pMemClasses
Definition: sswClass.c:48
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Ssw_CnfGetNodeValue ( Ssw_Sat_t p,
Aig_Obj_t pObj 
)

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 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int sat_solver_var_value(sat_solver *s, int v)
Definition: satSolver.h:200
sat_solver * pSat
Definition: sswInt.h:147
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static int Ssw_ObjSatNum(Ssw_Sat_t *p, Aig_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: sswInt.h:169
#define assert(ex)
Definition: util_old.h:213
int Ssw_CnfGetNodeValue(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:402
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Ssw_CnfNodeAddToSolver ( Ssw_Sat_t p,
Aig_Obj_t pObj 
)

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 );
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 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void Ssw_AddClausesSuper(Ssw_Sat_t *p, Aig_Obj_t *pNode, Vec_Ptr_t *vSuper)
Definition: sswCnf.c:223
Vec_Ptr_t * vFanins
Definition: sswInt.h:150
else
Definition: sparse_int.h:55
Definition: aig.h:69
void Ssw_AddClausesMux(Ssw_Sat_t *p, Aig_Obj_t *pNode)
Definition: sswCnf.c:104
void Ssw_CollectSuper(Aig_Obj_t *pObj, int fUseMuxes, Vec_Ptr_t *vSuper)
Definition: sswCnf.c:303
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int Aig_ObjIsMuxType(Aig_Obj_t *pObj)
Definition: aigUtil.c:307
static int Ssw_ObjSatNum(Ssw_Sat_t *p, Aig_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: sswInt.h:169
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Ssw_ObjAddToFrontier(Ssw_Sat_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vFrontier)
Definition: sswCnf.c:322
int Ssw_FilterUsingSemi ( Ssw_Man_t pMan,
int  fCheckTargets,
int  nConfMax,
int  fVerbose 
)

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  {
282 clk = 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_ClassesClassNum(Ssw_Cla_t *p)
Definition: sswClass.c:275
void Ssw_ManCleanup(Ssw_Man_t *p)
Definition: sswMan.c:158
ABC_NAMESPACE_IMPL_START Ssw_Sat_t * Ssw_SatStart(int fPolarFlip)
DECLARATIONS ///.
Definition: sswCnf.c:45
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Ssw_ClassesCand1Num(Ssw_Cla_t *p)
Definition: sswClass.c:259
int Ssw_SemCheckTargets(Ssw_Sem_t *p)
Definition: sswSemi.c:129
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
typedefABC_NAMESPACE_IMPL_START struct Ssw_Sem_t_ Ssw_Sem_t
DECLARATIONS ///.
Definition: sswSemi.c:30
Ssw_Sem_t * Ssw_SemManStart(Ssw_Man_t *pMan, int nConfMax, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition: sswSemi.c:64
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define ABC_PRT(a, t)
Definition: abc_global.h:220
void Ssw_SemManStop(Ssw_Sem_t *p)
Definition: sswSemi.c:110
#define assert(ex)
Definition: util_old.h:213
int Ssw_ManFilterBmc(Ssw_Sem_t *pBmc, int iPat, int fCheckTargets)
Definition: sswSemi.c:177
ABC_INT64_T abctime
Definition: abc_global.h:278
Aig_Man_t* Ssw_FramesWithClasses ( Ssw_Man_t p)

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

Synopsis [Prepares the inductive case with speculative reduction.]

Description []

SideEffects []

SeeAlso []

Definition at line 144 of file sswAig.c.

145 {
146  Aig_Man_t * pFrames;
147  Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pObjNew;
148  int i, f, iLits;
149  assert( p->pFrames == NULL );
150  assert( Aig_ManRegNum(p->pAig) > 0 );
152  p->nConstrTotal = p->nConstrReduced = 0;
153 
154  // start the fraig package
155  pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->nFrames );
156  // create latches for the first frame
157  Saig_ManForEachLo( p->pAig, pObj, i )
158  Ssw_ObjSetFrame( p, pObj, 0, Aig_ObjCreateCi(pFrames) );
159  // add timeframes
160  iLits = 0;
161  for ( f = 0; f < p->pPars->nFramesK; f++ )
162  {
163  // map constants and PIs
164  Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(pFrames) );
165  Saig_ManForEachPi( p->pAig, pObj, i )
166  {
167  pObjNew = Aig_ObjCreateCi(pFrames);
168  pObjNew->fPhase = (p->vInits != NULL) && Vec_IntEntry(p->vInits, iLits++);
169  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
170  }
171  // set the constraints on the latch outputs
172  Saig_ManForEachLo( p->pAig, pObj, i )
173  Ssw_FramesConstrainNode( p, pFrames, p->pAig, pObj, f, 1 );
174  // add internal nodes of this frame
175  Aig_ManForEachNode( p->pAig, pObj, i )
176  {
177  pObjNew = Aig_And( pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
178  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
179  Ssw_FramesConstrainNode( p, pFrames, p->pAig, pObj, f, 1 );
180  }
181  // transfer to the primary outputs
182  Aig_ManForEachCo( p->pAig, pObj, i )
183  Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj,f) );
184  // transfer latch input to the latch outputs
185  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
186  Ssw_ObjSetFrame( p, pObjLo, f+1, Ssw_ObjFrame(p, pObjLi,f) );
187  }
188  assert( p->vInits == NULL || Vec_IntSize(p->vInits) == iLits + Saig_ManPiNum(p->pAig) );
189  // add the POs for the latch outputs of the last frame
190  Saig_ManForEachLo( p->pAig, pObj, i )
191  Aig_ObjCreateCo( pFrames, Ssw_ObjFrame( p, pObj, p->pPars->nFramesK ) );
192 
193  // remove dangling nodes
194  Aig_ManCleanup( pFrames );
195  // make sure the satisfying assignment is node assigned
196  assert( pFrames->pData == NULL );
197 //Aig_ManShow( pFrames, 0, NULL );
198  return pFrames;
199 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
for(p=first;p->value< newval;p=p->next)
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static void Ssw_FramesConstrainNode(Ssw_Man_t *p, Aig_Man_t *pFrames, Aig_Man_t *pAig, Aig_Obj_t *pObj, int iFrame, int fTwoPos)
Definition: sswAig.c:89
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned int fPhase
Definition: aig.h:78
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define assert(ex)
Definition: util_old.h:213
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
Ssw_Frm_t* Ssw_FrmStart ( Aig_Man_t pAig)

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 }
char * memset()
int nFrames
Definition: sswInt.h:160
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFill(Vec_Ptr_t *p, int nSize, void *Entry)
Definition: vecPtr.h:449
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Aig_Man_t * pAig
Definition: sswInt.h:158
Aig_Man_t * pFrames
Definition: sswInt.h:161
Vec_Ptr_t * vAig2Frm
Definition: sswInt.h:162
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int nObjs
Definition: sswInt.h:159
void Ssw_FrmStop ( Ssw_Frm_t p)

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
Aig_Man_t * pFrames
Definition: sswInt.h:161
Vec_Ptr_t * vAig2Frm
Definition: sswInt.h:162
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Ssw_ManCleanup ( Ssw_Man_t p)

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 }
char * memset()
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
void Aig_ManCleanMarkAB(Aig_Man_t *p)
Definition: aigUtil.c:186
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Ssw_Man_t* Ssw_ManCreate ( Aig_Man_t pAig,
Ssw_Pars_t pPars 
)

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 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
typedefABC_NAMESPACE_HEADER_START struct Ssw_Man_t_ Ssw_Man_t
INCLUDES ///.
Definition: sswInt.h:47
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static int Abc_BitWordNum(int nBits)
Definition: abc_global.h:255
#define assert(ex)
Definition: util_old.h:213
int Ssw_ManGetSatVarValue ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  f 
)

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 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int sat_solver_var_value(sat_solver *s, int v)
Definition: satSolver.h:200
Definition: aig.h:69
unsigned int fPhase
Definition: aig.h:78
static int Ssw_ObjSatNum(Ssw_Sat_t *p, Aig_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: sswInt.h:169
int Ssw_CnfGetNodeValue(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:402
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
void Ssw_ManLoadSolver ( Ssw_Man_t p,
Aig_Obj_t pRepr,
Aig_Obj_t pObj 
)

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;
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 }
void Ssw_ManCollectPos_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, Vec_Int_t *vNewPos)
Definition: sswDyn.c:103
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
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Ssw_NodesAreConstrained(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
Definition: sswSat.c:196
unsigned int fMarkB
Definition: aig.h:80
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Definition: aig.h:69
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
void Ssw_ManRefineByConstrSim ( Ssw_Man_t p)

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 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
unsigned int fMarkB
Definition: aig.h:80
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
int Ssw_ClassesRefine(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1034
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
for(p=first;p->value< newval;p=p->next)
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
else
Definition: sparse_int.h:55
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
int Ssw_ClassesRefineConst1(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1119
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
void Ssw_ManResimulateBit ( Ssw_Man_t p,
Aig_Obj_t pCand,
Aig_Obj_t pRepr 
)

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  }
78 p->timeSimSat += Abc_Clock() - clk;
79 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
unsigned int fMarkB
Definition: aig.h:80
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
int Ssw_ClassesRefine(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1034
static abctime Abc_Clock()
Definition: abc_global.h:279
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
if(last==0)
Definition: sparse_int.h:34
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
int Ssw_ClassesRefineConst1(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1119
void Ssw_ManResimulateWord ( Ssw_Man_t p,
Aig_Obj_t pCand,
Aig_Obj_t pRepr,
int  f 
)

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  }
116 p->timeSimSat += Abc_Clock() - clk;
117 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Ssw_SmlAssignDist1Plus(Ssw_Sml_t *p, unsigned *pPat)
Definition: sswSim.c:674
int Ssw_ClassesRefine(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1034
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Ssw_SmlSimulateOne(Ssw_Sml_t *p)
Definition: sswSim.c:1005
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
int Ssw_ClassesRefineConst1(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1119
void Ssw_ManStop ( Ssw_Man_t p)

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 )
193  Ssw_ManPrintStats( p );
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 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Ssw_ManPrintStats(Ssw_Man_t *p)
Definition: sswMan.c:104
void Ssw_ClassesStop(Ssw_Cla_t *p)
Definition: sswClass.c:189
void Ssw_SmlStop(Ssw_Sml_t *p)
Definition: sswSim.c:1211
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Ssw_ManSweep ( Ssw_Man_t p)

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 365 of file sswSweep.c.

366 {
367  static int Counter;
368  Bar_Progress_t * pProgress = NULL;
369  Aig_Obj_t * pObj, * pObj2, * pObjNew;
370  int nConstrPairs, i, f;
371  abctime clk;
372  Vec_Int_t * vDisproved;
373 
374  // perform speculative reduction
375 clk = Abc_Clock();
376  // create timeframes
377  p->pFrames = Ssw_FramesWithClasses( p );
378  // add constants
379  nConstrPairs = Aig_ManCoNum(p->pFrames)-Aig_ManRegNum(p->pAig);
380  assert( (nConstrPairs & 1) == 0 );
381  for ( i = 0; i < nConstrPairs; i += 2 )
382  {
383  pObj = Aig_ManCo( p->pFrames, i );
384  pObj2 = Aig_ManCo( p->pFrames, i+1 );
386  }
387  // build logic cones for register inputs
388  for ( i = 0; i < Aig_ManRegNum(p->pAig); i++ )
389  {
390  pObj = Aig_ManCo( p->pFrames, nConstrPairs + i );
391  Ssw_CnfNodeAddToSolver( p->pMSat, Aig_ObjFanin0(pObj) );//
392  }
393  sat_solver_simplify( p->pMSat->pSat );
394 
395  // map constants and PIs of the last frame
396  f = p->pPars->nFramesK;
397  Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
398  Saig_ManForEachPi( p->pAig, pObj, i )
399  Ssw_ObjSetFrame( p, pObj, f, Aig_ObjCreateCi(p->pFrames) );
400 p->timeReduce += Abc_Clock() - clk;
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  vDisproved = p->pPars->fEquivDump? Vec_IntAlloc(1000) : NULL;
408  Aig_ManForEachObj( p->pAig, pObj, i )
409  {
410  if ( p->pPars->fVerbose )
411  Bar_ProgressUpdate( pProgress, i, NULL );
412  if ( Saig_ObjIsLo(p->pAig, pObj) )
413  p->fRefined |= Ssw_ManSweepNode( p, pObj, f, 0, vDisproved );
414  else if ( Aig_ObjIsNode(pObj) )
415  {
416  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
417  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
418  p->fRefined |= Ssw_ManSweepNode( p, pObj, f, 0, vDisproved );
419  }
420  }
421  if ( p->pPars->fVerbose )
422  Bar_ProgressStop( pProgress );
423 
424  // cleanup
425 // Ssw_ClassesCheck( p->ppClasses );
426  if ( p->pPars->fEquivDump )
427  Ssw_ManDumpEquivMiter( p->pAig, vDisproved, Counter++ );
428  Vec_IntFreeP( &vDisproved );
429  return p->fRefined;
430 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Ssw_NodesAreConstrained(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
Definition: sswSat.c:196
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static abctime Abc_Clock()
Definition: abc_global.h:279
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
void Ssw_ClassesClearRefined(Ssw_Cla_t *p)
Definition: sswClass.c:243
static void Bar_ProgressUpdate(Bar_Progress_t *p, int nItemsCur, char *pString)
Definition: bar.h:63
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static int Counter
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
void Ssw_ManDumpEquivMiter(Aig_Man_t *p, Vec_Int_t *vPairs, int Num)
Definition: sswSweep.c:334
DECLARATIONS ///.
Definition: bar.c:36
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
int Ssw_ManSweepNode(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc, Vec_Int_t *vPairs)
Definition: sswSweep.c:187
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
Aig_Man_t * Ssw_FramesWithClasses(Ssw_Man_t *p)
Definition: sswAig.c:144
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
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
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
int Ssw_ManSweepBmc ( Ssw_Man_t p)

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 267 of file sswSweep.c.

268 {
269  Bar_Progress_t * pProgress = NULL;
270  Aig_Obj_t * pObj, * pObjNew, * pObjLi, * pObjLo;
271  int i, f;
272  abctime clk;
273 clk = Abc_Clock();
274 
275  // start initialized timeframes
276  p->pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
277  Saig_ManForEachLo( p->pAig, pObj, i )
278  Ssw_ObjSetFrame( p, pObj, 0, Aig_ManConst0(p->pFrames) );
279 
280  // sweep internal nodes
281  p->fRefined = 0;
282  if ( p->pPars->fVerbose )
283  pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
284  for ( f = 0; f < p->pPars->nFramesK; f++ )
285  {
286  // map constants and PIs
287  Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
288  Saig_ManForEachPi( p->pAig, pObj, i )
289  Ssw_ObjSetFrame( p, pObj, f, Aig_ObjCreateCi(p->pFrames) );
290  // sweep internal nodes
291  Aig_ManForEachNode( p->pAig, pObj, i )
292  {
293  if ( p->pPars->fVerbose )
294  Bar_ProgressUpdate( pProgress, Aig_ManObjNumMax(p->pAig) * f + i, NULL );
295  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
296  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
297  p->fRefined |= Ssw_ManSweepNode( p, pObj, f, 1, NULL );
298  }
299  // quit if this is the last timeframe
300  if ( f == p->pPars->nFramesK - 1 )
301  break;
302  // transfer latch input to the latch outputs
303  Aig_ManForEachCo( p->pAig, pObj, i )
304  Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj, f) );
305  // build logic cones for register outputs
306  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
307  {
308  pObjNew = Ssw_ObjFrame( p, pObjLi, f );
309  Ssw_ObjSetFrame( p, pObjLo, f+1, pObjNew );
310  Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pObjNew) );//
311  }
312  }
313  if ( p->pPars->fVerbose )
314  Bar_ProgressStop( pProgress );
315 
316  // cleanup
317 // Ssw_ClassesCheck( p->ppClasses );
318 p->timeBmc += Abc_Clock() - clk;
319  return p->fRefined;
320 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static abctime Abc_Clock()
Definition: abc_global.h:279
for(p=first;p->value< newval;p=p->next)
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static void Bar_ProgressUpdate(Bar_Progress_t *p, int nItemsCur, char *pString)
Definition: bar.h:63
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
DECLARATIONS ///.
Definition: bar.c:36
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
int Ssw_ManSweepNode(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc, Vec_Int_t *vPairs)
Definition: sswSweep.c:187
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
ABC_INT64_T abctime
Definition: abc_global.h:278
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
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
int Ssw_ManSweepBmcConstr ( Ssw_Man_t p)

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;
503 clk = 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 
538  // sweep internal nodes
539  Aig_ManForEachNode( p->pAig, pObj, i )
540  {
541  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
542  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
543  p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 1 );
544  }
545  // quit if this is the last timeframe
546  if ( f == p->pPars->nFramesK - 1 )
547  break;
548  // transfer latch input to the latch outputs
549  Aig_ManForEachCo( p->pAig, pObj, i )
550  Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj, f) );
551  // build logic cones for register outputs
552  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
553  {
554  pObjNew = Ssw_ObjFrame( p, pObjLi, f );
555  Ssw_ObjSetFrame( p, pObjLo, f+1, pObjNew );
556  Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pObjNew) );//
557  }
558  }
559  assert( Vec_IntSize(p->vInits) == iLits + Saig_ManPiNum(p->pAig) );
560 
561  // cleanup
562 // Ssw_ClassesCheck( p->ppClasses );
563 p->timeBmc += Abc_Clock() - clk;
564  return p->fRefined;
565 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
int Ssw_NodesAreConstrained(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
Definition: sswSat.c:196
int Ssw_ManSweepNodeConstr(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc)
Definition: sswConstr.c:314
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static abctime Abc_Clock()
Definition: abc_global.h:279
for(p=first;p->value< newval;p=p->next)
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned int fPhase
Definition: aig.h:78
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * Ssw_ManSweepBmcConstr_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition: sswConstr.c:370
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
int Ssw_ManSweepConstr ( Ssw_Man_t p)

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 619 of file sswConstr.c.

620 {
621  Bar_Progress_t * pProgress = NULL;
622  Aig_Obj_t * pObj, * pObj2, * pObjNew;
623  int nConstrPairs, i, f, iLits;
624  abctime clk;
625 //Ssw_ManPrintPolarity( p->pAig );
626 
627  // perform speculative reduction
628 clk = Abc_Clock();
629  // create timeframes
630  p->pFrames = Ssw_FramesWithClasses( p );
631  // add constants
632  nConstrPairs = Aig_ManCoNum(p->pFrames)-Aig_ManRegNum(p->pAig);
633  assert( (nConstrPairs & 1) == 0 );
634  for ( i = 0; i < nConstrPairs; i += 2 )
635  {
636  pObj = Aig_ManCo( p->pFrames, i );
637  pObj2 = Aig_ManCo( p->pFrames, i+1 );
639  }
640  // build logic cones for register inputs
641  for ( i = 0; i < Aig_ManRegNum(p->pAig); i++ )
642  {
643  pObj = Aig_ManCo( p->pFrames, nConstrPairs + i );
644  Ssw_CnfNodeAddToSolver( p->pMSat, Aig_ObjFanin0(pObj) );//
645  }
646 
647  // map constants and PIs of the last frame
648  f = p->pPars->nFramesK;
649 // iLits = 0;
650  iLits = f * Saig_ManPiNum(p->pAig);
651  Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
652  Saig_ManForEachPi( p->pAig, pObj, i )
653  {
654  pObjNew = Aig_ObjCreateCi(p->pFrames);
655  pObjNew->fPhase = (p->vInits != NULL) && Vec_IntEntry(p->vInits, iLits++);
656  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
657  }
658  assert( Vec_IntSize(p->vInits) == iLits );
659 p->timeReduce += Abc_Clock() - clk;
660 
661  // add constraints to all timeframes
662  for ( f = 0; f <= p->pPars->nFramesK; f++ )
663  {
664  Saig_ManForEachPo( p->pAig, pObj, i )
665  {
666  if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
667  continue;
669 // if ( Aig_Regular(Ssw_ObjChild0Fra(p,pObj,f)) == Aig_ManConst1(p->pFrames) )
670  if ( Ssw_ObjChild0Fra(p,pObj,f) == Aig_ManConst0(p->pFrames) )
671  continue;
672  assert( Ssw_ObjChild0Fra(p,pObj,f) != Aig_ManConst1(p->pFrames) );
673  if ( Ssw_ObjChild0Fra(p,pObj,f) == Aig_ManConst1(p->pFrames) )
674  {
675  Abc_Print( 1, "Polarity violation.\n" );
676  continue;
677  }
679  }
680  }
681  f = p->pPars->nFramesK;
682  // clean the solver
683  sat_solver_simplify( p->pMSat->pSat );
684 
685 
686  // sweep internal nodes
687  p->fRefined = 0;
688  Ssw_ClassesClearRefined( p->ppClasses );
689  if ( p->pPars->fVerbose )
690  pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAig) );
691  Aig_ManForEachObj( p->pAig, pObj, i )
692  {
693  if ( p->pPars->fVerbose )
694  Bar_ProgressUpdate( pProgress, i, NULL );
695  if ( Saig_ObjIsLo(p->pAig, pObj) )
696  p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 0 );
697  else if ( Aig_ObjIsNode(pObj) )
698  {
699  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
700  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
701  p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 0 );
702  }
703  }
704  if ( p->pPars->fVerbose )
705  Bar_ProgressStop( pProgress );
706  // cleanup
707 // Ssw_ClassesCheck( p->ppClasses );
708  return p->fRefined;
709 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Ssw_NodesAreConstrained(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
Definition: sswSat.c:196
int Ssw_ManSweepNodeConstr(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc)
Definition: sswConstr.c:314
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
static abctime Abc_Clock()
Definition: abc_global.h:279
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
void Ssw_ClassesClearRefined(Ssw_Cla_t *p)
Definition: sswClass.c:243
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
static void Bar_ProgressUpdate(Bar_Progress_t *p, int nItemsCur, char *pString)
Definition: bar.h:63
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
DECLARATIONS ///.
Definition: bar.c:36
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned int fPhase
Definition: aig.h:78
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
Aig_Man_t * Ssw_FramesWithClasses(Ssw_Man_t *p)
Definition: sswAig.c:144
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
void Bar_ProgressStop(Bar_Progress_t *p)
Definition: bar.c:126
Aig_Obj_t * Ssw_FramesWithClasses_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition: sswConstr.c:581
Bar_Progress_t * Bar_ProgressStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Definition: bar.c:66
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
int Ssw_ManSweepDyn ( Ssw_Man_t p)

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
381 clk = 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
394  Ssw_ManLabelPiNodes( p );
395 p->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
443  Ssw_ManLabelPiNodes( p );
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 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
ABC_NAMESPACE_IMPL_START Ssw_Sat_t * Ssw_SatStart(int fPolarFlip)
DECLARATIONS ///.
Definition: sswCnf.c:45
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
int Ssw_ManSweepResimulateDynLocal(Ssw_Man_t *p, int f)
Definition: sswDyn.c:295
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
Definition: vecPtr.h:968
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Ssw_ClassesClearRefined(Ssw_Cla_t *p)
Definition: sswClass.c:243
static void Bar_ProgressUpdate(Bar_Progress_t *p, int nItemsCur, char *pString)
Definition: bar.h:63
ABC_NAMESPACE_IMPL_START void Ssw_ManLabelPiNodes(Ssw_Man_t *p)
DECLARATIONS ///.
Definition: sswDyn.c:46
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
int Ssw_ManSweepNode(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc, Vec_Int_t *vPairs)
Definition: sswSweep.c:187
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
DECLARATIONS ///.
Definition: bar.c:36
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
void Aig_ManCleanMarkAB(Aig_Man_t *p)
Definition: aigUtil.c:186
Aig_Man_t * Ssw_FramesWithClasses(Ssw_Man_t *p)
Definition: sswAig.c:144
#define assert(ex)
Definition: util_old.h:213
void Ssw_SatStop(Ssw_Sat_t *p)
Definition: sswCnf.c:81
ABC_INT64_T abctime
Definition: abc_global.h:278
void Bar_ProgressStop(Bar_Progress_t *p)
Definition: bar.c:126
int Ssw_ManSweepResimulateDyn(Ssw_Man_t *p, int f)
Definition: sswDyn.c:263
Bar_Progress_t * Bar_ProgressStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Definition: bar.c:66
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
int Ssw_ManSweepLatch ( Ssw_Man_t p)

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 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
Aig_Man_t * pAig
Definition: llb3Image.c:49
ABC_NAMESPACE_IMPL_START Ssw_Sat_t * Ssw_SatStart(int fPolarFlip)
DECLARATIONS ///.
Definition: sswCnf.c:45
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
Definition: vecPtr.h:968
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
int Ssw_ManSweepResimulate(Ssw_Man_t *p)
Definition: sswLcorr.c:78
unsigned int fPhase
Definition: aig.h:78
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
void Ssw_ClassesCollectClass(Ssw_Cla_t *p, Aig_Obj_t *pRepr, Vec_Ptr_t *vClass)
Definition: sswClass.c:328
static int Ssw_ObjIsConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:172
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
void Ssw_SatStop(Ssw_Sat_t *p)
Definition: sswCnf.c:81
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Ssw_ManSweepLatchOne(Ssw_Man_t *p, Aig_Obj_t *pObjRepr, Aig_Obj_t *pObj)
Definition: sswLcorr.c:160
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
int Ssw_ManSweepNode ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  f,
int  fBmc,
Vec_Int_t vPairs 
)

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  {
209 clk = Abc_Clock();
210  Ssw_ManLoadSolver( p, pObjRepr, pObj );
211  p->nRecycleCalls++;
212 p->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  return 0;
224  }
225  if ( vPairs )
226  {
227  Vec_IntPush( vPairs, pObjRepr->Id );
228  Vec_IntPush( vPairs, pObj->Id );
229  }
230  if ( RetValue == -1 ) // timed out
231  {
232  Ssw_ClassesRemoveNode( p->ppClasses, pObj );
233  return 1;
234  }
235  // disproved the equivalence
236  if ( !fBmc && p->pPars->fDynamic )
237  {
239  p->nPatterns++;
240  return 1;
241  }
242  else
243  Ssw_SmlSavePatternAig( p, f );
244  if ( !p->pPars->fConstrs )
245  Ssw_ManResimulateWord( p, pObj, pObjRepr, f );
246  else
247  Ssw_ManResimulateBit( p, pObj, pObjRepr );
248  assert( Aig_ObjRepr( p->pAig, pObj ) != pObjRepr );
249  if ( Aig_ObjRepr( p->pAig, pObj ) == pObjRepr )
250  {
251  Abc_Print( 1, "Ssw_ManSweepNode(): Failed to refine representative.\n" );
252  }
253  return 1;
254 }
void Ssw_SmlSavePatternAig(Ssw_Man_t *p, int f)
Definition: sswSweep.c:136
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Ssw_ManResimulateWord(Ssw_Man_t *p, Aig_Obj_t *pCand, Aig_Obj_t *pRepr, int f)
Definition: sswSimSat.c:92
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static abctime Abc_Clock()
Definition: abc_global.h:279
void Ssw_ClassesRemoveNode(Ssw_Cla_t *p, Aig_Obj_t *pObj)
Definition: sswClass.c:448
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
Definition: aig.h:299
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
void Ssw_ManLoadSolver(Ssw_Man_t *p, Aig_Obj_t *pRepr, Aig_Obj_t *pObj)
Definition: sswDyn.c:142
unsigned int fPhase
Definition: aig.h:78
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
#define assert(ex)
Definition: util_old.h:213
void Ssw_SmlAddPatternDyn(Ssw_Man_t *p)
Definition: sswSweep.c:157
int Ssw_NodesAreEquiv(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
DECLARATIONS ///.
Definition: sswSat.c:45
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
ABC_INT64_T abctime
Definition: abc_global.h:278
int Id
Definition: aig.h:85
void Ssw_ManResimulateBit(Ssw_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
DECLARATIONS ///.
Definition: sswSimSat.c:45
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
int Ssw_ManUniqueAddConstraint ( Ssw_Man_t p,
Vec_Ptr_t vCommon,
int  f1,
int  f2 
)

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_Man_t * pAig
Definition: llb3Image.c:49
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static lit toLitCond(int v, int c)
Definition: satVec.h:143
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
static int Ssw_ObjSatNum(Ssw_Sat_t *p, Aig_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: sswInt.h:169
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
int Ssw_ManUniqueOne ( Ssw_Man_t p,
Aig_Obj_t pRepr,
Aig_Obj_t pObj,
int  fVerbose 
)

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 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_SupportNodes(Aig_Man_t *p, Aig_Obj_t **ppObjs, int nObjs, Vec_Ptr_t *vSupp)
Definition: aigDfs.c:854
int Ssw_ManGetSatVarValue(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
DECLARATIONS ///.
Definition: sswSweep.c:46
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Definition: vecPtr.h:528
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
int Ssw_NodeIsConstrained ( Ssw_Man_t p,
Aig_Obj_t pPoObj 
)

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 }
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static lit lit_neg(lit l)
Definition: satVec.h:144
static lit toLitCond(int v, int c)
Definition: satVec.h:143
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Ssw_ObjSatNum(Ssw_Sat_t *p, Aig_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: sswInt.h:169
#define assert(ex)
Definition: util_old.h:213
int Ssw_NodesAreConstrained ( Ssw_Man_t p,
Aig_Obj_t pOld,
Aig_Obj_t pNew 
)

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 }
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static lit lit_neg(lit l)
Definition: satVec.h:144
static lit toLitCond(int v, int c)
Definition: satVec.h:143
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
Definition: aig.h:299
Definition: aig.h:69
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
unsigned int fPhase
Definition: aig.h:78
static int Ssw_ObjSatNum(Ssw_Sat_t *p, Aig_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: sswInt.h:169
#define assert(ex)
Definition: util_old.h:213
int Ssw_NodesAreEquiv ( Ssw_Man_t p,
Aig_Obj_t pOld,
Aig_Obj_t pNew 
)

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 
83 clk = 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 );
86 p->timeSat += Abc_Clock() - clk;
87  if ( RetValue1 == l_False )
88  {
89 p->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  {
108 p->timeSatSat += Abc_Clock() - clk;
109  p->nSatCallsSat++;
110  return 0;
111  }
112  else // if ( RetValue1 == l_Undef )
113  {
114 p->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 
145 clk = 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 );
148 p->timeSat += Abc_Clock() - clk;
149  if ( RetValue1 == l_False )
150  {
151 p->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  {
170 p->timeSatSat += Abc_Clock() - clk;
171  p->nSatCallsSat++;
172  return 0;
173  }
174  else // if ( RetValue1 == l_Undef )
175  {
176 p->timeSatUndec += Abc_Clock() - clk;
177  p->nSatFailsReal++;
178  return -1;
179  }
180  // return SAT proof
181  p->nSatProof++;
182  return 1;
183 }
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define l_True
Definition: SolverTypes.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
static lit lit_neg(lit l)
Definition: satVec.h:144
static lit toLitCond(int v, int c)
Definition: satVec.h:143
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
unsigned int fPhase
Definition: aig.h:78
#define l_False
Definition: SolverTypes.h:85
static int Ssw_ObjSatNum(Ssw_Sat_t *p, Aig_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: sswInt.h:169
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
static Aig_Obj_t* Ssw_ObjChild0Fra ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 185 of file sswInt.h.

185 { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin0(pObj)? Aig_NotCond(Ssw_ObjFrame(p, Aig_ObjFanin0(pObj), i), Aig_ObjFaninC0(pObj)) : NULL; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
static Aig_Obj_t* Ssw_ObjChild0Fra_ ( Ssw_Frm_t p,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 191 of file sswInt.h.

191 { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin0(pObj)? Aig_NotCond(Ssw_ObjFrame_(p, Aig_ObjFanin0(pObj), i), Aig_ObjFaninC0(pObj)) : NULL; }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Ssw_ObjFrame_(Ssw_Frm_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:188
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t* Ssw_ObjChild1Fra ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 186 of file sswInt.h.

186 { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin1(pObj)? Aig_NotCond(Ssw_ObjFrame(p, Aig_ObjFanin1(pObj), i), Aig_ObjFaninC1(pObj)) : NULL; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
static Aig_Obj_t* Ssw_ObjChild1Fra_ ( Ssw_Frm_t p,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 192 of file sswInt.h.

192 { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin1(pObj)? Aig_NotCond(Ssw_ObjFrame_(p, Aig_ObjFanin1(pObj), i), Aig_ObjFaninC1(pObj)) : NULL; }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static Aig_Obj_t * Ssw_ObjFrame_(Ssw_Frm_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:188
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t* Ssw_ObjFrame ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 182 of file sswInt.h.

182 { return p->pNodeToFrames[p->nFrames*pObj->Id + i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Id
Definition: aig.h:85
static Aig_Obj_t* Ssw_ObjFrame_ ( Ssw_Frm_t p,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 188 of file sswInt.h.

188 { return (Aig_Obj_t *)Vec_PtrGetEntry( p->vAig2Frm, p->nObjs*i+pObj->Id ); }
static void * Vec_PtrGetEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:494
Definition: aig.h:69
Vec_Ptr_t * vAig2Frm
Definition: sswInt.h:162
int nObjs
Definition: sswInt.h:159
int Id
Definition: aig.h:85
static int Ssw_ObjIsConst1Cand ( Aig_Man_t pAig,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 172 of file sswInt.h.

173 {
174  return Aig_ObjRepr(pAig, pObj) == Aig_ManConst1(pAig);
175 }
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Ssw_ObjSatNum ( Ssw_Sat_t p,
Aig_Obj_t pObj 
)
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 169 of file sswInt.h.

169 { return Vec_IntGetEntry( p->vSatVars, pObj->Id ); }
static int Vec_IntGetEntry(Vec_Int_t *p, int i)
Definition: bblif.c:401
Vec_Int_t * vSatVars
Definition: sswInt.h:149
int Id
Definition: aig.h:85
static void Ssw_ObjSetConst1Cand ( Aig_Man_t pAig,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 176 of file sswInt.h.

177 {
178  assert( !Ssw_ObjIsConst1Cand( pAig, pObj ) );
179  Aig_ObjSetRepr( pAig, pObj, Aig_ManConst1(pAig) );
180 }
static void Aig_ObjSetRepr(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition: aig.h:331
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Ssw_ObjIsConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:172
#define assert(ex)
Definition: util_old.h:213
static void Ssw_ObjSetFrame ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  i,
Aig_Obj_t pNode 
)
inlinestatic

Definition at line 183 of file sswInt.h.

183 { p->pNodeToFrames[p->nFrames*pObj->Id + i] = pNode; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Id
Definition: aig.h:85
static void Ssw_ObjSetFrame_ ( Ssw_Frm_t p,
Aig_Obj_t pObj,
int  i,
Aig_Obj_t pNode 
)
inlinestatic

Definition at line 189 of file sswInt.h.

189 { Vec_PtrSetEntry( p->vAig2Frm, p->nObjs*i+pObj->Id, pNode ); }
static void Vec_PtrSetEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:511
Vec_Ptr_t * vAig2Frm
Definition: sswInt.h:162
int nObjs
Definition: sswInt.h:159
int Id
Definition: aig.h:85
static void Ssw_ObjSetSatNum ( Ssw_Sat_t p,
Aig_Obj_t pObj,
int  Num 
)
inlinestatic

Definition at line 170 of file sswInt.h.

170 { Vec_IntSetEntry(p->vSatVars, pObj->Id, Num); }
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
Vec_Int_t * vSatVars
Definition: sswInt.h:149
int Id
Definition: aig.h:85
Ssw_Sat_t* Ssw_SatStart ( int  fPolarFlip)

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 }
char * memset()
Vec_Ptr_t * vUsedPis
Definition: sswInt.h:151
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Vec_Int_t * vSatVars
Definition: sswInt.h:149
static lit lit_neg(lit l)
Definition: satVec.h:144
sat_solver * pSat
Definition: sswInt.h:147
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
Vec_Ptr_t * vFanins
Definition: sswInt.h:150
static lit toLit(int v)
Definition: satVec.h:142
Aig_Man_t * pAig
Definition: sswInt.h:145
void sat_solver_setnvars(sat_solver *s, int n)
Definition: satSolver.c:1072
int fPolarFlip
Definition: sswInt.h:146
sat_solver * sat_solver_new(void)
Definition: satSolver.c:1001
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int nSatVars
Definition: sswInt.h:148
void Ssw_SatStop ( Ssw_Sat_t p)

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 }
Vec_Ptr_t * vUsedPis
Definition: sswInt.h:151
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
Vec_Int_t * vSatVars
Definition: sswInt.h:149
sat_solver * pSat
Definition: sswInt.h:147
Vec_Ptr_t * vFanins
Definition: sswInt.h:150
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Man_t* Ssw_SignalCorrespondenceRefine ( Ssw_Man_t p)

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

Synopsis [Performs computation of signal correspondence with constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file sswCore.c.

235 {
236  int nSatProof, nSatCallsSat, nRecycles, nSatFailsReal, nUniques;
237  Aig_Man_t * pAigNew;
238  int RetValue, nIter = -1;
239  abctime clk, clkTotal = Abc_Clock();
240  // get the starting stats
241  p->nLitsBeg = Ssw_ClassesLitNum( p->ppClasses );
242  p->nNodesBeg = Aig_ManNodeNum(p->pAig);
243  p->nRegsBeg = Aig_ManRegNum(p->pAig);
244  // refine classes using BMC
245  if ( p->pPars->fVerbose )
246  {
247  Abc_Print( 1, "Before BMC: " );
248  Ssw_ClassesPrint( p->ppClasses, 0 );
249  }
250  if ( !p->pPars->fLatchCorr )
251  {
252  p->pMSat = Ssw_SatStart( 0 );
253  if ( p->pPars->fConstrs )
255  else
256  Ssw_ManSweepBmc( p );
257  Ssw_SatStop( p->pMSat );
258  p->pMSat = NULL;
259  Ssw_ManCleanup( p );
260  }
261  if ( p->pPars->fVerbose )
262  {
263  Abc_Print( 1, "After BMC: " );
264  Ssw_ClassesPrint( p->ppClasses, 0 );
265  }
266  // apply semi-formal filtering
267 /*
268  if ( p->pPars->fSemiFormal )
269  {
270  Aig_Man_t * pSRed;
271  Ssw_FilterUsingSemi( p, 0, 2000, p->pPars->fVerbose );
272 // Ssw_FilterUsingSemi( p, 1, 100000, p->pPars->fVerbose );
273  pSRed = Ssw_SpeculativeReduction( p );
274  Aig_ManDumpBlif( pSRed, "srm.blif", NULL, NULL );
275  Aig_ManStop( pSRed );
276  }
277 */
278  if ( p->pPars->pFunc )
279  {
280  ((int (*)(void *))p->pPars->pFunc)( p->pPars->pData );
281  ((int (*)(void *))p->pPars->pFunc)( p->pPars->pData );
282  }
283  if ( p->pPars->nStepsMax == 0 )
284  {
285  Abc_Print( 1, "Stopped signal correspondence after BMC.\n" );
286  goto finalize;
287  }
288  // refine classes using induction
289  nSatProof = nSatCallsSat = nRecycles = nSatFailsReal = nUniques = 0;
290  for ( nIter = 0; ; nIter++ )
291  {
292  if ( p->pPars->nStepsMax == nIter )
293  {
294  Abc_Print( 1, "Stopped signal correspondence after %d refiment iterations.\n", nIter );
295  goto finalize;
296  }
297  if ( p->pPars->nItersStop >= 0 && p->pPars->nItersStop == nIter )
298  {
299  Aig_Man_t * pSRed = Ssw_SpeculativeReduction( p );
300  Aig_ManDumpBlif( pSRed, "srm.blif", NULL, NULL );
301  Aig_ManStop( pSRed );
302  Abc_Print( 1, "Iterative refinement is stopped before iteration %d.\n", nIter );
303  Abc_Print( 1, "The network is reduced using candidate equivalences.\n" );
304  Abc_Print( 1, "Speculatively reduced miter is saved in file \"%s\".\n", "srm.blif" );
305  Abc_Print( 1, "If the miter is SAT, the reduced result is incorrect.\n" );
306  break;
307  }
308 
309 clk = Abc_Clock();
310  p->pMSat = Ssw_SatStart( 0 );
311  if ( p->pPars->fLatchCorrOpt )
312  {
313  RetValue = Ssw_ManSweepLatch( p );
314  if ( p->pPars->fVerbose )
315  {
316  Abc_Print( 1, "%3d : C =%7d. Cl =%7d. Pr =%6d. Cex =%5d. R =%4d. F =%4d. ",
317  nIter, Ssw_ClassesCand1Num(p->ppClasses), Ssw_ClassesClassNum(p->ppClasses),
318  p->nSatProof-nSatProof, p->nSatCallsSat-nSatCallsSat,
319  p->nRecycles-nRecycles, p->nSatFailsReal-nSatFailsReal );
320  ABC_PRT( "T", Abc_Clock() - clk );
321  }
322  }
323  else
324  {
325  if ( p->pPars->fConstrs )
326  RetValue = Ssw_ManSweepConstr( p );
327  else if ( p->pPars->fDynamic )
328  RetValue = Ssw_ManSweepDyn( p );
329  else
330  RetValue = Ssw_ManSweep( p );
331 
332  p->pPars->nConflicts += p->pMSat->pSat->stats.conflicts;
333  if ( p->pPars->fVerbose )
334  {
335  Abc_Print( 1, "%3d : C =%7d. Cl =%7d. LR =%6d. NR =%6d. ",
336  nIter, Ssw_ClassesCand1Num(p->ppClasses), Ssw_ClassesClassNum(p->ppClasses),
337  p->nConstrReduced, Aig_ManNodeNum(p->pFrames) );
338  if ( p->pPars->fDynamic )
339  {
340  Abc_Print( 1, "Cex =%5d. ", p->nSatCallsSat-nSatCallsSat );
341  Abc_Print( 1, "R =%4d. ", p->nRecycles-nRecycles );
342  }
343  Abc_Print( 1, "F =%5d. %s ", p->nSatFailsReal-nSatFailsReal,
344  (Saig_ManPoNum(p->pAig)==1 && Ssw_ObjIsConst1Cand(p->pAig,Aig_ObjFanin0(Aig_ManCo(p->pAig,0))))? "+" : "-" );
345  ABC_PRT( "T", Abc_Clock() - clk );
346  }
347 // if ( p->pPars->fDynamic && p->nSatCallsSat-nSatCallsSat < 100 )
348 // p->pPars->nBTLimit = 10000;
349 
350  if ( p->pPars->fStopWhenGone && Saig_ManPoNum(p->pAig) == 1 && !Ssw_ObjIsConst1Cand(p->pAig,Aig_ObjFanin0(Aig_ManCo(p->pAig,0))) )
351  {
352  printf( "Iterative refinement is stopped after iteration %d\n", nIter );
353  printf( "because the property output is no longer a candidate constant.\n" );
354  // prepare to quite
355  p->nLitsEnd = p->nLitsBeg;
356  p->nNodesEnd = p->nNodesBeg;
357  p->nRegsEnd = p->nRegsBeg;
358  // cleanup
359  Ssw_SatStop( p->pMSat );
360  p->pMSat = NULL;
361  Ssw_ManCleanup( p );
362  // cleanup
363  Aig_ManSetPhase( p->pAig );
365  return Aig_ManDupSimple( p->pAig );
366  }
367  }
368  nSatProof = p->nSatProof;
369  nSatCallsSat = p->nSatCallsSat;
370  nRecycles = p->nRecycles;
371  nSatFailsReal = p->nSatFailsReal;
372  nUniques = p->nUniques;
373 
374  p->nVarsMax = Abc_MaxInt( p->nVarsMax, p->pMSat->nSatVars );
375  p->nCallsMax = Abc_MaxInt( p->nCallsMax, p->pMSat->nSolverCalls );
376  Ssw_SatStop( p->pMSat );
377  p->pMSat = NULL;
378  Ssw_ManCleanup( p );
379  if ( !RetValue )
380  break;
381  if ( p->pPars->pFunc )
382  ((int (*)(void *))p->pPars->pFunc)( p->pPars->pData );
383  }
384 
385 finalize:
386  p->pPars->nIters = nIter + 1;
387 p->timeTotal = Abc_Clock() - clkTotal;
388 
389  Ssw_ManUpdateEquivs( p, p->pAig, p->pPars->fVerbose );
390  pAigNew = Aig_ManDupRepr( p->pAig, 0 );
391  Aig_ManSeqCleanup( pAigNew );
392 //Ssw_ClassesPrint( p->ppClasses, 1 );
393  // get the final stats
394  p->nLitsEnd = Ssw_ClassesLitNum( p->ppClasses );
395  p->nNodesEnd = Aig_ManNodeNum(pAigNew);
396  p->nRegsEnd = Aig_ManRegNum(pAigNew);
397  // cleanup
398  Aig_ManSetPhase( p->pAig );
400  return pAigNew;
401 }
void Ssw_ManUpdateEquivs(Ssw_Man_t *p, Aig_Man_t *pAig, int fVerbose)
Definition: sswCore.c:187
int Ssw_ClassesClassNum(Ssw_Cla_t *p)
Definition: sswClass.c:275
Aig_Man_t * pAig
Definition: llb3Image.c:49
void Ssw_ManCleanup(Ssw_Man_t *p)
Definition: sswMan.c:158
ABC_NAMESPACE_IMPL_START Ssw_Sat_t * Ssw_SatStart(int fPolarFlip)
DECLARATIONS ///.
Definition: sswCnf.c:45
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition: aigScl.c:158
int Ssw_ClassesCand1Num(Ssw_Cla_t *p)
Definition: sswClass.c:259
int Ssw_ManSweepLatch(Ssw_Man_t *p)
Definition: sswLcorr.c:238
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
void Aig_ManCleanMarkB(Aig_Man_t *p)
Definition: aigUtil.c:167
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int Ssw_ManSweepDyn(Ssw_Man_t *p)
Definition: sswDyn.c:373
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
int Ssw_ManSweepConstr(Ssw_Man_t *p)
Definition: sswConstr.c:619
void Aig_ManSetPhase(Aig_Man_t *pAig)
Definition: aigUtil.c:1431
int Ssw_ManSweepBmcConstr(Ssw_Man_t *p)
Definition: sswConstr.c:498
int Ssw_ManSweep(Ssw_Man_t *p)
Definition: sswSweep.c:365
void Ssw_ClassesPrint(Ssw_Cla_t *p, int fVeryVerbose)
Definition: sswClass.c:414
int Ssw_ManSweepBmc(Ssw_Man_t *p)
Definition: sswSweep.c:267
void Aig_ManDumpBlif(Aig_Man_t *p, char *pFileName, Vec_Ptr_t *vPiNames, Vec_Ptr_t *vPoNames)
Definition: aigUtil.c:733
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition: aigRepr.c:267
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static int Ssw_ObjIsConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:172
void Ssw_SatStop(Ssw_Sat_t *p)
Definition: sswCnf.c:81
ABC_INT64_T abctime
Definition: abc_global.h:278
Aig_Man_t * Ssw_SpeculativeReduction(Ssw_Man_t *p)
Definition: sswAig.c:212
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
int Ssw_ClassesLitNum(Ssw_Cla_t *p)
Definition: sswClass.c:291
void Ssw_SmlAssignDist1Plus ( Ssw_Sml_t p,
unsigned *  pPat 
)

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 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static void Abc_InfoXorBit(unsigned *p, int i)
Definition: abc_global.h:260
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
void Ssw_SmlObjAssignConst(Ssw_Sml_t *p, Aig_Obj_t *pObj, int fConst1, int iFrame)
Definition: sswSim.c:560
for(p=first;p->value< newval;p=p->next)
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
Definition: aig.h:69
Aig_Man_t * pAig
Definition: sswSim.c:33
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
void Ssw_SmlAssignRandomFrame(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
Definition: sswSim.c:538
#define assert(ex)
Definition: util_old.h:213
int nFrames
Definition: sswSim.c:35
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
void Ssw_SmlAssignRandomFrame ( Ssw_Sml_t p,
Aig_Obj_t pObj,
int  iFrame 
)

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 }
int nWordsFrame
Definition: sswSim.c:36
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
static unsigned Ssw_ObjRandomSim()
Definition: sswSim.c:46
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Id
Definition: aig.h:85
void Ssw_SmlClean ( Ssw_Sml_t p)

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 }
char * memset()
unsigned pData[0]
Definition: sswSim.c:42
int nWordsTotal
Definition: sswSim.c:37
Aig_Man_t * pAig
Definition: sswSim.c:33
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
void Ssw_SmlObjAssignConst ( Ssw_Sml_t p,
Aig_Obj_t pObj,
int  fConst1,
int  iFrame 
)

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 }
int nWordsFrame
Definition: sswSim.c:36
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Id
Definition: aig.h:85
unsigned Ssw_SmlObjHashWord ( Ssw_Sml_t p,
Aig_Obj_t pObj 
)

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 }
int nWordsPref
Definition: sswSim.c:38
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
int Id
Definition: aig.h:85
int Ssw_SmlObjIsConstBit ( void *  p,
Aig_Obj_t pObj 
)

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 }
unsigned int fMarkB
Definition: aig.h:80
unsigned int fPhase
Definition: aig.h:78
int Ssw_SmlObjIsConstWord ( Ssw_Sml_t p,
Aig_Obj_t pObj 
)

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 }
int nWordsPref
Definition: sswSim.c:38
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
int Id
Definition: aig.h:85
int Ssw_SmlObjsAreEqualBit ( void *  p,
Aig_Obj_t pObj0,
Aig_Obj_t pObj1 
)

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 }
unsigned int fMarkB
Definition: aig.h:80
unsigned int fPhase
Definition: aig.h:78
int Ssw_SmlObjsAreEqualWord ( Ssw_Sml_t p,
Aig_Obj_t pObj0,
Aig_Obj_t pObj1 
)

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 }
int nWordsPref
Definition: sswSim.c:38
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
int Id
Definition: aig.h:85
void Ssw_SmlObjSetWord ( Ssw_Sml_t p,
Aig_Obj_t pObj,
unsigned  Word,
int  iWord,
int  iFrame 
)

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 }
int nWordsFrame
Definition: sswSim.c:36
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Id
Definition: aig.h:85
void Ssw_SmlResimulateSeq ( Ssw_Sml_t p)

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

Synopsis [Performs next round of sequential simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 1269 of file sswSim.c.

1270 {
1271  Ssw_SmlReinitialize( p );
1272  Ssw_SmlSimulateOne( 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 fNonConstOut
Definition: sswSim.c:39
int Ssw_SmlCheckNonConstOutputs(Ssw_Sml_t *p)
Definition: sswSim.c:980
void Ssw_SmlSavePatternAig ( Ssw_Man_t p,
int  f 
)

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 }
char * memset()
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
ABC_NAMESPACE_IMPL_START int Ssw_ManGetSatVarValue(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
DECLARATIONS ///.
Definition: sswSweep.c:46
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
void Ssw_SmlSimulateOne ( Ssw_Sml_t p)

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;
1010 clk = 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  }
1029 p->timeSim += Abc_Clock() - clk;
1030 p->nSimRounds++;
1031 }
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
void Ssw_SmlNodeTransferNext(Ssw_Sml_t *p, Aig_Obj_t *pOut, Aig_Obj_t *pIn, int iFrame)
Definition: sswSim.c:837
static abctime Abc_Clock()
Definition: abc_global.h:279
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
Aig_Man_t * pAig
Definition: sswSim.c:33
void Ssw_SmlNodeSimulate(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
Definition: sswSim.c:706
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
int nFrames
Definition: sswSim.c:35
ABC_INT64_T abctime
Definition: abc_global.h:278
void Ssw_SmlNodeCopyFanin(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
Definition: sswSim.c:803
void Ssw_SmlSimulateOneDyn_rec ( Ssw_Sml_t p,
Aig_Obj_t pObj,
int  f,
int *  pVisited,
int  nVisCounter 
)

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 }
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
void Ssw_SmlSimulateOneDyn_rec(Ssw_Sml_t *p, Aig_Obj_t *pObj, int f, int *pVisited, int nVisCounter)
Definition: sswSim.c:1076
static Aig_Obj_t * Saig_ObjLoToLi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:86
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
void Ssw_SmlNodeTransferNext(Ssw_Sml_t *p, Aig_Obj_t *pOut, Aig_Obj_t *pIn, int iFrame)
Definition: sswSim.c:837
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Saig_ObjIsLi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:85
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Aig_Man_t * pAig
Definition: sswSim.c:33
void Ssw_SmlNodeSimulate(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
Definition: sswSim.c:706
#define assert(ex)
Definition: util_old.h:213
int nFrames
Definition: sswSim.c:35
void Ssw_SmlNodeCopyFanin(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
Definition: sswSim.c:803
int Id
Definition: aig.h:85
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:82
void Ssw_SmlSimulateOneFrame ( Ssw_Sml_t p)

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;
1122 clk = 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 );
1132 p->timeSim += Abc_Clock() - clk;
1133 p->nSimRounds++;
1134 }
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
void Ssw_SmlNodeTransferNext(Ssw_Sml_t *p, Aig_Obj_t *pOut, Aig_Obj_t *pIn, int iFrame)
Definition: sswSim.c:837
static abctime Abc_Clock()
Definition: abc_global.h:279
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
Definition: aig.h:69
Aig_Man_t * pAig
Definition: sswSim.c:33
void Ssw_SmlNodeSimulate(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
Definition: sswSim.c:706
ABC_INT64_T abctime
Definition: abc_global.h:278
void Ssw_SmlNodeCopyFanin(Ssw_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
Definition: sswSim.c:803
Ssw_Sml_t* Ssw_SmlStart ( Aig_Man_t pAig,
int  nPref,
int  nFrames,
int  nWordsFrame 
)

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 }
char * memset()
int nWordsPref
Definition: sswSim.c:38
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWordsFrame
Definition: sswSim.c:36
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nWordsTotal
Definition: sswSim.c:37
int nPref
Definition: sswSim.c:34
Aig_Man_t * pAig
Definition: sswSim.c:33
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
int nFrames
Definition: sswSim.c:35
DECLARATIONS ///.
Definition: sswSim.c:31
void Ssw_SmlStop ( Ssw_Sml_t p)

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

Synopsis [Deallocates simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1211 of file sswSim.c.

1212 {
1213  ABC_FREE( p );
1214 }
#define ABC_FREE(obj)
Definition: abc_global.h:232
Aig_Man_t* Ssw_SpeculativeReduction ( Ssw_Man_t p)

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

Synopsis [Prepares the inductive case with speculative reduction.]

Description []

SideEffects []

SeeAlso []

Definition at line 212 of file sswAig.c.

213 {
214  Aig_Man_t * pFrames;
215  Aig_Obj_t * pObj, * pObjNew;
216  int i;
217  assert( p->pFrames == NULL );
218  assert( Aig_ManRegNum(p->pAig) > 0 );
220  p->nConstrTotal = p->nConstrReduced = 0;
221 
222  // start the fraig package
223  pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->nFrames );
224  pFrames->pName = Abc_UtilStrsav( p->pAig->pName );
225  // map constants and PIs
226  Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), 0, Aig_ManConst1(pFrames) );
227  Saig_ManForEachPi( p->pAig, pObj, i )
228  Ssw_ObjSetFrame( p, pObj, 0, Aig_ObjCreateCi(pFrames) );
229  // create latches for the first frame
230  Saig_ManForEachLo( p->pAig, pObj, i )
231  Ssw_ObjSetFrame( p, pObj, 0, Aig_ObjCreateCi(pFrames) );
232  // set the constraints on the latch outputs
233  Saig_ManForEachLo( p->pAig, pObj, i )
234  Ssw_FramesConstrainNode( p, pFrames, p->pAig, pObj, 0, 0 );
235  // add internal nodes of this frame
236  Aig_ManForEachNode( p->pAig, pObj, i )
237  {
238  pObjNew = Aig_And( pFrames, Ssw_ObjChild0Fra(p, pObj, 0), Ssw_ObjChild1Fra(p, pObj, 0) );
239  Ssw_ObjSetFrame( p, pObj, 0, pObjNew );
240  Ssw_FramesConstrainNode( p, pFrames, p->pAig, pObj, 0, 0 );
241  }
242  // add the POs for the latch outputs of the last frame
243  Saig_ManForEachLi( p->pAig, pObj, i )
244  Aig_ObjCreateCo( pFrames, Ssw_ObjChild0Fra(p, pObj,0) );
245  // remove dangling nodes
246  Aig_ManCleanup( pFrames );
247  Aig_ManSetRegNum( pFrames, Aig_ManRegNum(p->pAig) );
248 // Abc_Print( 1, "SpecRed: Total constraints = %d. Reduced constraints = %d.\n",
249 // p->nConstrTotal, p->nConstrReduced );
250  return pFrames;
251 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static void Ssw_FramesConstrainNode(Ssw_Man_t *p, Aig_Man_t *pFrames, Aig_Man_t *pAig, Aig_Obj_t *pObj, int iFrame, int fTwoPos)
Definition: sswAig.c:89
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
#define assert(ex)
Definition: util_old.h:213
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
void Ssw_UniqueRegisterPairInfo ( Ssw_Man_t p)

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 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
Definition: aig.h:299
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
int Ssw_NodesAreEquiv(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
DECLARATIONS ///.
Definition: sswSat.c:45
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182