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

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START
Aig_Obj_t
Aig_ObjFrames (Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
 DECLARATIONS ///. More...
 
static void Aig_ObjSetFrames (Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
 
static Aig_Obj_tAig_ObjChild0Frames (Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
 
static Aig_Obj_tAig_ObjChild1Frames (Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
 
Aig_Man_tAig_ManFrames (Aig_Man_t *pAig, int nFs, int fInit, int fOuts, int fRegs, int fEnlarge, Aig_Obj_t ***ppObjMap)
 FUNCTION DEFINITIONS ///. More...
 

Function Documentation

Aig_Man_t* Aig_ManFrames ( Aig_Man_t pAig,
int  nFs,
int  fInit,
int  fOuts,
int  fRegs,
int  fEnlarge,
Aig_Obj_t ***  ppObjMap 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs timeframe expansion of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 51 of file aigFrames.c.

52 {
53  Aig_Man_t * pFrames;
54  Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pObjNew;
55  Aig_Obj_t ** pObjMap;
56  int i, f;
57 
58  // create mapping for the frames nodes
59  pObjMap = ABC_ALLOC( Aig_Obj_t *, nFs * Aig_ManObjNumMax(pAig) );
60  memset( pObjMap, 0, sizeof(Aig_Obj_t *) * nFs * Aig_ManObjNumMax(pAig) );
61 
62  // start the fraig package
63  pFrames = Aig_ManStart( Aig_ManObjNumMax(pAig) * nFs );
64  pFrames->pName = Abc_UtilStrsav( pAig->pName );
65  pFrames->pSpec = Abc_UtilStrsav( pAig->pSpec );
66  // map constant nodes
67  for ( f = 0; f < nFs; f++ )
68  Aig_ObjSetFrames( pObjMap, nFs, Aig_ManConst1(pAig), f, Aig_ManConst1(pFrames) );
69  // create PI nodes for the frames
70  for ( f = 0; f < nFs; f++ )
71  Aig_ManForEachPiSeq( pAig, pObj, i )
72  Aig_ObjSetFrames( pObjMap, nFs, pObj, f, Aig_ObjCreateCi(pFrames) );
73  // set initial state for the latches
74  if ( fInit )
75  {
76  Aig_ManForEachLoSeq( pAig, pObj, i )
77  Aig_ObjSetFrames( pObjMap, nFs, pObj, 0, Aig_ManConst0(pFrames) );
78  }
79  else
80  {
81  Aig_ManForEachLoSeq( pAig, pObj, i )
82  Aig_ObjSetFrames( pObjMap, nFs, pObj, 0, Aig_ObjCreateCi(pFrames) );
83  }
84 
85  // add timeframes
86  for ( f = 0; f < nFs; f++ )
87  {
88 // printf( "Frame = %d.\n", f );
89  // add internal nodes of this frame
90  Aig_ManForEachNode( pAig, pObj, i )
91  {
92 // Aig_Obj_t * pFanin0 = Aig_ObjChild0Frames(pObjMap,nFs,pObj,f);
93 // Aig_Obj_t * pFanin1 = Aig_ObjChild1Frames(pObjMap,nFs,pObj,f);
94 // printf( "Node = %3d. Fanin0 = %3d. Fanin1 = %3d.\n", pObj->Id, Aig_Regular(pFanin0)->Id, Aig_Regular(pFanin1)->Id );
95  pObjNew = Aig_And( pFrames, Aig_ObjChild0Frames(pObjMap,nFs,pObj,f), Aig_ObjChild1Frames(pObjMap,nFs,pObj,f) );
96  Aig_ObjSetFrames( pObjMap, nFs, pObj, f, pObjNew );
97  }
98  // set the latch inputs and copy them into the latch outputs of the next frame
99  Aig_ManForEachLiLoSeq( pAig, pObjLi, pObjLo, i )
100  {
101  pObjNew = Aig_ObjChild0Frames(pObjMap,nFs,pObjLi,f);
102  if ( f < nFs - 1 )
103  Aig_ObjSetFrames( pObjMap, nFs, pObjLo, f+1, pObjNew );
104  }
105  }
106  if ( fOuts )
107  {
108  for ( f = fEnlarge?nFs-1:0; f < nFs; f++ )
109  Aig_ManForEachPoSeq( pAig, pObj, i )
110  {
111  pObjNew = Aig_ObjCreateCo( pFrames, Aig_ObjChild0Frames(pObjMap,nFs,pObj,f) );
112  Aig_ObjSetFrames( pObjMap, nFs, pObj, f, pObjNew );
113  }
114  }
115  if ( fRegs )
116  {
117  pFrames->nRegs = pAig->nRegs;
118  Aig_ManForEachLiSeq( pAig, pObj, i )
119  {
120  pObjNew = Aig_ObjCreateCo( pFrames, Aig_ObjChild0Frames(pObjMap,nFs,pObj,fEnlarge?0:nFs-1) );
121  Aig_ObjSetFrames( pObjMap, nFs, pObj, nFs-1, pObjNew );
122  }
123  Aig_ManSetRegNum( pFrames, Aig_ManRegNum(pAig) );
124  }
125  Aig_ManCleanup( pFrames );
126  // return the new manager
127  if ( ppObjMap )
128  *ppObjMap = pObjMap;
129  else
130  ABC_FREE( pObjMap );
131  return pFrames;
132 }
char * memset()
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
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static Aig_Obj_t * Aig_ObjChild1Frames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
Definition: aigFrames.c:34
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 ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Aig_ObjSetFrames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: aigFrames.c:31
for(p=first;p->value< newval;p=p->next)
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 Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
else
Definition: sparse_int.h:55
Definition: aig.h:69
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
#define ABC_FREE(obj)
Definition: abc_global.h:232
static Aig_Obj_t * Aig_ObjChild0Frames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
Definition: aigFrames.c:33
#define Aig_ManForEachLoSeq(p, pObj, i)
Definition: aig.h:441
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
static Aig_Obj_t* Aig_ObjChild0Frames ( Aig_Obj_t **  pObjMap,
int  nFs,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 33 of file aigFrames.c.

33 { return Aig_ObjFanin0(pObj)? Aig_NotCond(Aig_ObjFrames(pObjMap,nFs,Aig_ObjFanin0(pObj),i), Aig_ObjFaninC0(pObj)) : NULL; }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static ABC_NAMESPACE_IMPL_START Aig_Obj_t * Aig_ObjFrames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
DECLARATIONS ///.
Definition: aigFrames.c:30
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t* Aig_ObjChild1Frames ( Aig_Obj_t **  pObjMap,
int  nFs,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 34 of file aigFrames.c.

34 { return Aig_ObjFanin1(pObj)? Aig_NotCond(Aig_ObjFrames(pObjMap,nFs,Aig_ObjFanin1(pObj),i), Aig_ObjFaninC1(pObj)) : NULL; }
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static ABC_NAMESPACE_IMPL_START Aig_Obj_t * Aig_ObjFrames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
DECLARATIONS ///.
Definition: aigFrames.c:30
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static ABC_NAMESPACE_IMPL_START Aig_Obj_t* Aig_ObjFrames ( Aig_Obj_t **  pObjMap,
int  nFs,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

DECLARATIONS ///.

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

FileName [aigFrames.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Performs timeframe expansion of the AIG.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
aigFrames.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

]

Definition at line 30 of file aigFrames.c.

30 { return pObjMap[nFs*pObj->Id + i]; }
int Id
Definition: aig.h:85
static void Aig_ObjSetFrames ( Aig_Obj_t **  pObjMap,
int  nFs,
Aig_Obj_t pObj,
int  i,
Aig_Obj_t pNode 
)
inlinestatic

Definition at line 31 of file aigFrames.c.

31 { pObjMap[nFs*pObj->Id + i] = pNode; }
int Id
Definition: aig.h:85