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
a26d61f4
Commit
a26d61f4
authored
Apr 06, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvement in SOP balancing.
parent
d05f83b2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
151 additions
and
128 deletions
+151
-128
src/aig/gia/giaIf.c
+2
-54
src/base/abci/abc.c
+2
-2
src/base/abci/abcIf.c
+8
-9
src/map/if/if.h
+7
-25
src/map/if/ifDelay.c
+87
-24
src/map/if/ifDsd.c
+12
-7
src/map/if/ifMan.c
+13
-0
src/map/if/ifMap.c
+4
-6
src/map/if/ifTime.c
+0
-0
src/map/if/ifTruth.c
+16
-1
No files found.
src/aig/gia/giaIf.c
View file @
a26d61f4
...
@@ -618,58 +618,6 @@ If_Man_t * Gia_ManToIf( Gia_Man_t * p, If_Par_t * pPars )
...
@@ -618,58 +618,6 @@ If_Man_t * Gia_ManToIf( Gia_Man_t * p, If_Par_t * pPars )
return
pIfMan
;
return
pIfMan
;
}
}
/**Function*************************************************************
Synopsis [Derives node's AIG after SOP balancing]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Gia_ManNodeIfSopToGiaInt
(
Gia_Man_t
*
pNew
,
Vec_Wrd_t
*
vAnds
,
int
nVars
,
Vec_Int_t
*
vLeaves
,
int
fHash
)
{
Vec_Int_t
*
vResults
;
int
iRes0
,
iRes1
,
iRes
=
-
1
;
If_And_t
This
;
word
Entry
;
int
i
;
if
(
Vec_WrdSize
(
vAnds
)
==
0
)
return
0
;
if
(
Vec_WrdSize
(
vAnds
)
==
1
&&
Vec_WrdEntry
(
vAnds
,
0
)
==
0
)
return
1
;
vResults
=
Vec_IntAlloc
(
Vec_WrdSize
(
vAnds
)
);
for
(
i
=
0
;
i
<
nVars
;
i
++
)
Vec_IntPush
(
vResults
,
Vec_IntEntry
(
vLeaves
,
i
)
);
Vec_WrdForEachEntryStart
(
vAnds
,
Entry
,
i
,
nVars
)
{
This
=
If_WrdToAnd
(
Entry
);
iRes0
=
Abc_LitNotCond
(
Vec_IntEntry
(
vResults
,
This
.
iFan0
),
This
.
fCompl0
);
iRes1
=
Abc_LitNotCond
(
Vec_IntEntry
(
vResults
,
This
.
iFan1
),
This
.
fCompl1
);
if
(
fHash
)
iRes
=
Gia_ManHashAnd
(
pNew
,
iRes0
,
iRes1
);
else
if
(
iRes0
==
iRes1
)
iRes
=
iRes0
;
else
iRes
=
Gia_ManAppendAnd
(
pNew
,
iRes0
,
iRes1
);
Vec_IntPush
(
vResults
,
iRes
);
}
Vec_IntFree
(
vResults
);
return
Abc_LitNotCond
(
iRes
,
This
.
fCompl
);
}
int
Gia_ManNodeIfSopToGia
(
Gia_Man_t
*
pNew
,
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vLeaves
,
int
fHash
)
{
int
iResult
;
Vec_Wrd_t
*
vArray
;
vArray
=
If_CutDelaySopArray
(
p
,
pCut
);
iResult
=
Gia_ManNodeIfSopToGiaInt
(
pNew
,
vArray
,
If_CutLeaveNum
(
pCut
),
vLeaves
,
fHash
);
// Vec_WrdFree( vArray );
return
iResult
;
}
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Rebuilds GIA from mini AIG.]
Synopsis [Rebuilds GIA from mini AIG.]
...
@@ -722,9 +670,9 @@ int Gia_ManBuildFromMiniInt( Gia_Man_t * pNew, Vec_Int_t * vLeaves, Vec_Int_t *
...
@@ -722,9 +670,9 @@ int Gia_ManBuildFromMiniInt( Gia_Man_t * pNew, Vec_Int_t * vLeaves, Vec_Int_t *
int
Gia_ManBuildFromMini
(
Gia_Man_t
*
pNew
,
If_Man_t
*
pIfMan
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vLeaves
,
Vec_Int_t
*
vAig
,
int
fHash
,
int
fUseDsd
)
int
Gia_ManBuildFromMini
(
Gia_Man_t
*
pNew
,
If_Man_t
*
pIfMan
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vLeaves
,
Vec_Int_t
*
vAig
,
int
fHash
,
int
fUseDsd
)
{
{
if
(
fUseDsd
)
if
(
fUseDsd
)
If_
DsdCutBalanceAig
(
pIfMan
,
pCut
,
vAig
);
If_
CutDsdBalanceEval
(
pIfMan
,
pCut
,
vAig
);
else
else
If_Cut
DelaySopArray3
(
pIfMan
,
pCut
,
vAig
);
If_Cut
SopBalanceEval
(
pIfMan
,
pCut
,
vAig
);
return
Gia_ManBuildFromMiniInt
(
pNew
,
vLeaves
,
vAig
,
fHash
);
return
Gia_ManBuildFromMiniInt
(
pNew
,
vLeaves
,
vAig
,
fHash
);
}
}
...
...
src/base/abci/abc.c
View file @
a26d61f4
...
@@ -15102,7 +15102,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -15102,7 +15102,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars
->
fTruth
=
1
;
pPars
->
fTruth
=
1
;
pPars
->
fCutMin
=
1
;
pPars
->
fCutMin
=
1
;
pPars
->
fExpRed
=
0
;
pPars
->
fExpRed
=
0
;
pPars
->
fUsePerm
=
1
;
pPars
->
fUsePerm
=
0
;
pPars
->
pLutLib
=
NULL
;
pPars
->
pLutLib
=
NULL
;
}
}
// modify for delay optimization
// modify for delay optimization
...
@@ -29855,7 +29855,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -29855,7 +29855,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars
->
fTruth
=
1
;
pPars
->
fTruth
=
1
;
pPars
->
fCutMin
=
1
;
pPars
->
fCutMin
=
1
;
pPars
->
fExpRed
=
0
;
pPars
->
fExpRed
=
0
;
pPars
->
fUsePerm
=
1
;
pPars
->
fUsePerm
=
0
;
pPars
->
pLutLib
=
NULL
;
pPars
->
pLutLib
=
NULL
;
}
}
// modify for delay optimization
// modify for delay optimization
src/base/abci/abcIf.c
View file @
a26d61f4
...
@@ -391,14 +391,13 @@ Hop_Obj_t * Abc_NodeBuildFromMiniInt( Hop_Man_t * pMan, Vec_Int_t * vAig, int nL
...
@@ -391,14 +391,13 @@ Hop_Obj_t * Abc_NodeBuildFromMiniInt( Hop_Man_t * pMan, Vec_Int_t * vAig, int nL
return
piLit
;
return
piLit
;
}
}
}
}
Hop_Obj_t
*
Abc_NodeBuildFromMini
(
Hop_Man_t
*
pMan
,
If_Man_t
*
p
,
If_Cut_t
*
pCut
)
Hop_Obj_t
*
Abc_NodeBuildFromMini
(
Hop_Man_t
*
pMan
,
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
int
fUseDsd
)
{
{
Hop_Obj_t
*
pResult
;
if
(
fUseDsd
)
if
(
p
->
vArray
==
NULL
)
If_CutDsdBalanceEval
(
p
,
pCut
,
p
->
vArray
);
p
->
vArray
=
Vec_IntAlloc
(
1000
);
else
If_CutDelaySopArray3
(
p
,
pCut
,
p
->
vArray
);
If_CutSopBalanceEval
(
p
,
pCut
,
p
->
vArray
);
pResult
=
Abc_NodeBuildFromMiniInt
(
pMan
,
p
->
vArray
,
If_CutLeaveNum
(
pCut
)
);
return
Abc_NodeBuildFromMiniInt
(
pMan
,
p
->
vArray
,
If_CutLeaveNum
(
pCut
)
);
return
pResult
;
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -477,9 +476,9 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
...
@@ -477,9 +476,9 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
}
}
}
}
else
if
(
pIfMan
->
pPars
->
fDelayOpt
)
else
if
(
pIfMan
->
pPars
->
fDelayOpt
)
pNodeNew
->
pData
=
Abc_NodeBuildFromMini
(
(
Hop_Man_t
*
)
pNtkNew
->
pManFunc
,
pIfMan
,
pCutBest
);
pNodeNew
->
pData
=
Abc_NodeBuildFromMini
(
(
Hop_Man_t
*
)
pNtkNew
->
pManFunc
,
pIfMan
,
pCutBest
,
0
);
else
if
(
pIfMan
->
pPars
->
fDsdBalance
)
else
if
(
pIfMan
->
pPars
->
fDsdBalance
)
pNodeNew
->
pData
=
Abc_NodeBuildFromMini
(
(
Hop_Man_t
*
)
pNtkNew
->
pManFunc
,
pIfMan
,
pCutBest
);
pNodeNew
->
pData
=
Abc_NodeBuildFromMini
(
(
Hop_Man_t
*
)
pNtkNew
->
pManFunc
,
pIfMan
,
pCutBest
,
1
);
else
if
(
pIfMan
->
pPars
->
fUserRecLib
)
else
if
(
pIfMan
->
pPars
->
fUserRecLib
)
{
{
extern
Hop_Obj_t
*
Abc_RecToHop3
(
Hop_Man_t
*
pMan
,
If_Man_t
*
pIfMan
,
If_Cut_t
*
pCut
,
If_Obj_t
*
pIfObj
);
extern
Hop_Obj_t
*
Abc_RecToHop3
(
Hop_Man_t
*
pMan
,
If_Man_t
*
pIfMan
,
If_Cut_t
*
pCut
,
If_Obj_t
*
pIfObj
);
...
...
src/map/if/if.h
View file @
a26d61f4
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include "misc/util/utilTruth.h"
#include "misc/util/utilTruth.h"
#include "opt/dau/dau.h"
#include "opt/dau/dau.h"
#include "misc/vec/vecHash.h"
#include "misc/vec/vecHash.h"
#include "misc/vec/vecWec.h"
ABC_NAMESPACE_HEADER_START
ABC_NAMESPACE_HEADER_START
...
@@ -237,6 +238,7 @@ struct If_Man_t_
...
@@ -237,6 +238,7 @@ struct If_Man_t_
int
nCuts5
,
nCuts5a
;
int
nCuts5
,
nCuts5a
;
If_DsdMan_t
*
pIfDsdMan
;
// DSD manager
If_DsdMan_t
*
pIfDsdMan
;
// DSD manager
Vec_Mem_t
*
vTtMem
[
IF_MAX_FUNC_LUTSIZE
+
1
];
// truth table memory and hash table
Vec_Mem_t
*
vTtMem
[
IF_MAX_FUNC_LUTSIZE
+
1
];
// truth table memory and hash table
Vec_Wec_t
*
vTtIsops
[
IF_MAX_FUNC_LUTSIZE
+
1
];
// mapping of truth table into DSD
Vec_Int_t
*
vTtDsds
[
IF_MAX_FUNC_LUTSIZE
+
1
];
// mapping of truth table into DSD
Vec_Int_t
*
vTtDsds
[
IF_MAX_FUNC_LUTSIZE
+
1
];
// mapping of truth table into DSD
Vec_Str_t
*
vTtPerms
[
IF_MAX_FUNC_LUTSIZE
+
1
];
// mapping of truth table into permutations
Vec_Str_t
*
vTtPerms
[
IF_MAX_FUNC_LUTSIZE
+
1
];
// mapping of truth table into permutations
Hash_IntMan_t
*
vPairHash
;
// hashing pairs of truth tables
Hash_IntMan_t
*
vPairHash
;
// hashing pairs of truth tables
...
@@ -327,18 +329,6 @@ struct If_Obj_t_
...
@@ -327,18 +329,6 @@ struct If_Obj_t_
If_Cut_t
CutBest
;
// the best cut selected
If_Cut_t
CutBest
;
// the best cut selected
};
};
typedef
struct
If_And_t_
If_And_t
;
struct
If_And_t_
{
unsigned
iFan0
:
15
;
// fanin0
unsigned
fCompl0
:
1
;
// compl fanin0
unsigned
iFan1
:
15
;
// fanin1
unsigned
fCompl1
:
1
;
// compl fanin1
unsigned
Id
:
15
;
// Id
unsigned
fCompl
:
1
;
// compl output
unsigned
Delay
:
16
;
// delay
};
typedef
struct
If_Box_t_
If_Box_t
;
typedef
struct
If_Box_t_
If_Box_t
;
struct
If_Box_t_
struct
If_Box_t_
{
{
...
@@ -428,11 +418,6 @@ static inline If_Obj_t * If_CutLeaf( If_Man_t * p, If_Cut_t * pCut, int i ) { a
...
@@ -428,11 +418,6 @@ static inline If_Obj_t * If_CutLeaf( If_Man_t * p, If_Cut_t * pCut, int i ) { a
static
inline
float
If_CutLutArea
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
)
{
return
pCut
->
fUser
?
(
float
)
pCut
->
Cost
:
(
p
->
pPars
->
pLutLib
?
p
->
pPars
->
pLutLib
->
pLutAreas
[
pCut
->
nLeaves
]
:
(
float
)
1
.
0
);
}
static
inline
float
If_CutLutArea
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
)
{
return
pCut
->
fUser
?
(
float
)
pCut
->
Cost
:
(
p
->
pPars
->
pLutLib
?
p
->
pPars
->
pLutLib
->
pLutAreas
[
pCut
->
nLeaves
]
:
(
float
)
1
.
0
);
}
static
inline
float
If_CutLutDelay
(
If_LibLut_t
*
p
,
int
Size
,
int
iPin
)
{
return
p
?
(
p
->
fVarPinDelays
?
p
->
pLutDelays
[
Size
][
iPin
]
:
p
->
pLutDelays
[
Size
][
0
])
:
1
.
0
;
}
static
inline
float
If_CutLutDelay
(
If_LibLut_t
*
p
,
int
Size
,
int
iPin
)
{
return
p
?
(
p
->
fVarPinDelays
?
p
->
pLutDelays
[
Size
][
iPin
]
:
p
->
pLutDelays
[
Size
][
0
])
:
1
.
0
;
}
static
inline
word
If_AndToWrd
(
If_And_t
m
)
{
union
{
If_And_t
x
;
word
y
;
}
v
;
v
.
x
=
m
;
return
v
.
y
;
}
static
inline
If_And_t
If_WrdToAnd
(
word
m
)
{
union
{
If_And_t
x
;
word
y
;
}
v
;
v
.
y
=
m
;
return
v
.
x
;
}
static
inline
void
If_AndClear
(
If_And_t
*
pNode
)
{
*
pNode
=
If_WrdToAnd
(
0
);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
/// MACRO DEFINITIONS ///
...
@@ -536,8 +521,9 @@ extern int If_CluCheckExt( void * p, word * pTruth, int nVars, int n
...
@@ -536,8 +521,9 @@ extern int If_CluCheckExt( void * p, word * pTruth, int nVars, int n
extern
int
If_CluCheckExt3
(
void
*
p
,
word
*
pTruth
,
int
nVars
,
int
nLutLeaf
,
int
nLutLeaf2
,
int
nLutRoot
,
extern
int
If_CluCheckExt3
(
void
*
p
,
word
*
pTruth
,
int
nVars
,
int
nLutLeaf
,
int
nLutLeaf2
,
int
nLutRoot
,
char
*
pLut0
,
char
*
pLut1
,
char
*
pLut2
,
word
*
pFunc0
,
word
*
pFunc1
,
word
*
pFunc2
);
char
*
pLut0
,
char
*
pLut1
,
char
*
pLut2
,
word
*
pFunc0
,
word
*
pFunc1
,
word
*
pFunc2
);
/*=== ifDelay.c =============================================================*/
/*=== ifDelay.c =============================================================*/
extern
int
If_CutDelaySopArray3
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vAig
);
extern
int
If_CutDelaySop
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
);
extern
int
If_CutPinDelaysSopArray3
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
char
*
pPerm
);
extern
int
If_CutSopBalanceEval
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vAig
);
extern
int
If_CutSopBalancePinDelays
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
char
*
pPerm
);
/*=== ifDsd.c =============================================================*/
/*=== ifDsd.c =============================================================*/
extern
If_DsdMan_t
*
If_DsdManAlloc
(
int
nVars
,
int
nLutSize
);
extern
If_DsdMan_t
*
If_DsdManAlloc
(
int
nVars
,
int
nLutSize
);
extern
void
If_DsdManPrint
(
If_DsdMan_t
*
p
,
char
*
pFileName
,
int
Number
,
int
Support
,
int
fOccurs
,
int
fTtDump
,
int
fVerbose
);
extern
void
If_DsdManPrint
(
If_DsdMan_t
*
p
,
char
*
pFileName
,
int
Number
,
int
Support
,
int
fOccurs
,
int
fTtDump
,
int
fVerbose
);
...
@@ -554,8 +540,8 @@ extern int If_DsdManLutSize( If_DsdMan_t * p );
...
@@ -554,8 +540,8 @@ extern int If_DsdManLutSize( If_DsdMan_t * p );
extern
int
If_DsdManSuppSize
(
If_DsdMan_t
*
p
,
int
iDsd
);
extern
int
If_DsdManSuppSize
(
If_DsdMan_t
*
p
,
int
iDsd
);
extern
int
If_DsdManCheckDec
(
If_DsdMan_t
*
p
,
int
iDsd
);
extern
int
If_DsdManCheckDec
(
If_DsdMan_t
*
p
,
int
iDsd
);
extern
unsigned
If_DsdManCheckXY
(
If_DsdMan_t
*
p
,
int
iDsd
,
int
LutSize
,
int
fDerive
,
int
fHighEffort
,
int
fVerbose
);
extern
unsigned
If_DsdManCheckXY
(
If_DsdMan_t
*
p
,
int
iDsd
,
int
LutSize
,
int
fDerive
,
int
fHighEffort
,
int
fVerbose
);
extern
int
If_
DsdCutBalanceCost
(
If_Man_t
*
pIfMan
,
If_Cut_t
*
pCut
);
extern
int
If_
CutDsdBalanceEval
(
If_Man_t
*
pIfMan
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vAig
);
extern
int
If_
DsdCutBalanceAig
(
If_Man_t
*
pIfMan
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vAig
);
extern
int
If_
CutDsdBalancePinDelays
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
char
*
pPerm
);
/*=== ifLib.c =============================================================*/
/*=== ifLib.c =============================================================*/
extern
If_LibLut_t
*
If_LibLutRead
(
char
*
FileName
);
extern
If_LibLut_t
*
If_LibLutRead
(
char
*
FileName
);
extern
If_LibLut_t
*
If_LibLutDup
(
If_LibLut_t
*
p
);
extern
If_LibLut_t
*
If_LibLutDup
(
If_LibLut_t
*
p
);
...
@@ -608,10 +594,6 @@ extern unsigned If_ManSatCheckXYall( void * pSat, int nLutSize, word * pT
...
@@ -608,10 +594,6 @@ extern unsigned If_ManSatCheckXYall( void * pSat, int nLutSize, word * pT
/*=== ifSeq.c =============================================================*/
/*=== ifSeq.c =============================================================*/
extern
int
If_ManPerformMappingSeq
(
If_Man_t
*
p
);
extern
int
If_ManPerformMappingSeq
(
If_Man_t
*
p
);
/*=== ifTime.c ============================================================*/
/*=== ifTime.c ============================================================*/
extern
int
If_CutDelaySopCost
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
);
extern
int
If_CutDelaySopCost2
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
);
extern
int
If_CutDelaySop
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
);
extern
Vec_Wrd_t
*
If_CutDelaySopArray
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
);
extern
float
If_CutDelay
(
If_Man_t
*
p
,
If_Obj_t
*
pObj
,
If_Cut_t
*
pCut
);
extern
float
If_CutDelay
(
If_Man_t
*
p
,
If_Obj_t
*
pObj
,
If_Cut_t
*
pCut
);
extern
void
If_CutPropagateRequired
(
If_Man_t
*
p
,
If_Obj_t
*
pObj
,
If_Cut_t
*
pCut
,
float
Required
);
extern
void
If_CutPropagateRequired
(
If_Man_t
*
p
,
If_Obj_t
*
pObj
,
If_Cut_t
*
pCut
,
float
Required
);
/*=== ifTruth.c ===========================================================*/
/*=== ifTruth.c ===========================================================*/
...
...
src/map/if/ifDelay.c
View file @
a26d61f4
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
***********************************************************************/
***********************************************************************/
#include "if.h"
#include "if.h"
#include "bool/kit/kit.h"
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
...
@@ -33,6 +32,77 @@ ABC_NAMESPACE_IMPL_START
...
@@ -33,6 +32,77 @@ ABC_NAMESPACE_IMPL_START
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Computes the SOP delay using balanced AND decomposition.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
If_CutMaxCubeSize
(
Vec_Int_t
*
vCover
,
int
nVars
)
{
int
i
,
k
,
Entry
,
Literal
,
Count
,
CountMax
=
0
;
Vec_IntForEachEntry
(
vCover
,
Entry
,
i
)
{
Count
=
0
;
for
(
k
=
0
;
k
<
nVars
;
k
++
)
{
Literal
=
(
3
&
(
Entry
>>
(
k
<<
1
)));
if
(
Literal
==
1
||
Literal
==
2
)
Count
++
;
}
CountMax
=
Abc_MaxInt
(
CountMax
,
Count
);
}
return
CountMax
;
}
int
If_CutDelaySop
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
)
{
// delay is calculated using 1+log2(NumFanins)
static
double
GateDelays
[
20
]
=
{
1
.
00
,
1
.
00
,
2
.
00
,
2
.
58
,
3
.
00
,
3
.
32
,
3
.
58
,
3
.
81
,
4
.
00
,
4
.
17
,
4
.
32
,
4
.
46
,
4
.
58
,
4
.
70
,
4
.
81
,
4
.
91
,
5
.
00
,
5
.
09
,
5
.
17
,
5
.
25
};
Vec_Int_t
*
vCover
;
If_Obj_t
*
pLeaf
;
int
i
,
nLitMax
,
Delay
,
DelayMax
;
// mark cut as a user cut
pCut
->
fUser
=
1
;
if
(
pCut
->
nLeaves
==
0
)
return
0
;
if
(
pCut
->
nLeaves
==
1
)
return
(
int
)
If_ObjCutBest
(
If_CutLeaf
(
p
,
pCut
,
0
))
->
Delay
;
vCover
=
Vec_WecEntry
(
p
->
vTtIsops
[
pCut
->
nLeaves
],
Abc_Lit2Var
(
If_CutTruthLit
(
pCut
))
);
if
(
Vec_IntSize
(
vCover
)
==
0
)
return
-
1
;
// mark the output as complemented
// vAnds = If_CutDelaySopAnds( p, pCut, p->vCover, RetValue ^ pCut->fCompl );
if
(
Vec_IntSize
(
p
->
vCover
)
>
p
->
pPars
->
nGateSize
)
return
ABC_INFINITY
;
// set the area cost
assert
(
If_CutLeaveNum
(
pCut
)
>=
0
&&
If_CutLeaveNum
(
pCut
)
<=
16
);
// compute the gate delay
nLitMax
=
If_CutMaxCubeSize
(
p
->
vCover
,
If_CutLeaveNum
(
pCut
)
);
if
(
Vec_IntSize
(
p
->
vCover
)
<
2
)
{
pCut
->
Cost
=
Vec_IntSize
(
p
->
vCover
);
Delay
=
(
int
)(
GateDelays
[
If_CutLeaveNum
(
pCut
)]
+
0
.
5
);
DelayMax
=
0
;
If_CutForEachLeaf
(
p
,
pCut
,
pLeaf
,
i
)
DelayMax
=
Abc_MaxInt
(
DelayMax
,
If_ObjCutBest
(
pLeaf
)
->
Delay
+
(
pCut
->
pPerm
[
i
]
=
(
char
)
Delay
)
);
}
else
{
pCut
->
Cost
=
Vec_IntSize
(
p
->
vCover
)
+
1
;
Delay
=
(
int
)(
GateDelays
[
If_CutLeaveNum
(
pCut
)]
+
GateDelays
[
nLitMax
]
+
0
.
5
);
DelayMax
=
0
;
If_CutForEachLeaf
(
p
,
pCut
,
pLeaf
,
i
)
DelayMax
=
Abc_MaxInt
(
DelayMax
,
If_ObjCutBest
(
pLeaf
)
->
Delay
+
(
pCut
->
pPerm
[
i
]
=
(
char
)
Delay
)
);
}
return
DelayMax
;
}
/**Function*************************************************************
Synopsis [Naive implementation of log-counter.]
Synopsis [Naive implementation of log-counter.]
Description [Incrementally computes [log2(SUMi(2^di)).]
Description [Incrementally computes [log2(SUMi(2^di)).]
...
@@ -453,7 +523,7 @@ static inline word If_LogPinDelaysMulti( word * pPinDels, int nFanins, int nSupp
...
@@ -453,7 +523,7 @@ static inline word If_LogPinDelaysMulti( word * pPinDels, int nFanins, int nSupp
pPinDels
[
i
-
1
]
=
If_CutPinDelayMax
(
pPinDels
[
i
],
pPinDels
[
i
-
1
],
nSuppAll
,
1
+
fXor
);
pPinDels
[
i
-
1
]
=
If_CutPinDelayMax
(
pPinDels
[
i
],
pPinDels
[
i
-
1
],
nSuppAll
,
1
+
fXor
);
return
pPinDels
[
0
];
return
pPinDels
[
0
];
}
}
int
If_Cut
PinDelaysSopArray3Int
Int
(
Vec_Int_t
*
vCover
,
int
*
pTimes
,
int
nSuppAll
,
char
*
pPerm
)
int
If_Cut
SopBalancePinDelays
Int
(
Vec_Int_t
*
vCover
,
int
*
pTimes
,
int
nSuppAll
,
char
*
pPerm
)
{
{
word
pPinDelsAnd
[
IF_MAX_FUNC_LUTSIZE
],
pPinDelsOr
[
32
];
word
pPinDelsAnd
[
IF_MAX_FUNC_LUTSIZE
],
pPinDelsOr
[
32
];
int
nCounterAnd
,
pCounterAnd
[
IF_MAX_FUNC_LUTSIZE
];
int
nCounterAnd
,
pCounterAnd
[
IF_MAX_FUNC_LUTSIZE
];
...
@@ -483,18 +553,8 @@ int If_CutPinDelaysSopArray3IntInt( Vec_Int_t * vCover, int * pTimes, int nSuppA
...
@@ -483,18 +553,8 @@ int If_CutPinDelaysSopArray3IntInt( Vec_Int_t * vCover, int * pTimes, int nSuppA
If_CutPinDelayTranslate
(
ResOr
,
nSuppAll
,
pPerm
);
If_CutPinDelayTranslate
(
ResOr
,
nSuppAll
,
pPerm
);
return
Delay
;
return
Delay
;
}
}
int
If_CutPinDelaysSopArray3Int
(
unsigned
*
pTruth
,
int
nLeaves
,
int
*
pTimes
,
Vec_Int_t
*
vCover
,
char
*
pPerm
)
int
If_CutSopBalancePinDelays
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
char
*
pPerm
)
{
int
RetValue
=
Kit_TruthIsop
(
pTruth
,
nLeaves
,
vCover
,
1
);
if
(
RetValue
==
-
1
)
return
-
1
;
// Kit_TruthIsopPrint( pTruth, nLeaves, vCover, 1 );
return
If_CutPinDelaysSopArray3IntInt
(
vCover
,
pTimes
,
nLeaves
,
pPerm
);
}
int
If_CutPinDelaysSopArray3
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
char
*
pPerm
)
{
{
if
(
p
->
vCover
==
NULL
)
p
->
vCover
=
Vec_IntAlloc
(
0
);
if
(
pCut
->
nLeaves
==
0
)
// const
if
(
pCut
->
nLeaves
==
0
)
// const
return
0
;
return
0
;
if
(
pCut
->
nLeaves
==
1
)
// variable
if
(
pCut
->
nLeaves
==
1
)
// variable
...
@@ -504,10 +564,14 @@ int If_CutPinDelaysSopArray3( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
...
@@ -504,10 +564,14 @@ int If_CutPinDelaysSopArray3( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
}
}
else
else
{
{
Vec_Int_t
*
vCover
;
int
i
,
pTimes
[
IF_MAX_FUNC_LUTSIZE
];
int
i
,
pTimes
[
IF_MAX_FUNC_LUTSIZE
];
vCover
=
Vec_WecEntry
(
p
->
vTtIsops
[
pCut
->
nLeaves
],
Abc_Lit2Var
(
If_CutTruthLit
(
pCut
))
);
if
(
Vec_IntSize
(
vCover
)
==
0
)
return
-
1
;
for
(
i
=
0
;
i
<
If_CutLeaveNum
(
pCut
);
i
++
)
for
(
i
=
0
;
i
<
If_CutLeaveNum
(
pCut
);
i
++
)
pTimes
[
i
]
=
(
int
)
If_ObjCutBest
(
If_CutLeaf
(
p
,
pCut
,
i
))
->
Delay
;
pTimes
[
i
]
=
(
int
)
If_ObjCutBest
(
If_CutLeaf
(
p
,
pCut
,
i
))
->
Delay
;
return
If_Cut
PinDelaysSopArray3Int
(
If_CutTruth
(
p
,
pCut
),
If_CutLeaveNum
(
pCut
),
pTimes
,
p
->
vCover
,
pPerm
);
return
If_Cut
SopBalancePinDelaysInt
(
vCover
,
pTimes
,
If_CutLeaveNum
(
pCut
)
,
pPerm
);
}
}
}
}
...
@@ -522,7 +586,7 @@ int If_CutPinDelaysSopArray3( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
...
@@ -522,7 +586,7 @@ int If_CutPinDelaysSopArray3( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
If_Cut
DelaySopArray3
IntInt
(
Vec_Int_t
*
vCover
,
int
*
pTimes
,
Vec_Int_t
*
vAig
,
int
*
piRes
,
int
nSuppAll
,
int
*
pArea
)
int
If_Cut
SopBalanceEval
IntInt
(
Vec_Int_t
*
vCover
,
int
*
pTimes
,
Vec_Int_t
*
vAig
,
int
*
piRes
,
int
nSuppAll
,
int
*
pArea
)
{
{
int
nCounterAnd
,
pCounterAnd
[
IF_MAX_FUNC_LUTSIZE
],
pFaninLitsAnd
[
IF_MAX_FUNC_LUTSIZE
];
int
nCounterAnd
,
pCounterAnd
[
IF_MAX_FUNC_LUTSIZE
],
pFaninLitsAnd
[
IF_MAX_FUNC_LUTSIZE
];
int
nCounterOr
,
pCounterOr
[
32
],
pFaninLitsOr
[
32
];
int
nCounterOr
,
pCounterOr
[
32
],
pFaninLitsOr
[
32
];
...
@@ -558,24 +622,21 @@ int If_CutDelaySopArray3IntInt( Vec_Int_t * vCover, int * pTimes, Vec_Int_t * vA
...
@@ -558,24 +622,21 @@ int If_CutDelaySopArray3IntInt( Vec_Int_t * vCover, int * pTimes, Vec_Int_t * vA
*
pArea
+=
Vec_IntSize
(
vCover
)
==
1
?
0
:
Vec_IntSize
(
vCover
)
-
1
;
*
pArea
+=
Vec_IntSize
(
vCover
)
==
1
?
0
:
Vec_IntSize
(
vCover
)
-
1
;
return
Delay
;
return
Delay
;
}
}
int
If_Cut
DelaySopArray3Int
(
unsigned
*
pTruth
,
int
nLeaves
,
int
*
pTimes
,
Vec_Int_t
*
vCover
,
Vec_Int_t
*
vAig
,
int
fCompl
,
int
*
pArea
)
int
If_Cut
SopBalanceEvalInt
(
Vec_Int_t
*
vCover
,
int
nLeaves
,
int
*
pTimes
,
Vec_Int_t
*
vAig
,
int
fCompl
,
int
*
pArea
)
{
{
int
iRes
=
0
,
Res
;
int
iRes
=
0
,
Res
;
int
RetValue
=
Kit_TruthIsop
(
pTruth
,
nLeaves
,
vCover
,
1
);
if
(
Vec_IntSize
(
vCover
)
==
0
)
if
(
RetValue
==
-
1
)
return
-
1
;
return
-
1
;
Res
=
If_Cut
DelaySopArray3
IntInt
(
vCover
,
pTimes
,
vAig
,
&
iRes
,
nLeaves
,
pArea
);
Res
=
If_Cut
SopBalanceEval
IntInt
(
vCover
,
pTimes
,
vAig
,
&
iRes
,
nLeaves
,
pArea
);
assert
(
vAig
==
NULL
||
Abc_Lit2Var
(
iRes
)
==
nLeaves
+
Abc_Lit2Var
(
Vec_IntSize
(
vAig
))
-
1
);
assert
(
vAig
==
NULL
||
Abc_Lit2Var
(
iRes
)
==
nLeaves
+
Abc_Lit2Var
(
Vec_IntSize
(
vAig
))
-
1
);
if
(
vAig
)
if
(
vAig
)
Vec_IntPush
(
vAig
,
RetValue
^
Abc_LitIsCompl
(
iRes
)
^
fCompl
);
Vec_IntPush
(
vAig
,
Abc_LitIsCompl
(
iRes
)
^
fCompl
);
assert
(
vAig
==
NULL
||
(
Vec_IntSize
(
vAig
)
&
1
)
);
assert
(
vAig
==
NULL
||
(
Vec_IntSize
(
vAig
)
&
1
)
);
return
Res
;
return
Res
;
}
}
int
If_Cut
DelaySopArray3
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vAig
)
int
If_Cut
SopBalanceEval
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vAig
)
{
{
pCut
->
fUser
=
1
;
pCut
->
fUser
=
1
;
if
(
p
->
vCover
==
NULL
)
p
->
vCover
=
Vec_IntAlloc
(
0
);
if
(
vAig
)
if
(
vAig
)
Vec_IntClear
(
vAig
);
Vec_IntClear
(
vAig
);
if
(
pCut
->
nLeaves
==
0
)
// const
if
(
pCut
->
nLeaves
==
0
)
// const
...
@@ -596,11 +657,13 @@ int If_CutDelaySopArray3( If_Man_t * p, If_Cut_t * pCut, Vec_Int_t * vAig )
...
@@ -596,11 +657,13 @@ int If_CutDelaySopArray3( If_Man_t * p, If_Cut_t * pCut, Vec_Int_t * vAig )
}
}
else
else
{
{
Vec_Int_t
*
vCover
=
Vec_WecEntry
(
p
->
vTtIsops
[
pCut
->
nLeaves
],
Abc_Lit2Var
(
If_CutTruthLit
(
pCut
))
);
int
fCompl
=
Abc_LitIsCompl
(
If_CutTruthLit
(
pCut
))
^
((
vCover
->
nCap
>>
16
)
&
1
);
// hack to remember complemented attribute
int
Delay
,
Area
=
0
;
int
Delay
,
Area
=
0
;
int
i
,
pTimes
[
IF_MAX_FUNC_LUTSIZE
];
int
i
,
pTimes
[
IF_MAX_FUNC_LUTSIZE
];
for
(
i
=
0
;
i
<
If_CutLeaveNum
(
pCut
);
i
++
)
for
(
i
=
0
;
i
<
If_CutLeaveNum
(
pCut
);
i
++
)
pTimes
[
i
]
=
(
int
)
If_ObjCutBest
(
If_CutLeaf
(
p
,
pCut
,
i
))
->
Delay
;
pTimes
[
i
]
=
(
int
)
If_ObjCutBest
(
If_CutLeaf
(
p
,
pCut
,
i
))
->
Delay
;
Delay
=
If_Cut
DelaySopArray3Int
(
If_CutTruth
(
p
,
pCut
),
If_CutLeaveNum
(
pCut
),
pTimes
,
p
->
vCover
,
vAig
,
0
,
&
Area
);
Delay
=
If_Cut
SopBalanceEvalInt
(
vCover
,
If_CutLeaveNum
(
pCut
),
pTimes
,
vAig
,
fCompl
,
&
Area
);
pCut
->
Cost
=
Area
;
pCut
->
Cost
=
Area
;
return
Delay
;
return
Delay
;
}
}
...
...
src/map/if/ifDsd.c
View file @
a26d61f4
...
@@ -2025,7 +2025,7 @@ static inline int If_LogCounterAddAig( int * pTimes, int * pnTimes, int * pFanin
...
@@ -2025,7 +2025,7 @@ static inline int If_LogCounterAddAig( int * pTimes, int * pnTimes, int * pFanin
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
If_
DsdCutBalanceAig
_rec
(
If_DsdMan_t
*
p
,
int
Id
,
int
*
pTimes
,
int
*
pnSupp
,
Vec_Int_t
*
vAig
,
int
*
piLit
,
int
nSuppAll
,
int
*
pArea
)
int
If_
CutDsdBalanceEval
_rec
(
If_DsdMan_t
*
p
,
int
Id
,
int
*
pTimes
,
int
*
pnSupp
,
Vec_Int_t
*
vAig
,
int
*
piLit
,
int
nSuppAll
,
int
*
pArea
)
{
{
If_DsdObj_t
*
pObj
=
If_DsdVecObj
(
&
p
->
vObjs
,
Id
);
If_DsdObj_t
*
pObj
=
If_DsdVecObj
(
&
p
->
vObjs
,
Id
);
if
(
If_DsdObjType
(
pObj
)
==
IF_DSD_PRIME
)
if
(
If_DsdObjType
(
pObj
)
==
IF_DSD_PRIME
)
...
@@ -2041,7 +2041,7 @@ int If_DsdCutBalanceAig_rec( If_DsdMan_t * p, int Id, int * pTimes, int * pnSupp
...
@@ -2041,7 +2041,7 @@ int If_DsdCutBalanceAig_rec( If_DsdMan_t * p, int Id, int * pTimes, int * pnSupp
int
i
,
iFanin
,
Delay
[
3
],
pFaninLits
[
3
];
int
i
,
iFanin
,
Delay
[
3
],
pFaninLits
[
3
];
If_DsdObjForEachFaninLit
(
&
p
->
vObjs
,
pObj
,
iFanin
,
i
)
If_DsdObjForEachFaninLit
(
&
p
->
vObjs
,
pObj
,
iFanin
,
i
)
{
{
Delay
[
i
]
=
If_
DsdCutBalanceAig
_rec
(
p
,
Abc_Lit2Var
(
iFanin
),
pTimes
,
pnSupp
,
vAig
,
pFaninLits
+
i
,
nSuppAll
,
pArea
);
Delay
[
i
]
=
If_
CutDsdBalanceEval
_rec
(
p
,
Abc_Lit2Var
(
iFanin
),
pTimes
,
pnSupp
,
vAig
,
pFaninLits
+
i
,
nSuppAll
,
pArea
);
if
(
Delay
[
i
]
==
-
1
)
if
(
Delay
[
i
]
==
-
1
)
return
-
1
;
return
-
1
;
}
}
...
@@ -2058,7 +2058,7 @@ int If_DsdCutBalanceAig_rec( If_DsdMan_t * p, int Id, int * pTimes, int * pnSupp
...
@@ -2058,7 +2058,7 @@ int If_DsdCutBalanceAig_rec( If_DsdMan_t * p, int Id, int * pTimes, int * pnSupp
int
nCounter
=
0
,
pCounter
[
IF_MAX_FUNC_LUTSIZE
],
pFaninLits
[
IF_MAX_FUNC_LUTSIZE
];
int
nCounter
=
0
,
pCounter
[
IF_MAX_FUNC_LUTSIZE
],
pFaninLits
[
IF_MAX_FUNC_LUTSIZE
];
If_DsdObjForEachFaninLit
(
&
p
->
vObjs
,
pObj
,
iFanin
,
i
)
If_DsdObjForEachFaninLit
(
&
p
->
vObjs
,
pObj
,
iFanin
,
i
)
{
{
Delay
=
If_
DsdCutBalanceAig
_rec
(
p
,
Abc_Lit2Var
(
iFanin
),
pTimes
,
pnSupp
,
vAig
,
pFaninLits
+
i
,
nSuppAll
,
pArea
);
Delay
=
If_
CutDsdBalanceEval
_rec
(
p
,
Abc_Lit2Var
(
iFanin
),
pTimes
,
pnSupp
,
vAig
,
pFaninLits
+
i
,
nSuppAll
,
pArea
);
if
(
Delay
==
-
1
)
if
(
Delay
==
-
1
)
return
-
1
;
return
-
1
;
Result
=
If_LogCounterAddAig
(
pCounter
,
&
nCounter
,
pFaninLits
,
Delay
,
pFaninLits
[
i
],
vAig
,
nSuppAll
,
fXor
);
Result
=
If_LogCounterAddAig
(
pCounter
,
&
nCounter
,
pFaninLits
,
Delay
,
pFaninLits
[
i
],
vAig
,
nSuppAll
,
fXor
);
...
@@ -2070,11 +2070,11 @@ int If_DsdCutBalanceAig_rec( If_DsdMan_t * p, int Id, int * pTimes, int * pnSupp
...
@@ -2070,11 +2070,11 @@ int If_DsdCutBalanceAig_rec( If_DsdMan_t * p, int Id, int * pTimes, int * pnSupp
return
Result
;
return
Result
;
}
}
}
}
int
If_
DsdCutBalanceAig
Int
(
If_DsdMan_t
*
p
,
int
iDsd
,
int
*
pTimes
,
Vec_Int_t
*
vAig
,
int
*
pArea
)
int
If_
CutDsdBalanceEval
Int
(
If_DsdMan_t
*
p
,
int
iDsd
,
int
*
pTimes
,
Vec_Int_t
*
vAig
,
int
*
pArea
)
{
{
int
nSupp
=
0
,
iLit
=
0
;
int
nSupp
=
0
,
iLit
=
0
;
int
nSuppAll
=
If_DsdVecLitSuppSize
(
&
p
->
vObjs
,
iDsd
);
int
nSuppAll
=
If_DsdVecLitSuppSize
(
&
p
->
vObjs
,
iDsd
);
int
Res
=
If_
DsdCutBalanceAig
_rec
(
p
,
Abc_Lit2Var
(
iDsd
),
pTimes
,
&
nSupp
,
vAig
,
&
iLit
,
nSuppAll
,
pArea
);
int
Res
=
If_
CutDsdBalanceEval
_rec
(
p
,
Abc_Lit2Var
(
iDsd
),
pTimes
,
&
nSupp
,
vAig
,
&
iLit
,
nSuppAll
,
pArea
);
assert
(
nSupp
==
nSuppAll
);
assert
(
nSupp
==
nSuppAll
);
assert
(
vAig
==
NULL
||
Abc_Lit2Var
(
iLit
)
==
nSupp
+
Abc_Lit2Var
(
Vec_IntSize
(
vAig
))
-
1
);
assert
(
vAig
==
NULL
||
Abc_Lit2Var
(
iLit
)
==
nSupp
+
Abc_Lit2Var
(
Vec_IntSize
(
vAig
))
-
1
);
if
(
vAig
)
if
(
vAig
)
...
@@ -2082,7 +2082,7 @@ int If_DsdCutBalanceAigInt( If_DsdMan_t * p, int iDsd, int * pTimes, Vec_Int_t *
...
@@ -2082,7 +2082,7 @@ int If_DsdCutBalanceAigInt( If_DsdMan_t * p, int iDsd, int * pTimes, Vec_Int_t *
assert
(
vAig
==
NULL
||
(
Vec_IntSize
(
vAig
)
&
1
)
);
assert
(
vAig
==
NULL
||
(
Vec_IntSize
(
vAig
)
&
1
)
);
return
Res
;
return
Res
;
}
}
int
If_
DsdCutBalanceAig
(
If_Man_t
*
pIfMan
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vAig
)
int
If_
CutDsdBalanceEval
(
If_Man_t
*
pIfMan
,
If_Cut_t
*
pCut
,
Vec_Int_t
*
vAig
)
{
{
pCut
->
fUser
=
1
;
pCut
->
fUser
=
1
;
if
(
vAig
)
if
(
vAig
)
...
@@ -2110,12 +2110,17 @@ int If_DsdCutBalanceAig( If_Man_t * pIfMan, If_Cut_t * pCut, Vec_Int_t * vAig )
...
@@ -2110,12 +2110,17 @@ int If_DsdCutBalanceAig( If_Man_t * pIfMan, If_Cut_t * pCut, Vec_Int_t * vAig )
int
Delay
,
Area
=
0
;
int
Delay
,
Area
=
0
;
If_CutForEachLeaf
(
pIfMan
,
pCut
,
pLeaf
,
i
)
If_CutForEachLeaf
(
pIfMan
,
pCut
,
pLeaf
,
i
)
pTimes
[
i
]
=
(
int
)
If_ObjCutBest
(
pLeaf
)
->
Delay
;
pTimes
[
i
]
=
(
int
)
If_ObjCutBest
(
pLeaf
)
->
Delay
;
Delay
=
If_
DsdCutBalanceAig
Int
(
pIfMan
->
pIfDsdMan
,
If_CutDsdLit
(
pCut
),
pTimes
,
vAig
,
&
Area
);
Delay
=
If_
CutDsdBalanceEval
Int
(
pIfMan
->
pIfDsdMan
,
If_CutDsdLit
(
pCut
),
pTimes
,
vAig
,
&
Area
);
pCut
->
Cost
=
Area
;
pCut
->
Cost
=
Area
;
return
Delay
;
return
Delay
;
}
}
}
}
int
If_CutDsdBalancePinDelays
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
char
*
pPerm
)
{
return
0
;
}
/**Function*************************************************************
/**Function*************************************************************
...
...
src/map/if/ifMan.c
View file @
a26d61f4
...
@@ -73,6 +73,17 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
...
@@ -73,6 +73,17 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
p
->
vTtMem
[
v
]
=
Vec_MemAllocForTT
(
v
,
pPars
->
fUseTtPerm
);
p
->
vTtMem
[
v
]
=
Vec_MemAllocForTT
(
v
,
pPars
->
fUseTtPerm
);
for
(
v
=
0
;
v
<
6
;
v
++
)
for
(
v
=
0
;
v
<
6
;
v
++
)
p
->
vTtMem
[
v
]
=
p
->
vTtMem
[
6
];
p
->
vTtMem
[
v
]
=
p
->
vTtMem
[
6
];
if
(
p
->
pPars
->
fDelayOpt
)
{
p
->
vCover
=
Vec_IntAlloc
(
0
);
p
->
vArray
=
Vec_IntAlloc
(
1000
);
for
(
v
=
6
;
v
<=
p
->
pPars
->
nLutSize
;
v
++
)
p
->
vTtIsops
[
v
]
=
Vec_WecAlloc
(
1000
);
for
(
v
=
6
;
v
<=
p
->
pPars
->
nLutSize
;
v
++
)
Vec_WecInit
(
p
->
vTtIsops
[
v
],
2
);
for
(
v
=
0
;
v
<
6
;
v
++
)
p
->
vTtIsops
[
v
]
=
p
->
vTtIsops
[
6
];
}
}
}
p
->
nPermWords
=
p
->
pPars
->
fUsePerm
?
If_CutPermWords
(
p
->
pPars
->
nLutSize
)
:
0
;
p
->
nPermWords
=
p
->
pPars
->
fUsePerm
?
If_CutPermWords
(
p
->
pPars
->
nLutSize
)
:
0
;
p
->
nObjBytes
=
sizeof
(
If_Obj_t
)
+
sizeof
(
int
)
*
(
p
->
pPars
->
nLutSize
+
p
->
nPermWords
/* + p->nTruthWords*/
);
p
->
nObjBytes
=
sizeof
(
If_Obj_t
)
+
sizeof
(
int
)
*
(
p
->
pPars
->
nLutSize
+
p
->
nPermWords
/* + p->nTruthWords*/
);
...
@@ -226,6 +237,8 @@ void If_ManStop( If_Man_t * p )
...
@@ -226,6 +237,8 @@ void If_ManStop( If_Man_t * p )
Vec_MemHashFree
(
p
->
vTtMem
[
i
]
);
Vec_MemHashFree
(
p
->
vTtMem
[
i
]
);
for
(
i
=
6
;
i
<=
p
->
pPars
->
nLutSize
;
i
++
)
for
(
i
=
6
;
i
<=
p
->
pPars
->
nLutSize
;
i
++
)
Vec_MemFreeP
(
&
p
->
vTtMem
[
i
]
);
Vec_MemFreeP
(
&
p
->
vTtMem
[
i
]
);
for
(
i
=
6
;
i
<=
p
->
pPars
->
nLutSize
;
i
++
)
Vec_WecFreeP
(
&
p
->
vTtIsops
[
i
]
);
Mem_FixedStop
(
p
->
pMemObj
,
0
);
Mem_FixedStop
(
p
->
pMemObj
,
0
);
ABC_FREE
(
p
->
pMemCi
);
ABC_FREE
(
p
->
pMemCi
);
ABC_FREE
(
p
->
pMemAnd
);
ABC_FREE
(
p
->
pMemAnd
);
...
...
src/map/if/ifMap.c
View file @
a26d61f4
...
@@ -124,10 +124,9 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
...
@@ -124,10 +124,9 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
{
{
// recompute the parameters of the best cut
// recompute the parameters of the best cut
if
(
p
->
pPars
->
fDelayOpt
)
if
(
p
->
pPars
->
fDelayOpt
)
// pCut->Delay = If_CutDelaySopCost( p, pCut );
pCut
->
Delay
=
If_CutSopBalanceEval
(
p
,
pCut
,
NULL
);
pCut
->
Delay
=
If_CutDelaySopArray3
(
p
,
pCut
,
NULL
);
else
if
(
p
->
pPars
->
fDsdBalance
)
else
if
(
p
->
pPars
->
fDsdBalance
)
pCut
->
Delay
=
If_
DsdCutBalanceCost
(
p
,
pCut
);
pCut
->
Delay
=
If_
CutDsdBalanceEval
(
p
,
pCut
,
NULL
);
else
if
(
p
->
pPars
->
fUserRecLib
)
else
if
(
p
->
pPars
->
fUserRecLib
)
pCut
->
Delay
=
If_CutDelayRecCost3
(
p
,
pCut
,
pObj
);
pCut
->
Delay
=
If_CutDelayRecCost3
(
p
,
pCut
,
pObj
);
else
if
(
p
->
pPars
->
nGateSize
>
0
)
else
if
(
p
->
pPars
->
nGateSize
>
0
)
...
@@ -281,10 +280,9 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
...
@@ -281,10 +280,9 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
continue
;
continue
;
// check if the cut satisfies the required times
// check if the cut satisfies the required times
if
(
p
->
pPars
->
fDelayOpt
)
if
(
p
->
pPars
->
fDelayOpt
)
// pCut->Delay = If_CutDelaySopCost( p, pCut );
pCut
->
Delay
=
If_CutSopBalanceEval
(
p
,
pCut
,
NULL
);
pCut
->
Delay
=
If_CutDelaySopArray3
(
p
,
pCut
,
NULL
);
else
if
(
p
->
pPars
->
fDsdBalance
)
else
if
(
p
->
pPars
->
fDsdBalance
)
pCut
->
Delay
=
If_
DsdCutBalanceCost
(
p
,
pCut
);
pCut
->
Delay
=
If_
CutDsdBalanceEval
(
p
,
pCut
,
NULL
);
else
if
(
p
->
pPars
->
fUserRecLib
)
else
if
(
p
->
pPars
->
fUserRecLib
)
pCut
->
Delay
=
If_CutDelayRecCost3
(
p
,
pCut
,
pObj
);
pCut
->
Delay
=
If_CutDelayRecCost3
(
p
,
pCut
,
pObj
);
else
if
(
p
->
pPars
->
nGateSize
>
0
)
else
if
(
p
->
pPars
->
nGateSize
>
0
)
...
...
src/map/if/ifTime.c
View file @
a26d61f4
This diff is collapsed.
Click to expand it.
src/map/if/ifTruth.c
View file @
a26d61f4
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
***********************************************************************/
***********************************************************************/
#include "if.h"
#include "if.h"
#include "bool/kit/kit.h"
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
...
@@ -97,7 +98,7 @@ void If_CutRotatePins( If_Man_t * p, If_Cut_t * pCut )
...
@@ -97,7 +98,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
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
,
RetValue
=
0
;
int
fCompl
,
truthId
,
nLeavesNew
,
RetValue
=
0
;
int
nWords
=
Abc_TtWordNum
(
pCut
->
nLeaves
);
int
PrevSize
,
nWords
=
Abc_TtWordNum
(
pCut
->
nLeaves
);
word
*
pTruth0s
=
Vec_MemReadEntry
(
p
->
vTtMem
[
pCut0
->
nLeaves
],
Abc_Lit2Var
(
pCut0
->
iCutFunc
)
);
word
*
pTruth0s
=
Vec_MemReadEntry
(
p
->
vTtMem
[
pCut0
->
nLeaves
],
Abc_Lit2Var
(
pCut0
->
iCutFunc
)
);
word
*
pTruth1s
=
Vec_MemReadEntry
(
p
->
vTtMem
[
pCut1
->
nLeaves
],
Abc_Lit2Var
(
pCut1
->
iCutFunc
)
);
word
*
pTruth1s
=
Vec_MemReadEntry
(
p
->
vTtMem
[
pCut1
->
nLeaves
],
Abc_Lit2Var
(
pCut1
->
iCutFunc
)
);
word
*
pTruth0
=
(
word
*
)
p
->
puTemp
[
0
];
word
*
pTruth0
=
(
word
*
)
p
->
puTemp
[
0
];
...
@@ -121,6 +122,7 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_
...
@@ -121,6 +122,7 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_
RetValue
=
1
;
RetValue
=
1
;
}
}
}
}
PrevSize
=
Vec_MemEntryNum
(
p
->
vTtMem
[
pCut
->
nLeaves
]
);
truthId
=
Vec_MemHashInsert
(
p
->
vTtMem
[
pCut
->
nLeaves
],
pTruth
);
truthId
=
Vec_MemHashInsert
(
p
->
vTtMem
[
pCut
->
nLeaves
],
pTruth
);
pCut
->
iCutFunc
=
Abc_Var2Lit
(
truthId
,
fCompl
);
pCut
->
iCutFunc
=
Abc_Var2Lit
(
truthId
,
fCompl
);
assert
(
(
pTruth
[
0
]
&
1
)
==
0
);
assert
(
(
pTruth
[
0
]
&
1
)
==
0
);
...
@@ -132,6 +134,19 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_
...
@@ -132,6 +134,19 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_
Abc_TtCanonicize
(
pCopy
,
pCut
->
nLeaves
,
pCanonPerm
);
Abc_TtCanonicize
(
pCopy
,
pCut
->
nLeaves
,
pCanonPerm
);
}
}
#endif
#endif
if
(
p
->
vTtIsops
[
pCut
->
nLeaves
]
&&
PrevSize
!=
Vec_MemEntryNum
(
p
->
vTtMem
[
pCut
->
nLeaves
])
)
{
Vec_Int_t
*
vLevel
=
Vec_WecPushLevel
(
p
->
vTtIsops
[
pCut
->
nLeaves
]
);
fCompl
=
Kit_TruthIsop
(
(
unsigned
*
)
pTruth
,
pCut
->
nLeaves
,
p
->
vCover
,
1
);
if
(
fCompl
>=
0
)
{
Vec_IntGrow
(
vLevel
,
Vec_IntSize
(
p
->
vCover
)
);
Vec_IntAppend
(
vLevel
,
p
->
vCover
);
if
(
fCompl
)
vLevel
->
nCap
^=
(
1
<<
16
);
// hack to remember complemented attribute
}
assert
(
Vec_WecSize
(
p
->
vTtIsops
[
pCut
->
nLeaves
])
==
Vec_MemEntryNum
(
p
->
vTtMem
[
pCut
->
nLeaves
])
);
}
return
RetValue
;
return
RetValue
;
}
}
...
...
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