abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
intFrames.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [intFrames.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Interpolation engine.]
8 
9  Synopsis [Sequential AIG unrolling for interpolation.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 24, 2008.]
16 
17  Revision [$Id: intFrames.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "intInt.h"
22 
24 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// FUNCTION DEFINITIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 /**Function*************************************************************
35 
36  Synopsis [Create timeframes of the manager for interpolation.]
37 
38  Description [The resulting manager is combinational. The primary inputs
39  corresponding to register outputs are ordered first. The only POs of the
40  manager is the property output of the last timeframe.]
41 
42  SideEffects []
43 
44  SeeAlso []
45 
46 ***********************************************************************/
47 Aig_Man_t * Inter_ManFramesInter( Aig_Man_t * pAig, int nFrames, int fAddRegOuts, int fUseTwoFrames )
48 {
49  Aig_Man_t * pFrames;
50  Aig_Obj_t * pObj, * pObjLi, * pObjLo;
51  Aig_Obj_t * pLastPo = NULL;
52  int i, f;
53  assert( Saig_ManRegNum(pAig) > 0 );
54  assert( Saig_ManPoNum(pAig)-Saig_ManConstrNum(pAig) == 1 );
55  pFrames = Aig_ManStart( Aig_ManNodeNum(pAig) * nFrames );
56  // map the constant node
57  Aig_ManConst1(pAig)->pData = Aig_ManConst1( pFrames );
58  // create variables for register outputs
59  if ( fAddRegOuts )
60  {
61  Saig_ManForEachLo( pAig, pObj, i )
62  pObj->pData = Aig_ManConst0( pFrames );
63  }
64  else
65  {
66  Saig_ManForEachLo( pAig, pObj, i )
67  pObj->pData = Aig_ObjCreateCi( pFrames );
68  }
69  // add timeframes
70  for ( f = 0; f < nFrames; f++ )
71  {
72  // create PI nodes for this frame
73  Saig_ManForEachPi( pAig, pObj, i )
74  pObj->pData = Aig_ObjCreateCi( pFrames );
75  // add internal nodes of this frame
76  Aig_ManForEachNode( pAig, pObj, i )
77  pObj->pData = Aig_And( pFrames, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
78  // add outputs for constraints
79  Saig_ManForEachPo( pAig, pObj, i )
80  {
81  if ( i < Saig_ManPoNum(pAig)-Saig_ManConstrNum(pAig) )
82  continue;
83  Aig_ObjCreateCo( pFrames, Aig_Not( Aig_ObjChild0Copy(pObj) ) );
84  }
85  if ( f == nFrames - 1 )
86  break;
87  // remember the last PO
88  pObj = Aig_ManCo( pAig, 0 );
89  pLastPo = Aig_ObjChild0Copy(pObj);
90  // save register inputs
91  Saig_ManForEachLi( pAig, pObj, i )
92  pObj->pData = Aig_ObjChild0Copy(pObj);
93  // transfer to register outputs
94  Saig_ManForEachLiLo( pAig, pObjLi, pObjLo, i )
95  pObjLo->pData = pObjLi->pData;
96  }
97  // create POs for each register output
98  if ( fAddRegOuts )
99  {
100  Saig_ManForEachLi( pAig, pObj, i )
101  Aig_ObjCreateCo( pFrames, Aig_ObjChild0Copy(pObj) );
102  }
103  // create the only PO of the manager
104  else
105  {
106  pObj = Aig_ManCo( pAig, 0 );
107  // add the last PO
108  if ( pLastPo == NULL || !fUseTwoFrames )
109  pLastPo = Aig_ObjChild0Copy(pObj);
110  else
111  pLastPo = Aig_Or( pFrames, pLastPo, Aig_ObjChild0Copy(pObj) );
112  Aig_ObjCreateCo( pFrames, pLastPo );
113  }
114  Aig_ManCleanup( pFrames );
115  return pFrames;
116 }
117 
118 ////////////////////////////////////////////////////////////////////////
119 /// END OF FILE ///
120 ////////////////////////////////////////////////////////////////////////
121 
122 
124 
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
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
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
ABC_NAMESPACE_IMPL_START Aig_Man_t * Inter_ManFramesInter(Aig_Man_t *pAig, int nFrames, int fAddRegOuts, int fUseTwoFrames)
DECLARATIONS ///.
Definition: intFrames.c:47
void * pData
Definition: aig.h:87
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 * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
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
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
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
#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 Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#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