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
ee939fa0
Commit
ee939fa0
authored
Oct 31, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to the truth table computations.
parent
d8e84ce6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
src/misc/util/utilTruth.h
+13
-4
No files found.
src/misc/util/utilTruth.h
View file @
ee939fa0
...
...
@@ -1004,8 +1004,6 @@ static inline int Abc_TtCountOnesSlow( word t )
}
static
inline
int
Abc_TtCountOnes
(
word
x
)
{
if
(
x
==
0
)
return
0
;
x
=
x
-
((
x
>>
1
)
&
0x5555555555555555
);
x
=
(
x
&
0x3333333333333333
)
+
((
x
>>
2
)
&
0x3333333333333333
);
x
=
(
x
+
(
x
>>
4
))
&
0x0F0F0F0F0F0F0F0F
;
...
...
@@ -1031,16 +1029,19 @@ static inline int Abc_TtCountOnesInTruth( word * pTruth, int nVars )
int
nWords
=
Abc_TtWordNum
(
nVars
);
int
k
,
Counter
=
0
;
for
(
k
=
0
;
k
<
nWords
;
k
++
)
if
(
pTruth
[
k
]
)
Counter
+=
Abc_TtCountOnes
(
pTruth
[
k
]
);
return
Counter
;
}
static
inline
void
Abc_TtCountOnesInCofs
(
word
*
pTruth
,
int
nVars
,
int
*
pStore
)
{
word
Temp
;
int
i
,
k
,
Counter
,
nWords
;
memset
(
pStore
,
0
,
sizeof
(
int
)
*
nVars
);
if
(
nVars
<=
6
)
{
for
(
i
=
0
;
i
<
nVars
;
i
++
)
if
(
pTruth
[
0
]
&
s_Truths6Neg
[
i
]
)
pStore
[
i
]
=
Abc_TtCountOnes
(
pTruth
[
0
]
&
s_Truths6Neg
[
i
]
);
return
;
}
...
...
@@ -1050,18 +1051,26 @@ static inline void Abc_TtCountOnesInCofs( word * pTruth, int nVars, int * pStore
{
// count 1's for the first six variables
for
(
i
=
0
;
i
<
6
;
i
++
)
pStore
[
i
]
+=
Abc_TtCountOnes
(
(
pTruth
[
k
]
&
s_Truths6Neg
[
i
])
|
((
pTruth
[
k
+
1
]
&
s_Truths6Neg
[
i
])
<<
(
1
<<
i
))
);
if
(
(
Temp
=
(
pTruth
[
k
]
&
s_Truths6Neg
[
i
])
|
((
pTruth
[
k
+
1
]
&
s_Truths6Neg
[
i
])
<<
(
1
<<
i
)))
)
pStore
[
i
]
+=
Abc_TtCountOnes
(
Temp
);
// count 1's for all other variables
if
(
pTruth
[
k
]
)
{
Counter
=
Abc_TtCountOnes
(
pTruth
[
k
]
);
for
(
i
=
6
;
i
<
nVars
;
i
++
)
if
(
(
k
&
(
1
<<
(
i
-
6
)))
==
0
)
pStore
[
i
]
+=
Counter
;
}
k
++
;
// count 1's for all other variables
Counter
=
Abc_TtCountOnes
(
pTruth
[
++
k
]
);
if
(
pTruth
[
k
]
)
{
Counter
=
Abc_TtCountOnes
(
pTruth
[
k
]
);
for
(
i
=
6
;
i
<
nVars
;
i
++
)
if
(
(
k
&
(
1
<<
(
i
-
6
)))
==
0
)
pStore
[
i
]
+=
Counter
;
}
}
}
static
inline
void
Abc_TtCountOnesInCofsSlow
(
word
*
pTruth
,
int
nVars
,
int
*
pStore
)
{
...
...
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