abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sswAig.c File Reference
#include "sswInt.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Ssw_Frm_t
Ssw_FrmStart (Aig_Man_t *pAig)
 DECLARATIONS ///. More...
 
void Ssw_FrmStop (Ssw_Frm_t *p)
 
static void Ssw_FramesConstrainNode (Ssw_Man_t *p, Aig_Man_t *pFrames, Aig_Man_t *pAig, Aig_Obj_t *pObj, int iFrame, int fTwoPos)
 
Aig_Man_tSsw_FramesWithClasses (Ssw_Man_t *p)
 
Aig_Man_tSsw_SpeculativeReduction (Ssw_Man_t *p)
 

Function Documentation

static void Ssw_FramesConstrainNode ( Ssw_Man_t p,
Aig_Man_t pFrames,
Aig_Man_t pAig,
Aig_Obj_t pObj,
int  iFrame,
int  fTwoPos 
)
inlinestatic

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

Synopsis [Performs speculative reduction for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file sswAig.c.

90 {
91  Aig_Obj_t * pObjNew, * pObjNew2, * pObjRepr, * pObjReprNew, * pMiter;
92  // skip nodes without representative
93  pObjRepr = Aig_ObjRepr(pAig, pObj);
94  if ( pObjRepr == NULL )
95  return;
96  p->nConstrTotal++;
97  assert( pObjRepr->Id < pObj->Id );
98  // get the new node
99  pObjNew = Ssw_ObjFrame( p, pObj, iFrame );
100  // get the new node of the representative
101  pObjReprNew = Ssw_ObjFrame( p, pObjRepr, iFrame );
102  // if this is the same node, no need to add constraints
103  if ( pObj->fPhase == pObjRepr->fPhase )
104  {
105  assert( pObjNew != Aig_Not(pObjReprNew) );
106  if ( pObjNew == pObjReprNew )
107  return;
108  }
109  else
110  {
111  assert( pObjNew != pObjReprNew );
112  if ( pObjNew == Aig_Not(pObjReprNew) )
113  return;
114  }
115  p->nConstrReduced++;
116  // these are different nodes - perform speculative reduction
117  pObjNew2 = Aig_NotCond( pObjReprNew, pObj->fPhase ^ pObjRepr->fPhase );
118  // set the new node
119  Ssw_ObjSetFrame( p, pObj, iFrame, pObjNew2 );
120  // add the constraint
121  if ( fTwoPos )
122  {
123  Aig_ObjCreateCo( pFrames, pObjNew2 );
124  Aig_ObjCreateCo( pFrames, pObjNew );
125  }
126  else
127  {
128  pMiter = Aig_Exor( pFrames, pObjNew, pObjNew2 );
129  Aig_ObjCreateCo( pFrames, Aig_NotCond(pMiter, Aig_ObjPhaseReal(pMiter)) );
130  }
131 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
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 Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
Definition: aig.h:299
Definition: aig.h:69
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
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
int Id
Definition: aig.h:85
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
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
ABC_NAMESPACE_IMPL_START Ssw_Frm_t* Ssw_FrmStart ( Aig_Man_t pAig)

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
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