Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
2f926f2f
Commit
2f926f2f
authored
Mar 30, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving cut computation.
parent
7d500c89
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
39 additions
and
226 deletions
+39
-226
src/aig/gia/giaIf.c
+1
-1
src/aig/gia/giaJf.c
+2
-0
src/aig/gia/giaKf.c
+1
-19
src/base/abci/abc.c
+3
-3
src/base/abci/abcIf.c
+1
-1
src/map/if/if.h
+2
-0
src/map/if/ifCache.c
+3
-3
src/map/if/ifCut.c
+0
-0
src/map/if/ifMan.c
+3
-18
src/map/if/ifMap.c
+15
-50
src/map/if/ifReduce.c
+1
-119
src/map/if/ifTruth.c
+7
-12
No files found.
src/aig/gia/giaIf.c
View file @
2f926f2f
...
...
@@ -1291,7 +1291,7 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
{
pCutBest
=
If_ObjCutBest
(
pIfObj
);
// perform sorting of cut leaves by delay, so that the slowest pin drives the fastest input of the LUT
if
(
!
pIfMan
->
pPars
->
fDelayOpt
&&
!
pIfMan
->
pPars
->
pLutStruct
&&
!
pIfMan
->
pPars
->
fUserRecLib
&&
!
pIfMan
->
pPars
->
nGateSize
&&
!
pIfMan
->
pPars
->
fEnableCheck75
&&
!
pIfMan
->
pPars
->
fEnableCheck75u
&&
!
pIfMan
->
pPars
->
fEnableCheck07
)
if
(
!
pIfMan
->
pPars
->
f
UseTtPerm
&&
!
pIfMan
->
pPars
->
f
DelayOpt
&&
!
pIfMan
->
pPars
->
pLutStruct
&&
!
pIfMan
->
pPars
->
fUserRecLib
&&
!
pIfMan
->
pPars
->
nGateSize
&&
!
pIfMan
->
pPars
->
fEnableCheck75
&&
!
pIfMan
->
pPars
->
fEnableCheck75u
&&
!
pIfMan
->
pPars
->
fEnableCheck07
)
If_CutRotatePins
(
pIfMan
,
pCutBest
);
// collect leaves of the best cut
Vec_IntClear
(
vLeaves
);
...
...
src/aig/gia/giaJf.c
View file @
2f926f2f
...
...
@@ -594,6 +594,8 @@ static inline int Jf_CutMergeOrder( int * pCut0, int * pCut1, int * pCut, int Lu
}
// compare two cuts with different numbers
i
=
k
=
c
=
s
=
0
;
if
(
nSize0
==
0
)
goto
FlushCut1
;
if
(
nSize1
==
0
)
goto
FlushCut0
;
while
(
1
)
{
if
(
c
==
LutSize
)
return
0
;
...
...
src/aig/gia/giaKf.c
View file @
2f926f2f
...
...
@@ -534,14 +534,7 @@ static inline int Kf_SetCutIsContainedSimple( Kf_Cut_t * pBase, Kf_Cut_t * pCut
int
*
pB
=
pBase
->
pLeaves
;
int
*
pC
=
pCut
->
pLeaves
;
int
i
,
k
;
if
(
nSizeB
==
nSizeC
)
{
for
(
i
=
0
;
i
<
nSizeB
;
i
++
)
if
(
pBase
->
pLeaves
[
i
]
!=
pCut
->
pLeaves
[
i
]
)
return
0
;
return
1
;
}
assert
(
nSizeB
>
nSizeC
);
assert
(
nSizeB
>=
nSizeC
);
for
(
i
=
0
;
i
<
nSizeC
;
i
++
)
{
for
(
k
=
0
;
k
<
nSizeB
;
k
++
)
...
...
@@ -560,17 +553,6 @@ static inline int Kf_SetMergeSimpleOne( Kf_Cut_t * pCut0, Kf_Cut_t * pCut1, Kf_C
int
*
pC1
=
pCut1
->
pLeaves
;
int
*
pC
=
pCut
->
pLeaves
;
int
i
,
k
,
c
;
// the case of the largest cut sizes
if
(
nSize0
==
nLutSize
&&
nSize1
==
nLutSize
)
{
for
(
i
=
0
;
i
<
nSize0
;
i
++
)
{
if
(
pC0
[
i
]
!=
pC1
[
i
]
)
return
0
;
pC
[
i
]
=
pC0
[
i
];
}
pCut
->
nLeaves
=
nLutSize
;
return
1
;
}
// compare two cuts with different numbers
c
=
nSize0
;
for
(
i
=
0
;
i
<
nSize1
;
i
++
)
...
...
src/base/abci/abc.c
View file @
2f926f2f
...
...
@@ -15118,7 +15118,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars
->
fTruth
=
1
;
pPars
->
fCutMin
=
1
;
pPars
->
fExpRed
=
0
;
pPars
->
fUsePerm
=
1
;
pPars
->
fUsePerm
=
pPars
->
fUseDsd
;
}
if
(
pPars
->
fUseDsd
)
...
...
@@ -29867,7 +29867,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars
->
fTruth
=
1
;
pPars
->
fCutMin
=
1
;
pPars
->
fExpRed
=
0
;
pPars
->
fUsePerm
=
1
;
pPars
->
fUsePerm
=
pPars
->
fUseDsd
;
}
if
(
pPars
->
fUseDsd
)
...
...
@@ -29924,7 +29924,7 @@ usage:
sprintf
(
LutSize
,
"library"
);
else
sprintf
(
LutSize
,
"%d"
,
pPars
->
nLutSize
);
Abc_Print
(
-
2
,
"usage: &if [-KCFAGRT num] [-DEW float] [-S str] [-qarlepmsdbgyojikfu
c
ztncvh]
\n
"
);
Abc_Print
(
-
2
,
"usage: &if [-KCFAGRT num] [-DEW float] [-S str] [-qarlepmsdbgyojikfuztncvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs FPGA technology mapping of the network
\n
"
);
Abc_Print
(
-
2
,
"
\t
-K num : the number of LUT inputs (2 < num < %d) [default = %s]
\n
"
,
IF_MAX_LUTSIZE
+
1
,
LutSize
);
Abc_Print
(
-
2
,
"
\t
-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]
\n
"
,
pPars
->
nCutsMax
);
src/base/abci/abcIf.c
View file @
2f926f2f
...
...
@@ -437,7 +437,7 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
pCutBest
=
If_ObjCutBest
(
pIfObj
);
// printf( "%d 0x%02X %d\n", pCutBest->nLeaves, 0xff & *If_CutTruth(pCutBest), pIfMan->pPars->pFuncCost(pCutBest) );
// if ( pIfMan->pPars->pLutLib && pIfMan->pPars->pLutLib->fVarPinDelays )
if
(
!
pIfMan
->
pPars
->
fDelayOpt
&&
!
pIfMan
->
pPars
->
pLutStruct
&&
!
pIfMan
->
pPars
->
fUserRecLib
&&
!
pIfMan
->
pPars
->
nGateSize
)
if
(
!
pIfMan
->
pPars
->
f
UseTtPerm
&&
!
pIfMan
->
pPars
->
f
DelayOpt
&&
!
pIfMan
->
pPars
->
pLutStruct
&&
!
pIfMan
->
pPars
->
fUserRecLib
&&
!
pIfMan
->
pPars
->
nGateSize
)
If_CutRotatePins
(
pIfMan
,
pCutBest
);
if
(
pIfMan
->
pPars
->
fUseCnfs
||
pIfMan
->
pPars
->
fUseMv
)
{
...
...
src/map/if/if.h
View file @
2f926f2f
...
...
@@ -481,9 +481,11 @@ static inline void If_AndClear( If_And_t * pNode ) { *
extern
int
If_ManPerformMapping
(
If_Man_t
*
p
);
extern
int
If_ManPerformMappingComb
(
If_Man_t
*
p
);
/*=== ifCut.c ============================================================*/
extern
int
If_CutVerifyCuts
(
If_Set_t
*
pCutSet
,
int
fOrdered
);
extern
int
If_CutFilter
(
If_Set_t
*
pCutSet
,
If_Cut_t
*
pCut
);
extern
void
If_CutSort
(
If_Man_t
*
p
,
If_Set_t
*
pCutSet
,
If_Cut_t
*
pCut
);
extern
void
If_CutOrder
(
If_Cut_t
*
pCut
);
extern
int
If_CutMergeOrdered
(
If_Man_t
*
p
,
If_Cut_t
*
pCut0
,
If_Cut_t
*
pCut1
,
If_Cut_t
*
pCut
);
extern
int
If_CutMerge
(
If_Man_t
*
p
,
If_Cut_t
*
pCut0
,
If_Cut_t
*
pCut1
,
If_Cut_t
*
pCut
);
extern
int
If_CutCheck
(
If_Cut_t
*
pCut
);
extern
void
If_CutPrint
(
If_Cut_t
*
pCut
);
...
...
src/map/if/ifCache.c
View file @
2f926f2f
...
...
@@ -79,14 +79,14 @@ void If_ManCacheAnalize( If_Man_t * p )
{
uUnique
=
Vec_IntCountUnique
(
vTest
[
i
]);
printf
(
"%2d-var entries = %8d. (%6.2f %%) Unique entries = %8d. (%6.2f %%)
\n
"
,
i
,
Vec_IntSize
(
vTest
[
i
]),
100
.
0
*
Vec_IntSize
(
vTest
[
i
])
/
Vec_IntSize
(
vRes
),
uUnique
,
100
.
0
*
uUnique
/
Vec_IntSize
(
vTest
[
i
]
)
);
i
,
Vec_IntSize
(
vTest
[
i
]),
100
.
0
*
Vec_IntSize
(
vTest
[
i
])
/
Abc_MaxInt
(
1
,
Vec_IntSize
(
vRes
)
),
uUnique
,
100
.
0
*
uUnique
/
Abc_MaxInt
(
1
,
Vec_IntSize
(
vTest
[
i
])
)
);
}
for
(
i
=
0
;
i
<=
p
->
pPars
->
nLutSize
;
i
++
)
Vec_IntFree
(
vTest
[
i
]
);
uUnique
=
Vec_IntCountUnique
(
vRes
);
printf
(
"Total entries = %8d. (%6.2f %%) Unique entries = %8d. (%6.2f %%)
\n
"
,
Vec_IntSize
(
p
->
vCutData
)
/
4
,
100
.
0
,
uUnique
,
100
.
0
*
uUnique
/
(
Vec_IntSize
(
p
->
vCutData
)
/
4
)
);
Vec_IntSize
(
p
->
vCutData
)
/
4
,
100
.
0
,
uUnique
,
100
.
0
*
uUnique
/
Abc_MaxInt
(
1
,
Vec_IntSize
(
p
->
vCutData
)
/
4
)
);
Vec_IntFree
(
vRes
);
}
...
...
src/map/if/ifCut.c
View file @
2f926f2f
This diff is collapsed.
Click to expand it.
src/map/if/ifMan.c
View file @
2f926f2f
...
...
@@ -154,21 +154,6 @@ void If_ManStop( If_Man_t * p )
extern
void
If_ManCacheAnalize
(
If_Man_t
*
p
);
if
(
p
->
pPars
->
fVerbose
&&
p
->
vCutData
)
If_ManCacheAnalize
(
p
);
/*
if ( p->pIfDsdMan )
{
If_DsdMan_t * pNew;
If_DsdManSave( p->pIfDsdMan, NULL );
pNew = If_DsdManLoad( If_DsdManFileName(p->pIfDsdMan) );
If_DsdManFree( pNew, 1 );
}
*/
{
// extern void If_CluHashFindMedian( If_Man_t * p );
// extern void If_CluHashTableCheck( If_Man_t * p );
// If_CluHashFindMedian( p );
// If_CluHashTableCheck( p );
}
if
(
p
->
pPars
->
fVerbose
&&
p
->
vTtMem
)
printf
(
"Unique truth tables = %d. Memory = %.2f MB
\n
"
,
Vec_MemEntryNum
(
p
->
vTtMem
),
Vec_MemMemory
(
p
->
vTtMem
)
/
(
1
<<
20
)
);
if
(
p
->
pPars
->
fVerbose
&&
p
->
nCutsUselessAll
)
...
...
@@ -452,10 +437,10 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId )
pCut
->
nLeaves
=
1
;
pCut
->
pLeaves
[
0
]
=
p
->
pPars
->
fLiftLeaves
?
(
ObjId
<<
8
)
:
ObjId
;
pCut
->
uSign
=
If_ObjCutSign
(
pCut
->
pLeaves
[
0
]
);
pCut
->
iCutFunc
=
p
->
pPars
->
fTruth
?
2
:
-
1
;
pCut
->
iCutDsd
=
(
p
->
pPars
->
fUseDsd
||
p
->
pPars
->
fUseTtPerm
)
?
2
:
-
1
;
pCut
->
iCutFunc
=
(
p
->
pPars
->
fTruth
||
p
->
pPars
->
fUseTtPerm
)
?
2
:
-
1
;
pCut
->
iCutDsd
=
p
->
pPars
->
fUseDsd
?
2
:
(
p
->
pPars
->
fUseTtPerm
?
0
:
-
1
)
;
assert
(
pCut
->
pLeaves
[
0
]
<
p
->
vObjs
->
nSize
);
if
(
p
->
pPars
->
fUseDsd
||
p
->
pPars
->
fUseTtPerm
)
if
(
p
->
pPars
->
fUseDsd
)
pCut
->
pPerm
[
0
]
=
0
;
}
...
...
src/map/if/ifMap.c
View file @
2f926f2f
...
...
@@ -140,7 +140,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
{
If_Set_t
*
pCutSet
;
If_Cut_t
*
pCut0
,
*
pCut1
,
*
pCut
;
int
i
,
k
,
v
;
int
i
,
k
,
v
,
fChange
;
assert
(
p
->
pPars
->
fSeqMap
||
!
If_ObjIsAnd
(
pObj
->
pFanin0
)
||
pObj
->
pFanin0
->
pCutSet
->
nCuts
>
0
);
assert
(
p
->
pPars
->
fSeqMap
||
!
If_ObjIsAnd
(
pObj
->
pFanin1
)
||
pObj
->
pFanin1
->
pCutSet
->
nCuts
>
0
);
...
...
@@ -197,28 +197,36 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
if
(
If_WordCountOnes
(
pCut0
->
uSign
|
pCut1
->
uSign
)
>
p
->
pPars
->
nLutSize
)
continue
;
// merge the cuts
if
(
p
->
pPars
->
fUseTtPerm
)
{
if
(
!
If_CutMerge
(
p
,
pCut0
,
pCut1
,
pCut
)
)
continue
;
assert
(
If_CutCheck
(
pCut
)
);
}
else
{
if
(
!
If_CutMergeOrdered
(
p
,
pCut0
,
pCut1
,
pCut
)
)
continue
;
}
if
(
pObj
->
fSpec
&&
pCut
->
nLeaves
==
(
unsigned
)
p
->
pPars
->
nLutSize
)
continue
;
p
->
nCutsMerged
++
;
p
->
nCutsTotal
++
;
// check if this cut is contained in any of the available cuts
// if ( p->pPars->pFuncCost == NULL && If_CutFilter( p, pCut ) ) // do not filter functionality cuts
if
(
!
p
->
pPars
->
fSkipCutFilter
&&
If_CutFilter
(
pCutSet
,
pCut
)
)
continue
;
// compute the truth table
pCut
->
fCompl
=
0
;
pCut
->
iCutFunc
=
-
1
;
pCut
->
iCutDsd
=
-
1
;
if
(
p
->
pPars
->
fTruth
)
if
(
p
->
pPars
->
fTruth
&&
!
p
->
pPars
->
fUseTtPerm
)
{
// abctime clk = Abc_Clock();
if
(
p
->
pPars
->
fUseTtPerm
)
If_CutComputeTruthPerm
(
p
,
pCut
,
pCut0
,
pCut1
,
pObj
->
fCompl0
,
pObj
->
fCompl1
);
fChange
=
If_CutComputeTruthPerm
(
p
,
pCut
,
pCut0
,
pCut1
,
pObj
->
fCompl0
,
pObj
->
fCompl1
);
else
If_CutComputeTruth
(
p
,
pCut
,
pCut0
,
pCut1
,
pObj
->
fCompl0
,
pObj
->
fCompl1
);
fChange
=
If_CutComputeTruth
(
p
,
pCut
,
pCut0
,
pCut1
,
pObj
->
fCompl0
,
pObj
->
fCompl1
);
if
(
!
p
->
pPars
->
fSkipCutFilter
&&
fChange
&&
If_CutFilter
(
pCutSet
,
pCut
)
)
continue
;
// p->timeTruth += Abc_Clock() - clk;
if
(
p
->
pPars
->
fUseDsd
)
{
...
...
@@ -283,50 +291,6 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
p
->
nCuts5a
++
;
}
}
/*
if ( p->pPars->fUseDsd )
{
if ( p->pPars->pLutStruct )
{
int Value = If_DsdManCheckDec( p->pIfDsdMan, pCut->iCutDsd );
if ( Value != (int)pCut->fUseless )
{
if ( pCut->fUseless && !Value )
p->nCountNonDec[0]++;
if ( !pCut->fUseless && Value )
p->nCountNonDec[1]++;
// if ( pCut->fUseless && !Value )
// printf( "Old does not work. New works.\n" );
if ( !pCut->fUseless && Value )
printf( "Old works. New does not work. DSD = %d.\n", Abc_Lit2Var(pCut->iCutDsd) );
if ( !pCut->fUseless && Value )
{
extern word If_Dec6Perform( word t, int fDerive );
extern word * If_DsdManComputeTruth( If_DsdMan_t * p, int iDsd, unsigned char * pPermLits );
int s;
// word z, t = *If_CutTruthW(p, pCut);
word z, t = *If_DsdManComputeTruth( p->pIfDsdMan, pCut->iCutDsd, NULL );
Extra_PrintHex( stdout, (unsigned *)If_CutTruthW(p, pCut), pCut->nLeaves ); printf( "\n" );
Dau_DsdPrintFromTruth( &t, pCut->nLeaves );
// Dau_DsdPrintFromTruth( If_CutTruthW(p, pCut), pCut->nLeaves );
// If_DsdManPrintOne( stdout, p->pIfDsdMan, Abc_Lit2Var(pCut->iCutDsd), pCut->pPerm, 1 );
// printf( "Old works. New does not work. DSD = %d.\n", Abc_Lit2Var(pCut->iCutDsd) );
z = If_Dec6Perform( t, 1 );
If_DecPrintConfig( z );
s = If_DsdManCheckXY( p->pIfDsdMan, pCut->iCutDsd, 4, 0, 0, 1 );
printf( "Confirm %d\n", s );
s = 0;
}
}
}
}
*/
}
// compute the application-specific cost and depth
...
...
@@ -362,6 +326,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
// If_CutTraverse( p, pObj, pCut );
}
assert
(
pCutSet
->
nCuts
>
0
);
// If_CutVerifyCuts( pCutSet, !p->pPars->fUseTtPerm );
// update the best cut
if
(
!
fPreprocess
||
pCutSet
->
ppCuts
[
0
]
->
Delay
<=
pObj
->
Required
+
p
->
fEpsilon
)
...
...
src/map/if/ifReduce.c
View file @
2f926f2f
...
...
@@ -27,7 +27,6 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
static
void
If_ManImproveReduce
(
If_Man_t
*
p
,
int
nLimit
);
static
void
If_ManImproveExpand
(
If_Man_t
*
p
,
int
nLimit
);
static
void
If_ManImproveNodeExpand
(
If_Man_t
*
p
,
If_Obj_t
*
pObj
,
int
nLimit
,
Vec_Ptr_t
*
vFront
,
Vec_Ptr_t
*
vFrontOld
,
Vec_Ptr_t
*
vVisited
);
static
void
If_ManImproveNodePrepare
(
If_Man_t
*
p
,
If_Obj_t
*
pObj
,
int
nLimit
,
Vec_Ptr_t
*
vFront
,
Vec_Ptr_t
*
vFrontOld
,
Vec_Ptr_t
*
vVisited
);
...
...
@@ -62,29 +61,6 @@ void If_ManImproveMapping( If_Man_t * p )
p
->
RequiredGlo
,
p
->
AreaGlo
,
p
->
nNets
,
p
->
dPower
,
p
->
nCutsMerged
);
Abc_PrintTime
(
1
,
"T"
,
Abc_Clock
()
-
clk
);
}
/*
clk = Abc_Clock();
If_ManImproveReduce( p, p->pPars->nLutSize );
If_ManComputeRequired( p, 0 );
if ( p->pPars->fVerbose )
{
Abc_Print( 1, "R: Del = %6.2f. Area = %8.2f. Nets = %6d. Cuts = %8d. Lim = %2d. Ave = %5.2f. ",
p->RequiredGlo, p->AreaGlo, p->nNets, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
Abc_PrintTime( 1, "T", Abc_Clock() - clk );
}
*/
/*
clk = Abc_Clock();
If_ManImproveExpand( p, p->pPars->nLutSize );
If_ManComputeRequired( p, 0 );
if ( p->pPars->fVerbose )
{
Abc_Print( 1, "E: Del = %6.2f. Area = %8.2f. Nets = %6d. Cuts = %8d. Lim = %2d. Ave = %5.2f. ",
p->RequiredGlo, p->AreaGlo, p->nNets, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
Abc_PrintTime( 1, "T", Abc_Clock() - clk );
}
*/
}
/**Function*************************************************************
...
...
@@ -267,6 +243,7 @@ void If_ManImproveNodeUpdate( If_Man_t * p, If_Obj_t * pObj, Vec_Ptr_t * vFront
Vec_PtrForEachEntry
(
If_Obj_t
*
,
vFront
,
pFanin
,
i
)
pCut
->
pLeaves
[
i
]
=
pFanin
->
Id
;
If_CutOrder
(
pCut
);
pCut
->
uSign
=
If_ObjCutSignCompute
(
pCut
);
// ref the new cut
If_CutAreaRef
(
p
,
pCut
);
}
...
...
@@ -477,101 +454,6 @@ void If_ManImproveNodeFaninCompact( If_Man_t * p, If_Obj_t * pObj, int nLimit, V
}
/**Function*************************************************************
Synopsis [Performs fast mapping for one node.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
If_ManImproveNodeReduce
(
If_Man_t
*
p
,
If_Obj_t
*
pObj
,
int
nLimit
)
{
/*
If_Cut_t * pCut, * pCut0, * pCut1, * pCutR;
If_Obj_t * pFanin0, * pFanin1;
float AreaBef, AreaAft;
int RetValue;
assert( nLimit <= 32 );
assert( If_ObjIsAnd(pObj) );
// get the fanins
pFanin0 = If_ObjFanin0(pObj);
pFanin1 = If_ObjFanin1(pObj);
// get the cuts
pCut = If_ObjCutBest(pObj);
pCut0 = If_ObjIsCi(pFanin0) ? If_ObjCutTriv(pFanin0) : If_ObjCutBest(pFanin0);
pCut1 = If_ObjIsCi(pFanin1) ? If_ObjCutTriv(pFanin1) : If_ObjCutBest(pFanin1);
assert( pCut->Delay <= pObj->Required + p->fEpsilon );
// deref the cut if the node is refed
if ( pObj->nRefs > 0 )
If_CutAreaDeref( p, pCut );
// get the area
AreaBef = If_CutAreaDerefed( p, pCut );
// get the fanin support
if ( pFanin0->nRefs > 2 && pCut0->Delay < pObj->Required + p->fEpsilon )
// if ( pSupp0->nRefs > 0 && pSupp0->Delay < pSupp->DelayR ) // this leads to 2% worse results
{
pCut0 = If_ObjCutTriv(pFanin0);
}
// get the fanin support
if ( pFanin1->nRefs > 2 && pCut1->Delay < pObj->Required + p->fEpsilon )
// if ( pSupp1->nRefs > 0 && pSupp1->Delay < pSupp->DelayR )
{
pCut1 = If_ObjCutTriv(pFanin1);
}
// merge the cuts
pCutR = p->ppCuts[0];
RetValue = If_CutMerge( pCut0, pCut1, pCutR );
// try very simple cut
if ( !RetValue )
{
RetValue = If_CutMerge( If_ObjCutTriv(pFanin0), If_ObjCutTriv(pFanin1), pCutR );
assert( RetValue == 1 );
}
if ( RetValue )
{
pCutR->Delay = If_CutDelay( p, pObj, pCutR );
AreaAft = If_CutAreaDerefed( p, pCutR );
// update the best cut
if ( AreaAft < AreaBef - p->fEpsilon && pCutR->Delay < pObj->Required + p->fEpsilon )
If_CutCopy( p, pCut, pCutR );
}
// recompute the delay of the best cut
pCut->Delay = If_CutDelay( p, pObj, pCut );
// ref the cut if the node is refed
if ( pObj->nRefs > 0 )
If_CutRef( p, pCut );
*/
}
/**Function*************************************************************
Synopsis [Performs area recovery for each node.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
If_ManImproveReduce
(
If_Man_t
*
p
,
int
nLimit
)
{
If_Obj_t
*
pObj
;
int
i
;
If_ManForEachNode
(
p
,
pObj
,
i
)
If_ManImproveNodeReduce
(
p
,
pObj
,
nLimit
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/map/if/ifTruth.c
View file @
2f926f2f
...
...
@@ -44,7 +44,7 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
void
If_CutTruthPermute
(
word
*
pTruth
,
int
nLeaves
,
int
nVars
,
int
nWords
,
float
*
pDelays
,
int
*
pVars
,
char
*
pPerm
)
void
If_CutTruthPermute
(
word
*
pTruth
,
int
nLeaves
,
int
nVars
,
int
nWords
,
float
*
pDelays
,
int
*
pVars
)
{
while
(
1
)
{
...
...
@@ -55,8 +55,6 @@ void If_CutTruthPermute( word * pTruth, int nLeaves, int nVars, int nWords, floa
continue
;
ABC_SWAP
(
float
,
pDelays
[
i
],
pDelays
[
i
+
1
]
);
ABC_SWAP
(
int
,
pVars
[
i
],
pVars
[
i
+
1
]
);
if
(
pPerm
)
ABC_SWAP
(
char
,
pPerm
[
i
],
pPerm
[
i
+
1
]
);
if
(
pTruth
)
Abc_TtSwapAdjacent
(
pTruth
,
nWords
,
i
);
fChange
=
1
;
...
...
@@ -70,20 +68,16 @@ void If_CutRotatePins( If_Man_t * p, If_Cut_t * pCut )
If_Obj_t
*
pLeaf
;
float
PinDelays
[
IF_MAX_LUTSIZE
];
int
i
,
truthId
;
assert
(
!
p
->
pPars
->
fUseTtPerm
);
If_CutForEachLeaf
(
p
,
pCut
,
pLeaf
,
i
)
PinDelays
[
i
]
=
If_ObjCutBest
(
pLeaf
)
->
Delay
;
if
(
p
->
vTtMem
==
NULL
)
{
If_CutTruthPermute
(
NULL
,
If_CutLeaveNum
(
pCut
),
pCut
->
nLimit
,
p
->
nTruth6Words
,
PinDelays
,
If_CutLeaves
(
pCut
),
NULL
);
return
;
}
if
(
p
->
pPars
->
fUseTtPerm
)
{
If_CutTruthPermute
(
NULL
,
If_CutLeaveNum
(
pCut
),
pCut
->
nLimit
,
p
->
nTruth6Words
,
PinDelays
,
If_CutLeaves
(
pCut
),
pCut
->
pPerm
);
If_CutTruthPermute
(
NULL
,
If_CutLeaveNum
(
pCut
),
pCut
->
nLimit
,
p
->
nTruth6Words
,
PinDelays
,
If_CutLeaves
(
pCut
)
);
return
;
}
Abc_TtCopy
(
p
->
puTempW
,
If_CutTruthWR
(
p
,
pCut
),
p
->
nTruth6Words
,
0
);
If_CutTruthPermute
(
p
->
puTempW
,
If_CutLeaveNum
(
pCut
),
pCut
->
nLimit
,
p
->
nTruth6Words
,
PinDelays
,
If_CutLeaves
(
pCut
)
,
NULL
);
If_CutTruthPermute
(
p
->
puTempW
,
If_CutLeaveNum
(
pCut
),
pCut
->
nLimit
,
p
->
nTruth6Words
,
PinDelays
,
If_CutLeaves
(
pCut
)
);
truthId
=
Vec_MemHashInsert
(
p
->
vTtMem
,
p
->
puTempW
);
pCut
->
iCutFunc
=
Abc_Var2Lit
(
truthId
,
If_CutTruthIsCompl
(
pCut
)
);
assert
(
(
p
->
puTempW
[
0
]
&
1
)
==
0
);
...
...
@@ -102,7 +96,7 @@ void If_CutRotatePins( If_Man_t * p, If_Cut_t * pCut )
***********************************************************************/
int
If_CutComputeTruth
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
If_Cut_t
*
pCut0
,
If_Cut_t
*
pCut1
,
int
fCompl0
,
int
fCompl1
)
{
int
fCompl
,
truthId
,
nLeavesNew
;
int
fCompl
,
truthId
,
nLeavesNew
,
RetValue
=
0
;
int
iFuncLit0
=
pCut0
->
iCutFunc
;
int
iFuncLit1
=
pCut1
->
iCutFunc
;
int
nWords
=
Abc_TtWordNum
(
pCut
->
nLimit
);
...
...
@@ -124,6 +118,7 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_
{
pCut
->
nLeaves
=
nLeavesNew
;
pCut
->
uSign
=
If_ObjCutSignCompute
(
pCut
);
RetValue
=
1
;
}
}
truthId
=
Vec_MemHashInsert
(
p
->
vTtMem
,
pTruth
);
...
...
@@ -137,7 +132,7 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_
Abc_TtCanonicize
(
pCopy
,
pCut
->
nLimit
,
pCanonPerm
);
}
#endif
return
1
;
return
RetValue
;
}
/**Function*************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment