From b77bdeeb173ef7799dc7a2b406ef7f1155ae3b5a Mon Sep 17 00:00:00 2001 From: aletempiac Date: Thu, 16 Nov 2023 19:21:29 +0100 Subject: [PATCH] Enabling ACD for area --- src/map/if/if.h | 2 +- src/map/if/ifDelay.c | 36 +++++++++++++++++++++++++----------- src/map/if/ifMap.c | 2 +- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/map/if/if.h b/src/map/if/if.h index 05dc33949..b4d06edca 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -570,7 +570,7 @@ extern int If_CutSopBalancePinDelaysInt( Vec_Int_t * vCover, int * p extern int If_CutSopBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm ); extern int If_CutLutBalanceEval( If_Man_t * p, If_Cut_t * pCut ); extern int If_CutLutBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm ); -extern int If_AcdEval( If_Man_t * p, If_Cut_t * pCut, int best_delay ); +extern int If_AcdEval( If_Man_t * p, If_Cut_t * pCut, If_Obj_t * pObj, int optDelay ); extern int If_AcdReEval( If_Man_t * p, If_Cut_t * pCut ); extern float If_AcdLeafProp( If_Man_t * p, If_Cut_t * pCut, int i, float required ); /*=== ifDsd.c =============================================================*/ diff --git a/src/map/if/ifDelay.c b/src/map/if/ifDelay.c index c1ecd7c08..75a0a0a66 100644 --- a/src/map/if/ifDelay.c +++ b/src/map/if/ifDelay.c @@ -412,7 +412,7 @@ int If_CutLutBalanceEval( If_Man_t * p, If_Cut_t * pCut ) } } -int If_AcdEval( If_Man_t * p, If_Cut_t * pCut, int best_delay ) +int If_AcdEval( If_Man_t * p, If_Cut_t * pCut, If_Obj_t * pObj, int optDelay ) { pCut->fUser = 1; pCut->Cost = pCut->nLeaves > 1 ? 1 : 0; @@ -460,20 +460,34 @@ int If_AcdEval( If_Man_t * p, If_Cut_t * pCut, int best_delay ) // } /* compute the decomposition */ - int use_late_arrival = DelayMax + 2 >= best_delay; + int use_late_arrival; unsigned cost = 1; - - /* TODO: have checks based on delay */ - if ( use_late_arrival && nLeafMax > LutSize / 2 ) + + if ( optDelay ) { - pCut->Cost = IF_COST_MAX; - return ABC_INFINITY; + /* checks based on delay: must be better than the previous best cut */ + use_late_arrival = DelayMax + 2 >= If_ObjCutBest(pObj)->Delay; } - - /* remove from critical set */ - if ( !use_late_arrival && nLeafMax > LutSize / 2 ) + else { - uLeafMask = 0; + /* checks based on delay: look at the required time */ + use_late_arrival = DelayMax + 2 > pObj->Required + p->fEpsilon; + } + + /* Too many late-arriving signals */ + if ( nLeafMax > LutSize / 2 ) + { + if ( use_late_arrival ) + { + /* unfeasible decomposition */ + pCut->Cost = IF_COST_MAX; + return ABC_INFINITY; + } + else + { + /* remove critical signals as not needed */ + uLeafMask = 0; + } } word *pTruth = If_CutTruthW( p, pCut ); diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c index da83b5525..1455846f6 100644 --- a/src/map/if/ifMap.c +++ b/src/map/if/ifMap.c @@ -431,7 +431,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep pCut->Delay = If_CutDelayRecCost3( p, pCut, pObj ); else if ( p->pPars->fAcd ) { - pCut->Delay = If_AcdEval( p, pCut, fFirst ? ABC_INFINITY : (int) If_ObjCutBest(pObj)->Delay ); + pCut->Delay = If_AcdEval( p, pCut, pObj, Mode == 0 ); pCut->fUseless = pCut->Delay == ABC_INFINITY; } else if ( p->pPars->fUserSesLib )