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
22406e71
Commit
22406e71
authored
Jun 17, 2016
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Plain Diff
Merged in boschmitt/abc (pull request #28)
Handling D1C and SCC in FXCH
parents
c9128752
85428a60
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
169 additions
and
108 deletions
+169
-108
src/opt/fxch/Fxch.h
+2
-0
src/opt/fxch/FxchDiv.c
+11
-0
src/opt/fxch/FxchMan.c
+147
-97
src/opt/fxch/FxchSCHashTable.c
+9
-11
No files found.
src/opt/fxch/Fxch.h
View file @
22406e71
...
@@ -112,6 +112,7 @@ struct Fxch_Man_t_
...
@@ -112,6 +112,7 @@ struct Fxch_Man_t_
Vec_Int_t
*
vPairs
;
/* cube pairs for the given double cube divisor */
Vec_Int_t
*
vPairs
;
/* cube pairs for the given double cube divisor */
Vec_Int_t
*
vCubeFree
;
// cube-free divisor
Vec_Int_t
*
vCubeFree
;
// cube-free divisor
Vec_Int_t
*
vDiv
;
// selected divisor
Vec_Int_t
*
vDiv
;
// selected divisor
Vec_Int_t
*
vSCC
;
/* Statistics */
/* Statistics */
abctime
timeInit
;
/* Initialization time */
abctime
timeInit
;
/* Initialization time */
...
@@ -145,6 +146,7 @@ int Fxch_DivRemove( Fxch_Man_t* pFxchMan, int fUpdate, int fSingleCube, int fBa
...
@@ -145,6 +146,7 @@ int Fxch_DivRemove( Fxch_Man_t* pFxchMan, int fUpdate, int fSingleCube, int fBa
void
Fxch_DivSepareteCubes
(
Vec_Int_t
*
vDiv
,
Vec_Int_t
*
vCube0
,
Vec_Int_t
*
vCube1
);
void
Fxch_DivSepareteCubes
(
Vec_Int_t
*
vDiv
,
Vec_Int_t
*
vCube0
,
Vec_Int_t
*
vCube1
);
int
Fxch_DivRemoveLits
(
Vec_Int_t
*
vCube0
,
Vec_Int_t
*
vCube1
,
Vec_Int_t
*
vDiv
,
int
*
fCompl
);
int
Fxch_DivRemoveLits
(
Vec_Int_t
*
vCube0
,
Vec_Int_t
*
vCube1
,
Vec_Int_t
*
vDiv
,
int
*
fCompl
);
void
Fxch_DivPrint
(
Fxch_Man_t
*
pFxchMan
,
int
iDiv
);
void
Fxch_DivPrint
(
Fxch_Man_t
*
pFxchMan
,
int
iDiv
);
int
Fxch_DivIsNotConstant1
(
Vec_Int_t
*
vDiv
);
/*===== FxchMan.c ====================================================================================================*/
/*===== FxchMan.c ====================================================================================================*/
Fxch_Man_t
*
Fxch_ManAlloc
(
Vec_Wec_t
*
vCubes
);
Fxch_Man_t
*
Fxch_ManAlloc
(
Vec_Wec_t
*
vCubes
);
...
...
src/opt/fxch/FxchDiv.c
View file @
22406e71
...
@@ -457,6 +457,17 @@ void Fxch_DivPrint( Fxch_Man_t* pFxchMan,
...
@@ -457,6 +457,17 @@ void Fxch_DivPrint( Fxch_Man_t* pFxchMan,
printf
(
"Divs =%8d
\n
"
,
Hsh_VecSize
(
pFxchMan
->
pDivHash
)
);
printf
(
"Divs =%8d
\n
"
,
Hsh_VecSize
(
pFxchMan
->
pDivHash
)
);
}
}
int
Fxch_DivIsNotConstant1
(
Vec_Int_t
*
vDiv
)
{
int
Lit0
=
Abc_Lit2Var
(
Vec_IntEntry
(
vDiv
,
0
)
),
Lit1
=
Abc_Lit2Var
(
Vec_IntEntry
(
vDiv
,
1
)
);
if
(
(
Vec_IntSize
(
vDiv
)
==
2
)
&&
(
Lit0
==
Abc_LitNot
(
Lit1
)
)
)
return
0
;
return
1
;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
src/opt/fxch/FxchMan.c
View file @
22406e71
...
@@ -170,6 +170,7 @@ Fxch_Man_t* Fxch_ManAlloc( Vec_Wec_t* vCubes )
...
@@ -170,6 +170,7 @@ Fxch_Man_t* Fxch_ManAlloc( Vec_Wec_t* vCubes )
pFxchMan
->
vDivCubePairs
=
Vec_WecAlloc
(
1000
);
pFxchMan
->
vDivCubePairs
=
Vec_WecAlloc
(
1000
);
pFxchMan
->
vCubeFree
=
Vec_IntAlloc
(
100
);
pFxchMan
->
vCubeFree
=
Vec_IntAlloc
(
100
);
pFxchMan
->
vDiv
=
Vec_IntAlloc
(
100
);
pFxchMan
->
vDiv
=
Vec_IntAlloc
(
100
);
pFxchMan
->
vSCC
=
Vec_IntAlloc
(
64
);
pFxchMan
->
vCubesS
=
Vec_IntAlloc
(
100
);
pFxchMan
->
vCubesS
=
Vec_IntAlloc
(
100
);
pFxchMan
->
vPairs
=
Vec_IntAlloc
(
100
);
pFxchMan
->
vPairs
=
Vec_IntAlloc
(
100
);
...
@@ -188,6 +189,7 @@ void Fxch_ManFree( Fxch_Man_t* pFxchMan )
...
@@ -188,6 +189,7 @@ void Fxch_ManFree( Fxch_Man_t* pFxchMan )
Vec_IntFree
(
pFxchMan
->
vLevels
);
Vec_IntFree
(
pFxchMan
->
vLevels
);
Vec_IntFree
(
pFxchMan
->
vCubeFree
);
Vec_IntFree
(
pFxchMan
->
vCubeFree
);
Vec_IntFree
(
pFxchMan
->
vDiv
);
Vec_IntFree
(
pFxchMan
->
vDiv
);
Vec_IntFree
(
pFxchMan
->
vSCC
);
Vec_IntFree
(
pFxchMan
->
vCubesS
);
Vec_IntFree
(
pFxchMan
->
vCubesS
);
Vec_IntFree
(
pFxchMan
->
vPairs
);
Vec_IntFree
(
pFxchMan
->
vPairs
);
ABC_FREE
(
pFxchMan
);
ABC_FREE
(
pFxchMan
);
...
@@ -341,85 +343,87 @@ void Fxch_ManComputeLevel( Fxch_Man_t* pFxchMan )
...
@@ -341,85 +343,87 @@ void Fxch_ManComputeLevel( Fxch_Man_t* pFxchMan )
}
}
}
}
void
Fxch_ManUpdate
(
Fxch_Man_t
*
pFxchMan
,
/* Extract divisor from single-cubes */
int
iDiv
)
static
inline
void
Fxch_ManExtractDivFromCube
(
Fxch_Man_t
*
pFxchMan
,
const
int
Lit0
,
const
int
Lit1
,
const
int
iVarNew
)
{
{
int
i
,
int
i
,
iCube0
;
k
,
Vec_Int_t
*
vLitP
=
Vec_WecEntry
(
pFxchMan
->
vLits
,
Vec_WecSize
(
pFxchMan
->
vLits
)
-
2
);
iCube0
,
iCube1
,
Lit0
=
-
1
,
Lit1
=
-
1
,
iVarNew
,
Level
,
nCompls
;
Vec_Int_t
*
vCube0
,
Vec_IntForEachEntry
(
pFxchMan
->
vCubesS
,
iCube0
,
i
)
*
vCube1
,
{
*
vLitP
,
int
RetValue
;
*
vLitN
,
Vec_Int_t
*
vCube0
;
*
vDivCubePairs
;
/* Get the selected candidate (divisor) */
vCube0
=
Fxch_ManGetCube
(
pFxchMan
,
iCube0
);
Vec_IntClear
(
pFxchMan
->
vDiv
);
RetValue
=
Vec_IntRemove1
(
vCube0
,
Abc_LitNot
(
Lit0
)
);
Vec_IntAppend
(
pFxchMan
->
vDiv
,
Hsh_VecReadEntry
(
pFxchMan
->
pDivHash
,
iDiv
)
);
RetValue
+=
Vec_IntRemove1
(
vCube0
,
Abc_LitNot
(
Lit1
)
);
assert
(
RetValue
==
2
);
/* Find cubes associated with the single divisor */
Vec_IntPush
(
vCube0
,
Abc_Var2Lit
(
iVarNew
,
0
)
);
Vec_IntClear
(
pFxchMan
->
vCubesS
);
Vec_IntPush
(
vLitP
,
Vec_WecLevelId
(
pFxchMan
->
vCubes
,
vCube0
)
);
if
(
Vec_IntSize
(
pFxchMan
->
vDiv
)
==
2
)
{
Lit0
=
Abc_Lit2Var
(
Vec_IntEntry
(
pFxchMan
->
vDiv
,
0
)
);
Lit1
=
Abc_Lit2Var
(
Vec_IntEntry
(
pFxchMan
->
vDiv
,
1
)
);
assert
(
Lit0
>=
0
&&
Lit1
>=
0
);
Fxch_ManCompressCubes
(
pFxchMan
->
vCubes
,
Vec_WecEntry
(
pFxchMan
->
vLits
,
Abc_LitNot
(
Lit0
)
)
);
pFxchMan
->
nLits
--
;
Fxch_ManCompressCubes
(
pFxchMan
->
vCubes
,
Vec_WecEntry
(
pFxchMan
->
vLits
,
Abc_LitNot
(
Lit1
)
)
);
Vec_IntTwoRemoveCommon
(
Vec_WecEntry
(
pFxchMan
->
vLits
,
Abc_LitNot
(
Lit0
)
),
Vec_WecEntry
(
pFxchMan
->
vLits
,
Abc_LitNot
(
Lit1
)
),
pFxchMan
->
vCubesS
);
}
}
}
/* Extract divisor from cube pairs */
static
inline
int
Fxch_ManExtractDivFromCubePairs
(
Fxch_Man_t
*
pFxchMan
,
const
int
iVarNew
)
{
/* For each pair (Ci, Cj) */
int
k
=
0
,
iCube0
,
iCube1
,
i
;
/* Find pairs associated with the divisor */
Vec_Int_t
*
vLitP
=
Vec_WecEntry
(
pFxchMan
->
vLits
,
Vec_WecSize
(
pFxchMan
->
vLits
)
-
2
),
Vec_IntClear
(
pFxchMan
->
vPairs
);
*
vLitN
=
Vec_WecEntry
(
pFxchMan
->
vLits
,
Vec_WecSize
(
pFxchMan
->
vLits
)
-
1
);
vDivCubePairs
=
Vec_WecEntry
(
pFxchMan
->
vDivCubePairs
,
iDiv
);
Vec_IntAppend
(
pFxchMan
->
vPairs
,
vDivCubePairs
);
Vec_IntErase
(
vDivCubePairs
);
Vec_IntForEachEntryDouble
(
pFxchMan
->
vPairs
,
iCube0
,
iCube1
,
i
)
Vec_IntForEachEntryDouble
(
pFxchMan
->
vPairs
,
iCube0
,
iCube1
,
i
)
{
{
assert
(
Fxch_ManGetLit
(
pFxchMan
,
iCube0
,
0
)
==
Fxch_ManGetLit
(
pFxchMan
,
iCube1
,
0
)
);
int
RetValue
,
if
(
iCube0
>
iCube1
)
fCompl
=
0
;
{
Vec_IntSetEntry
(
pFxchMan
->
vPairs
,
i
,
iCube1
);
Vec_IntSetEntry
(
pFxchMan
->
vPairs
,
i
+
1
,
iCube0
);
}
}
Vec_IntUniqifyPairs
(
pFxchMan
->
vPairs
);
Vec_Int_t
*
vCube0
=
Fxch_ManGetCube
(
pFxchMan
,
iCube0
),
assert
(
Vec_IntSize
(
pFxchMan
->
vPairs
)
%
2
==
0
);
*
vCube1
=
Fxch_ManGetCube
(
pFxchMan
,
iCube1
);
/* subtract cost of single-cube divisors */
RetValue
=
Fxch_DivRemoveLits
(
vCube0
,
vCube1
,
pFxchMan
->
vDiv
,
&
fCompl
);
Vec_IntForEachEntry
(
pFxchMan
->
vCubesS
,
iCube0
,
i
)
Fxch_ManDivSingleCube
(
pFxchMan
,
iCube0
,
0
,
1
);
/* remove (fAdd = 0) - fUpdate = 1 */
Vec_IntForEachEntryDouble
(
pFxchMan
->
vPairs
,
iCube0
,
iCube1
,
i
)
assert
(
RetValue
==
Vec_IntSize
(
pFxchMan
->
vDiv
)
);
Fxch_ManDivSingleCube
(
pFxchMan
,
iCube0
,
0
,
1
),
/* remove (fAdd = 0) - fUpdate = 1 */
Fxch_ManDivSingleCube
(
pFxchMan
,
iCube1
,
0
,
1
);
/* remove (fAdd = 0) - fUpdate = 1 */
/* subtract cost of double-cube divisors */
pFxchMan
->
nLits
-=
Vec_IntSize
(
pFxchMan
->
vDiv
)
+
Vec_IntSize
(
vCube1
)
-
2
;
Vec_IntForEachEntry
(
pFxchMan
->
vCubesS
,
iCube0
,
i
)
/* Remove second cube */
Vec_IntClear
(
vCube1
);
Vec_IntWriteEntry
(
pFxchMan
->
vPairs
,
k
++
,
Vec_WecLevelId
(
pFxchMan
->
vCubes
,
vCube0
)
);
if
(
iVarNew
)
{
{
if
(
iCube0
<
Vec_IntSize
(
pFxchMan
->
pSCHashTable
->
vCubeLinks
)
)
if
(
Vec_IntSize
(
pFxchMan
->
vDiv
)
==
2
||
fCompl
)
Fxch_ManDivDoubleCube
(
pFxchMan
,
iCube0
,
0
,
1
);
/* remove (fAdd = 0) - fUpdate = 1 */
{
Vec_IntPush
(
vCube0
,
Abc_Var2Lit
(
iVarNew
,
1
)
);
Vec_IntPush
(
vLitN
,
Vec_WecLevelId
(
pFxchMan
->
vCubes
,
vCube0
)
);
}
}
else
Vec_IntForEachEntry
(
pFxchMan
->
vPairs
,
iCube0
,
i
)
{
{
if
(
iCube0
<
Vec_IntSize
(
pFxchMan
->
pSCHashTable
->
vCubeLinks
)
)
Vec_IntPush
(
vCube0
,
Abc_Var2Lit
(
iVarNew
,
0
)
);
Fxch_ManDivDoubleCube
(
pFxchMan
,
iCube0
,
0
,
1
);
/* remove (fAdd = 0) - fUpdate = 1 */
Vec_IntPush
(
vLitP
,
Vec_WecLevelId
(
pFxchMan
->
vCubes
,
vCube0
)
);
}
}
}
}
return
k
;
}
static
inline
int
Fxch_ManCreateCube
(
Fxch_Man_t
*
pFxchMan
,
int
Lit0
,
int
Lit1
)
{
int
Level
,
iVarNew
;
Vec_Int_t
*
vCube0
,
*
vCube1
;
/* Create a new variable */
/* Create a new variable */
iVarNew
=
pFxchMan
->
nVars
;
iVarNew
=
pFxchMan
->
nVars
;
...
@@ -457,58 +461,89 @@ void Fxch_ManUpdate( Fxch_Man_t* pFxchMan,
...
@@ -457,58 +461,89 @@ void Fxch_ManUpdate( Fxch_Man_t* pFxchMan,
pFxchMan
->
nLits
+=
Vec_IntSize
(
pFxchMan
->
vDiv
);
pFxchMan
->
nLits
+=
Vec_IntSize
(
pFxchMan
->
vDiv
);
/* Create new literals */
/* Create new literals */
vLitP
=
Vec_WecPushLevel
(
pFxchMan
->
vLits
);
Vec_WecPushLevel
(
pFxchMan
->
vLits
);
vLitN
=
Vec_WecPushLevel
(
pFxchMan
->
vLits
);
Vec_WecPushLevel
(
pFxchMan
->
vLits
);
vLitP
=
Vec_WecEntry
(
pFxchMan
->
vLits
,
Vec_WecSize
(
pFxchMan
->
vLits
)
-
2
);
/* Extract divisor from single-cubes */
return
iVarNew
;
Vec_IntForEachEntry
(
pFxchMan
->
vCubesS
,
iCube0
,
i
)
}
{
int
RetValue
;
vCube0
=
Fxch_ManGetCube
(
pFxchMan
,
iCube0
);
void
Fxch_ManUpdate
(
Fxch_Man_t
*
pFxchMan
,
RetValue
=
Vec_IntRemove1
(
vCube0
,
Abc_LitNot
(
Lit0
)
);
int
iDiv
)
RetValue
+=
Vec_IntRemove1
(
vCube0
,
Abc_LitNot
(
Lit1
)
);
{
assert
(
RetValue
==
2
);
int
i
,
iCube0
,
iCube1
,
Lit0
=
-
1
,
Lit1
=
-
1
,
iVarNew
;
Vec_IntPush
(
vCube0
,
Abc_Var2Lit
(
iVarNew
,
0
)
);
Vec_Int_t
*
vCube0
,
Vec_IntPush
(
vLitP
,
Vec_WecLevelId
(
pFxchMan
->
vCubes
,
vCube0
)
);
*
vCube1
,
*
vDivCubePairs
;
pFxchMan
->
nLits
--
;
/* Get the selected candidate (divisor) */
Vec_IntClear
(
pFxchMan
->
vDiv
);
Vec_IntAppend
(
pFxchMan
->
vDiv
,
Hsh_VecReadEntry
(
pFxchMan
->
pDivHash
,
iDiv
)
);
/* Find cubes associated with the divisor */
Vec_IntClear
(
pFxchMan
->
vCubesS
);
if
(
Vec_IntSize
(
pFxchMan
->
vDiv
)
==
2
)
{
Lit0
=
Abc_Lit2Var
(
Vec_IntEntry
(
pFxchMan
->
vDiv
,
0
)
);
Lit1
=
Abc_Lit2Var
(
Vec_IntEntry
(
pFxchMan
->
vDiv
,
1
)
);
assert
(
Lit0
>=
0
&&
Lit1
>=
0
);
Fxch_ManCompressCubes
(
pFxchMan
->
vCubes
,
Vec_WecEntry
(
pFxchMan
->
vLits
,
Abc_LitNot
(
Lit0
)
)
);
Fxch_ManCompressCubes
(
pFxchMan
->
vCubes
,
Vec_WecEntry
(
pFxchMan
->
vLits
,
Abc_LitNot
(
Lit1
)
)
);
Vec_IntTwoRemoveCommon
(
Vec_WecEntry
(
pFxchMan
->
vLits
,
Abc_LitNot
(
Lit0
)
),
Vec_WecEntry
(
pFxchMan
->
vLits
,
Abc_LitNot
(
Lit1
)
),
pFxchMan
->
vCubesS
);
}
}
/* For each pair (Ci, Cj) */
/* Find pairs associated with the divisor */
/* Extract divisor from cube pairs */
Vec_IntClear
(
pFxchMan
->
vPairs
);
k
=
0
;
vDivCubePairs
=
Vec_WecEntry
(
pFxchMan
->
vDivCubePairs
,
iDiv
);
nCompls
=
0
;
Vec_IntAppend
(
pFxchMan
->
vPairs
,
vDivCubePairs
);
Vec_IntErase
(
vDivCubePairs
);
Vec_IntForEachEntryDouble
(
pFxchMan
->
vPairs
,
iCube0
,
iCube1
,
i
)
Vec_IntForEachEntryDouble
(
pFxchMan
->
vPairs
,
iCube0
,
iCube1
,
i
)
{
{
int
RetValue
,
fCompl
=
0
;
assert
(
Fxch_ManGetLit
(
pFxchMan
,
iCube0
,
0
)
==
Fxch_ManGetLit
(
pFxchMan
,
iCube1
,
0
)
);
if
(
iCube0
>
iCube1
)
{
Vec_IntSetEntry
(
pFxchMan
->
vPairs
,
i
,
iCube1
);
Vec_IntSetEntry
(
pFxchMan
->
vPairs
,
i
+
1
,
iCube0
);
}
}
vCube0
=
Fxch_ManGetCube
(
pFxchMan
,
iCube0
);
Vec_IntUniqifyPairs
(
pFxchMan
->
vPairs
);
vCube1
=
Fxch_ManGetCube
(
pFxchMan
,
iCube1
);
assert
(
Vec_IntSize
(
pFxchMan
->
vPairs
)
%
2
==
0
);
RetValue
=
Fxch_DivRemoveLits
(
vCube0
,
vCube1
,
pFxchMan
->
vDiv
,
&
fCompl
);
/* subtract cost of single-cube divisors */
nCompls
+=
fCompl
;
Vec_IntForEachEntry
(
pFxchMan
->
vCubesS
,
iCube0
,
i
)
Fxch_ManDivSingleCube
(
pFxchMan
,
iCube0
,
0
,
1
);
/* remove (fAdd = 0) - fUpdate = 1 */
assert
(
RetValue
==
Vec_IntSize
(
pFxchMan
->
vDiv
)
);
Vec_IntForEachEntryDouble
(
pFxchMan
->
vPairs
,
iCube0
,
iCube1
,
i
)
Fxch_ManDivSingleCube
(
pFxchMan
,
iCube0
,
0
,
1
),
/* remove (fAdd = 0) - fUpdate = 1 */
Fxch_ManDivSingleCube
(
pFxchMan
,
iCube1
,
0
,
1
);
/* remove (fAdd = 0) - fUpdate = 1 */
if
(
Vec_IntSize
(
pFxchMan
->
vDiv
)
==
2
||
fCompl
)
/* subtract cost of double-cube divisors */
Vec_IntForEachEntry
(
pFxchMan
->
vCubesS
,
iCube0
,
i
)
if
(
iCube0
<
Vec_IntSize
(
pFxchMan
->
pSCHashTable
->
vCubeLinks
)
)
Fxch_ManDivDoubleCube
(
pFxchMan
,
iCube0
,
0
,
1
);
/* remove (fAdd = 0) - fUpdate = 1 */
Vec_IntForEachEntry
(
pFxchMan
->
vPairs
,
iCube0
,
i
)
if
(
iCube0
<
Vec_IntSize
(
pFxchMan
->
pSCHashTable
->
vCubeLinks
)
)
Fxch_ManDivDoubleCube
(
pFxchMan
,
iCube0
,
0
,
1
);
/* remove (fAdd = 0) - fUpdate = 1 */
int
k
=
0
;
if
(
Fxch_DivIsNotConstant1
(
pFxchMan
->
vDiv
)
)
{
{
Vec_IntPush
(
vCube0
,
Abc_Var2Lit
(
iVarNew
,
1
)
);
iVarNew
=
Fxch_ManCreateCube
(
pFxchMan
,
Lit0
,
Lit1
);
Vec_IntPush
(
vLitN
,
Vec_WecLevelId
(
pFxchMan
->
vCubes
,
vCube0
)
);
Fxch_ManExtractDivFromCube
(
pFxchMan
,
Lit0
,
Lit1
,
iVarNew
);
k
=
Fxch_ManExtractDivFromCubePairs
(
pFxchMan
,
iVarNew
);
}
}
else
else
{
k
=
Fxch_ManExtractDivFromCubePairs
(
pFxchMan
,
0
);
Vec_IntPush
(
vCube0
,
Abc_Var2Lit
(
iVarNew
,
0
)
);
Vec_IntPush
(
vLitP
,
Vec_WecLevelId
(
pFxchMan
->
vCubes
,
vCube0
)
);
}
pFxchMan
->
nLits
-=
Vec_IntSize
(
pFxchMan
->
vDiv
)
+
Vec_IntSize
(
vCube1
)
-
2
;
/* Remove second cube */
Vec_IntClear
(
vCube1
);
Vec_IntWriteEntry
(
pFxchMan
->
vPairs
,
k
++
,
Vec_WecLevelId
(
pFxchMan
->
vCubes
,
vCube0
)
);
}
assert
(
k
==
Vec_IntSize
(
pFxchMan
->
vPairs
)
/
2
);
assert
(
k
==
Vec_IntSize
(
pFxchMan
->
vPairs
)
/
2
);
Vec_IntShrink
(
pFxchMan
->
vPairs
,
k
);
Vec_IntShrink
(
pFxchMan
->
vPairs
,
k
);
...
@@ -528,6 +563,22 @@ void Fxch_ManUpdate( Fxch_Man_t* pFxchMan,
...
@@ -528,6 +563,22 @@ void Fxch_ManUpdate( Fxch_Man_t* pFxchMan,
if
(
iCube0
<
Vec_IntSize
(
pFxchMan
->
pSCHashTable
->
vCubeLinks
)
)
if
(
iCube0
<
Vec_IntSize
(
pFxchMan
->
pSCHashTable
->
vCubeLinks
)
)
Fxch_ManDivDoubleCube
(
pFxchMan
,
iCube0
,
1
,
1
);
/* fAdd = 1 - fUpdate = 1 */
Fxch_ManDivDoubleCube
(
pFxchMan
,
iCube0
,
1
,
1
);
/* fAdd = 1 - fUpdate = 1 */
/* Deal with SCC */
if
(
Vec_IntSize
(
pFxchMan
->
vSCC
)
)
{
Vec_IntUniqify
(
pFxchMan
->
vSCC
);
Vec_IntForEachEntry
(
pFxchMan
->
vSCC
,
iCube0
,
i
)
if
(
iCube0
<
Vec_IntSize
(
pFxchMan
->
pSCHashTable
->
vCubeLinks
)
)
{
Fxch_ManDivDoubleCube
(
pFxchMan
,
iCube0
,
0
,
1
);
/* remove (fAdd = 0) - fUpdate = 1 */
vCube0
=
Fxch_ManGetCube
(
pFxchMan
,
iCube0
),
Vec_IntClear
(
vCube0
);
}
Vec_IntClear
(
pFxchMan
->
vSCC
);
}
/* If it's a double-cube devisor add its cost */
/* If it's a double-cube devisor add its cost */
if
(
Vec_IntSize
(
pFxchMan
->
vDiv
)
>
2
)
if
(
Vec_IntSize
(
pFxchMan
->
vDiv
)
>
2
)
{
{
...
@@ -567,7 +618,6 @@ void Fxch_ManPrintDivs( Fxch_Man_t* pFxchMan )
...
@@ -567,7 +618,6 @@ void Fxch_ManPrintDivs( Fxch_Man_t* pFxchMan )
void
Fxch_ManPrintStats
(
Fxch_Man_t
*
pFxchMan
)
void
Fxch_ManPrintStats
(
Fxch_Man_t
*
pFxchMan
)
{
{
printf
(
"[FXCH] "
);
printf
(
"Cubes =%8d "
,
Vec_WecSizeUsed
(
pFxchMan
->
vCubes
)
);
printf
(
"Cubes =%8d "
,
Vec_WecSizeUsed
(
pFxchMan
->
vCubes
)
);
printf
(
"Lits =%8d "
,
Vec_WecSizeUsed
(
pFxchMan
->
vLits
)
);
printf
(
"Lits =%8d "
,
Vec_WecSizeUsed
(
pFxchMan
->
vLits
)
);
printf
(
"Divs =%8d "
,
Hsh_VecSize
(
pFxchMan
->
pDivHash
)
);
printf
(
"Divs =%8d "
,
Hsh_VecSize
(
pFxchMan
->
pDivHash
)
);
...
...
src/opt/fxch/FxchSCHashTable.c
View file @
22406e71
...
@@ -182,10 +182,6 @@ static inline int Fxch_SCHashTableEntryCompare( Fxch_SCHashTable_t* pSCHashTable
...
@@ -182,10 +182,6 @@ static inline int Fxch_SCHashTableEntryCompare( Fxch_SCHashTable_t* pSCHashTable
Vec_IntClear
(
&
pSCHashTable
->
vSubCube0
);
Vec_IntClear
(
&
pSCHashTable
->
vSubCube0
);
Vec_IntClear
(
&
pSCHashTable
->
vSubCube1
);
Vec_IntClear
(
&
pSCHashTable
->
vSubCube1
);
if
(
pSCData0
->
iLit1
==
0
&&
pSCData1
->
iLit1
==
0
&&
Vec_IntEntry
(
vCube0
,
pSCData0
->
iLit0
)
==
Abc_LitNot
(
Vec_IntEntry
(
vCube1
,
pSCData1
->
iLit0
)
)
)
return
0
;
if
(
pSCData0
->
iLit1
>
0
&&
pSCData1
->
iLit1
>
0
&&
if
(
pSCData0
->
iLit1
>
0
&&
pSCData1
->
iLit1
>
0
&&
(
Vec_IntEntry
(
vCube0
,
pSCData0
->
iLit0
)
==
Vec_IntEntry
(
vCube1
,
pSCData1
->
iLit0
)
||
(
Vec_IntEntry
(
vCube0
,
pSCData0
->
iLit0
)
==
Vec_IntEntry
(
vCube1
,
pSCData1
->
iLit0
)
||
Vec_IntEntry
(
vCube0
,
pSCData0
->
iLit0
)
==
Vec_IntEntry
(
vCube1
,
pSCData1
->
iLit1
)
||
Vec_IntEntry
(
vCube0
,
pSCData0
->
iLit0
)
==
Vec_IntEntry
(
vCube1
,
pSCData1
->
iLit1
)
||
...
@@ -270,14 +266,16 @@ int Fxch_SCHashTableInsert( Fxch_SCHashTable_t* pSCHashTable,
...
@@ -270,14 +266,16 @@ int Fxch_SCHashTableInsert( Fxch_SCHashTable_t* pSCHashTable,
if
(
!
Fxch_SCHashTableEntryCompare
(
pSCHashTable
,
vCubes
,
&
(
pEntry
->
SCData
),
&
(
pNewEntry
->
SCData
)
)
)
if
(
!
Fxch_SCHashTableEntryCompare
(
pSCHashTable
,
vCubes
,
&
(
pEntry
->
SCData
),
&
(
pNewEntry
->
SCData
)
)
)
continue
;
continue
;
if
(
pEntry
->
SCData
.
iLit0
==
0
)
if
(
(
pEntry
->
SCData
.
iLit0
==
0
)
||
(
pNewEntry
->
SCData
.
iLit0
==
0
)
)
{
printf
(
"[FXCH] SCC detected
\n
"
);
continue
;
}
if
(
pNewEntry
->
SCData
.
iLit0
==
0
)
{
{
printf
(
"[FXCH] SCC detected
\n
"
);
Vec_Int_t
*
vCube0
=
Fxch_ManGetCube
(
pSCHashTable
->
pFxchMan
,
pEntry
->
SCData
.
iCube
),
*
vCube1
=
Fxch_ManGetCube
(
pSCHashTable
->
pFxchMan
,
pEntry
->
SCData
.
iCube
);
if
(
Vec_IntSize
(
vCube0
)
>
Vec_IntSize
(
vCube1
)
)
Vec_IntPush
(
pSCHashTable
->
pFxchMan
->
vSCC
,
pEntry
->
SCData
.
iCube
);
else
Vec_IntPush
(
pSCHashTable
->
pFxchMan
->
vSCC
,
pNewEntry
->
SCData
.
iCube
);
continue
;
continue
;
}
}
...
...
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