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
35c8d6a2
Commit
35c8d6a2
authored
Nov 01, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to the truth table computations.
parent
d56570f2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
40 deletions
+40
-40
abclib.dsp
+4
-0
src/base/abci/abcRec3.c
+15
-4
src/misc/util/utilTruth.h
+2
-10
src/opt/dau/dauCanon.c
+11
-3
src/opt/dau/dauDsd.c
+8
-23
No files found.
abclib.dsp
View file @
35c8d6a2
...
@@ -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\dau.h
# End Source File
# Begin Source File
SOURCE=.\src\opt\dau\dauCanon.c
SOURCE=.\src\opt\dau\dauCanon.c
# End Source File
# End Source File
# Begin Source File
# Begin Source File
...
...
src/base/abci/abcRec3.c
View file @
35c8d6a2
...
@@ -23,11 +23,13 @@
...
@@ -23,11 +23,13 @@
#include "bool/kit/kit.h"
#include "bool/kit/kit.h"
#include "aig/gia/giaAig.h"
#include "aig/gia/giaAig.h"
#include "misc/vec/vecMem.h"
#include "misc/vec/vecMem.h"
#include "
bool/lucky/lucky
.h"
#include "
opt/dau/dau
.h"
#include "misc/util/utilTruth.h"
#include "misc/util/utilTruth.h"
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
//#define LMS_USE_OLD_FORM
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
@@ -488,8 +490,11 @@ p->timeCollect += clock() - clk;
...
@@ -488,8 +490,11 @@ p->timeCollect += clock() - clk;
// semi-canonicize
// semi-canonicize
clk
=
clock
();
clk
=
clock
();
memcpy
(
p
->
pTemp1
,
pTruth
,
p
->
nWords
*
sizeof
(
word
)
);
memcpy
(
p
->
pTemp1
,
pTruth
,
p
->
nWords
*
sizeof
(
word
)
);
// uCanonPhase = luckyCanonicizer_final_fast( p->pTemp1, nLeaves, pCanonPerm );
#ifdef LMS_USE_OLD_FORM
uCanonPhase
=
Kit_TruthSemiCanonicize
(
(
unsigned
*
)
p
->
pTemp1
,
(
unsigned
*
)
p
->
pTemp2
,
nLeaves
,
pCanonPerm
);
uCanonPhase
=
Kit_TruthSemiCanonicize
(
(
unsigned
*
)
p
->
pTemp1
,
(
unsigned
*
)
p
->
pTemp2
,
nLeaves
,
pCanonPerm
);
#else
uCanonPhase
=
Abc_TtCanonicize
(
p
->
pTemp1
,
nLeaves
,
pCanonPerm
);
#endif
Abc_TtStretch5
(
(
unsigned
*
)
p
->
pTemp1
,
nLeaves
,
p
->
nVars
);
Abc_TtStretch5
(
(
unsigned
*
)
p
->
pTemp1
,
nLeaves
,
p
->
nVars
);
p
->
timeCanon
+=
clock
()
-
clk
;
p
->
timeCanon
+=
clock
()
-
clk
;
// pCanonPerm and uCanonPhase show what was the variable corresponding to each var in the current truth
// pCanonPerm and uCanonPhase show what was the variable corresponding to each var in the current truth
...
@@ -599,8 +604,11 @@ p->timeCollect += clock() - clk;
...
@@ -599,8 +604,11 @@ p->timeCollect += clock() - clk;
// semi-canonicize truth table
// semi-canonicize truth table
clk
=
clock
();
clk
=
clock
();
memcpy
(
p
->
pTemp1
,
If_CutTruthW
(
pCut
),
p
->
nWords
*
sizeof
(
word
)
);
memcpy
(
p
->
pTemp1
,
If_CutTruthW
(
pCut
),
p
->
nWords
*
sizeof
(
word
)
);
// uCanonPhase = luckyCanonicizer_final_fast( p->pTemp1, nLeaves, pCanonPerm );
#ifdef LMS_USE_OLD_FORM
uCanonPhase
=
Kit_TruthSemiCanonicize
(
(
unsigned
*
)
p
->
pTemp1
,
(
unsigned
*
)
p
->
pTemp2
,
nLeaves
,
pCanonPerm
);
uCanonPhase
=
Kit_TruthSemiCanonicize
(
(
unsigned
*
)
p
->
pTemp1
,
(
unsigned
*
)
p
->
pTemp2
,
nLeaves
,
pCanonPerm
);
#else
uCanonPhase
=
Abc_TtCanonicize
(
p
->
pTemp1
,
nLeaves
,
pCanonPerm
);
#endif
Abc_TtStretch5
(
(
unsigned
*
)
p
->
pTemp1
,
nLeaves
,
p
->
nVars
);
Abc_TtStretch5
(
(
unsigned
*
)
p
->
pTemp1
,
nLeaves
,
p
->
nVars
);
p
->
timeCanon
+=
clock
()
-
clk
;
p
->
timeCanon
+=
clock
()
-
clk
;
// pCanonPerm and uCanonPhase show what was the variable corresponding to each var in the current truth
// pCanonPerm and uCanonPhase show what was the variable corresponding to each var in the current truth
...
@@ -762,8 +770,11 @@ static inline int If_CutFindBestStruct( If_Man_t * pIfMan, If_Cut_t * pCut, char
...
@@ -762,8 +770,11 @@ static inline int If_CutFindBestStruct( If_Man_t * pIfMan, If_Cut_t * pCut, char
// semicanonicize the function
// semicanonicize the function
clk
=
clock
();
clk
=
clock
();
memcpy
(
p
->
pTemp1
,
If_CutTruthW
(
pCut
),
p
->
nWords
*
sizeof
(
word
)
);
memcpy
(
p
->
pTemp1
,
If_CutTruthW
(
pCut
),
p
->
nWords
*
sizeof
(
word
)
);
// uCanonPhase = luckyCanonicizer_final_fast( p->pTemp1, nLeaves, pCanonPerm );
#ifdef LMS_USE_OLD_FORM
*
puCanonPhase
=
Kit_TruthSemiCanonicize
(
(
unsigned
*
)
p
->
pTemp1
,
(
unsigned
*
)
p
->
pTemp2
,
nLeaves
,
pCanonPerm
);
*
puCanonPhase
=
Kit_TruthSemiCanonicize
(
(
unsigned
*
)
p
->
pTemp1
,
(
unsigned
*
)
p
->
pTemp2
,
nLeaves
,
pCanonPerm
);
#else
*
puCanonPhase
=
Abc_TtCanonicize
(
p
->
pTemp1
,
nLeaves
,
pCanonPerm
);
#endif
Abc_TtStretch5
(
(
unsigned
*
)
p
->
pTemp1
,
nLeaves
,
p
->
nVars
);
Abc_TtStretch5
(
(
unsigned
*
)
p
->
pTemp1
,
nLeaves
,
p
->
nVars
);
p
->
timeCanon
+=
clock
()
-
clk
;
p
->
timeCanon
+=
clock
()
-
clk
;
...
...
src/misc/util/utilTruth.h
View file @
35c8d6a2
...
@@ -53,14 +53,6 @@ static word s_Truths6Neg[6] = {
...
@@ -53,14 +53,6 @@ static word s_Truths6Neg[6] = {
0x00000000FFFFFFFF
0x00000000FFFFFFFF
};
};
static
word
s_CMasks6
[
5
]
=
{
0x1111111111111111
,
0x0303030303030303
,
0x000F000F000F000F
,
0x000000FF000000FF
,
0x000000000000FFFF
};
static
word
s_PMasks
[
5
][
3
]
=
{
static
word
s_PMasks
[
5
][
3
]
=
{
{
0x9999999999999999
,
0x2222222222222222
,
0x4444444444444444
},
{
0x9999999999999999
,
0x2222222222222222
,
0x4444444444444444
},
{
0xC3C3C3C3C3C3C3C3
,
0x0C0C0C0C0C0C0C0C
,
0x3030303030303030
},
{
0xC3C3C3C3C3C3C3C3
,
0x0C0C0C0C0C0C0C0C
,
0x3030303030303030
},
...
@@ -299,12 +291,12 @@ static inline int Abc_Tt6Cof1IsConst0( word t, int iVar ) { return (t & s_Truths
...
@@ -299,12 +291,12 @@ static inline int Abc_Tt6Cof1IsConst0( word t, int iVar ) { return (t & s_Truths
static
inline
int
Abc_Tt6Cof1IsConst1
(
word
t
,
int
iVar
)
{
return
(
t
&
s_Truths6
[
iVar
])
==
s_Truths6
[
iVar
];
}
static
inline
int
Abc_Tt6Cof1IsConst1
(
word
t
,
int
iVar
)
{
return
(
t
&
s_Truths6
[
iVar
])
==
s_Truths6
[
iVar
];
}
static
inline
int
Abc_Tt6CofsOpposite
(
word
t
,
int
iVar
)
{
return
((
t
>>
(
1
<<
iVar
))
&
s_Truths6Neg
[
iVar
])
==
(
~
t
&
s_Truths6Neg
[
iVar
]);
}
static
inline
int
Abc_Tt6CofsOpposite
(
word
t
,
int
iVar
)
{
return
((
t
>>
(
1
<<
iVar
))
&
s_Truths6Neg
[
iVar
])
==
(
~
t
&
s_Truths6Neg
[
iVar
]);
}
static
inline
word
Abc_Tt6Cof0
(
word
t
,
int
iVar
)
static
inline
word
Abc_Tt6Cof
actor
0
(
word
t
,
int
iVar
)
{
{
assert
(
iVar
>=
0
&&
iVar
<
6
);
assert
(
iVar
>=
0
&&
iVar
<
6
);
return
(
t
&
s_Truths6Neg
[
iVar
])
|
((
t
&
s_Truths6Neg
[
iVar
])
<<
(
1
<<
iVar
));
return
(
t
&
s_Truths6Neg
[
iVar
])
|
((
t
&
s_Truths6Neg
[
iVar
])
<<
(
1
<<
iVar
));
}
}
static
inline
word
Abc_Tt6Cof1
(
word
t
,
int
iVar
)
static
inline
word
Abc_Tt6Cof
actor
1
(
word
t
,
int
iVar
)
{
{
assert
(
iVar
>=
0
&&
iVar
<
6
);
assert
(
iVar
>=
0
&&
iVar
<
6
);
return
(
t
&
s_Truths6
[
iVar
])
|
((
t
&
s_Truths6
[
iVar
])
>>
(
1
<<
iVar
));
return
(
t
&
s_Truths6
[
iVar
])
|
((
t
&
s_Truths6
[
iVar
])
>>
(
1
<<
iVar
));
...
...
src/opt/dau/dauCanon.c
View file @
35c8d6a2
...
@@ -27,6 +27,14 @@ ABC_NAMESPACE_IMPL_START
...
@@ -27,6 +27,14 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
static
word
s_CMasks6
[
5
]
=
{
0x1111111111111111
,
0x0303030303030303
,
0x000F000F000F000F
,
0x000000FF000000FF
,
0x000000000000FFFF
};
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
@@ -406,8 +414,8 @@ int Abc_TtCountOnesInCofsFast6_rec( word Truth, int iVar, int nBytes, int * pSto
...
@@ -406,8 +414,8 @@ int Abc_TtCountOnesInCofsFast6_rec( word Truth, int iVar, int nBytes, int * pSto
pStore
[
2
]
+=
bit_count
[
Truth
&
0x0F
];
pStore
[
2
]
+=
bit_count
[
Truth
&
0x0F
];
return
bit_count
[
Truth
&
0xFF
];
return
bit_count
[
Truth
&
0xFF
];
}
}
nMints0
=
Abc_TtCountOnesInCofsFast6_rec
(
Abc_Tt6Cof0
(
Truth
,
iVar
),
iVar
-
1
,
nBytes
/
2
,
pStore
);
nMints0
=
Abc_TtCountOnesInCofsFast6_rec
(
Abc_Tt6Cof
actor
0
(
Truth
,
iVar
),
iVar
-
1
,
nBytes
/
2
,
pStore
);
nMints1
=
Abc_TtCountOnesInCofsFast6_rec
(
Abc_Tt6Cof1
(
Truth
,
iVar
),
iVar
-
1
,
nBytes
/
2
,
pStore
);
nMints1
=
Abc_TtCountOnesInCofsFast6_rec
(
Abc_Tt6Cof
actor
1
(
Truth
,
iVar
),
iVar
-
1
,
nBytes
/
2
,
pStore
);
pStore
[
iVar
]
+=
nMints0
;
pStore
[
iVar
]
+=
nMints0
;
return
nMints0
+
nMints1
;
return
nMints0
+
nMints1
;
}
}
...
@@ -899,7 +907,7 @@ unsigned Abc_TtCanonicize( word * pTruth, int nVars, char * pCanonPerm )
...
@@ -899,7 +907,7 @@ unsigned Abc_TtCanonicize( word * pTruth, int nVars, char * pCanonPerm )
#endif
#endif
uCanonPhase
=
Abc_TtSemiCanonicize
(
pTruth
,
nVars
,
pCanonPerm
,
pStoreIn
);
uCanonPhase
=
Abc_TtSemiCanonicize
(
pTruth
,
nVars
,
pCanonPerm
,
pStoreIn
);
for
(
k
=
0
;
k
<
3
;
k
++
)
for
(
k
=
0
;
k
<
5
;
k
++
)
{
{
int
fChanges
=
0
;
int
fChanges
=
0
;
for
(
i
=
nVars
-
2
;
i
>=
0
;
i
--
)
for
(
i
=
nVars
-
2
;
i
>=
0
;
i
--
)
...
...
src/opt/dau/dauDsd.c
View file @
35c8d6a2
...
@@ -165,21 +165,6 @@ void Dau_DsdTest2()
...
@@ -165,21 +165,6 @@ void Dau_DsdTest2()
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
static
inline
word
Dau_DsdCof0
(
word
t
,
int
iVar
)
{
assert
(
iVar
>=
0
&&
iVar
<
6
);
return
(
t
&~
s_Truth6
[
iVar
])
|
((
t
&~
s_Truth6
[
iVar
])
<<
(
1
<<
iVar
));
}
static
inline
word
Dau_DsdCof1
(
word
t
,
int
iVar
)
{
assert
(
iVar
>=
0
&&
iVar
<
6
);
return
(
t
&
s_Truth6
[
iVar
])
|
((
t
&
s_Truth6
[
iVar
])
>>
(
1
<<
iVar
));
}
static
inline
word
Dau_DsdVarPres
(
word
t
,
int
iVar
)
{
assert
(
iVar
>=
0
&&
iVar
<
6
);
return
(
t
&
s_Truth6
[
iVar
])
!=
((
t
<<
(
1
<<
iVar
))
&
s_Truth6
[
iVar
]);
}
static
inline
int
Dau_DsdPerformReplace
(
char
*
pBuffer
,
int
PosStart
,
int
Pos
,
int
Symb
,
char
*
pNext
)
static
inline
int
Dau_DsdPerformReplace
(
char
*
pBuffer
,
int
PosStart
,
int
Pos
,
int
Symb
,
char
*
pNext
)
{
{
static
char
pTemp
[
DAU_MAX_STR
+
20
];
static
char
pTemp
[
DAU_MAX_STR
+
20
];
...
@@ -206,7 +191,7 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
...
@@ -206,7 +191,7 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
// perform support minimization
// perform support minimization
nVarsNew
=
0
;
nVarsNew
=
0
;
for
(
v
=
0
;
v
<
nVars
;
v
++
)
for
(
v
=
0
;
v
<
nVars
;
v
++
)
if
(
Dau_DsdVarPres
(
t
,
pVars
[
v
]
)
)
if
(
Abc_Tt6HasVar
(
t
,
pVars
[
v
]
)
)
pVarsNew
[
nVarsNew
++
]
=
pVars
[
v
];
pVarsNew
[
nVarsNew
++
]
=
pVars
[
v
];
assert
(
nVarsNew
>
0
);
assert
(
nVarsNew
>
0
);
// special case when function is a var
// special case when function is a var
...
@@ -229,8 +214,8 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
...
@@ -229,8 +214,8 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
// decompose on the output side
// decompose on the output side
for
(
v
=
0
;
v
<
nVarsNew
;
v
++
)
for
(
v
=
0
;
v
<
nVarsNew
;
v
++
)
{
{
Cof0
[
v
]
=
Dau_DsdCof
0
(
t
,
pVarsNew
[
v
]
);
Cof0
[
v
]
=
Abc_Tt6Cofactor
0
(
t
,
pVarsNew
[
v
]
);
Cof1
[
v
]
=
Dau_DsdCof
1
(
t
,
pVarsNew
[
v
]
);
Cof1
[
v
]
=
Abc_Tt6Cofactor
1
(
t
,
pVarsNew
[
v
]
);
assert
(
Cof0
[
v
]
!=
Cof1
[
v
]
);
assert
(
Cof0
[
v
]
!=
Cof1
[
v
]
);
if
(
Cof0
[
v
]
==
0
)
// ax
if
(
Cof0
[
v
]
==
0
)
// ax
{
{
...
@@ -281,10 +266,10 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
...
@@ -281,10 +266,10 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
for
(
v
=
0
;
v
<
nVarsNew
;
v
++
)
for
(
v
=
0
;
v
<
nVarsNew
;
v
++
)
for
(
u
=
v
+
1
;
u
<
nVarsNew
;
u
++
)
for
(
u
=
v
+
1
;
u
<
nVarsNew
;
u
++
)
{
{
Cof
[
0
]
=
Dau_DsdCof
0
(
Cof0
[
v
],
pVarsNew
[
u
]
);
Cof
[
0
]
=
Abc_Tt6Cofactor
0
(
Cof0
[
v
],
pVarsNew
[
u
]
);
Cof
[
1
]
=
Dau_DsdCof
1
(
Cof0
[
v
],
pVarsNew
[
u
]
);
Cof
[
1
]
=
Abc_Tt6Cofactor
1
(
Cof0
[
v
],
pVarsNew
[
u
]
);
Cof
[
2
]
=
Dau_DsdCof
0
(
Cof1
[
v
],
pVarsNew
[
u
]
);
Cof
[
2
]
=
Abc_Tt6Cofactor
0
(
Cof1
[
v
],
pVarsNew
[
u
]
);
Cof
[
3
]
=
Dau_DsdCof
1
(
Cof1
[
v
],
pVarsNew
[
u
]
);
Cof
[
3
]
=
Abc_Tt6Cofactor
1
(
Cof1
[
v
],
pVarsNew
[
u
]
);
if
(
Cof
[
0
]
==
Cof
[
1
]
&&
Cof
[
0
]
==
Cof
[
2
]
)
// vu
if
(
Cof
[
0
]
==
Cof
[
1
]
&&
Cof
[
0
]
==
Cof
[
2
]
)
// vu
{
{
PosStart
=
Pos
;
PosStart
=
Pos
;
...
@@ -333,7 +318,7 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
...
@@ -333,7 +318,7 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
{
{
int
CountCur
=
0
;
int
CountCur
=
0
;
for
(
u
=
0
;
u
<
nVarsNew
;
u
++
)
for
(
u
=
0
;
u
<
nVarsNew
;
u
++
)
if
(
u
!=
v
&&
Dau_DsdVarPres
(
Cof0
[
v
],
pVarsNew
[
u
])
&&
Dau_DsdVarPres
(
Cof1
[
v
],
pVarsNew
[
u
])
)
if
(
u
!=
v
&&
Abc_Tt6HasVar
(
Cof0
[
v
],
pVarsNew
[
u
])
&&
Abc_Tt6HasVar
(
Cof1
[
v
],
pVarsNew
[
u
])
)
CountCur
++
;
CountCur
++
;
if
(
CountBest
>
CountCur
)
if
(
CountBest
>
CountCur
)
{
{
...
...
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