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

Go to the source code of this file.

Functions

void If_ManImproveMapping (If_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
int If_ManImproveCutCost (If_Man_t *p, Vec_Ptr_t *vFront)
 
void If_ManImproveMark_rec (If_Man_t *p, If_Obj_t *pObj, Vec_Ptr_t *vVisited)
 
int If_ManImproveNodeWillGrow (If_Man_t *p, If_Obj_t *pObj)
 
int If_ManImproveNodeFaninCost (If_Man_t *p, If_Obj_t *pObj)
 
void If_ManImproveNodeFaninUpdate (If_Man_t *p, If_Obj_t *pObj, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited)
 
int If_ManImproveNodeFaninCompact0 (If_Man_t *p, If_Obj_t *pObj, int nLimit, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited)
 
int If_ManImproveNodeFaninCompact1 (If_Man_t *p, If_Obj_t *pObj, int nLimit, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited)
 
int If_ManImproveNodeFaninCompact2 (If_Man_t *p, If_Obj_t *pObj, int nLimit, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited)
 
int If_ManImproveNodeFaninCompact_int (If_Man_t *p, If_Obj_t *pObj, int nLimit, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited)
 

Function Documentation

◆ If_ManImproveCutCost()

int If_ManImproveCutCost ( If_Man_t * p,
Vec_Ptr_t * vFront )

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

Synopsis [Counts the number of nodes with no external fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 107 of file ifReduce.c.

108{
109 If_Obj_t * pFanin;
110 int i, Counter = 0;
111 Vec_PtrForEachEntry( If_Obj_t *, vFront, pFanin, i )
112 if ( pFanin->nRefs == 0 )
113 Counter++;
114 return Counter;
115}
struct If_Obj_t_ If_Obj_t
Definition if.h:79
int nRefs
Definition if.h:346
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55

◆ If_ManImproveMapping()

void If_ManImproveMapping ( If_Man_t * p)

FUNCTION DEFINITIONS ///.

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

Synopsis [Improves current mapping using expand/Expand of one cut.]

Description [Assumes current mapping assigned and required times computed.]

SideEffects []

SeeAlso []

Definition at line 51 of file ifReduce.c.

52{
53 abctime clk;
54
55 clk = Abc_Clock();
56 If_ManImproveExpand( p, p->pPars->nLutSize );
58 if ( p->pPars->fVerbose )
59 {
60 Abc_Print( 1, "E: Del = %7.2f. Ar = %9.1f. Edge = %8d. ",
61 p->RequiredGlo, p->AreaGlo, p->nNets );
62 if ( p->dPower )
63 Abc_Print( 1, "Switch = %7.2f. ", p->dPower );
64 Abc_Print( 1, "Cut = %8d. ", p->nCutsMerged );
65 Abc_PrintTime( 1, "T", Abc_Clock() - clk );
66 }
67}
ABC_INT64_T abctime
Definition abc_global.h:332
Cube * p
Definition exorList.c:222
void If_ManComputeRequired(If_Man_t *p)
Definition ifTime.c:313
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManImproveMark_rec()

void If_ManImproveMark_rec ( If_Man_t * p,
If_Obj_t * pObj,
Vec_Ptr_t * vVisited )

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

Synopsis [Performs area recovery for each node.]

Description []

SideEffects []

SeeAlso []

Definition at line 182 of file ifReduce.c.

183{
184 if ( pObj->fMark )
185 return;
186 assert( If_ObjIsAnd(pObj) );
187 If_ManImproveMark_rec( p, If_ObjFanin0(pObj), vVisited );
188 If_ManImproveMark_rec( p, If_ObjFanin1(pObj), vVisited );
189 Vec_PtrPush( vVisited, pObj );
190 pObj->fMark = 1;
191}
void If_ManImproveMark_rec(If_Man_t *p, If_Obj_t *pObj, Vec_Ptr_t *vVisited)
Definition ifReduce.c:182
unsigned fMark
Definition if.h:338
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManImproveNodeFaninCompact0()

int If_ManImproveNodeFaninCompact0 ( If_Man_t * p,
If_Obj_t * pObj,
int nLimit,
Vec_Ptr_t * vFront,
Vec_Ptr_t * vVisited )

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

Synopsis [Compacts the number of external refs.]

Description []

SideEffects []

SeeAlso []

Definition at line 345 of file ifReduce.c.

346{
347 If_Obj_t * pFanin;
348 int i;
349 Vec_PtrForEachEntry( If_Obj_t *, vFront, pFanin, i )
350 {
351 if ( If_ObjIsCi(pFanin) )
352 continue;
353 if ( If_ManImproveNodeWillGrow(p, pFanin) )
354 continue;
355 if ( If_ManImproveNodeFaninCost(p, pFanin) <= 0 )
356 {
357 If_ManImproveNodeFaninUpdate( p, pFanin, vFront, vVisited );
358 return 1;
359 }
360 }
361 return 0;
362}
int If_ManImproveNodeWillGrow(If_Man_t *p, If_Obj_t *pObj)
Definition ifReduce.c:266
int If_ManImproveNodeFaninCost(If_Man_t *p, If_Obj_t *pObj)
Definition ifReduce.c:286
void If_ManImproveNodeFaninUpdate(If_Man_t *p, If_Obj_t *pObj, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited)
Definition ifReduce.c:313
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManImproveNodeFaninCompact1()

int If_ManImproveNodeFaninCompact1 ( If_Man_t * p,
If_Obj_t * pObj,
int nLimit,
Vec_Ptr_t * vFront,
Vec_Ptr_t * vVisited )

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

Synopsis [Compacts the number of external refs.]

Description []

SideEffects []

SeeAlso []

Definition at line 375 of file ifReduce.c.

376{
377 If_Obj_t * pFanin;
378 int i;
379 Vec_PtrForEachEntry( If_Obj_t *, vFront, pFanin, i )
380 {
381 if ( If_ObjIsCi(pFanin) )
382 continue;
383 if ( If_ManImproveNodeFaninCost(p, pFanin) < 0 )
384 {
385 If_ManImproveNodeFaninUpdate( p, pFanin, vFront, vVisited );
386 return 1;
387 }
388 }
389 return 0;
390}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManImproveNodeFaninCompact2()

int If_ManImproveNodeFaninCompact2 ( If_Man_t * p,
If_Obj_t * pObj,
int nLimit,
Vec_Ptr_t * vFront,
Vec_Ptr_t * vVisited )

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

Synopsis [Compacts the number of external refs.]

Description []

SideEffects []

SeeAlso []

Definition at line 403 of file ifReduce.c.

404{
405 If_Obj_t * pFanin;
406 int i;
407 Vec_PtrForEachEntry( If_Obj_t *, vFront, pFanin, i )
408 {
409 if ( If_ObjIsCi(pFanin) )
410 continue;
411 if ( If_ManImproveNodeFaninCost(p, pFanin) <= 0 )
412 {
413 If_ManImproveNodeFaninUpdate( p, pFanin, vFront, vVisited );
414 return 1;
415 }
416 }
417 return 0;
418}
Here is the call graph for this function:

◆ If_ManImproveNodeFaninCompact_int()

int If_ManImproveNodeFaninCompact_int ( If_Man_t * p,
If_Obj_t * pObj,
int nLimit,
Vec_Ptr_t * vFront,
Vec_Ptr_t * vVisited )

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

Synopsis [Compacts the number of external refs.]

Description []

SideEffects []

SeeAlso []

Definition at line 431 of file ifReduce.c.

432{
433 if ( If_ManImproveNodeFaninCompact0(p, pObj, nLimit, vFront, vVisited) )
434 return 1;
435 if ( Vec_PtrSize(vFront) < nLimit && If_ManImproveNodeFaninCompact1(p, pObj, nLimit, vFront, vVisited) )
436 return 1;
437// if ( Vec_PtrSize(vFront) < nLimit && If_ManImproveNodeFaninCompact2(p, pObj, nLimit, vFront, vVisited) )
438// return 1;
439 assert( Vec_PtrSize(vFront) <= nLimit );
440 return 0;
441}
int If_ManImproveNodeFaninCompact1(If_Man_t *p, If_Obj_t *pObj, int nLimit, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited)
Definition ifReduce.c:375
int If_ManImproveNodeFaninCompact0(If_Man_t *p, If_Obj_t *pObj, int nLimit, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited)
Definition ifReduce.c:345
Here is the call graph for this function:

◆ If_ManImproveNodeFaninCost()

int If_ManImproveNodeFaninCost ( If_Man_t * p,
If_Obj_t * pObj )

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

Synopsis [Returns the increase in the number of fanins with no external refs.]

Description []

SideEffects []

SeeAlso []

Definition at line 286 of file ifReduce.c.

287{
288 int Counter = 0;
289 assert( If_ObjIsAnd(pObj) );
290 // check if the node has external refs
291 if ( pObj->nRefs == 0 )
292 Counter--;
293 // increment the number of fanins without external refs
294 if ( !If_ObjFanin0(pObj)->fMark && If_ObjFanin0(pObj)->nRefs == 0 )
295 Counter++;
296 // increment the number of fanins without external refs
297 if ( !If_ObjFanin1(pObj)->fMark && If_ObjFanin1(pObj)->nRefs == 0 )
298 Counter++;
299 return Counter;
300}
Here is the caller graph for this function:

◆ If_ManImproveNodeFaninUpdate()

void If_ManImproveNodeFaninUpdate ( If_Man_t * p,
If_Obj_t * pObj,
Vec_Ptr_t * vFront,
Vec_Ptr_t * vVisited )

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

Synopsis [Updates the frontier.]

Description []

SideEffects []

SeeAlso []

Definition at line 313 of file ifReduce.c.

314{
315 If_Obj_t * pFanin;
316 assert( If_ObjIsAnd(pObj) );
317 Vec_PtrRemove( vFront, pObj );
318 pFanin = If_ObjFanin0(pObj);
319 if ( !pFanin->fMark )
320 {
321 Vec_PtrPush( vFront, pFanin );
322 Vec_PtrPush( vVisited, pFanin );
323 pFanin->fMark = 1;
324 }
325 pFanin = If_ObjFanin1(pObj);
326 if ( !pFanin->fMark )
327 {
328 Vec_PtrPush( vFront, pFanin );
329 Vec_PtrPush( vVisited, pFanin );
330 pFanin->fMark = 1;
331 }
332}
Here is the caller graph for this function:

◆ If_ManImproveNodeWillGrow()

int If_ManImproveNodeWillGrow ( If_Man_t * p,
If_Obj_t * pObj )

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

Synopsis [Returns 1 if the number of fanins will grow.]

Description []

SideEffects []

SeeAlso []

Definition at line 266 of file ifReduce.c.

267{
268 If_Obj_t * pFanin0, * pFanin1;
269 assert( If_ObjIsAnd(pObj) );
270 pFanin0 = If_ObjFanin0(pObj);
271 pFanin1 = If_ObjFanin1(pObj);
272 return !pFanin0->fMark && !pFanin1->fMark;
273}
Here is the caller graph for this function: