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
8bc4894c
Commit
8bc4894c
authored
Aug 01, 2016
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compiler errors on Windows.
parent
f59788f6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
39 deletions
+50
-39
src/opt/fxch/Fxch.c
+13
-10
src/opt/fxch/Fxch.h
+3
-0
src/opt/fxch/FxchMan.c
+16
-13
src/opt/fxch/FxchSCHashTable.c
+18
-16
No files found.
src/opt/fxch/Fxch.c
View file @
8bc4894c
...
...
@@ -37,7 +37,8 @@ ABC_NAMESPACE_IMPL_START
void
Fxch_CubesGruping
(
Fxch_Man_t
*
pFxchMan
)
{
Vec_Int_t
*
vCube
;
int
iCube
;
int
iCube
,
nOutputs
,
SizeOutputID
;
Hsh_VecMan_t
*
pCubeHash
;
/* Identify the number of Outputs and create the translation table */
pFxchMan
->
vTranslation
=
Vec_IntAlloc
(
32
);
...
...
@@ -49,30 +50,31 @@ void Fxch_CubesGruping(Fxch_Man_t* pFxchMan)
if
(
iTranslation
==
-
1
)
Vec_IntPush
(
pFxchMan
->
vTranslation
,
Id
);
}
int
nOutputs
=
Vec_IntSize
(
pFxchMan
->
vTranslation
);
nOutputs
=
Vec_IntSize
(
pFxchMan
->
vTranslation
);
/* Size of the OutputID in number o ints */
int
SizeOutputID
=
(
nOutputs
>>
5
)
+
(
(
nOutputs
&
31
)
>
0
);
SizeOutputID
=
(
nOutputs
>>
5
)
+
(
(
nOutputs
&
31
)
>
0
);
/* Initialize needed structures */
pFxchMan
->
vOutputID
=
Vec_IntAlloc
(
4096
);
pFxchMan
->
pTempOutputID
=
ABC_CALLOC
(
int
,
SizeOutputID
);
pFxchMan
->
nSizeOutputID
=
SizeOutputID
;
Hsh_VecMan_t
*
pCubeHash
=
Hsh_VecManStart
(
1024
);
pCubeHash
=
Hsh_VecManStart
(
1024
);
/* Identify equal cubes */
Vec_WecForEachLevel
(
pFxchMan
->
vCubes
,
vCube
,
iCube
)
{
int
Id
=
Vec_IntEntry
(
vCube
,
0
);
int
iTranslation
=
Vec_IntFind
(
pFxchMan
->
vTranslation
,
Id
);
int
i
,
iCubeNoID
,
Temp
,
*
pEntry
;
Vec_IntWriteEntry
(
vCube
,
0
,
0
);
// Clear ID, Outputs will be identified by it later
i
nt
i
CubeNoID
=
Hsh_VecManAdd
(
pCubeHash
,
vCube
);
int
Temp
=
(
1
<<
(
iTranslation
&
31
)
);
iCubeNoID
=
Hsh_VecManAdd
(
pCubeHash
,
vCube
);
Temp
=
(
1
<<
(
iTranslation
&
31
)
);
if
(
iCubeNoID
==
Vec_IntSize
(
pFxchMan
->
vOutputID
)
/
SizeOutputID
)
{
for
(
i
nt
i
=
0
;
i
<
SizeOutputID
;
i
++
)
for
(
i
=
0
;
i
<
SizeOutputID
;
i
++
)
pFxchMan
->
pTempOutputID
[
i
]
=
0
;
pFxchMan
->
pTempOutputID
[
iTranslation
>>
5
]
=
Temp
;
...
...
@@ -81,7 +83,7 @@ void Fxch_CubesGruping(Fxch_Man_t* pFxchMan)
else
{
Vec_IntClear
(
vCube
);
int
*
pEntry
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
(
iCubeNoID
*
SizeOutputID
)
+
(
iTranslation
>>
5
)
);
pEntry
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
(
iCubeNoID
*
SizeOutputID
)
+
(
iTranslation
>>
5
)
);
*
pEntry
|=
Temp
;
}
}
...
...
@@ -111,11 +113,12 @@ void Fxch_CubesUnGruping(Fxch_Man_t* pFxchMan)
assert
(
Vec_WecSize
(
pFxchMan
->
vCubes
)
==
(
Vec_IntSize
(
pFxchMan
->
vOutputID
)
/
pFxchMan
->
nSizeOutputID
)
);
Vec_WecForEachLevel
(
pFxchMan
->
vCubes
,
vCube
,
iCube
)
{
int
*
pOutputID
,
nOnes
;
if
(
Vec_IntSize
(
vCube
)
==
0
||
Vec_IntEntry
(
vCube
,
0
)
!=
0
)
continue
;
int
*
pOutputID
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
iCube
*
pFxchMan
->
nSizeOutputID
);
int
nOnes
=
0
;
pOutputID
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
iCube
*
pFxchMan
->
nSizeOutputID
);
nOnes
=
0
;
for
(
i
=
0
;
i
<
pFxchMan
->
nSizeOutputID
;
i
++
)
nOnes
+=
Fxch_CountOnes
(
(
unsigned
int
)
pOutputID
[
i
]
);
...
...
src/opt/fxch/Fxch.h
View file @
8bc4894c
...
...
@@ -28,6 +28,9 @@
ABC_NAMESPACE_HEADER_START
typedef
unsigned
char
uint8_t
;
typedef
unsigned
int
uint32_t
;
////////////////////////////////////////////////////////////////////////
/// TYPEDEF DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
...
...
src/opt/fxch/FxchMan.c
View file @
8bc4894c
...
...
@@ -67,16 +67,17 @@ static inline int Fxch_ManDivSingleCube( Fxch_Man_t* pFxchMan,
Vec_IntForEachEntryStart
(
vCube
,
Lit0
,
i
,
1
)
Vec_IntForEachEntryStart
(
vCube
,
Lit1
,
k
,
(
i
+
1
)
)
{
int
*
pOutputID
,
nOnes
,
j
,
z
;
assert
(
Lit0
<
Lit1
);
Vec_IntClear
(
pFxchMan
->
vCubeFree
);
Vec_IntPush
(
pFxchMan
->
vCubeFree
,
Abc_Var2Lit
(
Abc_LitNot
(
Lit0
),
0
)
);
Vec_IntPush
(
pFxchMan
->
vCubeFree
,
Abc_Var2Lit
(
Abc_LitNot
(
Lit1
),
1
)
);
int
*
pOutputID
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
iCube
*
pFxchMan
->
nSizeOutputID
);
int
nOnes
=
0
;
pOutputID
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
iCube
*
pFxchMan
->
nSizeOutputID
);
nOnes
=
0
;
for
(
int
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
;
j
++
)
for
(
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
;
j
++
)
nOnes
+=
Fxch_CountOnes
(
pOutputID
[
j
]
);
if
(
nOnes
==
0
)
...
...
@@ -84,13 +85,13 @@ static inline int Fxch_ManDivSingleCube( Fxch_Man_t* pFxchMan,
if
(
fAdd
)
{
for
(
int
z
=
0
;
z
<
nOnes
;
z
++
)
for
(
z
=
0
;
z
<
nOnes
;
z
++
)
Fxch_DivAdd
(
pFxchMan
,
fUpdate
,
fSingleCube
,
fBase
);
pFxchMan
->
nPairsS
++
;
}
else
{
for
(
int
z
=
0
;
z
<
nOnes
;
z
++
)
for
(
z
=
0
;
z
<
nOnes
;
z
++
)
Fxch_DivRemove
(
pFxchMan
,
fUpdate
,
fSingleCube
,
fBase
);
pFxchMan
->
nPairsS
--
;
}
...
...
@@ -396,6 +397,7 @@ static inline void Fxch_ManExtractDivFromCubePairs( Fxch_Man_t* pFxchMan,
int
j
,
Lit
,
RetValue
,
fCompl
=
0
;
int
*
pOutputID0
,
*
pOutputID1
;
Vec_Int_t
*
vCube
=
NULL
,
*
vCube0
=
Fxch_ManGetCube
(
pFxchMan
,
iCube0
),
...
...
@@ -410,8 +412,8 @@ static inline void Fxch_ManExtractDivFromCubePairs( Fxch_Man_t* pFxchMan,
pFxchMan
->
nLits
-=
Vec_IntSize
(
pFxchMan
->
vDiv
)
+
Vec_IntSize
(
vCube1
)
-
2
;
/* Identify type of Extraction */
int
*
pOutputID0
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
iCube0
*
pFxchMan
->
nSizeOutputID
);
int
*
pOutputID1
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
iCube1
*
pFxchMan
->
nSizeOutputID
);
pOutputID0
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
iCube0
*
pFxchMan
->
nSizeOutputID
);
pOutputID1
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
iCube1
*
pFxchMan
->
nSizeOutputID
);
RetValue
=
1
;
for
(
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
&&
RetValue
;
j
++
)
RetValue
=
(
pOutputID0
[
j
]
==
pOutputID1
[
j
]
);
...
...
@@ -512,7 +514,8 @@ static inline int Fxch_ManCreateCube( Fxch_Man_t* pFxchMan,
int
Lit1
)
{
int
Level
,
iVarNew
;
iVarNew
,
j
;
Vec_Int_t
*
vCube0
,
*
vCube1
;
...
...
@@ -521,7 +524,7 @@ static inline int Fxch_ManCreateCube( Fxch_Man_t* pFxchMan,
pFxchMan
->
nVars
++
;
/* Clear temporary outputID vector */
for
(
int
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
;
j
++
)
for
(
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
;
j
++
)
pFxchMan
->
pTempOutputID
[
j
]
=
0
;
/* Create new Lit hash keys */
...
...
@@ -674,6 +677,7 @@ void Fxch_ManUpdate( Fxch_Man_t* pFxchMan,
Vec_IntForEachEntryDouble
(
pFxchMan
->
vSCC
,
iCube0
,
iCube1
,
i
)
{
int
j
,
RetValue
=
1
;
int
*
pOutputID0
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
iCube0
*
pFxchMan
->
nSizeOutputID
);
int
*
pOutputID1
=
Vec_IntEntryP
(
pFxchMan
->
vOutputID
,
iCube1
*
pFxchMan
->
nSizeOutputID
);
vCube0
=
Vec_WecEntry
(
pFxchMan
->
vCubes
,
iCube0
);
...
...
@@ -695,7 +699,7 @@ void Fxch_ManUpdate( Fxch_Man_t* pFxchMan,
if
(
Vec_IntSize
(
vCube0
)
==
Vec_IntSize
(
vCube1
)
)
{
for
(
int
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
;
j
++
)
for
(
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
;
j
++
)
{
pOutputID1
[
j
]
|=
pOutputID0
[
j
];
pOutputID0
[
j
]
=
0
;
...
...
@@ -705,8 +709,7 @@ void Fxch_ManUpdate( Fxch_Man_t* pFxchMan,
continue
;
}
int
RetValue
=
1
;
for
(
int
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
&&
RetValue
;
j
++
)
for
(
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
&&
RetValue
;
j
++
)
RetValue
=
(
pOutputID0
[
j
]
==
pOutputID1
[
j
]
);
if
(
RetValue
)
...
...
@@ -717,7 +720,7 @@ void Fxch_ManUpdate( Fxch_Man_t* pFxchMan,
else
{
RetValue
=
0
;
for
(
int
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
;
j
++
)
for
(
j
=
0
;
j
<
pFxchMan
->
nSizeOutputID
;
j
++
)
{
RetValue
|=
(
pOutputID0
[
j
]
&
~
(
pOutputID1
[
j
]
)
);
pOutputID0
[
j
]
&=
~
(
pOutputID1
[
j
]
);
...
...
src/opt/fxch/FxchSCHashTable.c
View file @
8bc4894c
...
...
@@ -124,7 +124,7 @@ static inline int Fxch_SCHashTableEntryCompare( Fxch_SCHashTable_t* pSCHashTable
int
*
pOutputID0
=
Vec_IntEntryP
(
pSCHashTable
->
pFxchMan
->
vOutputID
,
pSCData0
->
iCube
*
pSCHashTable
->
pFxchMan
->
nSizeOutputID
),
*
pOutputID1
=
Vec_IntEntryP
(
pSCHashTable
->
pFxchMan
->
vOutputID
,
pSCData1
->
iCube
*
pSCHashTable
->
pFxchMan
->
nSizeOutputID
);
int
Result
=
0
;
int
i
,
Result
=
0
;
if
(
!
Vec_IntSize
(
vCube0
)
||
!
Vec_IntSize
(
vCube1
)
||
...
...
@@ -132,7 +132,7 @@ static inline int Fxch_SCHashTableEntryCompare( Fxch_SCHashTable_t* pSCHashTable
pSCData0
->
Id
!=
pSCData1
->
Id
)
return
0
;
for
(
i
nt
i
=
0
;
i
<
pSCHashTable
->
pFxchMan
->
nSizeOutputID
&&
Result
==
0
;
i
++
)
for
(
i
=
0
;
i
<
pSCHashTable
->
pFxchMan
->
nSizeOutputID
&&
Result
==
0
;
i
++
)
Result
=
(
pOutputID0
[
i
]
&
pOutputID1
[
i
]
);
if
(
Result
==
0
)
...
...
@@ -181,6 +181,8 @@ int Fxch_SCHashTableInsert( Fxch_SCHashTable_t* pSCHashTable,
int
Pairs
=
0
;
uint32_t
BinID
;
Fxch_SCHashTable_Entry_t
*
pBin
;
Fxch_SubCube_t
*
pNewEntry
;
int
iEntry
;
MurmurHash3_x86_32
(
(
void
*
)
&
SubCubeID
,
sizeof
(
int
),
0x9747b28c
,
&
BinID
);
pBin
=
Fxch_SCHashTableBin
(
pSCHashTable
,
BinID
);
...
...
@@ -207,15 +209,15 @@ int Fxch_SCHashTableInsert( Fxch_SCHashTable_t* pSCHashTable,
if
(
pBin
->
Size
==
1
)
return
0
;
Fxch_SubCube_t
*
pNewEntry
=
&
(
pBin
->
vSCData
[
iNewEntry
]
);
for
(
i
nt
iEntry
=
0
;
iEntry
<
pBin
->
Size
-
1
;
iEntry
++
)
pNewEntry
=
&
(
pBin
->
vSCData
[
iNewEntry
]
);
for
(
i
Entry
=
0
;
iEntry
<
(
int
)
pBin
->
Size
-
1
;
iEntry
++
)
{
Fxch_SubCube_t
*
pEntry
=
&
(
pBin
->
vSCData
[
iEntry
]
);
int
*
pOutputID0
=
Vec_IntEntryP
(
pSCHashTable
->
pFxchMan
->
vOutputID
,
pEntry
->
iCube
*
pSCHashTable
->
pFxchMan
->
nSizeOutputID
);
int
*
pOutputID1
=
Vec_IntEntryP
(
pSCHashTable
->
pFxchMan
->
vOutputID
,
pNewEntry
->
iCube
*
pSCHashTable
->
pFxchMan
->
nSizeOutputID
);
int
Result
=
0
;
int
Base
;
int
iNewDiv
;
int
iNewDiv
,
i
,
z
;
if
(
!
Fxch_SCHashTableEntryCompare
(
pSCHashTable
,
vCubes
,
pEntry
,
pNewEntry
)
)
continue
;
...
...
@@ -244,10 +246,10 @@ int Fxch_SCHashTableInsert( Fxch_SCHashTable_t* pSCHashTable,
if
(
Base
<
0
)
continue
;
for
(
i
nt
i
=
0
;
i
<
pSCHashTable
->
pFxchMan
->
nSizeOutputID
;
i
++
)
for
(
i
=
0
;
i
<
pSCHashTable
->
pFxchMan
->
nSizeOutputID
;
i
++
)
Result
+=
Fxch_CountOnes
(
pOutputID0
[
i
]
&
pOutputID1
[
i
]
);
for
(
int
z
=
0
;
z
<
Result
;
z
++
)
for
(
z
=
0
;
z
<
Result
;
z
++
)
iNewDiv
=
Fxch_DivAdd
(
pSCHashTable
->
pFxchMan
,
fUpdate
,
0
,
Base
);
Vec_WecPush
(
pSCHashTable
->
pFxchMan
->
vDivCubePairs
,
iNewDiv
,
pEntry
->
iCube
);
...
...
@@ -271,6 +273,8 @@ int Fxch_SCHashTableRemove( Fxch_SCHashTable_t* pSCHashTable,
int
Pairs
=
0
;
uint32_t
BinID
;
Fxch_SCHashTable_Entry_t
*
pBin
;
Fxch_SubCube_t
*
pEntry
;
int
idx
;
MurmurHash3_x86_32
(
(
void
*
)
&
SubCubeID
,
sizeof
(
int
),
0x9747b28c
,
&
BinID
);
...
...
@@ -282,22 +286,20 @@ int Fxch_SCHashTableRemove( Fxch_SCHashTable_t* pSCHashTable,
return
0
;
}
for
(
iEntry
=
0
;
iEntry
<
pBin
->
Size
;
iEntry
++
)
for
(
iEntry
=
0
;
iEntry
<
(
int
)
pBin
->
Size
;
iEntry
++
)
if
(
pBin
->
vSCData
[
iEntry
].
iCube
==
iCube
)
break
;
assert
(
(
iEntry
!=
pBin
->
Size
)
&&
(
pBin
->
Size
!=
0
)
);
Fxch_SubCube_t
*
pEntry
=
&
(
pBin
->
vSCData
[
iEntry
]
);
for
(
int
idx
=
0
;
idx
<
pBin
->
Size
;
idx
++
)
pEntry
=
&
(
pBin
->
vSCData
[
iEntry
]
);
for
(
idx
=
0
;
idx
<
(
int
)
pBin
->
Size
;
idx
++
)
if
(
idx
!=
iEntry
)
{
if
(
idx
==
iEntry
)
continue
;
int
Base
,
iDiv
;
int
i
,
int
i
,
z
,
iCube0
,
iCube1
;
...
...
@@ -317,10 +319,10 @@ int Fxch_SCHashTableRemove( Fxch_SCHashTable_t* pSCHashTable,
if
(
Base
<
0
)
continue
;
for
(
i
nt
i
=
0
;
i
<
pSCHashTable
->
pFxchMan
->
nSizeOutputID
;
i
++
)
for
(
i
=
0
;
i
<
pSCHashTable
->
pFxchMan
->
nSizeOutputID
;
i
++
)
Result
+=
Fxch_CountOnes
(
pOutputID0
[
i
]
&
pOutputID1
[
i
]
);
for
(
int
z
=
0
;
z
<
Result
;
z
++
)
for
(
z
=
0
;
z
<
Result
;
z
++
)
iDiv
=
Fxch_DivRemove
(
pSCHashTable
->
pFxchMan
,
fUpdate
,
0
,
Base
);
vDivCubePairs
=
Vec_WecEntry
(
pSCHashTable
->
pFxchMan
->
vDivCubePairs
,
iDiv
);
...
...
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