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
0fafe786
Commit
0fafe786
authored
Oct 30, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to the truth table computations.
parent
77fde55b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
111 additions
and
162 deletions
+111
-162
abclib.dsp
+4
-0
src/base/abci/abcNpn.c
+2
-0
src/misc/extra/extra.h
+1
-0
src/misc/extra/extraUtilFile.c
+18
-0
src/misc/util/abc_global.h
+1
-0
src/misc/util/utilTruth.h
+0
-0
src/opt/dau/dauDsd.c
+85
-162
No files found.
abclib.dsp
View file @
0fafe786
...
@@ -1975,6 +1975,10 @@ SOURCE=.\src\opt\dau\dau.c
...
@@ -1975,6 +1975,10 @@ SOURCE=.\src\opt\dau\dau.c
# End Source File
# End Source File
# Begin Source File
# Begin Source File
SOURCE=.\src\opt\dau\dauCanon.c
# End Source File
# Begin Source File
SOURCE=.\src\opt\dau\dauCore.c
SOURCE=.\src\opt\dau\dauCore.c
# End Source File
# End Source File
# Begin Source File
# Begin Source File
...
...
src/base/abci/abcNpn.c
View file @
0fafe786
...
@@ -202,8 +202,10 @@ void Abc_TruthNpnPerform( Abc_TtStore_t * p, int NpnType, int fVerbose )
...
@@ -202,8 +202,10 @@ void Abc_TruthNpnPerform( Abc_TtStore_t * p, int NpnType, int fVerbose )
{
{
for
(
i
=
0
;
i
<
p
->
nFuncs
;
i
++
)
for
(
i
=
0
;
i
<
p
->
nFuncs
;
i
++
)
{
{
extern
void
Abc_TtConfactorTest
(
word
*
pTruth
,
int
nVars
,
int
i
);
if
(
fVerbose
)
if
(
fVerbose
)
printf
(
"%7d : "
,
i
);
printf
(
"%7d : "
,
i
);
Abc_TtConfactorTest
(
p
->
pFuncs
[
i
],
p
->
nVars
,
i
);
if
(
fVerbose
)
if
(
fVerbose
)
Extra_PrintHex
(
stdout
,
(
unsigned
*
)
p
->
pFuncs
[
i
],
p
->
nVars
),
printf
(
"
\n
"
);
Extra_PrintHex
(
stdout
,
(
unsigned
*
)
p
->
pFuncs
[
i
],
p
->
nVars
),
printf
(
"
\n
"
);
}
}
...
...
src/misc/extra/extra.h
View file @
0fafe786
...
@@ -119,6 +119,7 @@ extern int Extra_ReadHexadecimal( unsigned Sign[], char * pString, int
...
@@ -119,6 +119,7 @@ extern int Extra_ReadHexadecimal( unsigned Sign[], char * pString, int
extern
void
Extra_PrintHexadecimal
(
FILE
*
pFile
,
unsigned
Sign
[],
int
nVars
);
extern
void
Extra_PrintHexadecimal
(
FILE
*
pFile
,
unsigned
Sign
[],
int
nVars
);
extern
void
Extra_PrintHexadecimalString
(
char
*
pString
,
unsigned
Sign
[],
int
nVars
);
extern
void
Extra_PrintHexadecimalString
(
char
*
pString
,
unsigned
Sign
[],
int
nVars
);
extern
void
Extra_PrintHex
(
FILE
*
pFile
,
unsigned
*
pTruth
,
int
nVars
);
extern
void
Extra_PrintHex
(
FILE
*
pFile
,
unsigned
*
pTruth
,
int
nVars
);
extern
void
Extra_PrintHexReverse
(
FILE
*
pFile
,
unsigned
*
pTruth
,
int
nVars
);
extern
void
Extra_PrintSymbols
(
FILE
*
pFile
,
char
Char
,
int
nTimes
,
int
fPrintNewLine
);
extern
void
Extra_PrintSymbols
(
FILE
*
pFile
,
char
Char
,
int
nTimes
,
int
fPrintNewLine
);
/*=== extraUtilReader.c ========================================================*/
/*=== extraUtilReader.c ========================================================*/
...
...
src/misc/extra/extraUtilFile.c
View file @
0fafe786
...
@@ -561,6 +561,24 @@ void Extra_PrintHex( FILE * pFile, unsigned * pTruth, int nVars )
...
@@ -561,6 +561,24 @@ void Extra_PrintHex( FILE * pFile, unsigned * pTruth, int nVars )
}
}
// fprintf( pFile, "\n" );
// fprintf( pFile, "\n" );
}
}
void
Extra_PrintHexReverse
(
FILE
*
pFile
,
unsigned
*
pTruth
,
int
nVars
)
{
int
nMints
,
nDigits
,
Digit
,
k
;
// write the number into the file
fprintf
(
pFile
,
"0x"
);
nMints
=
(
1
<<
nVars
);
nDigits
=
nMints
/
4
;
for
(
k
=
0
;
k
<
nDigits
;
k
++
)
{
Digit
=
((
pTruth
[
k
/
8
]
>>
(
k
*
4
))
&
15
);
if
(
Digit
<
10
)
fprintf
(
pFile
,
"%d"
,
Digit
);
else
fprintf
(
pFile
,
"%c"
,
'A'
+
Digit
-
10
);
}
// fprintf( pFile, "\n" );
}
/**Function*************************************************************
/**Function*************************************************************
...
...
src/misc/util/abc_global.h
View file @
0fafe786
...
@@ -198,6 +198,7 @@ typedef unsigned __int64 ABC_UINT64_T;
...
@@ -198,6 +198,7 @@ typedef unsigned __int64 ABC_UINT64_T;
#endif
/* defined(PLATFORM) */
#endif
/* defined(PLATFORM) */
typedef
ABC_UINT64_T
word
;
typedef
ABC_UINT64_T
word
;
typedef
ABC_INT64_T
iword
;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
/// MACRO DEFINITIONS ///
...
...
src/misc/util/utilTruth.h
View file @
0fafe786
This diff is collapsed.
Click to expand it.
src/opt/dau/dauDsd.c
View file @
0fafe786
...
@@ -478,163 +478,6 @@ void Dau_DsdTestOne( word t, int i )
...
@@ -478,163 +478,6 @@ void Dau_DsdTestOne( word t, int i )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
static
inline
int
Abc_TtTruthIsConst0
(
word
*
p
,
int
nWords
)
{
int
w
;
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
p
[
w
]
!=
0
)
return
0
;
return
1
;
}
static
inline
int
Abc_TtTruthIsConst1
(
word
*
p
,
int
nWords
)
{
int
w
;
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
p
[
w
]
!=
~
(
word
)
0
)
return
0
;
return
1
;
}
static
inline
int
Abc_TtCof0IsConst0
(
word
*
t
,
int
nWords
,
int
iVar
)
{
if
(
iVar
<
6
)
{
int
i
;
for
(
i
=
0
;
i
<
nWords
;
i
++
)
if
(
t
[
i
]
&
~
s_Truths6
[
iVar
]
)
return
0
;
return
1
;
}
else
{
int
i
,
Step
=
(
1
<<
(
iVar
-
6
));
word
*
tLimit
=
t
+
nWords
;
for
(
;
t
<
tLimit
;
t
+=
2
*
Step
)
for
(
i
=
0
;
i
<
Step
;
i
++
)
if
(
t
[
i
]
)
return
0
;
return
1
;
}
}
static
inline
int
Abc_TtCof0IsConst1
(
word
*
t
,
int
nWords
,
int
iVar
)
{
if
(
iVar
<
6
)
{
int
i
;
for
(
i
=
0
;
i
<
nWords
;
i
++
)
if
(
(
t
[
i
]
&
~
s_Truths6
[
iVar
])
!=
~
s_Truths6
[
iVar
]
)
return
0
;
return
1
;
}
else
{
int
i
,
Step
=
(
1
<<
(
iVar
-
6
));
word
*
tLimit
=
t
+
nWords
;
for
(
;
t
<
tLimit
;
t
+=
2
*
Step
)
for
(
i
=
0
;
i
<
Step
;
i
++
)
if
(
t
[
i
]
!=
~
(
word
)
0
)
return
0
;
return
1
;
}
}
static
inline
int
Abc_TtCof1IsConst0
(
word
*
t
,
int
nWords
,
int
iVar
)
{
if
(
iVar
<
6
)
{
int
i
;
for
(
i
=
0
;
i
<
nWords
;
i
++
)
if
(
t
[
i
]
&
s_Truths6
[
iVar
]
)
return
0
;
return
1
;
}
else
{
int
i
,
Step
=
(
1
<<
(
iVar
-
6
));
word
*
tLimit
=
t
+
nWords
;
for
(
;
t
<
tLimit
;
t
+=
2
*
Step
)
for
(
i
=
0
;
i
<
Step
;
i
++
)
if
(
t
[
i
+
Step
]
)
return
0
;
return
1
;
}
}
static
inline
int
Abc_TtCof1IsConst1
(
word
*
t
,
int
nWords
,
int
iVar
)
{
if
(
iVar
<
6
)
{
int
i
;
for
(
i
=
0
;
i
<
nWords
;
i
++
)
if
(
(
t
[
i
]
&
s_Truths6
[
iVar
])
!=
s_Truths6
[
iVar
]
)
return
0
;
return
1
;
}
else
{
int
i
,
Step
=
(
1
<<
(
iVar
-
6
));
word
*
tLimit
=
t
+
nWords
;
for
(
;
t
<
tLimit
;
t
+=
2
*
Step
)
for
(
i
=
0
;
i
<
Step
;
i
++
)
if
(
t
[
i
+
Step
]
!=
~
(
word
)
0
)
return
0
;
return
1
;
}
}
static
inline
int
Abc_TtCofsOpposite
(
word
*
t
,
int
nWords
,
int
iVar
)
{
if
(
iVar
<
6
)
{
int
i
,
Shift
=
(
1
<<
iVar
);
for
(
i
=
0
;
i
<
nWords
;
i
++
)
if
(
((
t
[
i
]
<<
Shift
)
&
s_Truths6
[
iVar
])
!=
(
~
t
[
i
]
&
s_Truths6
[
iVar
])
)
return
0
;
return
1
;
}
else
{
int
i
,
Step
=
(
1
<<
(
iVar
-
6
));
word
*
tLimit
=
t
+
nWords
;
for
(
;
t
<
tLimit
;
t
+=
2
*
Step
)
for
(
i
=
0
;
i
<
Step
;
i
++
)
if
(
t
[
i
]
!=
~
t
[
i
+
Step
]
)
return
0
;
return
1
;
}
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Abc_TtCof0HasVar
(
word
*
t
,
int
nWords
,
int
iVarI
,
int
iVarJ
)
{
assert
(
iVarI
>
iVarJ
);
if
(
iVarI
<
6
)
{
int
i
,
Shift
=
(
1
<<
iVarJ
);
for
(
i
=
0
;
i
<
nWords
;
i
++
)
if
(
(((
t
[
i
]
&
~
s_Truths6
[
iVarI
])
<<
Shift
)
&
s_Truths6
[
iVarJ
])
!=
((
t
[
i
]
&
~
s_Truths6
[
iVarI
])
&
s_Truths6
[
iVarJ
])
)
return
0
;
return
1
;
}
else
if
(
iVarI
==
6
)
{
}
else
{
int
i
,
Step
=
(
1
<<
(
iVarJ
-
6
));
word
*
tLimit
=
t
+
nWords
;
for
(
;
t
<
tLimit
;
t
+=
2
*
Step
)
for
(
i
=
0
;
i
<
Step
;
i
++
)
if
(
t
[
i
]
!=
t
[
i
+
Step
]
)
return
0
;
return
1
;
}
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Dau_DsdMinimize
(
word
*
p
,
int
*
pVars
,
int
nVars
)
int
Dau_DsdMinimize
(
word
*
p
,
int
*
pVars
,
int
nVars
)
{
{
int
i
,
k
;
int
i
,
k
;
...
@@ -683,16 +526,18 @@ int Dau_DsdRun6_rec( word * p, int * pVars, int nVars, char * pBuffer, int Pos,
...
@@ -683,16 +526,18 @@ int Dau_DsdRun6_rec( word * p, int * pVars, int nVars, char * pBuffer, int Pos,
***********************************************************************/
***********************************************************************/
int
Dau_DsdRun_rec
(
word
*
p
,
int
*
pVars
,
int
nVars
,
char
*
pBuffer
,
int
Pos
,
char
pStore
[
16
][
16
],
int
Func
)
int
Dau_DsdRun_rec
(
word
*
p
,
int
*
pVars
,
int
nVars
,
char
*
pBuffer
,
int
Pos
,
char
pStore
[
16
][
16
],
int
Func
)
{
{
int
v
,
nWords
=
Abc_TtWordNum
(
nVars
);
int
v
,
u
,
nWords
=
Abc_TtWordNum
(
nVars
);
nVars
=
Dau_DsdMinimize
(
p
,
pVars
,
nVars
);
nVars
=
Dau_DsdMinimize
(
p
,
pVars
,
nVars
);
if
(
nVars
<=
6
)
if
(
nVars
<=
6
)
return
Dau_DsdRun6_rec
(
p
,
pVars
,
nVars
,
pBuffer
,
Pos
,
pStore
,
Func
);
return
Dau_DsdRun6_rec
(
p
,
pVars
,
nVars
,
pBuffer
,
Pos
,
pStore
,
Func
);
// consider negative cofactors
if
(
p
[
0
]
&
1
)
if
(
p
[
0
]
&
1
)
{
{
// check for !(ax)
// check for !(ax)
for
(
v
=
0
;
v
<
nVars
;
v
++
)
for
(
v
=
0
;
v
<
nVars
;
v
++
)
if
(
Abc_TtCof0IsConst
0
(
p
,
nWords
,
v
)
)
if
(
Abc_TtCof0IsConst
1
(
p
,
nWords
,
v
)
)
{
{
pBuffer
[
Pos
++
]
=
'!'
;
pBuffer
[
Pos
++
]
=
'('
;
pBuffer
[
Pos
++
]
=
'('
;
pBuffer
[
Pos
++
]
=
'a'
+
pVars
[
v
];
pBuffer
[
Pos
++
]
=
'a'
+
pVars
[
v
];
Abc_TtSwapVars
(
p
,
nVars
,
v
,
nVars
-
1
);
Abc_TtSwapVars
(
p
,
nVars
,
v
,
nVars
-
1
);
...
@@ -706,9 +551,8 @@ int Dau_DsdRun_rec( word * p, int * pVars, int nVars, char * pBuffer, int Pos, c
...
@@ -706,9 +551,8 @@ int Dau_DsdRun_rec( word * p, int * pVars, int nVars, char * pBuffer, int Pos, c
{
{
// check for ax
// check for ax
for
(
v
=
0
;
v
<
nVars
;
v
++
)
for
(
v
=
0
;
v
<
nVars
;
v
++
)
if
(
Abc_TtCof0IsConst
1
(
p
,
nWords
,
v
)
)
if
(
Abc_TtCof0IsConst
0
(
p
,
nWords
,
v
)
)
{
{
pBuffer
[
Pos
++
]
=
'!'
;
pBuffer
[
Pos
++
]
=
'('
;
pBuffer
[
Pos
++
]
=
'('
;
pBuffer
[
Pos
++
]
=
'a'
+
pVars
[
v
];
pBuffer
[
Pos
++
]
=
'a'
+
pVars
[
v
];
Abc_TtSwapVars
(
p
,
nVars
,
v
,
nVars
-
1
);
Abc_TtSwapVars
(
p
,
nVars
,
v
,
nVars
-
1
);
...
@@ -718,6 +562,7 @@ int Dau_DsdRun_rec( word * p, int * pVars, int nVars, char * pBuffer, int Pos, c
...
@@ -718,6 +562,7 @@ int Dau_DsdRun_rec( word * p, int * pVars, int nVars, char * pBuffer, int Pos, c
return
Pos
;
return
Pos
;
}
}
}
}
// consider positive cofactors
if
(
(
p
[
nWords
-
1
]
>>
63
)
&
1
)
if
(
(
p
[
nWords
-
1
]
>>
63
)
&
1
)
{
{
// check for !(!ax)
// check for !(!ax)
...
@@ -764,7 +609,85 @@ int Dau_DsdRun_rec( word * p, int * pVars, int nVars, char * pBuffer, int Pos, c
...
@@ -764,7 +609,85 @@ int Dau_DsdRun_rec( word * p, int * pVars, int nVars, char * pBuffer, int Pos, c
return
Pos
;
return
Pos
;
}
}
return
0
;
// consider two-variable cofactors
for
(
v
=
nVars
-
1
;
v
>
0
;
v
--
)
{
unsigned
uSupp0
=
0
,
uSupp1
=
0
;
for
(
u
=
v
-
1
;
u
>=
0
;
u
--
)
{
if
(
Abc_TtCheckEqualCofs
(
p
,
nWords
,
u
,
v
,
0
,
1
)
)
{
uSupp0
|=
(
1
<<
u
);
if
(
Abc_TtCheckEqualCofs
(
p
,
nWords
,
u
,
v
,
2
,
3
)
)
{
uSupp1
|=
(
1
<<
u
);
// check XOR decomposition
if
(
Abc_TtCheckEqualCofs
(
p
,
nWords
,
u
,
v
,
0
,
3
)
&&
Abc_TtCheckEqualCofs
(
p
,
nWords
,
u
,
v
,
1
,
2
)
)
{
// perform XOR (u, v)
return
Pos
;
}
}
else
{
// F(v=0) does not depend on u; F(v=1) depends on u
if
(
Abc_TtCheckEqualCofs
(
p
,
nWords
,
u
,
v
,
0
,
2
)
)
{
// perform AND (u, v)
return
Pos
;
}
if
(
Abc_TtCheckEqualCofs
(
p
,
nWords
,
u
,
v
,
0
,
3
)
)
{
// perform AND (u, v)
return
Pos
;
}
}
}
else
if
(
Abc_TtCheckEqualCofs
(
p
,
nWords
,
u
,
v
,
2
,
3
)
)
{
uSupp1
|=
(
1
<<
u
);
// F(v=0) depends on u; F(v=1) does not depend on u
if
(
Abc_TtCheckEqualCofs
(
p
,
nWords
,
u
,
v
,
0
,
2
)
)
{
// perform AND (u, v)
return
Pos
;
}
if
(
Abc_TtCheckEqualCofs
(
p
,
nWords
,
u
,
v
,
1
,
2
)
)
{
// perform AND (u, v)
return
Pos
;
}
}
else
assert
(
0
);
}
// check MUX decomposition w.r.t. u
if
(
(
uSupp0
&
uSupp1
)
==
0
)
{
// perform MUX( v, F(v=1), F(v=0) )
}
// check MUX decomposition w.r.t. u
if
(
Abc_TtSuppOnlyOne
(
uSupp0
&
~
uSupp1
)
&&
Abc_TtSuppOnlyOne
(
~
uSupp0
&
uSupp1
)
)
{
// check MUX
int
iVar0
=
Abc_TtSuppFindFirst
(
uSupp0
);
int
iVar1
=
Abc_TtSuppFindFirst
(
uSupp1
);
int
fEqual0
,
fEqual1
;
if
(
iVar0
>
iVar1
)
ABC_SWAP
(
int
,
iVar0
,
iVar1
);
// check existence conditions
assert
(
iVar0
<
iVar1
);
fEqual0
=
Abc_TtCheckEqualCofs
(
p
,
nWords
,
iVar0
,
iVar1
,
0
,
2
)
&&
Abc_TtCheckEqualCofs
(
p
,
nWords
,
iVar0
,
iVar1
,
1
,
3
);
fEqual1
=
Abc_TtCheckEqualCofs
(
p
,
nWords
,
iVar0
,
iVar1
,
0
,
3
)
&&
Abc_TtCheckEqualCofs
(
p
,
nWords
,
iVar0
,
iVar1
,
1
,
2
);
if
(
fEqual0
||
fEqual1
)
{
// perform MUX( v, F(v=1), F(v=0) )
return
Pos
;
}
}
}
return
Pos
;
}
}
...
...
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