From 473012aaf02542647444355fab38df1699765de5 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 8 Aug 2016 11:56:33 -0700 Subject: Enabled progress bar in the 'if' mapper. --- src/map/if/ifMap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c index 76d3c757..f068c35d 100644 --- a/src/map/if/ifMap.c +++ b/src/map/if/ifMap.c @@ -19,7 +19,7 @@ ***********************************************************************/ #include "if.h" - +#include "misc/extra/extra.h" ABC_NAMESPACE_IMPL_START @@ -537,7 +537,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP ***********************************************************************/ int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fPreprocess, int fFirst, char * pLabel ) { -// ProgressBar * pProgress; + ProgressBar * pProgress; If_Obj_t * pObj; int i; abctime clk = Abc_Clock(); @@ -590,16 +590,16 @@ int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fPrepr } else { - // pProgress = Extra_ProgressBarStart( stdout, If_ManObjNum(p) ); + pProgress = Extra_ProgressBarStart( stdout, If_ManObjNum(p) ); If_ManForEachNode( p, pObj, i ) { - // Extra_ProgressBarUpdate( pProgress, i, pLabel ); + Extra_ProgressBarUpdate( pProgress, i, pLabel ); If_ObjPerformMappingAnd( p, pObj, Mode, fPreprocess, fFirst ); if ( pObj->fRepr ) If_ObjPerformMappingChoice( p, pObj, Mode, fPreprocess ); } } -// Extra_ProgressBarStop( pProgress ); + Extra_ProgressBarStop( pProgress ); // make sure the visit counters are all zero If_ManForEachNode( p, pObj, i ) assert( pObj->nVisits == 0 ); -- cgit v1.2.3 From a819e33c6f4a3177fd164228b51b4b2b8448e294 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 8 Aug 2016 12:36:10 -0700 Subject: Enabled delay computation for the cut output using cut inputs. --- src/map/if/if.h | 1 + src/map/if/ifMan.c | 2 ++ src/map/if/ifMap.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/map/if/if.h b/src/map/if/if.h index ca7e0411..5f86ef5c 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -265,6 +265,7 @@ struct If_Man_t_ int nCountNonDec[2]; Vec_Int_t * vCutData; // cut data storage int pArrTimeProfile[IF_MAX_FUNC_LUTSIZE]; + Vec_Ptr_t * vVisited; // timing manager Tim_Man_t * pManTim; diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c index 80d1f429..8f5a5c48 100644 --- a/src/map/if/ifMan.c +++ b/src/map/if/ifMan.c @@ -61,6 +61,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) p->vCos = Vec_PtrAlloc( 100 ); p->vObjs = Vec_PtrAlloc( 100 ); p->vTemp = Vec_PtrAlloc( 100 ); + p->vVisited = Vec_PtrAlloc( 100 ); // prepare the memory manager if ( p->pPars->fTruth ) { @@ -264,6 +265,7 @@ void If_ManStop( If_Man_t * p ) Vec_IntFreeP( &p->vCutData ); Vec_IntFreeP( &p->vPairRes ); Vec_StrFreeP( &p->vPairPerms ); + Vec_PtrFreeP( &p->vVisited ); if ( p->vPairHash ) Hash_IntManStop( p->vPairHash ); for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ ) diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c index f068c35d..27a2820d 100644 --- a/src/map/if/ifMap.c +++ b/src/map/if/ifMap.c @@ -35,6 +35,53 @@ extern int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfil /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// +/**Function************************************************************* + + Synopsis [Compute delay of the cut's output in terms of logic levels.] + + Description [Uses the best arrival time of the fanins of the cut + to compute the arrival times of the output of the cut.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_ManCutAigDelay_rec( If_Man_t * p, If_Obj_t * pObj, Vec_Ptr_t * vVisited ) +{ + int Delay0, Delay1; + if ( pObj->fVisit ) + return pObj->iCopy; + if ( If_ObjIsCi(pObj) || If_ObjIsConst1(pObj) ) + return -1; + // store the node in the structure by level + assert( If_ObjIsAnd(pObj) ); + pObj->fVisit = 1; + Vec_PtrPush( vVisited, pObj ); + Delay0 = If_ManCutAigDelay_rec( p, pObj->pFanin0, vVisited ); + Delay1 = If_ManCutAigDelay_rec( p, pObj->pFanin1, vVisited ); + pObj->iCopy = (Delay0 >= 0 && Delay1 >= 0) ? 1 + Abc_MaxInt(Delay0, Delay1) : -1; + return pObj->iCopy; +} +int If_ManCutAigDelay( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut ) +{ + If_Obj_t * pLeaf; + int i, Delay; + Vec_PtrClear( p->vVisited ); + If_CutForEachLeaf( p, pCut, pLeaf, i ) + { + assert( pLeaf->fVisit == 0 ); + pLeaf->fVisit = 1; + Vec_PtrPush( p->vVisited, pLeaf ); + pLeaf->iCopy = If_ObjCutBest(pLeaf)->Delay; + } + Delay = If_ManCutAigDelay_rec( p, pObj, p->vVisited ); + Vec_PtrForEachEntry( If_Obj_t *, p->vVisited, pLeaf, i ) + pLeaf->fVisit = 0; +// assert( Delay <= (int)pObj->Level ); + return Delay; +} + /**Function************************************************************* Synopsis [Counts the number of 1s in the signature.] @@ -152,7 +199,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep { int Cost = 0; pCut->fUser = 1; - pCut->Delay = (float)Abc_ExactDelayCost( If_CutTruthW(p, pCut), If_CutLeaveNum(pCut), If_CutArrTimeProfile(p, pCut), If_CutPerm(pCut), &Cost, (int)pObj->Level ); + pCut->Delay = (float)Abc_ExactDelayCost( If_CutTruthW(p, pCut), If_CutLeaveNum(pCut), If_CutArrTimeProfile(p, pCut), If_CutPerm(pCut), &Cost, If_ManCutAigDelay(p, pObj, pCut) ); if ( Cost == ABC_INFINITY ) { for ( v = 0; v < If_CutLeaveNum(pCut); v++ ) @@ -376,7 +423,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep { int Cost = 0; pCut->fUser = 1; - pCut->Delay = (float)Abc_ExactDelayCost( If_CutTruthW(p, pCut), If_CutLeaveNum(pCut), If_CutArrTimeProfile(p, pCut), If_CutPerm(pCut), &Cost, (int)pObj->Level ); + pCut->Delay = (float)Abc_ExactDelayCost( If_CutTruthW(p, pCut), If_CutLeaveNum(pCut), If_CutArrTimeProfile(p, pCut), If_CutPerm(pCut), &Cost, If_ManCutAigDelay(p, pObj, pCut) ); if ( Cost == ABC_INFINITY ) { for ( v = 0; v < If_CutLeaveNum(pCut); v++ ) -- cgit v1.2.3 From 713976f2cf07448212d997289714a12c976b010f Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 8 Aug 2016 12:38:21 -0700 Subject: Enabled progress bar in the 'if' mapper (warning). --- src/map/if/ifMap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c index 27a2820d..51865851 100644 --- a/src/map/if/ifMap.c +++ b/src/map/if/ifMap.c @@ -584,7 +584,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP ***********************************************************************/ int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fPreprocess, int fFirst, char * pLabel ) { - ProgressBar * pProgress; + ProgressBar * pProgress = NULL; If_Obj_t * pObj; int i; abctime clk = Abc_Clock(); -- cgit v1.2.3 From 693b587c5cfa624e6cae086ab7ae47ab9f72d082 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 8 Aug 2016 18:20:05 -0700 Subject: Adding truth table occurrence counters for 'if -c'. --- src/map/if/if.h | 1 + src/map/if/ifMan.c | 8 ++++++++ src/map/if/ifTruth.c | 5 +++++ 3 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/map/if/if.h b/src/map/if/if.h index 5f86ef5c..e822a0ad 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -253,6 +253,7 @@ struct If_Man_t_ Vec_Str_t * vTtPerms[IF_MAX_FUNC_LUTSIZE+1]; // mapping of truth table into permutations Vec_Str_t * vTtVars[IF_MAX_FUNC_LUTSIZE+1]; // mapping of truth table into selected vars Vec_Int_t * vTtDecs[IF_MAX_FUNC_LUTSIZE+1]; // mapping of truth table into decomposition pattern + Vec_Int_t * vTtOccurs[IF_MAX_FUNC_LUTSIZE+1];// truth table occurange counters Hash_IntMan_t * vPairHash; // hashing pairs of truth tables Vec_Int_t * vPairRes; // resulting truth table Vec_Str_t * vPairPerms; // resulting permutation diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c index 8f5a5c48..414a1911 100644 --- a/src/map/if/ifMan.c +++ b/src/map/if/ifMan.c @@ -125,6 +125,12 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) Vec_StrFill( p->vPairPerms, p->pPars->nLutSize, 0 ); p->vPairRes = Vec_IntAlloc( 1000 ); Vec_IntPush( p->vPairRes, -1 ); + for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ ) + p->vTtOccurs[v] = Vec_IntAlloc( 1000 ); + for ( v = 0; v < 6; v++ ) + p->vTtOccurs[v] = p->vTtOccurs[6]; + for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ ) + Vec_IntPushTwo( p->vTtOccurs[v], 0, 0 ); } if ( pPars->fUseCofVars ) { @@ -274,6 +280,8 @@ void If_ManStop( If_Man_t * p ) Vec_MemFreeP( &p->vTtMem[i] ); for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ ) Vec_WecFreeP( &p->vTtIsops[i] ); + for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ ) + Vec_IntFreeP( &p->vTtOccurs[i] ); Mem_FixedStop( p->pMemObj, 0 ); ABC_FREE( p->pMemCi ); ABC_FREE( p->pMemAnd ); diff --git a/src/map/if/ifTruth.c b/src/map/if/ifTruth.c index 91e6adcf..7c8892d3 100644 --- a/src/map/if/ifTruth.c +++ b/src/map/if/ifTruth.c @@ -244,10 +244,15 @@ p->timeCache[3] += Abc_Clock() - clk; else assert( pCut->uSign == If_ObjCutSignCompute( pCut ) ); + assert( Vec_IntSize(p->vTtOccurs[pCut->nLeaves]) == Vec_MemEntryNum(p->vTtMem[pCut->nLeaves]) ); // hash function fCompl = ((p->uCanonPhase >> pCut->nLeaves) & 1); truthId = Vec_MemHashInsert( p->vTtMem[pCut->nLeaves], pTruth ); pCut->iCutFunc = Abc_Var2Lit( truthId, fCompl ); + // count how many time this truth table is used + if ( Vec_IntSize(p->vTtOccurs[pCut->nLeaves]) < Vec_MemEntryNum(p->vTtMem[pCut->nLeaves]) ) + Vec_IntPush( p->vTtOccurs[pCut->nLeaves], 0 ); + Vec_IntAddToEntry( p->vTtOccurs[pCut->nLeaves], truthId, 1 ); if ( fVerbose ) { -- cgit v1.2.3