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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Aig_Man_t
Pdr_ManRehashWithMap (Aig_Man_t *pAig, Vec_Int_t *vMap)
 DECLARATIONS ///. More...
 
Vec_Int_tPdr_ManCreateMap (Aig_Man_t *p)
 
int Pdr_ManCountMap (Vec_Int_t *vMap)
 
void Pdr_ManPrintMap (Vec_Int_t *vMap)
 
void Pdr_ManEquivClasses (Aig_Man_t *pAig)
 

Function Documentation

int Pdr_ManCountMap ( Vec_Int_t vMap)

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

Synopsis [Counts reduced registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 127 of file pdrClass.c.

128 {
129  int i, Entry, Counter = 0;
130  Vec_IntForEachEntry( vMap, Entry, i )
131  if ( Entry != i )
132  Counter++;
133  return Counter;
134 }
if(last==0)
Definition: sparse_int.h:34
static int Counter
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Int_t* Pdr_ManCreateMap ( Aig_Man_t p)

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

Synopsis [Creates mapping of registers.]

Description [Var map contains -1 if const0 and <reg_num> otherwise.]

SideEffects []

SeeAlso []

Definition at line 91 of file pdrClass.c.

92 {
93  Aig_Obj_t * pObj;
94  Vec_Int_t * vMap;
95  int * pLit2Id, Lit, i;
96  pLit2Id = ABC_ALLOC( int, Aig_ManObjNumMax(p) * 2 );
97  for ( i = 0; i < Aig_ManObjNumMax(p) * 2; i++ )
98  pLit2Id[i] = -1;
99  vMap = Vec_IntAlloc( Aig_ManRegNum(p) );
100  Saig_ManForEachLi( p, pObj, i )
101  {
102  if ( Aig_ObjChild0(pObj) == Aig_ManConst0(p) )
103  {
104  Vec_IntPush( vMap, -1 );
105  continue;
106  }
107  Lit = 2 * Aig_ObjFaninId0(pObj) + Aig_ObjFaninC0(pObj);
108  if ( pLit2Id[Lit] < 0 ) // the first time
109  pLit2Id[Lit] = i;
110  Vec_IntPush( vMap, pLit2Id[Lit] );
111  }
112  ABC_FREE( pLit2Id );
113  return vMap;
114 }
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
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
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
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 int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Pdr_ManEquivClasses ( Aig_Man_t pAig)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 188 of file pdrClass.c.

189 {
190  Vec_Int_t * vMap;
191  Aig_Man_t * pTemp;
192  int f, nFrames = 100;
193  assert( Saig_ManRegNum(pAig) > 0 );
194  // start the map
195  vMap = Vec_IntAlloc( 0 );
196  Vec_IntFill( vMap, Aig_ManRegNum(pAig), -1 );
197  // iterate and print changes
198  for ( f = 0; f < nFrames; f++ )
199  {
200  // implement variable map
201  pTemp = Pdr_ManRehashWithMap( pAig, vMap );
202  // report the result
203  Abc_Print( 1, "F =%4d : Total = %6d. Nodes = %6d. RedRegs = %6d. Prop = %s\n",
204  f+1, Aig_ManNodeNum(pAig), Aig_ManNodeNum(pTemp), Pdr_ManCountMap(vMap),
205  Aig_ObjChild0(Aig_ManCo(pTemp,0)) == Aig_ManConst0(pTemp) ? "proof" : "unknown" );
206  // recreate the map
207  Pdr_ManPrintMap( vMap );
208  Vec_IntFree( vMap );
209  vMap = Pdr_ManCreateMap( pTemp );
210  Aig_ManStop( pTemp );
211  if ( Pdr_ManCountMap(vMap) == 0 )
212  break;
213  }
214  Vec_IntFree( vMap );
215 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
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
int Pdr_ManCountMap(Vec_Int_t *vMap)
Definition: pdrClass.c:127
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
ABC_NAMESPACE_IMPL_START Aig_Man_t * Pdr_ManRehashWithMap(Aig_Man_t *pAig, Vec_Int_t *vMap)
DECLARATIONS ///.
Definition: pdrClass.c:45
Vec_Int_t * Pdr_ManCreateMap(Aig_Man_t *p)
Definition: pdrClass.c:91
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Pdr_ManPrintMap(Vec_Int_t *vMap)
Definition: pdrClass.c:147
void Pdr_ManPrintMap ( Vec_Int_t vMap)

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

Synopsis [Counts reduced registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file pdrClass.c.

148 {
149  Vec_Int_t * vMarks;
150  int f, i, iClass, Entry, Counter = 0;
151  Abc_Print( 1, " Consts: " );
152  Vec_IntForEachEntry( vMap, Entry, i )
153  if ( Entry == -1 )
154  Abc_Print( 1, "%d ", i );
155  Abc_Print( 1, "\n" );
156  vMarks = Vec_IntAlloc( 100 );
157  Vec_IntForEachEntry( vMap, iClass, f )
158  {
159  if ( iClass == -1 )
160  continue;
161  if ( iClass == f )
162  continue;
163  // check previous classes
164  if ( Vec_IntFind( vMarks, iClass ) >= 0 )
165  continue;
166  Vec_IntPush( vMarks, iClass );
167  // print class
168  Abc_Print( 1, " Class %d : ", iClass );
169  Vec_IntForEachEntry( vMap, Entry, i )
170  if ( Entry == iClass )
171  Abc_Print( 1, "%d ", i );
172  Abc_Print( 1, "\n" );
173  }
174  Vec_IntFree( vMarks );
175 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
ABC_NAMESPACE_IMPL_START Aig_Man_t* Pdr_ManRehashWithMap ( Aig_Man_t pAig,
Vec_Int_t vMap 
)

DECLARATIONS ///.

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

FileName [pdrClass.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Property driven reachability.]

Synopsis [Equivalence classes of register outputs.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 20, 2010.]

Revision [

Id:
pdrClass.c,v 1.00 2010/11/20 00:00:00 alanmi Exp

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

Synopsis [Performs duplication with the variable map.]

Description [Var map contains -1 if const0 and <reg_num> otherwise.]

SideEffects []

SeeAlso []

Definition at line 45 of file pdrClass.c.

46 {
47  Aig_Man_t * pFrames;
48  Aig_Obj_t * pObj;
49  int i, iReg;
50  assert( Vec_IntSize(vMap) == Aig_ManRegNum(pAig) );
51  // start the fraig package
52  pFrames = Aig_ManStart( Aig_ManObjNumMax(pAig) );
53  pFrames->pName = Abc_UtilStrsav( pAig->pName );
54  pFrames->pSpec = Abc_UtilStrsav( pAig->pSpec );
55  // create CI mapping
56  Aig_ManCleanData( pAig );
57  Aig_ManConst1(pAig)->pData = Aig_ManConst1(pFrames);
58  Aig_ManForEachCi( pAig, pObj, i )
59  pObj->pData = Aig_ObjCreateCi(pFrames);
60  Saig_ManForEachLo( pAig, pObj, i )
61  {
62  iReg = Vec_IntEntry(vMap, i);
63  if ( iReg == -1 )
64  pObj->pData = Aig_ManConst0(pFrames);
65  else
66  pObj->pData = Saig_ManLo(pAig, iReg)->pData;
67  }
68  // add internal nodes of this frame
69  Aig_ManForEachNode( pAig, pObj, i )
70  pObj->pData = Aig_And( pFrames, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
71  // add output nodes
72  Aig_ManForEachCo( pAig, pObj, i )
73  pObj->pData = Aig_ObjCreateCo( pFrames, Aig_ObjChild0Copy(pObj) );
74  // finish off
75  Aig_ManCleanup( pFrames );
76  Aig_ManSetRegNum( pFrames, Aig_ManRegNum(pAig) );
77  return pFrames;
78 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void * pData
Definition: aig.h:87
static Aig_Obj_t * Saig_ManLo(Aig_Man_t *p, int i)
Definition: saig.h:79
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
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
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
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
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
#define assert(ex)
Definition: util_old.h:213
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265