ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
saigRetFwd.c File Reference
#include "saig.h"
Include dependency graph for saigRetFwd.c:

Go to the source code of this file.

Macros

#define Aig_ObjForEachFanoutStatic(pObj, pFan, i)
 

Functions

Aig_Obj_t ** Aig_ManStaticFanoutStart (Aig_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void Aig_ManMarkAutonomous_rec (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Saig_ManMarkAutonomous (Aig_Man_t *p)
 
Aig_Man_tSaig_ManRetimeForwardOne (Aig_Man_t *p, int *pnRegFixed, int *pnRegMoves)
 
Aig_Man_tSaig_ManRetimeForward (Aig_Man_t *p, int nMaxIters, int fVerbose)
 

Macro Definition Documentation

◆ Aig_ObjForEachFanoutStatic

#define Aig_ObjForEachFanoutStatic ( pObj,
pFan,
i )
Value:
for ( i = 0; (i < (int)(pObj)->nRefs) && ((pFan) = Aig_ObjFanoutStatic(pObj, i)); i++ )

Definition at line 33 of file saigRetFwd.c.

33#define Aig_ObjForEachFanoutStatic( pObj, pFan, i ) \
34 for ( i = 0; (i < (int)(pObj)->nRefs) && ((pFan) = Aig_ObjFanoutStatic(pObj, i)); i++ )

Function Documentation

◆ Aig_ManMarkAutonomous_rec()

void Aig_ManMarkAutonomous_rec ( Aig_Man_t * p,
Aig_Obj_t * pObj )

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

Synopsis [Marks the objects reachable from the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file saigRetFwd.c.

90{
91 Aig_Obj_t * pFanout;
92 int i;
93 if ( Aig_ObjIsTravIdCurrent(p, pObj) )
94 return;
95 Aig_ObjSetTravIdCurrent(p, pObj);
96 Aig_ObjForEachFanoutStatic( pObj, pFanout, i )
97 Aig_ManMarkAutonomous_rec( p, pFanout );
98}
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Cube * p
Definition exorList.c:222
void Aig_ManMarkAutonomous_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition saigRetFwd.c:89
#define Aig_ObjForEachFanoutStatic(pObj, pFan, i)
Definition saigRetFwd.c:33
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_ManStaticFanoutStart()

Aig_Obj_t ** Aig_ManStaticFanoutStart ( Aig_Man_t * p)

FUNCTION DEFINITIONS ///.

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

Synopsis [Allocate static fanout for all nodes in the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 51 of file saigRetFwd.c.

52{
53 Aig_Obj_t ** ppFanouts, * pObj;
54 int i, nFanouts, nFanoutsAlloc;
55 // allocate fanouts
56 nFanoutsAlloc = 2 * Aig_ManObjNumMax(p) - Aig_ManCiNum(p) - Aig_ManCoNum(p);
57 ppFanouts = ABC_ALLOC( Aig_Obj_t *, nFanoutsAlloc );
58 // mark up storage
59 nFanouts = 0;
60 Aig_ManForEachObj( p, pObj, i )
61 {
62 pObj->pData = ppFanouts + nFanouts;
63 nFanouts += pObj->nRefs;
64 pObj->nRefs = 0;
65 }
66 assert( nFanouts < nFanoutsAlloc );
67 // add fanouts
68 Aig_ManForEachObj( p, pObj, i )
69 {
70 if ( Aig_ObjChild0(pObj) )
71 Aig_ObjSetFanoutStatic( Aig_ObjFanin0(pObj), pObj );
72 if ( Aig_ObjChild1(pObj) )
73 Aig_ObjSetFanoutStatic( Aig_ObjFanin1(pObj), pObj );
74 }
75 return ppFanouts;
76}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
unsigned int nRefs
Definition aig.h:81
void * pData
Definition aig.h:87
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Saig_ManMarkAutonomous()

void Saig_ManMarkAutonomous ( Aig_Man_t * p)

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

Synopsis [Marks with current trav ID nodes reachable from Const1 and PIs.]

Description [Returns the number of unreachable registers.]

SideEffects []

SeeAlso []

Definition at line 111 of file saigRetFwd.c.

112{
113 Aig_Obj_t ** ppFanouts;
114 Aig_Obj_t * pObj, * pObjLi, * pObjLo;
115 int i;
116 // temporarily connect register outputs to register inputs
117 Saig_ManForEachLiLo( p, pObjLi, pObjLo, i )
118 {
119 pObjLo->pFanin0 = pObjLi;
120 pObjLi->nRefs = 1;
121 }
122 // mark nodes reachable from Const1 and PIs
124 ppFanouts = Aig_ManStaticFanoutStart( p );
125 Aig_ManMarkAutonomous_rec( p, Aig_ManConst1(p) );
126 Saig_ManForEachPi( p, pObj, i )
128 ABC_FREE( ppFanouts );
129 // disconnect LIs/LOs and label unreachable registers
130 Saig_ManForEachLiLo( p, pObjLi, pObjLo, i )
131 {
132 assert( pObjLo->pFanin0 && pObjLi->nRefs == 1 );
133 pObjLo->pFanin0 = NULL;
134 pObjLi->nRefs = 0;
135 }
136}
#define ABC_FREE(obj)
Definition abc_global.h:267
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigUtil.c:44
Aig_Obj_t ** Aig_ManStaticFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition saigRetFwd.c:51
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition saig.h:101
#define Saig_ManForEachPi(p, pObj, i)
Definition saig.h:91
Aig_Obj_t * pFanin0
Definition aig.h:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManRetimeForward()

Aig_Man_t * Saig_ManRetimeForward ( Aig_Man_t * p,
int nMaxIters,
int fVerbose )

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

Synopsis [Derives the cut for forward retiming.]

Description [Assumes topological ordering of the nodes.]

SideEffects []

SeeAlso []

Definition at line 213 of file saigRetFwd.c.

214{
215 Aig_Man_t * pNew, * pTemp;
216 int i, nRegFixed, nRegMoves = 1;
217 abctime clk;
218 pNew = p;
219 for ( i = 0; i < nMaxIters && nRegMoves > 0; i++ )
220 {
221 clk = Abc_Clock();
222 pNew = Saig_ManRetimeForwardOne( pTemp = pNew, &nRegFixed, &nRegMoves );
223 if ( fVerbose )
224 {
225 printf( "%2d : And = %6d. Reg = %5d. Unret = %5d. Move = %6d. ",
226 i + 1, Aig_ManNodeNum(pTemp), Aig_ManRegNum(pTemp), nRegFixed, nRegMoves );
227 ABC_PRT( "Time", Abc_Clock() - clk );
228 }
229 if ( pTemp != p )
230 Aig_ManStop( pTemp );
231 }
232 clk = Abc_Clock();
233 pNew = Aig_ManReduceLaches( pNew, fVerbose );
234 if ( fVerbose )
235 {
236 ABC_PRT( "Register sharing time", Abc_Clock() - clk );
237 }
238 return pNew;
239}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
Aig_Man_t * Aig_ManReduceLaches(Aig_Man_t *p, int fVerbose)
Definition aigScl.c:455
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
Aig_Man_t * Saig_ManRetimeForwardOne(Aig_Man_t *p, int *pnRegFixed, int *pnRegMoves)
Definition saigRetFwd.c:149
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManRetimeForwardOne()

Aig_Man_t * Saig_ManRetimeForwardOne ( Aig_Man_t * p,
int * pnRegFixed,
int * pnRegMoves )

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

Synopsis [Derives the cut for forward retiming.]

Description [Assumes topological ordering of the nodes.]

SideEffects []

SeeAlso []

Definition at line 149 of file saigRetFwd.c.

150{
151 Aig_Man_t * pNew;
152 Vec_Ptr_t * vCut;
153 Aig_Obj_t * pObj, * pFanin;
154 int i;
155 // mark the retimable nodes
157 // mark the retimable registers with the fresh trav ID
159 *pnRegFixed = 0;
160 Saig_ManForEachLo( p, pObj, i )
161 if ( Aig_ObjIsTravIdPrevious(p, pObj) )
162 Aig_ObjSetTravIdCurrent(p, pObj);
163 else
164 (*pnRegFixed)++;
165 // mark all the nodes that can be retimed forward
166 *pnRegMoves = 0;
167 Aig_ManForEachNode( p, pObj, i )
168 if ( Aig_ObjIsTravIdCurrent(p, Aig_ObjFanin0(pObj)) && Aig_ObjIsTravIdCurrent(p, Aig_ObjFanin1(pObj)) )
169 {
170 Aig_ObjSetTravIdCurrent(p, pObj);
171 (*pnRegMoves)++;
172 }
173 // mark the remaining registers
174 Saig_ManForEachLo( p, pObj, i )
175 Aig_ObjSetTravIdCurrent(p, pObj);
176 // find the cut (all such marked objects that fanout into unmarked nodes)
177 vCut = Vec_PtrAlloc( 1000 );
179 Aig_ManForEachObj( p, pObj, i )
180 {
181 if ( Aig_ObjIsTravIdPrevious(p, pObj) )
182 continue;
183 pFanin = Aig_ObjFanin0(pObj);
184 if ( pFanin && Aig_ObjIsTravIdPrevious(p, pFanin) )
185 {
186 Vec_PtrPush( vCut, pFanin );
187 Aig_ObjSetTravIdCurrent( p, pFanin );
188 }
189 pFanin = Aig_ObjFanin1(pObj);
190 if ( pFanin && Aig_ObjIsTravIdPrevious(p, pFanin) )
191 {
192 Vec_PtrPush( vCut, pFanin );
193 Aig_ObjSetTravIdCurrent( p, pFanin );
194 }
195 }
196 // finally derive the new manager
197 pNew = Saig_ManRetimeDupForward( p, vCut );
198 Vec_PtrFree( vCut );
199 return pNew;
200}
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
void Saig_ManMarkAutonomous(Aig_Man_t *p)
Definition saigRetFwd.c:111
Aig_Man_t * Saig_ManRetimeDupForward(Aig_Man_t *p, Vec_Ptr_t *vCut)
Definition saigRetMin.c:281
#define Saig_ManForEachLo(p, pObj, i)
Definition saig.h:96
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function: