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
21e6a59e
Commit
21e6a59e
authored
Nov 11, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved DSD.
parent
1bef28e6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
34 deletions
+63
-34
src/base/abci/abcDec.c
+6
-10
src/misc/util/utilTruth.h
+46
-3
src/opt/dau/dau.h
+7
-2
src/opt/dau/dauDsd.c
+0
-0
src/opt/dau/dauMerge.c
+4
-19
No files found.
src/base/abci/abcDec.c
View file @
21e6a59e
...
...
@@ -24,6 +24,7 @@
#include "bool/bdc/bdc.h"
#include "bool/dec/dec.h"
#include "bool/kit/kit.h"
#include "opt/dau/dau.h"
ABC_NAMESPACE_IMPL_START
...
...
@@ -541,20 +542,15 @@ void Abc_TruthDecPerform( Abc_TtStore_t * p, int DecType, int fVerbose )
}
else
if
(
DecType
==
4
)
{
// extern void Dau_DsdTestOne( word t, int i );
if
(
p
->
nVars
!=
6
)
{
printf
(
"Currently only works for 6 variables.
\n
"
);
return
;
}
// perform disjoint-support decomposition and count AIG nodes
// (non-DSD blocks are decomposed into 2:1 MUXes, each counting as 3 AIG nodes)
assert
(
p
->
nVars
==
6
);
char
pDsd
[
DAU_MAX_STR
];
for
(
i
=
0
;
i
<
p
->
nFuncs
;
i
++
)
{
if
(
fVerbose
)
printf
(
"%7d : "
,
i
);
// Dau_DsdTestOne( *p->pFuncs[i], i );
Dau_DsdDecompose
(
p
->
pFuncs
[
i
],
p
->
nVars
,
0
,
pDsd
);
if
(
fVerbose
)
printf
(
"%s
\n
"
,
pDsd
);
nNodes
+=
Dau_DsdCountAnds
(
pDsd
);
}
}
else
assert
(
0
);
...
...
src/misc/util/utilTruth.h
View file @
21e6a59e
...
...
@@ -234,7 +234,6 @@ static inline void Abc_TtElemInit( word ** pTtElems, int nVars )
pTtElems
[
i
][
k
]
=
(
k
&
(
1
<<
(
i
-
6
)))
?
~
(
word
)
0
:
0
;
}
/**Function*************************************************************
Synopsis []
...
...
@@ -257,6 +256,50 @@ static inline word Abc_Tt6Cofactor1( word t, int iVar )
return
(
t
&
s_Truths6
[
iVar
])
|
((
t
&
s_Truths6
[
iVar
])
>>
(
1
<<
iVar
));
}
static
inline
void
Abc_TtCofactor0p
(
word
*
pOut
,
word
*
pIn
,
int
nWords
,
int
iVar
)
{
if
(
nWords
==
1
)
pOut
[
0
]
=
((
pIn
[
0
]
&
s_Truths6Neg
[
iVar
])
<<
(
1
<<
iVar
))
|
(
pIn
[
0
]
&
s_Truths6Neg
[
iVar
]);
else
if
(
iVar
<=
5
)
{
int
w
,
shift
=
(
1
<<
iVar
);
for
(
w
=
0
;
w
<
nWords
;
w
++
)
pOut
[
w
]
=
((
pIn
[
w
]
&
s_Truths6Neg
[
iVar
])
<<
shift
)
|
(
pIn
[
w
]
&
s_Truths6Neg
[
iVar
]);
}
else
// if ( iVar > 5 )
{
word
*
pLimit
=
pIn
+
nWords
;
int
i
,
iStep
=
Abc_TtWordNum
(
iVar
);
for
(
;
pIn
<
pLimit
;
pIn
+=
2
*
iStep
,
pOut
+=
2
*
iStep
)
for
(
i
=
0
;
i
<
iStep
;
i
++
)
{
pOut
[
i
]
=
pIn
[
i
];
pOut
[
i
+
iStep
]
=
pIn
[
i
];
}
}
}
static
inline
void
Abc_TtCofactor1p
(
word
*
pOut
,
word
*
pIn
,
int
nWords
,
int
iVar
)
{
if
(
nWords
==
1
)
pOut
[
0
]
=
(
pIn
[
0
]
&
s_Truths6
[
iVar
])
|
((
pIn
[
0
]
&
s_Truths6
[
iVar
])
>>
(
1
<<
iVar
));
else
if
(
iVar
<=
5
)
{
int
w
,
shift
=
(
1
<<
iVar
);
for
(
w
=
0
;
w
<
nWords
;
w
++
)
pOut
[
w
]
=
(
pIn
[
w
]
&
s_Truths6
[
iVar
])
|
((
pIn
[
w
]
&
s_Truths6
[
iVar
])
>>
shift
);
}
else
// if ( iVar > 5 )
{
word
*
pLimit
=
pIn
+
nWords
;
int
i
,
iStep
=
Abc_TtWordNum
(
iVar
);
for
(
;
pIn
<
pLimit
;
pIn
+=
2
*
iStep
,
pOut
+=
2
*
iStep
)
for
(
i
=
0
;
i
<
iStep
;
i
++
)
{
pOut
[
i
]
=
pIn
[
i
+
iStep
];
pOut
[
i
+
iStep
]
=
pIn
[
i
+
iStep
];
}
}
}
static
inline
void
Abc_TtCofactor0
(
word
*
pTruth
,
int
nWords
,
int
iVar
)
{
if
(
nWords
==
1
)
...
...
@@ -274,7 +317,7 @@ static inline void Abc_TtCofactor0( word * pTruth, int nWords, int iVar )
for
(
;
pTruth
<
pLimit
;
pTruth
+=
2
*
iStep
)
for
(
i
=
0
;
i
<
iStep
;
i
++
)
pTruth
[
i
+
iStep
]
=
pTruth
[
i
];
}
}
}
static
inline
void
Abc_TtCofactor1
(
word
*
pTruth
,
int
nWords
,
int
iVar
)
{
...
...
@@ -293,7 +336,7 @@ static inline void Abc_TtCofactor1( word * pTruth, int nWords, int iVar )
for
(
;
pTruth
<
pLimit
;
pTruth
+=
2
*
iStep
)
for
(
i
=
0
;
i
<
iStep
;
i
++
)
pTruth
[
i
]
=
pTruth
[
i
+
iStep
];
}
}
}
/**Function*************************************************************
...
...
src/opt/dau/dau.h
View file @
21e6a59e
...
...
@@ -39,8 +39,8 @@
ABC_NAMESPACE_HEADER_START
#define DAU_MAX_VAR
8
// should be 6 or more
#define DAU_MAX_STR
64
#define DAU_MAX_VAR
16
// should be 6 or more
#define DAU_MAX_STR
256
#define DAU_MAX_WORD (1<<(DAU_MAX_VAR-6))
////////////////////////////////////////////////////////////////////////
...
...
@@ -51,6 +51,10 @@ ABC_NAMESPACE_HEADER_START
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
static
inline
int
Dau_DsdIsConst
(
char
*
p
)
{
return
(
p
[
0
]
==
'0'
||
p
[
0
]
==
'1'
)
&&
p
[
1
]
==
0
;
}
static
inline
int
Dau_DsdIsConst0
(
char
*
p
)
{
return
p
[
0
]
==
'0'
&&
p
[
1
]
==
0
;
}
static
inline
int
Dau_DsdIsConst1
(
char
*
p
)
{
return
p
[
0
]
==
'1'
&&
p
[
1
]
==
0
;
}
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
...
...
@@ -62,6 +66,7 @@ extern int Dau_DsdDecompose( word * pTruth, int nVarsInit, int fSplitP
extern
word
*
Dau_DsdToTruth
(
char
*
p
,
int
nVars
);
extern
word
Dau_Dsd6ToTruth
(
char
*
p
);
extern
void
Dau_DsdNormalize
(
char
*
p
);
extern
int
Dau_DsdCountAnds
(
char
*
pDsd
);
/*=== dauMerge.c ==========================================================*/
extern
void
Dau_DsdRemoveBraces
(
char
*
pDsd
,
int
*
pMatches
);
...
...
src/opt/dau/dauDsd.c
View file @
21e6a59e
This diff is collapsed.
Click to expand it.
src/opt/dau/dauMerge.c
View file @
21e6a59e
...
...
@@ -31,21 +31,6 @@ ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Substitution storage.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Dau_DsdIsConst
(
char
*
p
)
{
return
(
p
[
0
]
==
'0'
||
p
[
0
]
==
'1'
)
&&
p
[
1
]
==
0
;
}
static
inline
int
Dau_DsdIsConst0
(
char
*
p
)
{
return
p
[
0
]
==
'0'
&&
p
[
1
]
==
0
;
}
static
inline
int
Dau_DsdIsConst1
(
char
*
p
)
{
return
p
[
0
]
==
'1'
&&
p
[
1
]
==
0
;
}
/**Function*************************************************************
...
...
@@ -328,7 +313,7 @@ int Dau_DsdMergeStatus_rec( char * pStr, char ** p, int * pMatches, int nShared,
pStatus
[
pTemp
-
pStr
]
=
-
1
;
}
}
if
(
**
p
>=
'a'
&&
**
p
<=
'
f
'
)
// var
if
(
**
p
>=
'a'
&&
**
p
<=
'
z
'
)
// var
return
pStatus
[
*
p
-
pStr
]
=
(
**
p
-
'a'
<
nShared
)
?
0
:
3
;
if
(
**
p
==
'('
||
**
p
==
'['
||
**
p
==
'<'
||
**
p
==
'{'
)
// and/or/xor
{
...
...
@@ -417,7 +402,7 @@ void Dau_DsdMergeSubstitute_rec( Dau_Sto_t * pS, char * pStr, char ** p, int * p
Dau_DsdMergeStoreAddToOutputChar
(
pS
,
*
pTemp
);
}
}
if
(
**
p
>=
'a'
&&
**
p
<=
'
f
'
)
// var
if
(
**
p
>=
'a'
&&
**
p
<=
'
z
'
)
// var
{
if
(
fWrite
)
Dau_DsdMergeStoreAddToOutputChar
(
pS
,
**
p
);
...
...
@@ -544,7 +529,7 @@ void Dau_DsdRemoveBraces_rec( char * pStr, char ** p, int * pMatches )
if
(
*
(
q
+
1
)
==
'{'
)
*
p
=
q
+
1
;
}
if
(
**
p
>=
'a'
&&
**
p
<=
'
f
'
)
// var
if
(
**
p
>=
'a'
&&
**
p
<=
'
z
'
)
// var
return
;
if
(
**
p
==
'('
||
**
p
==
'['
||
**
p
==
'<'
||
**
p
==
'{'
)
{
...
...
@@ -773,7 +758,7 @@ printf( "%s\n", pRes );
}
void
Dau_DsdTest
()
void
Dau_DsdTest
66
()
{
int
Perm0
[
DAU_MAX_VAR
]
=
{
0
,
1
,
2
,
3
,
4
,
5
};
// int pMatches[DAU_MAX_STR];
...
...
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