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
f1f1cf3e
Commit
f1f1cf3e
authored
Apr 06, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvement in SOP balancing.
parent
a26d61f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
23 deletions
+24
-23
src/base/abci/abcIf.c
+4
-2
src/map/if/ifDelay.c
+9
-5
src/map/if/ifMan.c
+11
-16
No files found.
src/base/abci/abcIf.c
View file @
f1f1cf3e
...
@@ -393,10 +393,12 @@ Hop_Obj_t * Abc_NodeBuildFromMiniInt( Hop_Man_t * pMan, Vec_Int_t * vAig, int nL
...
@@ -393,10 +393,12 @@ Hop_Obj_t * Abc_NodeBuildFromMiniInt( Hop_Man_t * pMan, Vec_Int_t * vAig, int nL
}
}
Hop_Obj_t
*
Abc_NodeBuildFromMini
(
Hop_Man_t
*
pMan
,
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
int
fUseDsd
)
Hop_Obj_t
*
Abc_NodeBuildFromMini
(
Hop_Man_t
*
pMan
,
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
int
fUseDsd
)
{
{
int
Delay
;
if
(
fUseDsd
)
if
(
fUseDsd
)
If_CutDsdBalanceEval
(
p
,
pCut
,
p
->
vArray
);
Delay
=
If_CutDsdBalanceEval
(
p
,
pCut
,
p
->
vArray
);
else
else
If_CutSopBalanceEval
(
p
,
pCut
,
p
->
vArray
);
Delay
=
If_CutSopBalanceEval
(
p
,
pCut
,
p
->
vArray
);
assert
(
Delay
>=
0
);
return
Abc_NodeBuildFromMiniInt
(
pMan
,
p
->
vArray
,
If_CutLeaveNum
(
pCut
)
);
return
Abc_NodeBuildFromMiniInt
(
pMan
,
p
->
vArray
,
If_CutLeaveNum
(
pCut
)
);
}
}
...
...
src/map/if/ifDelay.c
View file @
f1f1cf3e
...
@@ -26,6 +26,8 @@ ABC_NAMESPACE_IMPL_START
...
@@ -26,6 +26,8 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
#define IF_MAX_CUBES 70
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
@@ -525,12 +527,12 @@ static inline word If_LogPinDelaysMulti( word * pPinDels, int nFanins, int nSupp
...
@@ -525,12 +527,12 @@ static inline word If_LogPinDelaysMulti( word * pPinDels, int nFanins, int nSupp
}
}
int
If_CutSopBalancePinDelaysInt
(
Vec_Int_t
*
vCover
,
int
*
pTimes
,
int
nSuppAll
,
char
*
pPerm
)
int
If_CutSopBalancePinDelaysInt
(
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
[
IF_MAX_CUBES
];
int
nCounterAnd
,
pCounterAnd
[
IF_MAX_FUNC_LUTSIZE
];
int
nCounterAnd
,
pCounterAnd
[
IF_MAX_FUNC_LUTSIZE
];
int
nCounterOr
,
pCounterOr
[
32
];
int
nCounterOr
,
pCounterOr
[
IF_MAX_CUBES
];
int
i
,
k
,
Entry
,
Literal
,
Delay
=
0
;
int
i
,
k
,
Entry
,
Literal
,
Delay
=
0
;
word
ResAnd
,
ResOr
;
word
ResAnd
,
ResOr
;
if
(
Vec_IntSize
(
vCover
)
>
32
)
if
(
Vec_IntSize
(
vCover
)
>
IF_MAX_CUBES
)
return
-
1
;
return
-
1
;
nCounterOr
=
0
;
nCounterOr
=
0
;
Vec_IntForEachEntry
(
vCover
,
Entry
,
i
)
Vec_IntForEachEntry
(
vCover
,
Entry
,
i
)
...
@@ -589,9 +591,9 @@ int If_CutSopBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
...
@@ -589,9 +591,9 @@ int If_CutSopBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
int
If_CutSopBalanceEvalIntInt
(
Vec_Int_t
*
vCover
,
int
*
pTimes
,
Vec_Int_t
*
vAig
,
int
*
piRes
,
int
nSuppAll
,
int
*
pArea
)
int
If_CutSopBalanceEvalIntInt
(
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
[
IF_MAX_CUBES
],
pFaninLitsOr
[
IF_MAX_CUBES
];
int
i
,
k
,
Entry
,
Literal
,
nLits
,
Delay
=
0
,
iRes
=
0
;
int
i
,
k
,
Entry
,
Literal
,
nLits
,
Delay
=
0
,
iRes
=
0
;
if
(
Vec_IntSize
(
vCover
)
>
32
)
if
(
Vec_IntSize
(
vCover
)
>
IF_MAX_CUBES
)
return
-
1
;
return
-
1
;
nCounterOr
=
0
;
nCounterOr
=
0
;
Vec_IntForEachEntry
(
vCover
,
Entry
,
i
)
Vec_IntForEachEntry
(
vCover
,
Entry
,
i
)
...
@@ -628,6 +630,8 @@ int If_CutSopBalanceEvalInt( Vec_Int_t * vCover, int nLeaves, int * pTimes, Vec_
...
@@ -628,6 +630,8 @@ int If_CutSopBalanceEvalInt( Vec_Int_t * vCover, int nLeaves, int * pTimes, Vec_
if
(
Vec_IntSize
(
vCover
)
==
0
)
if
(
Vec_IntSize
(
vCover
)
==
0
)
return
-
1
;
return
-
1
;
Res
=
If_CutSopBalanceEvalIntInt
(
vCover
,
pTimes
,
vAig
,
&
iRes
,
nLeaves
,
pArea
);
Res
=
If_CutSopBalanceEvalIntInt
(
vCover
,
pTimes
,
vAig
,
&
iRes
,
nLeaves
,
pArea
);
if
(
Res
==
-
1
)
return
-
1
;
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
,
Abc_LitIsCompl
(
iRes
)
^
fCompl
);
Vec_IntPush
(
vAig
,
Abc_LitIsCompl
(
iRes
)
^
fCompl
);
...
...
src/map/if/ifMan.c
View file @
f1f1cf3e
...
@@ -32,8 +32,6 @@ static If_Obj_t * If_ManSetupObj( If_Man_t * p );
...
@@ -32,8 +32,6 @@ static If_Obj_t * If_ManSetupObj( If_Man_t * p );
static
void
If_ManCutSetRecycle
(
If_Man_t
*
p
,
If_Set_t
*
pSet
)
{
pSet
->
pNext
=
p
->
pFreeList
;
p
->
pFreeList
=
pSet
;
}
static
void
If_ManCutSetRecycle
(
If_Man_t
*
p
,
If_Set_t
*
pSet
)
{
pSet
->
pNext
=
p
->
pFreeList
;
p
->
pFreeList
=
pSet
;
}
static
If_Set_t
*
If_ManCutSetFetch
(
If_Man_t
*
p
)
{
If_Set_t
*
pTemp
=
p
->
pFreeList
;
p
->
pFreeList
=
p
->
pFreeList
->
pNext
;
return
pTemp
;
}
static
If_Set_t
*
If_ManCutSetFetch
(
If_Man_t
*
p
)
{
If_Set_t
*
pTemp
=
p
->
pFreeList
;
p
->
pFreeList
=
p
->
pFreeList
->
pNext
;
return
pTemp
;
}
extern
abctime
s_TimeComp
[
4
];
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
@@ -62,14 +60,13 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
...
@@ -62,14 +60,13 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
p
->
vCis
=
Vec_PtrAlloc
(
100
);
p
->
vCis
=
Vec_PtrAlloc
(
100
);
p
->
vCos
=
Vec_PtrAlloc
(
100
);
p
->
vCos
=
Vec_PtrAlloc
(
100
);
p
->
vObjs
=
Vec_PtrAlloc
(
100
);
p
->
vObjs
=
Vec_PtrAlloc
(
100
);
// p->vMapped = Vec_PtrAlloc( 100 );
p
->
vTemp
=
Vec_PtrAlloc
(
100
);
p
->
vTemp
=
Vec_PtrAlloc
(
100
);
// prepare the memory manager
// prepare the memory manager
if
(
p
->
pPars
->
fTruth
)
if
(
p
->
pPars
->
fTruth
)
{
{
for
(
v
=
0
;
v
<=
p
->
pPars
->
nLutSize
;
v
++
)
for
(
v
=
0
;
v
<=
p
->
pPars
->
nLutSize
;
v
++
)
p
->
nTruth6Words
[
v
]
=
Abc_Truth6WordNum
(
v
);
p
->
nTruth6Words
[
v
]
=
Abc_Truth6WordNum
(
v
);
for
(
v
=
6
;
v
<=
p
->
pPars
->
nLutSize
;
v
++
)
for
(
v
=
6
;
v
<=
Abc_MaxInt
(
6
,
p
->
pPars
->
nLutSize
)
;
v
++
)
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
];
...
@@ -77,20 +74,19 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
...
@@ -77,20 +74,19 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
{
{
p
->
vCover
=
Vec_IntAlloc
(
0
);
p
->
vCover
=
Vec_IntAlloc
(
0
);
p
->
vArray
=
Vec_IntAlloc
(
1000
);
p
->
vArray
=
Vec_IntAlloc
(
1000
);
for
(
v
=
6
;
v
<=
p
->
pPars
->
nLutSize
;
v
++
)
for
(
v
=
6
;
v
<=
Abc_MaxInt
(
6
,
p
->
pPars
->
nLutSize
)
;
v
++
)
p
->
vTtIsops
[
v
]
=
Vec_WecAlloc
(
1000
);
p
->
vTtIsops
[
v
]
=
Vec_WecAlloc
(
1000
);
for
(
v
=
6
;
v
<=
p
->
pPars
->
nLutSize
;
v
++
)
for
(
v
=
6
;
v
<=
Abc_MaxInt
(
6
,
p
->
pPars
->
nLutSize
)
;
v
++
)
Vec_WecInit
(
p
->
vTtIsops
[
v
],
2
);
Vec_WecInit
(
p
->
vTtIsops
[
v
],
2
);
for
(
v
=
0
;
v
<
6
;
v
++
)
for
(
v
=
0
;
v
<
6
;
v
++
)
p
->
vTtIsops
[
v
]
=
p
->
vTtIsops
[
6
];
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
->
nCutBytes
=
sizeof
(
If_Cut_t
)
+
sizeof
(
int
)
*
(
p
->
pPars
->
nLutSize
+
p
->
nPermWords
/* + p->nTruthWords*/
);
p
->
nCutBytes
=
sizeof
(
If_Cut_t
)
+
sizeof
(
int
)
*
(
p
->
pPars
->
nLutSize
+
p
->
nPermWords
);
p
->
nSetBytes
=
sizeof
(
If_Set_t
)
+
(
sizeof
(
If_Cut_t
*
)
+
p
->
nCutBytes
)
*
(
p
->
pPars
->
nCutsMax
+
1
);
p
->
nSetBytes
=
sizeof
(
If_Set_t
)
+
(
sizeof
(
If_Cut_t
*
)
+
p
->
nCutBytes
)
*
(
p
->
pPars
->
nCutsMax
+
1
);
p
->
pMemObj
=
Mem_FixedStart
(
p
->
nObjBytes
);
p
->
pMemObj
=
Mem_FixedStart
(
p
->
nObjBytes
);
// p->pMemSet = Mem_FixedStart( p->nSetBytes );
// report expected memory usage
// report expected memory usage
if
(
p
->
pPars
->
fVerbose
)
if
(
p
->
pPars
->
fVerbose
)
Abc_Print
(
1
,
"K = %d. Memory (bytes): Truth = %4d. Cut = %4d. Obj = %4d. Set = %4d. CutMin = %s
\n
"
,
Abc_Print
(
1
,
"K = %d. Memory (bytes): Truth = %4d. Cut = %4d. Obj = %4d. Set = %4d. CutMin = %s
\n
"
,
...
@@ -103,7 +99,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
...
@@ -103,7 +99,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
p
->
puTempW
=
p
->
pPars
->
fTruth
?
ABC_ALLOC
(
word
,
p
->
nTruth6Words
[
p
->
pPars
->
nLutSize
]
)
:
NULL
;
p
->
puTempW
=
p
->
pPars
->
fTruth
?
ABC_ALLOC
(
word
,
p
->
nTruth6Words
[
p
->
pPars
->
nLutSize
]
)
:
NULL
;
if
(
pPars
->
fUseDsd
)
if
(
pPars
->
fUseDsd
)
{
{
for
(
v
=
6
;
v
<=
p
->
pPars
->
nLutSize
;
v
++
)
for
(
v
=
6
;
v
<=
Abc_MaxInt
(
6
,
p
->
pPars
->
nLutSize
)
;
v
++
)
{
{
p
->
vTtDsds
[
v
]
=
Vec_IntAlloc
(
1000
);
p
->
vTtDsds
[
v
]
=
Vec_IntAlloc
(
1000
);
Vec_IntPush
(
p
->
vTtDsds
[
v
],
0
);
Vec_IntPush
(
p
->
vTtDsds
[
v
],
0
);
...
@@ -151,7 +147,6 @@ void If_ManRestart( If_Man_t * p )
...
@@ -151,7 +147,6 @@ void If_ManRestart( If_Man_t * p )
Vec_PtrClear
(
p
->
vCis
);
Vec_PtrClear
(
p
->
vCis
);
Vec_PtrClear
(
p
->
vCos
);
Vec_PtrClear
(
p
->
vCos
);
Vec_PtrClear
(
p
->
vObjs
);
Vec_PtrClear
(
p
->
vObjs
);
// Vec_PtrClear( p->vMapped );
Vec_PtrClear
(
p
->
vTemp
);
Vec_PtrClear
(
p
->
vTemp
);
Mem_FixedRestart
(
p
->
pMemObj
);
Mem_FixedRestart
(
p
->
pMemObj
);
// create the constant node
// create the constant node
...
@@ -182,9 +177,9 @@ void If_ManStop( If_Man_t * p )
...
@@ -182,9 +177,9 @@ void If_ManStop( If_Man_t * p )
if
(
p
->
pPars
->
fVerbose
&&
p
->
pPars
->
fTruth
)
if
(
p
->
pPars
->
fVerbose
&&
p
->
pPars
->
fTruth
)
{
{
int
nUnique
=
0
,
nMemTotal
=
0
;
int
nUnique
=
0
,
nMemTotal
=
0
;
for
(
i
=
6
;
i
<=
p
->
pPars
->
nLutSize
;
i
++
)
for
(
i
=
6
;
i
<=
Abc_MaxInt
(
6
,
p
->
pPars
->
nLutSize
)
;
i
++
)
nUnique
+=
Vec_MemEntryNum
(
p
->
vTtMem
[
i
]);
nUnique
+=
Vec_MemEntryNum
(
p
->
vTtMem
[
i
]);
for
(
i
=
6
;
i
<=
p
->
pPars
->
nLutSize
;
i
++
)
for
(
i
=
6
;
i
<=
Abc_MaxInt
(
6
,
p
->
pPars
->
nLutSize
)
;
i
++
)
nMemTotal
+=
(
int
)
Vec_MemMemory
(
p
->
vTtMem
[
i
]);
nMemTotal
+=
(
int
)
Vec_MemMemory
(
p
->
vTtMem
[
i
]);
printf
(
"Unique truth tables = %d Memory = %.2f MB "
,
nUnique
,
1
.
0
*
nMemTotal
/
(
1
<<
20
)
);
printf
(
"Unique truth tables = %d Memory = %.2f MB "
,
nUnique
,
1
.
0
*
nMemTotal
/
(
1
<<
20
)
);
Abc_PrintTime
(
1
,
"Time"
,
p
->
timeCache
[
4
]
);
Abc_PrintTime
(
1
,
"Time"
,
p
->
timeCache
[
4
]
);
...
@@ -233,11 +228,11 @@ void If_ManStop( If_Man_t * p )
...
@@ -233,11 +228,11 @@ void If_ManStop( If_Man_t * p )
Vec_StrFreeP
(
&
p
->
vPairPerms
);
Vec_StrFreeP
(
&
p
->
vPairPerms
);
if
(
p
->
vPairHash
)
if
(
p
->
vPairHash
)
Hash_IntManStop
(
p
->
vPairHash
);
Hash_IntManStop
(
p
->
vPairHash
);
for
(
i
=
6
;
i
<=
p
->
pPars
->
nLutSize
;
i
++
)
for
(
i
=
6
;
i
<=
Abc_MaxInt
(
6
,
p
->
pPars
->
nLutSize
)
;
i
++
)
Vec_MemHashFree
(
p
->
vTtMem
[
i
]
);
Vec_MemHashFree
(
p
->
vTtMem
[
i
]
);
for
(
i
=
6
;
i
<=
p
->
pPars
->
nLutSize
;
i
++
)
for
(
i
=
6
;
i
<=
Abc_MaxInt
(
6
,
p
->
pPars
->
nLutSize
)
;
i
++
)
Vec_MemFreeP
(
&
p
->
vTtMem
[
i
]
);
Vec_MemFreeP
(
&
p
->
vTtMem
[
i
]
);
for
(
i
=
6
;
i
<=
p
->
pPars
->
nLutSize
;
i
++
)
for
(
i
=
6
;
i
<=
Abc_MaxInt
(
6
,
p
->
pPars
->
nLutSize
)
;
i
++
)
Vec_WecFreeP
(
&
p
->
vTtIsops
[
i
]
);
Vec_WecFreeP
(
&
p
->
vTtIsops
[
i
]
);
Mem_FixedStop
(
p
->
pMemObj
,
0
);
Mem_FixedStop
(
p
->
pMemObj
,
0
);
ABC_FREE
(
p
->
pMemCi
);
ABC_FREE
(
p
->
pMemCi
);
...
...
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