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
ae6716b0
Commit
ae6716b0
authored
Jul 21, 2018
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Counting ones in truth table.
parent
24407e13
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
15 deletions
+53
-15
src/opt/dau/dau.h
+3
-0
src/opt/dau/dauCanon.c
+49
-15
src/opt/dau/dauCount.c
+0
-0
src/opt/dau/module.make
+1
-0
No files found.
src/opt/dau/dau.h
View file @
ae6716b0
...
...
@@ -79,6 +79,9 @@ static inline int Dau_DsdReadVar( char * p ) { if ( *p == '!' ) p++; return *p
extern
unsigned
Abc_TtCanonicize
(
word
*
pTruth
,
int
nVars
,
char
*
pCanonPerm
);
extern
unsigned
Abc_TtCanonicizePerm
(
word
*
pTruth
,
int
nVars
,
char
*
pCanonPerm
);
extern
unsigned
Abc_TtCanonicizePhase
(
word
*
pTruth
,
int
nVars
);
extern
int
Abc_TtCountOnesInCofsSimple
(
word
*
pTruth
,
int
nVars
,
int
*
pStore
);
/*=== dauCount.c ==========================================================*/
extern
int
Abc_TtCountOnesInCofsQuick
(
word
*
pTruth
,
int
nVars
,
int
*
pStore
);
/*=== dauDsd.c ==========================================================*/
extern
int
*
Dau_DsdComputeMatches
(
char
*
p
);
extern
int
Dau_DsdDecompose
(
word
*
pTruth
,
int
nVarsInit
,
int
fSplitPrime
,
int
fWriteTruth
,
char
*
pRes
);
...
...
src/opt/dau/dauCanon.c
View file @
ae6716b0
...
...
@@ -351,6 +351,11 @@ static inline void Abc_TtCountOnesInCofs( word * pTruth, int nVars, int * pStore
}
}
}
int
Abc_TtCountOnesInCofsSimple
(
word
*
pTruth
,
int
nVars
,
int
*
pStore
)
{
Abc_TtCountOnesInCofs
(
pTruth
,
nVars
,
pStore
);
return
Abc_TtCountOnesInTruth
(
pTruth
,
nVars
);
}
/**Function*************************************************************
...
...
@@ -491,6 +496,7 @@ int Abc_TtCountOnesInCofsFast( word * pTruth, int nVars, int * pStore )
***********************************************************************/
static
inline
unsigned
Abc_TtSemiCanonicize
(
word
*
pTruth
,
int
nVars
,
char
*
pCanonPerm
,
int
*
pStoreOut
,
int
fOnlySwap
)
{
int
fUseOld
=
1
;
int
fOldSwap
=
0
;
int
pStoreIn
[
17
];
int
*
pStore
=
pStoreOut
?
pStoreOut
:
pStoreIn
;
...
...
@@ -499,25 +505,53 @@ static inline unsigned Abc_TtSemiCanonicize( word * pTruth, int nVars, char * pC
assert
(
nVars
<=
16
);
for
(
i
=
0
;
i
<
nVars
;
i
++
)
pCanonPerm
[
i
]
=
i
;
// normalize polarity
nOnes
=
Abc_TtCountOnesInTruth
(
pTruth
,
nVars
);
if
(
nOnes
>
nWords
*
32
&&
!
fOnlySwap
)
if
(
fUseOld
)
{
Abc_TtNot
(
pTruth
,
nWords
);
nOnes
=
nWords
*
64
-
nOnes
;
uCanonPhase
|=
(
1
<<
nVars
);
// normalize polarity
nOnes
=
Abc_TtCountOnesInTruth
(
pTruth
,
nVars
);
if
(
nOnes
>
nWords
*
32
&&
!
fOnlySwap
)
{
Abc_TtNot
(
pTruth
,
nWords
);
nOnes
=
nWords
*
64
-
nOnes
;
uCanonPhase
|=
(
1
<<
nVars
);
}
// normalize phase
Abc_TtCountOnesInCofs
(
pTruth
,
nVars
,
pStore
);
pStore
[
nVars
]
=
nOnes
;
for
(
i
=
0
;
i
<
nVars
;
i
++
)
{
if
(
pStore
[
i
]
>=
nOnes
-
pStore
[
i
]
||
fOnlySwap
)
continue
;
Abc_TtFlip
(
pTruth
,
nWords
,
i
);
uCanonPhase
|=
(
1
<<
i
);
pStore
[
i
]
=
nOnes
-
pStore
[
i
];
}
}
// normalize phase
Abc_TtCountOnesInCofs
(
pTruth
,
nVars
,
pStore
);
pStore
[
nVars
]
=
nOnes
;
for
(
i
=
0
;
i
<
nVars
;
i
++
)
else
{
if
(
pStore
[
i
]
>=
nOnes
-
pStore
[
i
]
||
fOnlySwap
)
continue
;
Abc_TtFlip
(
pTruth
,
nWords
,
i
);
uCanonPhase
|=
(
1
<<
i
);
pStore
[
i
]
=
nOnes
-
pStore
[
i
];
nOnes
=
Abc_TtCountOnesInCofsQuick
(
pTruth
,
nVars
,
pStore
);
// normalize polarity
if
(
nOnes
>
nWords
*
32
&&
!
fOnlySwap
)
{
for
(
i
=
0
;
i
<
nVars
;
i
++
)
pStore
[
i
]
=
nWords
*
32
-
pStore
[
i
];
Abc_TtNot
(
pTruth
,
nWords
);
nOnes
=
nWords
*
64
-
nOnes
;
uCanonPhase
|=
(
1
<<
nVars
);
}
// normalize phase
pStore
[
nVars
]
=
nOnes
;
for
(
i
=
0
;
i
<
nVars
;
i
++
)
{
if
(
pStore
[
i
]
>=
nOnes
-
pStore
[
i
]
||
fOnlySwap
)
continue
;
Abc_TtFlip
(
pTruth
,
nWords
,
i
);
uCanonPhase
|=
(
1
<<
i
);
pStore
[
i
]
=
nOnes
-
pStore
[
i
];
}
}
// normalize permutation
if
(
fOldSwap
)
{
...
...
src/opt/dau/dauCount.c
0 → 100644
View file @
ae6716b0
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/opt/dau/module.make
View file @
ae6716b0
SRC
+=
src/opt/dau/dauCanon.c
\
src/opt/dau/dauCore.c
\
src/opt/dau/dauCount.c
\
src/opt/dau/dauDivs.c
\
src/opt/dau/dauDsd.c
\
src/opt/dau/dauEnum.c
\
...
...
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