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

Go to the source code of this file.

Data Structures

struct  Rtm_Man_t_
 
struct  Rtm_Edg_t_
 
struct  Rtm_Obj_t_
 

Macros

#define Rtm_ManForEachPi(p, pObj, i)   Vec_PtrForEachEntry( Rtm_Obj_t *, p->vPis, pObj, i )
 
#define Rtm_ManForEachPo(p, pObj, i)   Vec_PtrForEachEntry( Rtm_Obj_t *, p->vPos, pObj, i )
 
#define Rtm_ManForEachObj(p, pObj, i)   Vec_PtrForEachEntry( Rtm_Obj_t *, p->vObjs, pObj, i )
 
#define Rtm_ObjForEachFanin(pObj, pFanin, i)   for ( i = 0; i < (int)(pObj)->nFanins && ((pFanin = Rtm_ObjFanin(pObj, i)), 1); i++ )
 
#define Rtm_ObjForEachFanout(pObj, pFanout, i)   for ( i = 0; i < (int)(pObj)->nFanouts && ((pFanout = Rtm_ObjFanout(pObj, i)), 1); i++ )
 
#define Rtm_ObjForEachFaninEdge(pObj, pEdge, i)   for ( i = 0; i < (int)(pObj)->nFanins && ((pEdge = Rtm_ObjEdge(pObj, i)), 1); i++ )
 
#define Rtm_ObjForEachFanoutEdge(pObj, pEdge, i)   for ( i = 0; i < (int)(pObj)->nFanouts && ((pEdge = Rtm_ObjFanoutEdge(pObj, i)), 1); i++ )
 

Typedefs

typedef struct Rtm_Man_t_ Rtm_Man_t
 
typedef struct Rtm_Edg_t_ Rtm_Edg_t
 
typedef struct Rtm_Obj_t_ Rtm_Obj_t
 

Enumerations

enum  Rtm_Init_t { RTM_VAL_NONE, RTM_VAL_ZERO, RTM_VAL_ONE, RTM_VAL_VOID }
 DECLARATIONS ///. More...
 

Functions

static Rtm_Obj_tRtm_ObjFanin (Rtm_Obj_t *pObj, int i)
 
static Rtm_Obj_tRtm_ObjFanout (Rtm_Obj_t *pObj, int i)
 
static Rtm_Edg_tRtm_ObjEdge (Rtm_Obj_t *pObj, int i)
 
static Rtm_Edg_tRtm_ObjFanoutEdge (Rtm_Obj_t *pObj, int i)
 
static Rtm_Init_t Rtm_InitNot (Rtm_Init_t Val)
 
static Rtm_Init_t Rtm_InitNotCond (Rtm_Init_t Val, int c)
 
static Rtm_Init_t Rtm_InitAnd (Rtm_Init_t ValA, Rtm_Init_t ValB)
 
static int Rtm_InitWordsNum (int nLats)
 
static int Rtm_InitGetTwo (unsigned *p, int i)
 
static void Rtm_InitSetTwo (unsigned *p, int i, int val)
 
static void Rtm_InitXorTwo (unsigned *p, int i, int val)
 
static Rtm_Init_t Rtm_ObjGetFirst1 (Rtm_Edg_t *pEdge)
 
static Rtm_Init_t Rtm_ObjGetLast1 (Rtm_Edg_t *pEdge)
 
static Rtm_Init_t Rtm_ObjGetOne1 (Rtm_Edg_t *pEdge, int i)
 
static Rtm_Init_t Rtm_ObjRemFirst1 (Rtm_Edg_t *pEdge)
 
static Rtm_Init_t Rtm_ObjRemLast1 (Rtm_Edg_t *pEdge)
 
static void Rtm_ObjAddFirst1 (Rtm_Edg_t *pEdge, Rtm_Init_t Val)
 
static void Rtm_ObjAddLast1 (Rtm_Edg_t *pEdge, Rtm_Init_t Val)
 
static Rtm_Init_t Rtm_ObjGetFirst2 (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
static Rtm_Init_t Rtm_ObjGetLast2 (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
static Rtm_Init_t Rtm_ObjGetOne2 (Rtm_Man_t *p, Rtm_Edg_t *pEdge, int i)
 
static Rtm_Init_t Rtm_ObjRemFirst2 (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
static Rtm_Init_t Rtm_ObjRemLast2 (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
static void Rtm_ObjAddFirst2 (Rtm_Man_t *p, Rtm_Edg_t *pEdge, Rtm_Init_t Val)
 
static void Rtm_ObjAddLast2 (Rtm_Man_t *p, Rtm_Edg_t *pEdge, Rtm_Init_t Val)
 
static void Rtm_ObjTransferToSmall (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 FUNCTION DEFINITIONS ///. More...
 
static void Rtm_ObjTransferToBig (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
static void Rtm_ObjTransferToBigger (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
static Rtm_Init_t Rtm_ObjGetFirst (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
static Rtm_Init_t Rtm_ObjGetLast (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
static Rtm_Init_t Rtm_ObjGetOne (Rtm_Man_t *p, Rtm_Edg_t *pEdge, int i)
 
static Rtm_Init_t Rtm_ObjRemFirst (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
static Rtm_Init_t Rtm_ObjRemLast (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
static void Rtm_ObjAddFirst (Rtm_Man_t *p, Rtm_Edg_t *pEdge, Rtm_Init_t Val)
 
static void Rtm_ObjAddLast (Rtm_Man_t *p, Rtm_Edg_t *pEdge, Rtm_Init_t Val)
 
void Rtm_PrintEdge (Rtm_Man_t *p, Rtm_Edg_t *pEdge)
 
Rtm_Man_tRtm_ManAlloc (Aig_Man_t *p)
 
void Rtm_ManFree (Rtm_Man_t *p)
 
int Rtm_ManLatchMax (Rtm_Man_t *p)
 
Rtm_Obj_tRtm_ObjAlloc (Rtm_Man_t *pRtm, int nFanins, int nFanouts)
 
void Rtm_ObjAddFanin (Rtm_Obj_t *pObj, Rtm_Obj_t *pFanin, int fCompl)
 
int Rtm_ObjCheckRetimeFwd (Rtm_Obj_t *pObj)
 
int Rtm_ObjCheckRetimeBwd (Rtm_Obj_t *pObj)
 
int Rtm_ObjGetDegreeFwd (Rtm_Obj_t *pObj)
 
int Rtm_ObjGetDegreeBwd (Rtm_Obj_t *pObj)
 
void Rtm_ObjRetimeFwd (Rtm_Man_t *pRtm, Rtm_Obj_t *pObj)
 
void Rtm_ObjRetimeBwd (Rtm_Man_t *pRtm, Rtm_Obj_t *pObj)
 
void Rtm_ObjMarkAutoFwd_rec (Rtm_Obj_t *pObj)
 
int Rtm_ManMarkAutoFwd (Rtm_Man_t *pRtm)
 
void Rtm_ObjMarkAutoBwd_rec (Rtm_Obj_t *pObj)
 
int Rtm_ManMarkAutoBwd (Rtm_Man_t *pRtm)
 
Rtm_Man_tRtm_ManFromAig (Aig_Man_t *p)
 
Aig_Obj_tRtm_ManToAig_rec (Aig_Man_t *pNew, Rtm_Man_t *pRtm, Rtm_Obj_t *pObjRtm, int *pLatches)
 
Aig_Man_tRtm_ManToAig (Rtm_Man_t *pRtm)
 
Aig_Man_tRtm_ManRetime (Aig_Man_t *p, int fForward, int nStepsMax, int fVerbose)
 

Macro Definition Documentation

#define Rtm_ManForEachObj (   p,
  pObj,
 
)    Vec_PtrForEachEntry( Rtm_Obj_t *, p->vObjs, pObj, i )

Definition at line 127 of file aigRet.c.

#define Rtm_ManForEachPi (   p,
  pObj,
 
)    Vec_PtrForEachEntry( Rtm_Obj_t *, p->vPis, pObj, i )

Definition at line 121 of file aigRet.c.

#define Rtm_ManForEachPo (   p,
  pObj,
 
)    Vec_PtrForEachEntry( Rtm_Obj_t *, p->vPos, pObj, i )

Definition at line 124 of file aigRet.c.

#define Rtm_ObjForEachFanin (   pObj,
  pFanin,
 
)    for ( i = 0; i < (int)(pObj)->nFanins && ((pFanin = Rtm_ObjFanin(pObj, i)), 1); i++ )

Definition at line 130 of file aigRet.c.

#define Rtm_ObjForEachFaninEdge (   pObj,
  pEdge,
 
)    for ( i = 0; i < (int)(pObj)->nFanins && ((pEdge = Rtm_ObjEdge(pObj, i)), 1); i++ )

Definition at line 136 of file aigRet.c.

#define Rtm_ObjForEachFanout (   pObj,
  pFanout,
 
)    for ( i = 0; i < (int)(pObj)->nFanouts && ((pFanout = Rtm_ObjFanout(pObj, i)), 1); i++ )

Definition at line 133 of file aigRet.c.

#define Rtm_ObjForEachFanoutEdge (   pObj,
  pEdge,
 
)    for ( i = 0; i < (int)(pObj)->nFanouts && ((pEdge = Rtm_ObjFanoutEdge(pObj, i)), 1); i++ )

Definition at line 139 of file aigRet.c.

Typedef Documentation

typedef struct Rtm_Edg_t_ Rtm_Edg_t

Definition at line 53 of file aigRet.c.

typedef struct Rtm_Man_t_ Rtm_Man_t

Definition at line 38 of file aigRet.c.

typedef struct Rtm_Obj_t_ Rtm_Obj_t

Definition at line 60 of file aigRet.c.

Enumeration Type Documentation

enum Rtm_Init_t

DECLARATIONS ///.

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

FileName [aigRet.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Retiming of AIGs.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Enumerator
RTM_VAL_NONE 
RTM_VAL_ZERO 
RTM_VAL_ONE 
RTM_VAL_VOID 

Definition at line 31 of file aigRet.c.

31  {
32  RTM_VAL_NONE, // 0: non-existent value
33  RTM_VAL_ZERO, // 1: initial value 0
34  RTM_VAL_ONE, // 2: initial value 1
35  RTM_VAL_VOID // 3: unused value
36 } Rtm_Init_t;
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31

Function Documentation

static Rtm_Init_t Rtm_InitAnd ( Rtm_Init_t  ValA,
Rtm_Init_t  ValB 
)
inlinestatic

Definition at line 84 of file aigRet.c.

84 { if ( ValA == RTM_VAL_ONE && ValB == RTM_VAL_ONE ) return (Rtm_Init_t)RTM_VAL_ONE; if ( ValA == RTM_VAL_ZERO || ValB == RTM_VAL_ZERO ) return (Rtm_Init_t)RTM_VAL_ZERO; assert( 0 ); return (Rtm_Init_t)-1; }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
#define assert(ex)
Definition: util_old.h:213
static int Rtm_InitGetTwo ( unsigned *  p,
int  i 
)
inlinestatic

Definition at line 87 of file aigRet.c.

87 { return (p[i>>4] >> ((i & 15)<<1)) & 3; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Rtm_Init_t Rtm_InitNot ( Rtm_Init_t  Val)
inlinestatic

Definition at line 82 of file aigRet.c.

82 { if ( Val == RTM_VAL_ZERO ) return (Rtm_Init_t)RTM_VAL_ONE; if ( Val == RTM_VAL_ONE ) return (Rtm_Init_t)RTM_VAL_ZERO; assert( 0 ); return (Rtm_Init_t)-1; }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
#define assert(ex)
Definition: util_old.h:213
static Rtm_Init_t Rtm_InitNotCond ( Rtm_Init_t  Val,
int  c 
)
inlinestatic

Definition at line 83 of file aigRet.c.

83 { return c ? Rtm_InitNot(Val) : Val; }
static Rtm_Init_t Rtm_InitNot(Rtm_Init_t Val)
Definition: aigRet.c:82
static void Rtm_InitSetTwo ( unsigned *  p,
int  i,
int  val 
)
inlinestatic

Definition at line 88 of file aigRet.c.

88 { p[i>>4] |= (val << ((i & 15)<<1)); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Rtm_InitWordsNum ( int  nLats)
inlinestatic

Definition at line 86 of file aigRet.c.

86 { return (nLats >> 4) + ((nLats & 15) > 0); }
static void Rtm_InitXorTwo ( unsigned *  p,
int  i,
int  val 
)
inlinestatic

Definition at line 89 of file aigRet.c.

89 { p[i>>4] ^= (val << ((i & 15)<<1)); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Rtm_Man_t* Rtm_ManAlloc ( Aig_Man_t p)

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

Synopsis [Allocates the retiming manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 302 of file aigRet.c.

303 {
304  Rtm_Man_t * pRtm;
305  // start the manager
306  pRtm = ABC_ALLOC( Rtm_Man_t, 1 );
307  memset( pRtm, 0, sizeof(Rtm_Man_t) );
308  // perform initializations
309  pRtm->vObjs = Vec_PtrAlloc( Aig_ManObjNum(p) );
310  pRtm->vPis = Vec_PtrAlloc( Aig_ManCiNum(p) );
311  pRtm->vPos = Vec_PtrAlloc( Aig_ManCoNum(p) );
312  pRtm->pMem = Aig_MmFlexStart();
313  return pRtm;
314 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
Vec_Ptr_t * vObjs
Definition: aigRet.c:42
Vec_Ptr_t * vPis
Definition: aigRet.c:43
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Vec_Ptr_t * vPos
Definition: aigRet.c:44
Aig_MmFlex_t * pMem
Definition: aigRet.c:45
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Aig_MmFlex_t * Aig_MmFlexStart()
Definition: aigMem.c:305
void Rtm_ManFree ( Rtm_Man_t p)

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

Synopsis [Allocates the retiming manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 327 of file aigRet.c.

328 {
329  Vec_PtrFree( p->vObjs );
330  Vec_PtrFree( p->vPis );
331  Vec_PtrFree( p->vPos );
332  Aig_MmFlexStop( p->pMem, 0 );
333  ABC_FREE( p->pExtra );
334  ABC_FREE( p );
335 }
Vec_Ptr_t * vObjs
Definition: aigRet.c:42
Vec_Ptr_t * vPis
Definition: aigRet.c:43
unsigned * pExtra
Definition: aigRet.c:48
Vec_Ptr_t * vPos
Definition: aigRet.c:44
Aig_MmFlex_t * pMem
Definition: aigRet.c:45
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition: aigMem.c:337
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Rtm_Man_t* Rtm_ManFromAig ( Aig_Man_t p)

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

Synopsis [Derive retiming manager from the given AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 675 of file aigRet.c.

676 {
677  Rtm_Man_t * pRtm;
678  Aig_Obj_t * pObj, * pObjLi, * pObjLo;
679  int i;
680  assert( Aig_ManRegNum(p) > 0 );
681  assert( Aig_ManBufNum(p) == 0 );
682  // allocate the manager
683  pRtm = Rtm_ManAlloc( p );
684  // allocate objects
685  pObj = Aig_ManConst1(p);
686  pObj->pData = Rtm_ObjAlloc( pRtm, 0, pObj->nRefs );
687  Aig_ManForEachPiSeq( p, pObj, i )
688  {
689  pObj->pData = Rtm_ObjAlloc( pRtm, 0, pObj->nRefs );
690  Vec_PtrPush( pRtm->vPis, pObj->pData );
691  }
692  Aig_ManForEachPoSeq( p, pObj, i )
693  {
694  pObj->pData = Rtm_ObjAlloc( pRtm, 1, 0 );
695  Vec_PtrPush( pRtm->vPos, pObj->pData );
696  }
697  Aig_ManForEachLoSeq( p, pObj, i )
698  pObj->pData = Rtm_ObjAlloc( pRtm, 1, pObj->nRefs );
699  Aig_ManForEachLiSeq( p, pObj, i )
700  pObj->pData = Rtm_ObjAlloc( pRtm, 1, 1 );
701  Aig_ManForEachNode( p, pObj, i )
702  pObj->pData = Rtm_ObjAlloc( pRtm, 2, pObj->nRefs );
703  // connect objects
704  Aig_ManForEachPoSeq( p, pObj, i )
705  Rtm_ObjAddFanin( (Rtm_Obj_t *)pObj->pData, (Rtm_Obj_t *)Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj) );
706  Aig_ManForEachLiSeq( p, pObj, i )
707  Rtm_ObjAddFanin( (Rtm_Obj_t *)pObj->pData, (Rtm_Obj_t *)Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj) );
708  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
709  Rtm_ObjAddFanin( (Rtm_Obj_t *)pObjLo->pData, (Rtm_Obj_t *)pObjLi->pData, 0 );
710  Aig_ManForEachNode( p, pObj, i )
711  {
712  Rtm_ObjAddFanin( (Rtm_Obj_t *)pObj->pData, (Rtm_Obj_t *)Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj) );
713  Rtm_ObjAddFanin( (Rtm_Obj_t *)pObj->pData, (Rtm_Obj_t *)Aig_ObjFanin1(pObj)->pData, Aig_ObjFaninC1(pObj) );
714  }
715  return pRtm;
716 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Rtm_Man_t * Rtm_ManAlloc(Aig_Man_t *p)
Definition: aigRet.c:302
Vec_Ptr_t * vPis
Definition: aigRet.c:43
Rtm_Obj_t * Rtm_ObjAlloc(Rtm_Man_t *pRtm, int nFanins, int nFanouts)
Definition: aigRet.c:379
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
Vec_Ptr_t * vPos
Definition: aigRet.c:44
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 Aig_ManForEachLoSeq(p, pObj, i)
Definition: aig.h:441
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
void Rtm_ObjAddFanin(Rtm_Obj_t *pObj, Rtm_Obj_t *pFanin, int fCompl)
Definition: aigRet.c:404
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
unsigned int nRefs
Definition: aig.h:81
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
int Rtm_ManLatchMax ( Rtm_Man_t p)

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

Synopsis [Counts the maximum number of latches on an edge.]

Description []

SideEffects []

SeeAlso []

Definition at line 348 of file aigRet.c.

349 {
350  Rtm_Obj_t * pObj;
351  Rtm_Edg_t * pEdge;
352  int nLatchMax = 0, i, k;//, c, Val;
353  Rtm_ManForEachObj( p, pObj, i )
354  Rtm_ObjForEachFaninEdge( pObj, pEdge, k )
355  {
356 /*
357  for ( c = 0; c < (int)pEdge->nLats; c++ )
358  {
359  Val = Rtm_ObjGetOne( p, pEdge, c );
360  assert( Val == 1 || Val == 2 );
361  }
362 */
363  nLatchMax = Abc_MaxInt( nLatchMax, (int)pEdge->nLats );
364  }
365  return nLatchMax;
366 }
#define Rtm_ManForEachObj(p, pObj, i)
Definition: aigRet.c:127
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
#define Rtm_ObjForEachFaninEdge(pObj, pEdge, i)
Definition: aigRet.c:136
int Rtm_ManMarkAutoBwd ( Rtm_Man_t pRtm)

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

Synopsis [Marks the nodes unreachable from the POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 643 of file aigRet.c.

644 {
645  Rtm_Obj_t * pObjRtm;
646  int i, Counter = 0;
647  // mark nodes reachable from the PIs
648  pObjRtm = (Rtm_Obj_t *)Vec_PtrEntry( pRtm->vObjs, 0 );
649  pObjRtm->fAuto = 1;
650  Rtm_ManForEachPi( pRtm, pObjRtm, i )
651  pObjRtm->fAuto = 1;
652  Rtm_ManForEachPo( pRtm, pObjRtm, i )
653  Rtm_ObjMarkAutoBwd_rec( pObjRtm );
654  // count the number of autonomous nodes
655  Rtm_ManForEachObj( pRtm, pObjRtm, i )
656  {
657  pObjRtm->fAuto = !pObjRtm->fAuto;
658  Counter += pObjRtm->fAuto;
659  }
660  // mark the fanins of the autonomous nodes
661  return Counter;
662 }
unsigned long fAuto
Definition: aigRet.c:66
#define Rtm_ManForEachPo(p, pObj, i)
Definition: aigRet.c:124
#define Rtm_ManForEachObj(p, pObj, i)
Definition: aigRet.c:127
Vec_Ptr_t * vObjs
Definition: aigRet.c:42
void Rtm_ObjMarkAutoBwd_rec(Rtm_Obj_t *pObj)
Definition: aigRet.c:621
#define Rtm_ManForEachPi(p, pObj, i)
Definition: aigRet.c:121
static int Counter
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int Rtm_ManMarkAutoFwd ( Rtm_Man_t pRtm)

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

Synopsis [Marks the nodes unreachable from the PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 591 of file aigRet.c.

592 {
593  Rtm_Obj_t * pObjRtm;
594  int i, Counter = 0;
595  // mark nodes reachable from the PIs
596  pObjRtm = (Rtm_Obj_t *)Vec_PtrEntry( pRtm->vObjs, 0 );
597  Rtm_ObjMarkAutoFwd_rec( pObjRtm );
598  Rtm_ManForEachPi( pRtm, pObjRtm, i )
599  Rtm_ObjMarkAutoFwd_rec( pObjRtm );
600  // count the number of autonomous nodes
601  Rtm_ManForEachObj( pRtm, pObjRtm, i )
602  {
603  pObjRtm->fAuto = !pObjRtm->fAuto;
604  Counter += pObjRtm->fAuto;
605  }
606  // mark the fanins of the autonomous nodes
607  return Counter;
608 }
#define Rtm_ManForEachObj(p, pObj, i)
Definition: aigRet.c:127
Vec_Ptr_t * vObjs
Definition: aigRet.c:42
#define Rtm_ManForEachPi(p, pObj, i)
Definition: aigRet.c:121
static int Counter
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Rtm_ObjMarkAutoFwd_rec(Rtm_Obj_t *pObj)
Definition: aigRet.c:569
Aig_Man_t* Rtm_ManRetime ( Aig_Man_t p,
int  fForward,
int  nStepsMax,
int  fVerbose 
)

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

Synopsis [Performs forward retiming with the given limit on depth.]

Description []

SideEffects []

SeeAlso []

Definition at line 834 of file aigRet.c.

835 {
836  Vec_Ptr_t * vQueue;
837  Aig_Man_t * pNew;
838  Rtm_Man_t * pRtm;
839  Rtm_Obj_t * pObj, * pNext;
840  Aig_Obj_t * pObjAig;
841  int i, k, nAutos, Degree, DegreeMax = 0;
842  abctime clk;
843 
844  // create the retiming manager
845 clk = Abc_Clock();
846  pRtm = Rtm_ManFromAig( p );
847  // set registers
848  Aig_ManForEachLoSeq( p, pObjAig, i )
849  Rtm_ObjAddFirst( pRtm, Rtm_ObjEdge((Rtm_Obj_t *)pObjAig->pData, 0), fForward? RTM_VAL_ZERO : RTM_VAL_VOID );
850  // detect and mark the autonomous components
851  if ( fForward )
852  nAutos = Rtm_ManMarkAutoFwd( pRtm );
853  else
854  nAutos = Rtm_ManMarkAutoBwd( pRtm );
855  if ( fVerbose )
856  {
857  printf( "Detected %d autonomous objects. ", nAutos );
858  ABC_PRT( "Time", Abc_Clock() - clk );
859  }
860 
861  // set the current retiming number
862  Rtm_ManForEachObj( pRtm, pObj, i )
863  {
864  assert( pObj->nFanins == pObj->Num );
865  assert( pObj->nFanouts == pObj->Temp );
866  pObj->Num = 0;
867  }
868 
869 clk = Abc_Clock();
870  // put the LOs on the queue
871  vQueue = Vec_PtrAlloc( 1000 );
872  if ( fForward )
873  {
874  Aig_ManForEachLoSeq( p, pObjAig, i )
875  {
876  pObj = (Rtm_Obj_t *)pObjAig->pData;
877  if ( pObj->fAuto )
878  continue;
879  pObj->fMark = 1;
880  Vec_PtrPush( vQueue, pObj );
881  }
882  }
883  else
884  {
885  Aig_ManForEachLiSeq( p, pObjAig, i )
886  {
887  pObj = (Rtm_Obj_t *)pObjAig->pData;
888  if ( pObj->fAuto )
889  continue;
890  pObj->fMark = 1;
891  Vec_PtrPush( vQueue, pObj );
892  }
893  }
894  // perform retiming
895  DegreeMax = 0;
896  Vec_PtrForEachEntry( Rtm_Obj_t *, vQueue, pObj, i )
897  {
898  pObj->fMark = 0;
899  // retime the node
900  if ( fForward )
901  {
902  Rtm_ObjRetimeFwd( pRtm, pObj );
903  // check if its fanouts should be retimed
904  Rtm_ObjForEachFanout( pObj, pNext, k )
905  {
906  if ( pNext->fMark ) // skip aleady scheduled
907  continue;
908  if ( pNext->Type ) // skip POs
909  continue;
910  if ( !Rtm_ObjCheckRetimeFwd( pNext ) ) // skip non-retimable
911  continue;
912  Degree = Rtm_ObjGetDegreeFwd( pNext );
913  DegreeMax = Abc_MaxInt( DegreeMax, Degree );
914  if ( Degree > nStepsMax ) // skip nodes with high degree
915  continue;
916  pNext->fMark = 1;
917  pNext->Num = Degree;
918  Vec_PtrPush( vQueue, pNext );
919  }
920  }
921  else
922  {
923  Rtm_ObjRetimeBwd( pRtm, pObj );
924  // check if its fanouts should be retimed
925  Rtm_ObjForEachFanin( pObj, pNext, k )
926  {
927  if ( pNext->fMark ) // skip aleady scheduled
928  continue;
929  if ( pNext->nFanins == 0 ) // skip PIs
930  continue;
931  if ( !Rtm_ObjCheckRetimeBwd( pNext ) ) // skip non-retimable
932  continue;
933  Degree = Rtm_ObjGetDegreeBwd( pNext );
934  DegreeMax = Abc_MaxInt( DegreeMax, Degree );
935  if ( Degree > nStepsMax ) // skip nodes with high degree
936  continue;
937  pNext->fMark = 1;
938  pNext->Num = Degree;
939  Vec_PtrPush( vQueue, pNext );
940  }
941  }
942  }
943 
944  if ( fVerbose )
945  {
946  printf( "Performed %d %s latch moves of max depth %d and max latch count %d.\n",
947  Vec_PtrSize(vQueue), fForward? "fwd":"bwd", DegreeMax, Rtm_ManLatchMax(pRtm) );
948  printf( "Memory usage = %d. ", pRtm->nExtraCur );
949  ABC_PRT( "Time", Abc_Clock() - clk );
950  }
951  Vec_PtrFree( vQueue );
952 
953  // get the new manager
954  pNew = Rtm_ManToAig( pRtm );
955  pNew->pName = Abc_UtilStrsav( p->pName );
956  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
957  Rtm_ManFree( pRtm );
958  // group the registers
959 clk = Abc_Clock();
960  pNew = Aig_ManReduceLaches( pNew, fVerbose );
961  if ( fVerbose )
962  {
963  ABC_PRT( "Register sharing time", Abc_Clock() - clk );
964  }
965  return pNew;
966 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int Temp
Definition: aigRet.c:72
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 * Rtm_ManToAig(Rtm_Man_t *pRtm)
Definition: aigRet.c:765
unsigned long fAuto
Definition: aigRet.c:66
unsigned Num
Definition: aigRet.c:70
#define Rtm_ManForEachObj(p, pObj, i)
Definition: aigRet.c:127
void * pData
Definition: aig.h:87
unsigned long fMark
Definition: aigRet.c:65
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void Rtm_ObjAddFirst(Rtm_Man_t *p, Rtm_Edg_t *pEdge, Rtm_Init_t Val)
Definition: aigRet.c:116
int nFanouts
Definition: aigRet.c:73
#define Rtm_ObjForEachFanin(pObj, pFanin, i)
Definition: aigRet.c:130
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 Rtm_ObjGetDegreeFwd(Rtm_Obj_t *pObj)
Definition: aigRet.c:475
unsigned long Type
Definition: aigRet.c:64
#define Rtm_ObjForEachFanout(pObj, pFanout, i)
Definition: aigRet.c:133
unsigned long nFanins
Definition: aigRet.c:69
void Rtm_ManFree(Rtm_Man_t *p)
Definition: aigRet.c:327
void Rtm_ObjRetimeFwd(Rtm_Man_t *pRtm, Rtm_Obj_t *pObj)
Definition: aigRet.c:515
Aig_Man_t * Aig_ManReduceLaches(Aig_Man_t *p, int fVerbose)
Definition: aigScl.c:455
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
int Rtm_ManLatchMax(Rtm_Man_t *p)
Definition: aigRet.c:348
static Rtm_Edg_t * Rtm_ObjEdge(Rtm_Obj_t *pObj, int i)
Definition: aigRet.c:79
int Rtm_ObjCheckRetimeFwd(Rtm_Obj_t *pObj)
Definition: aigRet.c:433
Rtm_Man_t * Rtm_ManFromAig(Aig_Man_t *p)
Definition: aigRet.c:675
int Rtm_ObjCheckRetimeBwd(Rtm_Obj_t *pObj)
Definition: aigRet.c:454
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int Rtm_ManMarkAutoBwd(Rtm_Man_t *pRtm)
Definition: aigRet.c:643
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define Aig_ManForEachLoSeq(p, pObj, i)
Definition: aig.h:441
void Rtm_ObjRetimeBwd(Rtm_Man_t *pRtm, Rtm_Obj_t *pObj)
Definition: aigRet.c:545
int Rtm_ObjGetDegreeBwd(Rtm_Obj_t *pObj)
Definition: aigRet.c:495
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
int Rtm_ManMarkAutoFwd(Rtm_Man_t *pRtm)
Definition: aigRet.c:591
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Man_t* Rtm_ManToAig ( Rtm_Man_t pRtm)

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

Synopsis [Derive AIG manager after retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 765 of file aigRet.c.

766 {
767  Aig_Man_t * pNew;
768  Aig_Obj_t * pObjNew;
769  Rtm_Obj_t * pObjRtm;
770  Rtm_Edg_t * pEdge;
771  int i, k, m, Val, nLatches, * pLatches;
772  // count latches and mark the first latch on each edge
773  pLatches = ABC_ALLOC( int, 2 * Vec_PtrSize(pRtm->vObjs) );
774  nLatches = 0;
775  Rtm_ManForEachObj( pRtm, pObjRtm, i )
776  Rtm_ObjForEachFaninEdge( pObjRtm, pEdge, k )
777  {
778  pLatches[2*pObjRtm->Id + k] = Vec_PtrSize(pRtm->vPis) + nLatches;
779  nLatches += pEdge->nLats;
780  }
781  // create the new manager
782  pNew = Aig_ManStart( Vec_PtrSize(pRtm->vObjs) + nLatches );
783  // create PIs/POs and latches
784  pObjRtm = (Rtm_Obj_t *)Vec_PtrEntry( pRtm->vObjs, 0 );
785  pObjRtm->pCopy = Aig_ManConst1(pNew);
786  Rtm_ManForEachPi( pRtm, pObjRtm, i )
787  pObjRtm->pCopy = Aig_ObjCreateCi(pNew);
788  for ( i = 0; i < nLatches; i++ )
789  Aig_ObjCreateCi(pNew);
790  // create internal nodes
791  Rtm_ManForEachObj( pRtm, pObjRtm, i )
792  Rtm_ManToAig_rec( pNew, pRtm, pObjRtm, pLatches );
793  // create POs
794  Rtm_ManForEachPo( pRtm, pObjRtm, i )
795  Aig_ObjCreateCo( pNew, (Aig_Obj_t *)pObjRtm->pCopy );
796  // connect latches
797  Rtm_ManForEachObj( pRtm, pObjRtm, i )
798  Rtm_ObjForEachFaninEdge( pObjRtm, pEdge, k )
799  {
800  if ( pEdge->nLats == 0 )
801  continue;
802  pObjNew = (Aig_Obj_t *)Rtm_ObjFanin( pObjRtm, k )->pCopy;
803  for ( m = 0; m < (int)pEdge->nLats; m++ )
804  {
805  Val = Rtm_ObjGetOne( pRtm, pEdge, pEdge->nLats - 1 - m );
806  assert( Val == RTM_VAL_ZERO || Val == RTM_VAL_ONE || Val == RTM_VAL_VOID );
807  pObjNew = Aig_NotCond( pObjNew, Val == RTM_VAL_ONE );
808  Aig_ObjCreateCo( pNew, pObjNew );
809  pObjNew = Aig_ManCi( pNew, pLatches[2*pObjRtm->Id + k] + m );
810  pObjNew = Aig_NotCond( pObjNew, Val == RTM_VAL_ONE );
811  }
812 // assert( Aig_Regular(pObjNew)->nRefs > 0 );
813  }
814  ABC_FREE( pLatches );
815  Aig_ManSetRegNum( pNew, nLatches );
816  // remove useless nodes
817  Aig_ManCleanup( pNew );
818  if ( !Aig_ManCheck( pNew ) )
819  printf( "Rtm_ManToAig: The network check has failed.\n" );
820  return pNew;
821 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
Aig_Obj_t * Rtm_ManToAig_rec(Aig_Man_t *pNew, Rtm_Man_t *pRtm, Rtm_Obj_t *pObjRtm, int *pLatches)
Definition: aigRet.c:729
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
#define Rtm_ManForEachPo(p, pObj, i)
Definition: aigRet.c:124
#define Rtm_ManForEachObj(p, pObj, i)
Definition: aigRet.c:127
Vec_Ptr_t * vObjs
Definition: aigRet.c:42
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Vec_Ptr_t * vPis
Definition: aigRet.c:43
void * pCopy
Definition: aigRet.c:63
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
for(p=first;p->value< newval;p=p->next)
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
#define Rtm_ManForEachPi(p, pObj, i)
Definition: aigRet.c:121
#define Rtm_ObjForEachFaninEdge(pObj, pEdge, i)
Definition: aigRet.c:136
Definition: aig.h:69
static Rtm_Obj_t * Rtm_ObjFanin(Rtm_Obj_t *pObj, int i)
Definition: aigRet.c:77
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
#define ABC_FREE(obj)
Definition: abc_global.h:232
static Rtm_Init_t Rtm_ObjGetOne(Rtm_Man_t *p, Rtm_Edg_t *pEdge, int i)
Definition: aigRet.c:113
#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 Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Obj_t* Rtm_ManToAig_rec ( Aig_Man_t pNew,
Rtm_Man_t pRtm,
Rtm_Obj_t pObjRtm,
int *  pLatches 
)

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

Synopsis [Derive AIG manager after retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 729 of file aigRet.c.

730 {
731  Rtm_Edg_t * pEdge;
732  Aig_Obj_t * pRes, * pFanin;
733  int k, Val;
734  if ( pObjRtm->pCopy )
735  return (Aig_Obj_t *)pObjRtm->pCopy;
736  // get the inputs
737  pRes = Aig_ManConst1( pNew );
738  Rtm_ObjForEachFaninEdge( pObjRtm, pEdge, k )
739  {
740  if ( pEdge->nLats == 0 )
741  pFanin = Rtm_ManToAig_rec( pNew, pRtm, Rtm_ObjFanin(pObjRtm, k), pLatches );
742  else
743  {
744  Val = Rtm_ObjGetFirst( pRtm, pEdge );
745  pFanin = Aig_ManCi( pNew, pLatches[2*pObjRtm->Id + k] + pEdge->nLats - 1 );
746  pFanin = Aig_NotCond( pFanin, Val == RTM_VAL_ONE );
747  }
748  pFanin = Aig_NotCond( pFanin, k ? pObjRtm->fCompl1 : pObjRtm->fCompl0 );
749  pRes = Aig_And( pNew, pRes, pFanin );
750  }
751  return (Aig_Obj_t *)(pObjRtm->pCopy = pRes);
752 }
Aig_Obj_t * Rtm_ManToAig_rec(Aig_Man_t *pNew, Rtm_Man_t *pRtm, Rtm_Obj_t *pObjRtm, int *pLatches)
Definition: aigRet.c:729
unsigned long fCompl1
Definition: aigRet.c:68
void * pCopy
Definition: aigRet.c:63
unsigned long fCompl0
Definition: aigRet.c:67
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
#define Rtm_ObjForEachFaninEdge(pObj, pEdge, i)
Definition: aigRet.c:136
Definition: aig.h:69
static Rtm_Obj_t * Rtm_ObjFanin(Rtm_Obj_t *pObj, int i)
Definition: aigRet.c:77
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
int Id
Definition: aigRet.c:71
static Rtm_Init_t Rtm_ObjGetFirst(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:111
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
unsigned long nLats
Definition: aigRet.c:56
void Rtm_ObjAddFanin ( Rtm_Obj_t pObj,
Rtm_Obj_t pFanin,
int  fCompl 
)

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

Synopsis [Allocates the retiming object.]

Description []

SideEffects []

SeeAlso []

Definition at line 404 of file aigRet.c.

405 {
406  pObj->pFanio[ 2*pObj->nFanins ] = pFanin;
407  pObj->pFanio[ 2*pObj->nFanins + 1 ] = NULL;
408  pFanin->pFanio[ 2*(pFanin->Num + pFanin->nFanouts) ] = pObj;
409  pFanin->pFanio[ 2*(pFanin->Num + pFanin->nFanouts) + 1 ] = pObj->pFanio + 2*pObj->nFanins + 1;
410  if ( pObj->nFanins == 0 )
411  pObj->fCompl0 = fCompl;
412  else if ( pObj->nFanins == 1 )
413  pObj->fCompl1 = fCompl;
414  else
415  assert( 0 );
416  pObj->nFanins++;
417  pFanin->nFanouts++;
418  assert( pObj->nFanins <= pObj->Num );
419  assert( pFanin->nFanouts <= pFanin->Temp );
420 }
int Temp
Definition: aigRet.c:72
unsigned Num
Definition: aigRet.c:70
unsigned long fCompl1
Definition: aigRet.c:68
unsigned long fCompl0
Definition: aigRet.c:67
int nFanouts
Definition: aigRet.c:73
unsigned long nFanins
Definition: aigRet.c:69
if(last==0)
Definition: sparse_int.h:34
#define assert(ex)
Definition: util_old.h:213
void * pFanio[0]
Definition: aigRet.c:74
static void Rtm_ObjAddFirst ( Rtm_Man_t p,
Rtm_Edg_t pEdge,
Rtm_Init_t  Val 
)
static

Definition at line 116 of file aigRet.c.

116 { if ( pEdge->nLats == 10 ) Rtm_ObjTransferToBig(p, pEdge); else if ( (pEdge->nLats & 15) == 15 ) Rtm_ObjTransferToBigger(p, pEdge); if ( pEdge->nLats >= 10 ) Rtm_ObjAddFirst2(p, pEdge, Val); else Rtm_ObjAddFirst1(pEdge, Val); }
static void Rtm_ObjTransferToBig(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:174
static void Rtm_ObjAddFirst1(Rtm_Edg_t *pEdge, Rtm_Init_t Val)
Definition: aigRet.c:96
static void Rtm_ObjAddFirst2(Rtm_Man_t *p, Rtm_Edg_t *pEdge, Rtm_Init_t Val)
Definition: aigRet.c:252
unsigned long nLats
Definition: aigRet.c:56
static void Rtm_ObjTransferToBigger(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:198
static void Rtm_ObjAddFirst1 ( Rtm_Edg_t pEdge,
Rtm_Init_t  Val 
)
inlinestatic

Definition at line 96 of file aigRet.c.

96 { assert( Val > 0 ); pEdge->LData = (pEdge->LData << 2) | Val; pEdge->nLats++; }
unsigned long LData
Definition: aigRet.c:57
#define assert(ex)
Definition: util_old.h:213
unsigned long nLats
Definition: aigRet.c:56
void Rtm_ObjAddFirst2 ( Rtm_Man_t p,
Rtm_Edg_t pEdge,
Rtm_Init_t  Val 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 252 of file aigRet.c.

253 {
254  unsigned * pB = p->pExtra + pEdge->LData, * pE = pB + Rtm_InitWordsNum( ++pEdge->nLats );
255  Rtm_Init_t Temp;
256  assert( Val != 0 );
257  while ( pB < pE )
258  {
259  Temp = (Rtm_Init_t)(*pB >> 30);
260  *pB = (*pB << 2) | Val;
261  Val = Temp;
262  pB++;
263  }
264 }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
unsigned * pExtra
Definition: aigRet.c:48
static int Rtm_InitWordsNum(int nLats)
Definition: aigRet.c:86
#define assert(ex)
Definition: util_old.h:213
unsigned long nLats
Definition: aigRet.c:56
static void Rtm_ObjAddLast ( Rtm_Man_t p,
Rtm_Edg_t pEdge,
Rtm_Init_t  Val 
)
static

Definition at line 117 of file aigRet.c.

117 { if ( pEdge->nLats == 10 ) Rtm_ObjTransferToBig(p, pEdge); else if ( (pEdge->nLats & 15) == 15 ) Rtm_ObjTransferToBigger(p, pEdge); if ( pEdge->nLats >= 10 ) Rtm_ObjAddLast2(p, pEdge, Val); else Rtm_ObjAddLast1(pEdge, Val); }
static void Rtm_ObjTransferToBig(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:174
static void Rtm_ObjAddLast2(Rtm_Man_t *p, Rtm_Edg_t *pEdge, Rtm_Init_t Val)
Definition: aigRet.c:105
static void Rtm_ObjAddLast1(Rtm_Edg_t *pEdge, Rtm_Init_t Val)
Definition: aigRet.c:97
unsigned long nLats
Definition: aigRet.c:56
static void Rtm_ObjTransferToBigger(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:198
static void Rtm_ObjAddLast1 ( Rtm_Edg_t pEdge,
Rtm_Init_t  Val 
)
inlinestatic

Definition at line 97 of file aigRet.c.

97 { assert( Val > 0 ); pEdge->LData |= Val << (pEdge->nLats<<1); pEdge->nLats++; }
unsigned long LData
Definition: aigRet.c:57
#define assert(ex)
Definition: util_old.h:213
unsigned long nLats
Definition: aigRet.c:56
static void Rtm_ObjAddLast2 ( Rtm_Man_t p,
Rtm_Edg_t pEdge,
Rtm_Init_t  Val 
)
inlinestatic

Definition at line 105 of file aigRet.c.

105 { Rtm_InitSetTwo( p->pExtra + pEdge->LData, pEdge->nLats, Val ); pEdge->nLats++; }
unsigned long LData
Definition: aigRet.c:57
unsigned * pExtra
Definition: aigRet.c:48
static void Rtm_InitSetTwo(unsigned *p, int i, int val)
Definition: aigRet.c:88
unsigned long nLats
Definition: aigRet.c:56
Rtm_Obj_t* Rtm_ObjAlloc ( Rtm_Man_t pRtm,
int  nFanins,
int  nFanouts 
)

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

Synopsis [Allocates the retiming object.]

Description []

SideEffects []

SeeAlso []

Definition at line 379 of file aigRet.c.

380 {
381  Rtm_Obj_t * pObj;
382  int Size = sizeof(Rtm_Obj_t) + sizeof(Rtm_Obj_t *) * (nFanins + nFanouts) * 2;
383  pObj = (Rtm_Obj_t *)Aig_MmFlexEntryFetch( pRtm->pMem, Size );
384  memset( pObj, 0, sizeof(Rtm_Obj_t) );
385  pObj->Type = (int)(nFanins == 1 && nFanouts == 0); // mark PO
386  pObj->Num = nFanins; // temporary
387  pObj->Temp = nFanouts;
388  pObj->Id = Vec_PtrSize(pRtm->vObjs);
389  Vec_PtrPush( pRtm->vObjs, pObj );
390  return pObj;
391 }
char * memset()
int Temp
Definition: aigRet.c:72
unsigned Num
Definition: aigRet.c:70
Vec_Ptr_t * vObjs
Definition: aigRet.c:42
char * Aig_MmFlexEntryFetch(Aig_MmFlex_t *p, int nBytes)
Definition: aigMem.c:366
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
unsigned long Type
Definition: aigRet.c:64
struct Rtm_Obj_t_ Rtm_Obj_t
Definition: aigRet.c:60
int Id
Definition: aigRet.c:71
Aig_MmFlex_t * pMem
Definition: aigRet.c:45
int Rtm_ObjCheckRetimeBwd ( Rtm_Obj_t pObj)

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

Synopsis [Check the possibility of forward retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 454 of file aigRet.c.

455 {
456  Rtm_Edg_t * pEdge;
457  int i;
458  Rtm_ObjForEachFanoutEdge( pObj, pEdge, i )
459  if ( pEdge->nLats == 0 )
460  return 0;
461  return 1;
462 }
#define Rtm_ObjForEachFanoutEdge(pObj, pEdge, i)
Definition: aigRet.c:139
if(last==0)
Definition: sparse_int.h:34
int Rtm_ObjCheckRetimeFwd ( Rtm_Obj_t pObj)

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

Synopsis [Check the possibility of forward retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 433 of file aigRet.c.

434 {
435  Rtm_Edg_t * pEdge;
436  int i;
437  Rtm_ObjForEachFaninEdge( pObj, pEdge, i )
438  if ( pEdge->nLats == 0 )
439  return 0;
440  return 1;
441 }
if(last==0)
Definition: sparse_int.h:34
#define Rtm_ObjForEachFaninEdge(pObj, pEdge, i)
Definition: aigRet.c:136
static Rtm_Edg_t* Rtm_ObjEdge ( Rtm_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 79 of file aigRet.c.

79 { return (Rtm_Edg_t *)(pObj->pFanio + 2*i + 1); }
void * pFanio[0]
Definition: aigRet.c:74
static Rtm_Obj_t* Rtm_ObjFanin ( Rtm_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 77 of file aigRet.c.

77 { return (Rtm_Obj_t *)pObj->pFanio[2*i]; }
void * pFanio[0]
Definition: aigRet.c:74
static Rtm_Obj_t* Rtm_ObjFanout ( Rtm_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 78 of file aigRet.c.

78 { return (Rtm_Obj_t *)pObj->pFanio[2*(pObj->nFanins+i)]; }
unsigned long nFanins
Definition: aigRet.c:69
void * pFanio[0]
Definition: aigRet.c:74
static Rtm_Edg_t* Rtm_ObjFanoutEdge ( Rtm_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 80 of file aigRet.c.

80 { return (Rtm_Edg_t *)pObj->pFanio[2*(pObj->nFanins+i) + 1]; }
unsigned long nFanins
Definition: aigRet.c:69
void * pFanio[0]
Definition: aigRet.c:74
int Rtm_ObjGetDegreeBwd ( Rtm_Obj_t pObj)

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

Synopsis [Check the possibility of forward retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 495 of file aigRet.c.

496 {
497  Rtm_Obj_t * pFanout;
498  int i, Degree = 0;
499  Rtm_ObjForEachFanout( pObj, pFanout, i )
500  Degree = Abc_MaxInt( Degree, (int)pFanout->Num );
501  return Degree + 1;
502 }
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
#define Rtm_ObjForEachFanout(pObj, pFanout, i)
Definition: aigRet.c:133
int Rtm_ObjGetDegreeFwd ( Rtm_Obj_t pObj)

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

Synopsis [Check the possibility of forward retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 475 of file aigRet.c.

476 {
477  Rtm_Obj_t * pFanin;
478  int i, Degree = 0;
479  Rtm_ObjForEachFanin( pObj, pFanin, i )
480  Degree = Abc_MaxInt( Degree, (int)pFanin->Num );
481  return Degree + 1;
482 }
#define Rtm_ObjForEachFanin(pObj, pFanin, i)
Definition: aigRet.c:130
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Rtm_Init_t Rtm_ObjGetFirst ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
inlinestatic

Definition at line 111 of file aigRet.c.

111 { return pEdge->nLats > 10? Rtm_ObjGetFirst2(p, pEdge) : Rtm_ObjGetFirst1(pEdge); }
static Rtm_Init_t Rtm_ObjGetFirst1(Rtm_Edg_t *pEdge)
Definition: aigRet.c:91
static Rtm_Init_t Rtm_ObjGetFirst2(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:99
unsigned long nLats
Definition: aigRet.c:56
static Rtm_Init_t Rtm_ObjGetFirst1 ( Rtm_Edg_t pEdge)
inlinestatic

Definition at line 91 of file aigRet.c.

91 { return (Rtm_Init_t)(pEdge->LData & 3); }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
static Rtm_Init_t Rtm_ObjGetFirst2 ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
inlinestatic

Definition at line 99 of file aigRet.c.

99 { return (Rtm_Init_t)Rtm_InitGetTwo( p->pExtra + pEdge->LData, 0 ); }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
unsigned * pExtra
Definition: aigRet.c:48
static int Rtm_InitGetTwo(unsigned *p, int i)
Definition: aigRet.c:87
static Rtm_Init_t Rtm_ObjGetLast ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
inlinestatic

Definition at line 112 of file aigRet.c.

112 { return pEdge->nLats > 10? Rtm_ObjGetLast2(p, pEdge) : Rtm_ObjGetLast1(pEdge); }
static Rtm_Init_t Rtm_ObjGetLast2(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:100
static Rtm_Init_t Rtm_ObjGetLast1(Rtm_Edg_t *pEdge)
Definition: aigRet.c:92
unsigned long nLats
Definition: aigRet.c:56
static Rtm_Init_t Rtm_ObjGetLast1 ( Rtm_Edg_t pEdge)
inlinestatic

Definition at line 92 of file aigRet.c.

92 { return (Rtm_Init_t)((pEdge->LData >> ((pEdge->nLats-1)<<1)) & 3); }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
unsigned long nLats
Definition: aigRet.c:56
static Rtm_Init_t Rtm_ObjGetLast2 ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
inlinestatic

Definition at line 100 of file aigRet.c.

100 { return (Rtm_Init_t)Rtm_InitGetTwo( p->pExtra + pEdge->LData, pEdge->nLats - 1 ); }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
unsigned * pExtra
Definition: aigRet.c:48
static int Rtm_InitGetTwo(unsigned *p, int i)
Definition: aigRet.c:87
unsigned long nLats
Definition: aigRet.c:56
static Rtm_Init_t Rtm_ObjGetOne ( Rtm_Man_t p,
Rtm_Edg_t pEdge,
int  i 
)
inlinestatic

Definition at line 113 of file aigRet.c.

113 { return pEdge->nLats > 10? Rtm_ObjGetOne2(p, pEdge, i) : Rtm_ObjGetOne1(pEdge, i); }
static Rtm_Init_t Rtm_ObjGetOne2(Rtm_Man_t *p, Rtm_Edg_t *pEdge, int i)
Definition: aigRet.c:101
static Rtm_Init_t Rtm_ObjGetOne1(Rtm_Edg_t *pEdge, int i)
Definition: aigRet.c:93
unsigned long nLats
Definition: aigRet.c:56
static Rtm_Init_t Rtm_ObjGetOne1 ( Rtm_Edg_t pEdge,
int  i 
)
inlinestatic

Definition at line 93 of file aigRet.c.

93 { assert( i < (int)pEdge->nLats ); return (Rtm_Init_t)((pEdge->LData >> (i << 1)) & 3); }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
#define assert(ex)
Definition: util_old.h:213
unsigned long nLats
Definition: aigRet.c:56
static Rtm_Init_t Rtm_ObjGetOne2 ( Rtm_Man_t p,
Rtm_Edg_t pEdge,
int  i 
)
inlinestatic

Definition at line 101 of file aigRet.c.

101 { return (Rtm_Init_t)Rtm_InitGetTwo( p->pExtra + pEdge->LData, i ); }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
unsigned * pExtra
Definition: aigRet.c:48
static int Rtm_InitGetTwo(unsigned *p, int i)
Definition: aigRet.c:87
void Rtm_ObjMarkAutoBwd_rec ( Rtm_Obj_t pObj)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 621 of file aigRet.c.

622 {
623  Rtm_Obj_t * pFanin;
624  int i;
625  if ( pObj->fAuto )
626  return;
627  pObj->fAuto = 1;
628  Rtm_ObjForEachFanin( pObj, pFanin, i )
629  Rtm_ObjMarkAutoBwd_rec( pFanin );
630 }
unsigned long fAuto
Definition: aigRet.c:66
void Rtm_ObjMarkAutoBwd_rec(Rtm_Obj_t *pObj)
Definition: aigRet.c:621
#define Rtm_ObjForEachFanin(pObj, pFanin, i)
Definition: aigRet.c:130
void Rtm_ObjMarkAutoFwd_rec ( Rtm_Obj_t pObj)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 569 of file aigRet.c.

570 {
571  Rtm_Obj_t * pFanout;
572  int i;
573  if ( pObj->fAuto )
574  return;
575  pObj->fAuto = 1;
576  Rtm_ObjForEachFanout( pObj, pFanout, i )
577  Rtm_ObjMarkAutoFwd_rec( pFanout );
578 }
unsigned long fAuto
Definition: aigRet.c:66
#define Rtm_ObjForEachFanout(pObj, pFanout, i)
Definition: aigRet.c:133
void Rtm_ObjMarkAutoFwd_rec(Rtm_Obj_t *pObj)
Definition: aigRet.c:569
static Rtm_Init_t Rtm_ObjRemFirst ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
static

Definition at line 114 of file aigRet.c.

114 { Rtm_Init_t Res = pEdge->nLats > 10 ? Rtm_ObjRemFirst2(p, pEdge) : Rtm_ObjRemFirst1(pEdge); if ( pEdge->nLats == 10 ) Rtm_ObjTransferToSmall(p, pEdge); return Res; }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
static Rtm_Init_t Rtm_ObjRemFirst1(Rtm_Edg_t *pEdge)
Definition: aigRet.c:94
static void Rtm_ObjTransferToSmall(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
FUNCTION DEFINITIONS ///.
Definition: aigRet.c:157
static Rtm_Init_t Rtm_ObjRemFirst2(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:226
unsigned long nLats
Definition: aigRet.c:56
static Rtm_Init_t Rtm_ObjRemFirst1 ( Rtm_Edg_t pEdge)
inlinestatic

Definition at line 94 of file aigRet.c.

94 { int Val = pEdge->LData & 3; pEdge->LData >>= 2; assert(pEdge->nLats > 0); pEdge->nLats--; return (Rtm_Init_t)Val; }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
#define assert(ex)
Definition: util_old.h:213
unsigned long nLats
Definition: aigRet.c:56
Rtm_Init_t Rtm_ObjRemFirst2 ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 226 of file aigRet.c.

227 {
228  Rtm_Init_t Val = (Rtm_Init_t)0, Temp;
229  unsigned * pB = p->pExtra + pEdge->LData, * pE = pB + Rtm_InitWordsNum( pEdge->nLats-- ) - 1;
230  while ( pE >= pB )
231  {
232  Temp = (Rtm_Init_t)(*pE & 3);
233  *pE = (*pE >> 2) | (Val << 30);
234  Val = Temp;
235  pE--;
236  }
237  assert( Val != 0 );
238  return Val;
239 }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
unsigned * pExtra
Definition: aigRet.c:48
static int Rtm_InitWordsNum(int nLats)
Definition: aigRet.c:86
#define assert(ex)
Definition: util_old.h:213
unsigned long nLats
Definition: aigRet.c:56
static Rtm_Init_t Rtm_ObjRemLast ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
static

Definition at line 115 of file aigRet.c.

115 { Rtm_Init_t Res = pEdge->nLats > 10 ? Rtm_ObjRemLast2(p, pEdge) : Rtm_ObjRemLast1(pEdge); if ( pEdge->nLats == 10 ) Rtm_ObjTransferToSmall(p, pEdge); return Res; }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
static void Rtm_ObjTransferToSmall(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
FUNCTION DEFINITIONS ///.
Definition: aigRet.c:157
static Rtm_Init_t Rtm_ObjRemLast1(Rtm_Edg_t *pEdge)
Definition: aigRet.c:95
static Rtm_Init_t Rtm_ObjRemLast2(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:103
unsigned long nLats
Definition: aigRet.c:56
static Rtm_Init_t Rtm_ObjRemLast1 ( Rtm_Edg_t pEdge)
inlinestatic

Definition at line 95 of file aigRet.c.

95 { int Val = (pEdge->LData >> ((pEdge->nLats-1)<<1)) & 3; pEdge->LData ^= Val << ((pEdge->nLats-1)<<1); assert(pEdge->nLats > 0); pEdge->nLats--; return (Rtm_Init_t)Val; }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
#define assert(ex)
Definition: util_old.h:213
unsigned long nLats
Definition: aigRet.c:56
static Rtm_Init_t Rtm_ObjRemLast2 ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
inlinestatic

Definition at line 103 of file aigRet.c.

103 { Rtm_Init_t Val = Rtm_ObjGetLast2( p, pEdge ); Rtm_InitXorTwo( p->pExtra + pEdge->LData, pEdge->nLats - 1, Val ); pEdge->nLats--; return (Rtm_Init_t)Val; }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long LData
Definition: aigRet.c:57
unsigned * pExtra
Definition: aigRet.c:48
static void Rtm_InitXorTwo(unsigned *p, int i, int val)
Definition: aigRet.c:89
static Rtm_Init_t Rtm_ObjGetLast2(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:100
unsigned long nLats
Definition: aigRet.c:56
void Rtm_ObjRetimeBwd ( Rtm_Man_t pRtm,
Rtm_Obj_t pObj 
)

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

Synopsis [Performs forward retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 545 of file aigRet.c.

546 {
547  Rtm_Edg_t * pEdge;
548  int i;
549  assert( Rtm_ObjCheckRetimeBwd(pObj) );
550  // extract values and compute the result
551  Rtm_ObjForEachFanoutEdge( pObj, pEdge, i )
552  Rtm_ObjRemLast( pRtm, pEdge );
553  // insert the result in the fanout values
554  Rtm_ObjForEachFaninEdge( pObj, pEdge, i )
555  Rtm_ObjAddFirst( pRtm, pEdge, RTM_VAL_VOID );
556 }
static void Rtm_ObjAddFirst(Rtm_Man_t *p, Rtm_Edg_t *pEdge, Rtm_Init_t Val)
Definition: aigRet.c:116
#define Rtm_ObjForEachFanoutEdge(pObj, pEdge, i)
Definition: aigRet.c:139
#define Rtm_ObjForEachFaninEdge(pObj, pEdge, i)
Definition: aigRet.c:136
int Rtm_ObjCheckRetimeBwd(Rtm_Obj_t *pObj)
Definition: aigRet.c:454
#define assert(ex)
Definition: util_old.h:213
static Rtm_Init_t Rtm_ObjRemLast(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:115
void Rtm_ObjRetimeFwd ( Rtm_Man_t pRtm,
Rtm_Obj_t pObj 
)

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

Synopsis [Performs forward retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 515 of file aigRet.c.

516 {
517  Rtm_Init_t ValTotal, ValCur;
518  Rtm_Edg_t * pEdge;
519  int i;
520  assert( Rtm_ObjCheckRetimeFwd(pObj) );
521  // extract values and compute the result
522  ValTotal = RTM_VAL_ONE;
523  Rtm_ObjForEachFaninEdge( pObj, pEdge, i )
524  {
525  ValCur = Rtm_ObjRemFirst( pRtm, pEdge );
526  ValCur = Rtm_InitNotCond( ValCur, i? pObj->fCompl1 : pObj->fCompl0 );
527  ValTotal = Rtm_InitAnd( ValTotal, ValCur );
528  }
529  // insert the result in the fanout values
530  Rtm_ObjForEachFanoutEdge( pObj, pEdge, i )
531  Rtm_ObjAddLast( pRtm, pEdge, ValTotal );
532 }
Rtm_Init_t
DECLARATIONS ///.
Definition: aigRet.c:31
unsigned long fCompl1
Definition: aigRet.c:68
unsigned long fCompl0
Definition: aigRet.c:67
static Rtm_Init_t Rtm_InitNotCond(Rtm_Init_t Val, int c)
Definition: aigRet.c:83
static Rtm_Init_t Rtm_InitAnd(Rtm_Init_t ValA, Rtm_Init_t ValB)
Definition: aigRet.c:84
#define Rtm_ObjForEachFanoutEdge(pObj, pEdge, i)
Definition: aigRet.c:139
static void Rtm_ObjAddLast(Rtm_Man_t *p, Rtm_Edg_t *pEdge, Rtm_Init_t Val)
Definition: aigRet.c:117
#define Rtm_ObjForEachFaninEdge(pObj, pEdge, i)
Definition: aigRet.c:136
int Rtm_ObjCheckRetimeFwd(Rtm_Obj_t *pObj)
Definition: aigRet.c:433
#define assert(ex)
Definition: util_old.h:213
static Rtm_Init_t Rtm_ObjRemFirst(Rtm_Man_t *p, Rtm_Edg_t *pEdge)
Definition: aigRet.c:114
void Rtm_ObjTransferToBig ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
static

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

Synopsis [Transfers from small to big storage.]

Description []

SideEffects []

SeeAlso []

Definition at line 174 of file aigRet.c.

175 {
176  assert( pEdge->nLats == 10 );
177  if ( p->nExtraCur + 1 > p->nExtraAlloc )
178  {
179  int nExtraAllocNew = Abc_MaxInt( 2 * p->nExtraAlloc, 1024 );
180  p->pExtra = ABC_REALLOC( unsigned, p->pExtra, nExtraAllocNew );
181  p->nExtraAlloc = nExtraAllocNew;
182  }
183  p->pExtra[p->nExtraCur] = pEdge->LData;
184  pEdge->LData = p->nExtraCur++;
185 }
int nExtraCur
Definition: aigRet.c:49
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
unsigned long LData
Definition: aigRet.c:57
unsigned * pExtra
Definition: aigRet.c:48
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int nExtraAlloc
Definition: aigRet.c:50
#define assert(ex)
Definition: util_old.h:213
unsigned long nLats
Definition: aigRet.c:56
void Rtm_ObjTransferToBigger ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
static

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

Synopsis [Transfers to bigger storage.]

Description []

SideEffects []

SeeAlso []

Definition at line 198 of file aigRet.c.

199 {
200  int nWords;
201  assert( (pEdge->nLats & 15) == 15 );
202  nWords = (pEdge->nLats + 1) >> 4;
203  if ( p->nExtraCur + nWords + 1 > p->nExtraAlloc )
204  {
205  int nExtraAllocNew = Abc_MaxInt( 2 * p->nExtraAlloc, 1024 );
206  p->pExtra = ABC_REALLOC( unsigned, p->pExtra, nExtraAllocNew );
207  p->nExtraAlloc = nExtraAllocNew;
208  }
209  memcpy( p->pExtra + p->nExtraCur, p->pExtra + pEdge->LData, sizeof(unsigned) * nWords );
210  p->pExtra[p->nExtraCur + nWords] = 0;
211  pEdge->LData = p->nExtraCur;
212  p->nExtraCur += nWords + 1;
213 }
int nExtraCur
Definition: aigRet.c:49
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
unsigned long LData
Definition: aigRet.c:57
char * memcpy()
unsigned * pExtra
Definition: aigRet.c:48
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int nWords
Definition: abcNpn.c:127
int nExtraAlloc
Definition: aigRet.c:50
#define assert(ex)
Definition: util_old.h:213
unsigned long nLats
Definition: aigRet.c:56
void Rtm_ObjTransferToSmall ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)
static

FUNCTION DEFINITIONS ///.

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

Synopsis [Transfers from big to small storage.]

Description []

SideEffects []

SeeAlso []

Definition at line 157 of file aigRet.c.

158 {
159  assert( pEdge->nLats == 10 );
160  pEdge->LData = p->pExtra[pEdge->LData];
161 }
unsigned long LData
Definition: aigRet.c:57
unsigned * pExtra
Definition: aigRet.c:48
#define assert(ex)
Definition: util_old.h:213
unsigned long nLats
Definition: aigRet.c:56
void Rtm_PrintEdge ( Rtm_Man_t p,
Rtm_Edg_t pEdge 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file aigRet.c.

278 {
279 // unsigned LData = pEdge->LData;
280  printf( "%d : ", (int)pEdge->nLats );
281 /*
282  if ( pEdge->nLats > 10 )
283  Extra_PrintBinary( stdout, p->pExtra + pEdge->LData, 2*(pEdge->nLats+1) );
284  else
285  Extra_PrintBinary( stdout, &LData, 2*(pEdge->nLats+1) );
286 */
287  printf( "\n" );
288 }
unsigned long nLats
Definition: aigRet.c:56