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
66c044c6
Commit
66c044c6
authored
Oct 30, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to the truth table computations.
parent
32b09a1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
2 deletions
+39
-2
src/misc/util/utilTruth.h
+39
-2
No files found.
src/misc/util/utilTruth.h
View file @
66c044c6
...
...
@@ -1075,7 +1075,7 @@ static inline unsigned Abc_TtSemiCanonicize( word * pTruth, int nVars, char * pC
{
int
pStore
[
16
];
int
nWords
=
Abc_TtWordNum
(
nVars
);
int
i
,
Temp
,
fChange
,
nOnes
;
int
i
,
k
,
BestK
,
Temp
,
nOnes
;
//, nSwaps = 0;//, fChange
;
unsigned
uCanonPhase
=
0
;
assert
(
nVars
<=
16
);
// normalize polarity
...
...
@@ -1087,6 +1087,7 @@ static inline unsigned Abc_TtSemiCanonicize( word * pTruth, int nVars, char * pC
uCanonPhase
|=
(
1
<<
nVars
);
}
// normalize phase
// Abc_TtCountOnesInCofsSlow( pTruth, nVars, pStore );
Abc_TtCountOnesInCofs
(
pTruth
,
nVars
,
pStore
);
for
(
i
=
0
;
i
<
nVars
;
i
++
)
{
...
...
@@ -1096,7 +1097,7 @@ static inline unsigned Abc_TtSemiCanonicize( word * pTruth, int nVars, char * pC
uCanonPhase
|=
(
1
<<
i
);
pStore
[
i
]
=
nOnes
-
pStore
[
i
];
}
/*
do {
fChange = 0;
for ( i = 0; i < nVars-1; i++ )
...
...
@@ -1119,8 +1120,44 @@ static inline unsigned Abc_TtSemiCanonicize( word * pTruth, int nVars, char * pC
}
Abc_TtSwapAdjacent( pTruth, nWords, i );
fChange = 1;
// nSwaps++;
}
} while ( fChange );
*/
for
(
i
=
0
;
i
<
nVars
-
1
;
i
++
)
{
BestK
=
i
+
1
;
for
(
k
=
i
+
2
;
k
<
nVars
;
k
++
)
if
(
pStore
[
BestK
]
>
pStore
[
k
]
)
BestK
=
k
;
if
(
pStore
[
BestK
]
>=
pStore
[
i
]
)
continue
;
Temp
=
pCanonPerm
[
i
];
pCanonPerm
[
i
]
=
pCanonPerm
[
BestK
];
pCanonPerm
[
BestK
]
=
Temp
;
Temp
=
pStore
[
i
];
pStore
[
i
]
=
pStore
[
BestK
];
pStore
[
BestK
]
=
Temp
;
if
(
((
uCanonPhase
>>
i
)
&
1
)
!=
((
uCanonPhase
>>
BestK
)
&
1
)
)
{
uCanonPhase
^=
(
1
<<
i
);
uCanonPhase
^=
(
1
<<
BestK
);
}
Abc_TtSwapVars
(
pTruth
,
nVars
,
i
,
BestK
);
// nSwaps++;
}
/*
printf( "%d ", nSwaps );
printf( "Minterms: " );
for ( i = 0; i < nVars; i++ )
printf( "%d ", pStore[i] );
printf( "\n" );
*/
return
uCanonPhase
;
}
...
...
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