30extern char *
Dau_DsdMerge(
char * pDsd0i,
int * pPerm0,
char * pDsd1i,
int * pPerm1,
int fCompl0,
int fCompl1,
int nVars );
32extern int Abc_ExactDelayCost(
word * pTruth,
int nVars,
int * pArrTimeProfile,
char * pPerm,
int * Cost,
int AigLevel );
55 if ( If_ObjIsCi(pObj) || If_ObjIsConst1(pObj) )
58 assert( If_ObjIsAnd(pObj) );
60 Vec_PtrPush( vVisited, pObj );
63 pObj->
iCopy = (Delay0 >= 0 && Delay1 >= 0) ? 1 + Abc_MaxInt(Delay0, Delay1) : -1;
70 Vec_PtrClear(
p->vVisited );
75 Vec_PtrPush(
p->vVisited, pLeaf );
76 pLeaf->
iCopy = If_ObjCutBest(pLeaf)->Delay;
96static inline int If_WordCountOnes(
unsigned uWord )
98 uWord = (uWord & 0x55555555) + ((uWord>>1) & 0x55555555);
99 uWord = (uWord & 0x33333333) + ((uWord>>2) & 0x33333333);
100 uWord = (uWord & 0x0F0F0F0F) + ((uWord>>4) & 0x0F0F0F0F);
101 uWord = (uWord & 0x00FF00FF) + ((uWord>>8) & 0x00FF00FF);
102 return (uWord & 0x0000FFFF) + (uWord>>16);
118 static float Pin2Pin[2][3] = { {1.0, 1.0, 1.0}, {1.0, 1.0, 0.0} };
125 DelayCur = If_ObjCutBest(pLeaf)->Delay;
126 Delay =
IF_MAX( Delay, Pin2Pin[fCarry][i] + DelayCur );
146 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
147 p->pArrTimeProfile[i] = (
int)If_ObjCutBest(If_CutLeaf(
p, pCut, i))->Delay;
148 return p->pArrTimeProfile;
167 int fFunc0R, fFunc1R;
168 int i, k, v, iCutDsd, fChange;
169 int fSave0 =
p->pPars->fDelayOpt ||
p->pPars->fDelayOptLut ||
p->pPars->fDsdBalance ||
p->pPars->fUserRecLib ||
p->pPars->fUserSesLib ||
p->pPars->fUserLutDec ||
p->pPars->fUserLut2D ||
170 p->pPars->fUseDsdTune ||
p->pPars->fUseCofVars ||
p->pPars->fUseAndVars ||
p->pPars->fUse34Spec ||
p->pPars->pLutStruct ||
p->pPars->pFuncCell2 ||
p->pPars->fUseCheck1 ||
p->pPars->fUseCheck2;
171 int fUseAndCut = (
p->pPars->nAndDelay > 0) || (
p->pPars->nAndArea > 0);
178 else if ( Mode == 1 )
181 if ( Mode && pObj->
nRefs > 0 )
188 pCut = If_ObjCutBest(pObj);
192 if (
p->pPars->fDelayOpt )
194 else if (
p->pPars->fDsdBalance )
196 else if (
p->pPars->fUserRecLib )
198 else if (
p->pPars->fUserSesLib )
205 for ( v = 0; v < If_CutLeaveNum(pCut); v++ )
211 else if (
p->pPars->fUserLutDec ||
p->pPars->fUserLut2D )
215 else if (
p->pPars->fDelayOptLut )
217 else if(
p->pPars->nGateSize > 0 )
224 Abc_Print( 1,
"If_ObjPerformMappingAnd(): Warning! Node with ID %d has delay (%f) exceeding the required times (%f).\n",
227 if (
p->pPars->fEdge )
229 if (
p->pPars->fPower )
232 if ( !fPreprocess || pCut->
nLeaves <= 1 )
233 If_CutCopy(
p, pCutSet->
ppCuts[pCutSet->
nCuts++], pCut );
244 if ( If_WordCountOnes(pCut0->
uSign | pCut1->
uSign) >
p->pPars->nLutSize )
261 if (
p->pPars->fUseTtPerm )
271 if (
p->pPars->fUserLutDec && !fFirst && pCut->
nLeaves >
p->pPars->nLutDecSize )
273 if ( pObj->
fSpec && pCut->
nLeaves == (
unsigned)
p->pPars->nLutSize )
278 if ( !
p->pPars->fSkipCutFilter &&
If_CutFilter( pCutSet, pCut, fSave0 ) )
287 if (
p->pPars->fTruth )
291 if (
p->pPars->fVerbose )
293 if (
p->pPars->fUseTtPerm )
297 if (
p->pPars->fVerbose )
298 p->timeCache[4] += Abc_Clock() - clk;
299 if ( !
p->pPars->fSkipCutFilter && fChange &&
If_CutFilter( pCutSet, pCut, fSave0 ) )
303 if (
p->pPars->fUseDsd )
306 int truthId = Abc_Lit2Var(pCut->
iCutFunc);
307 if ( truthId >= Vec_IntSize(
p->vTtDsds[pCut->
nLeaves]) || Vec_IntEntry(
p->vTtDsds[pCut->
nLeaves], truthId) == -1 )
309 while ( truthId >= Vec_IntSize(
p->vTtDsds[pCut->
nLeaves]) )
311 Vec_IntPush(
p->vTtDsds[pCut->
nLeaves], -1 );
312 for ( v = 0; v < Abc_MaxInt(6, pCut->
nLeaves); v++ )
315 iCutDsd =
If_DsdManCompute(
p->pIfDsdMan, If_CutTruthWR(
p, pCut), pCut->
nLeaves, (
unsigned char *)If_CutDsdPerm(
p, pCut),
p->pPars->pLutStruct );
316 Vec_IntWriteEntry(
p->vTtDsds[pCut->
nLeaves], truthId, iCutDsd );
323 if (
p->pPars->pFuncCell ||
p->pPars->pFuncCell2 )
325 assert(
p->pPars->fUseTtPerm == 0 );
327 if (
p->pPars->fUseDsd )
329 else if (
p->pPars->pFuncCell2 )
332 pCut->
fUseless = !
p->pPars->pFuncCell(
p, If_CutTruth(
p, pCut), Abc_MaxInt(6, pCut->
nLeaves), pCut->
nLeaves,
p->pPars->pLutStruct );
338 if ( (
p->pPars->fEnableCheck75 ||
p->pPars->fEnableCheck75u) && pCut->
nLeaves == 5 && pCut->
nLimit == 5 )
342 unsigned TruthU = *If_CutTruth(
p, pCut);
350 else if (
p->pPars->fVerbose && pCut->
nLeaves == 5 )
354 unsigned TruthU = *If_CutTruth(
p, pCut);
361 else if (
p->pPars->fUseDsdTune )
369 else if (
p->pPars->fUse34Spec )
372 if ( pCut->
nLeaves == 4 && !Abc_Tt4Check( (
int)(0xFFFF & *If_CutTruth(
p, pCut)) ) )
377 if (
p->pPars->fUseAndVars )
379 int iDecMask = -1, truthId = Abc_Lit2Var(pCut->
iCutFunc);
380 assert(
p->pPars->nLutSize <= 13 );
381 if ( truthId >= Vec_IntSize(
p->vTtDecs[pCut->
nLeaves]) || Vec_IntEntry(
p->vTtDecs[pCut->
nLeaves], truthId) == -1 )
383 while ( truthId >= Vec_IntSize(
p->vTtDecs[pCut->
nLeaves]) )
384 Vec_IntPush(
p->vTtDecs[pCut->
nLeaves], -1 );
385 if ( (
int)pCut->
nLeaves >
p->pPars->nLutSize / 2 && (
int)pCut->
nLeaves <= 2 * (
p->pPars->nLutSize / 2) )
386 iDecMask = Abc_TtProcessBiDec( If_CutTruthWR(
p, pCut), (
int)pCut->
nLeaves,
p->pPars->nLutSize / 2 );
389 Vec_IntWriteEntry(
p->vTtDecs[pCut->
nLeaves], truthId, iDecMask );
391 iDecMask = Vec_IntEntry(
p->vTtDecs[pCut->
nLeaves], truthId);
393 pCut->
fUseless = (int)(iDecMask == 0 && (
int)pCut->
nLeaves >
p->pPars->nLutSize / 2);
399 if (
p->pPars->fUseCofVars && (!
p->pPars->fUseAndVars || pCut->
fUseless) )
401 int iCofVar = -1, truthId = Abc_Lit2Var(pCut->
iCutFunc);
402 if ( truthId >= Vec_StrSize(
p->vTtVars[pCut->
nLeaves]) || Vec_StrEntry(
p->vTtVars[pCut->
nLeaves], truthId) == (
char)-1 )
404 while ( truthId >= Vec_StrSize(
p->vTtVars[pCut->
nLeaves]) )
405 Vec_StrPush(
p->vTtVars[pCut->
nLeaves], (
char)-1 );
406 iCofVar = Abc_TtCheckCondDep( If_CutTruthWR(
p, pCut), pCut->
nLeaves,
p->pPars->nLutSize / 2 );
407 Vec_StrWriteEntry(
p->vTtVars[pCut->
nLeaves], truthId, (
char)iCofVar );
409 iCofVar = Vec_StrEntry(
p->vTtVars[pCut->
nLeaves], truthId);
421 pCut->
fUser = (
p->pPars->pFuncCost != NULL);
422 pCut->
Cost =
p->pPars->pFuncCost?
p->pPars->pFuncCost(
p, pCut) : 0;
426 if (
p->pPars->fDelayOpt )
428 else if (
p->pPars->fDsdBalance )
430 else if (
p->pPars->fUserRecLib )
432 else if (
p->pPars->fUserLutDec )
437 else if (
p->pPars->fUserLut2D )
442 else if (
p->pPars->fUserSesLib )
449 for ( v = 0; v < If_CutLeaveNum(pCut); v++ )
455 else if (
p->pPars->fDelayOptLut )
457 else if(
p->pPars->nGateSize > 0 )
461 if ( pCut->
Delay == -1 )
467 if (
p->pPars->fEdge )
469 if (
p->pPars->fPower )
482 If_CutCopy(
p, If_ObjCutBest(pObj), pCutSet->
ppCuts[0] );
483 if (
p->pPars->fUserRecLib ||
p->pPars->fUserSesLib )
487 if ( !pObj->
fSkipCut && If_ObjCutBest(pObj)->nLeaves > 1 )
498 if ( Mode && pObj->
nRefs > 0 )
500 if ( If_ObjCutBest(pObj)->fUseless )
501 Abc_Print( 1,
"The best cut is useless.\n" );
503 if (
p->pPars->pFuncUser )
505 p->pPars->pFuncUser(
p, pObj, pCut );
526 int i, fSave0 =
p->pPars->fDelayOpt ||
p->pPars->fDelayOptLut ||
p->pPars->fDsdBalance ||
p->pPars->fUserRecLib ||
p->pPars->fUserSesLib ||
p->pPars->fUse34Spec ||
p->pPars->fUserLutDec ||
p->pPars->fUserLut2D;
530 if ( Mode && pObj->
nRefs > 0 )
534 for ( pTemp = pObj; pTemp; pTemp = pTemp->
pEquiv )
542 for ( pTemp = pObj->
pEquiv; pTemp; pTemp = pTemp->
pEquiv )
555 If_CutCopy(
p, pCut, pCutTemp );
567 if (
p->pPars->fEdge )
569 if (
p->pPars->fPower )
580 If_CutCopy(
p, If_ObjCutBest(pObj), pCutSet->
ppCuts[0] );
582 if ( !pObj->
fSkipCut && If_ObjCutBest(pObj)->nLeaves > 1 )
589 if ( Mode && pObj->
nRefs > 0 )
613 assert( Mode >= 0 && Mode <= 2 );
614 p->nBestCutSmall[0] =
p->nBestCutSmall[1] = 0;
616 if ( Mode ||
p->pPars->fArea )
618 else if (
p->pPars->fFancy )
623 p->nCutsUsed = nCutsUsed;
629 if (
p->pManTim != NULL )
634 if ( If_ObjIsAnd(pObj) )
640 else if ( If_ObjIsCi(pObj) )
644 If_ObjSetArrTime( pObj, arrTime );
646 else if ( If_ObjIsCo(pObj) )
648 arrTime = If_ObjArrTime( If_ObjFanin0(pObj) );
651 else if ( If_ObjIsConst1(pObj) )
654 If_ObjSetArrTime( pObj, arrTime );
666 Extra_ProgressBarUpdate( pProgress, i, pLabel );
679 if (
p->pPars->fVerbose )
681 char Symb = fPreprocess?
'P' : ((Mode == 0)?
'D' : ((Mode == 1)?
'F' :
'A'));
682 Abc_Print( 1,
"%c: Del = %7.2f. Ar = %9.1f. Edge = %8d. ",
683 Symb,
p->RequiredGlo,
p->AreaGlo,
p->nNets );
685 Abc_Print( 1,
"Switch = %7.2f. ",
p->dPower );
686 Abc_Print( 1,
"Cut = %8d. ",
p->nCutsMerged );
687 Abc_PrintTime( 1,
"T", Abc_Clock() - clk );
#define ABC_SWAP(Type, a, b)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
ABC_NAMESPACE_IMPL_START void If_ManCacheRecord(If_Man_t *p, int iDsd0, int iDsd1, int nShared, int iDsd)
DECLARATIONS ///.
int If_CluCheckDecInAny(word t, int nVars)
int If_CluCheckDecOut(word t, int nVars)
int If_ManCutAigDelay_rec(If_Man_t *p, If_Obj_t *pObj, Vec_Ptr_t *vVisited)
FUNCTION DEFINITIONS ///.
float If_CutDelaySpecial(If_Man_t *p, If_Cut_t *pCut, int fCarry)
void If_ObjPerformMappingAnd(If_Man_t *p, If_Obj_t *pObj, int Mode, int fPreprocess, int fFirst)
int Abc_ExactDelayCost(word *pTruth, int nVars, int *pArrTimeProfile, char *pPerm, int *Cost, int AigLevel)
void If_ObjPerformMappingChoice(If_Man_t *p, If_Obj_t *pObj, int Mode, int fPreprocess)
ABC_NAMESPACE_IMPL_START char * Dau_DsdMerge(char *pDsd0i, int *pPerm0, char *pDsd1i, int *pPerm1, int fCompl0, int fCompl1, int nVars)
DECLARATIONS ///.
int * If_CutArrTimeProfile(If_Man_t *p, If_Cut_t *pCut)
int If_ManCutAigDelay(If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut)
int If_ManPerformMappingRound(If_Man_t *p, int nCutsUsed, int Mode, int fPreprocess, int fFirst, char *pLabel)
int If_CutDelayRecCost3(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pObj)
int If_CutMerge(If_Man_t *p, If_Cut_t *pCut0, If_Cut_t *pCut1, If_Cut_t *pCut)
#define If_ManForEachObj(p, pObj, i)
float If_CutAreaDeref(If_Man_t *p, If_Cut_t *pCut)
int If_CutComputeTruthPerm(If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int fCompl0, int fCompl1)
void If_ManSetupCutTriv(If_Man_t *p, If_Cut_t *pCut, int ObjId)
float If_CutPowerFlow(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
float If_CutEdgeDerefed(If_Man_t *p, If_Cut_t *pCut)
float If_CutDelay(If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut)
float If_CutEdgeFlow(If_Man_t *p, If_Cut_t *pCut)
int If_CutFilter(If_Set_t *pCutSet, If_Cut_t *pCut, int fSaveCut0)
struct If_Cut_t_ If_Cut_t
float If_CutAreaRef(If_Man_t *p, If_Cut_t *pCut)
If_Set_t * If_ManSetupNodeCutSet(If_Man_t *p, If_Obj_t *pObj)
int If_DsdManSuppSize(If_DsdMan_t *p, int iDsd)
float If_CutAreaFlow(If_Man_t *p, If_Cut_t *pCut)
void If_ManDerefChoiceCutSet(If_Man_t *p, If_Obj_t *pObj)
int If_CutLutBalanceEval(If_Man_t *p, If_Cut_t *pCut)
int If_DsdManCompute(If_DsdMan_t *p, word *pTruth, int nLeaves, unsigned char *pPerm, char *pLutStruct)
int If_CutDsdBalanceEval(If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
int If_CutDelaySop(If_Man_t *p, If_Cut_t *pCut)
int If_LutDecReEval(If_Man_t *p, If_Cut_t *pCut)
struct If_Set_t_ If_Set_t
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
void If_ManComputeRequired(If_Man_t *p)
int If_DsdManReadMark(If_DsdMan_t *p, int iDsd)
int If_Lut2DecEval(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pObj, int optDelay, int fFirst)
void If_CutSort(If_Man_t *p, If_Set_t *pCutSet, If_Cut_t *pCut)
int If_CutCheckTruth6(If_Man_t *p, If_Cut_t *pCut)
#define If_ObjForEachCut(pObj, pCut, i)
struct If_Man_t_ If_Man_t
BASIC TYPES ///.
void If_ManDerefNodeCutSet(If_Man_t *p, If_Obj_t *pObj)
#define If_ManForEachNode(p, pObj, i)
float If_CutAreaDerefed(If_Man_t *p, If_Cut_t *pCut)
int If_CutSopBalanceEval(If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
int If_CutMergeOrdered(If_Man_t *p, If_Cut_t *pCut0, If_Cut_t *pCut1, If_Cut_t *pCut)
struct If_Obj_t_ If_Obj_t
float If_CutPowerDerefed(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
int If_CutComputeTruth(If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int fCompl0, int fCompl1)
int If_LutDecEval(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pObj, int optDelay, int fFirst)
int If_DsdManCheckDec(If_DsdMan_t *p, int iDsd)
unsigned __int64 word
DECLARATIONS ///.
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.