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
dc9a2258
Commit
dc9a2258
authored
Oct 06, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New AIG optimization package.
parent
3d23bc8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
31 deletions
+18
-31
src/opt/dau/dauDsd.c
+18
-31
No files found.
src/opt/dau/dauDsd.c
View file @
dc9a2258
...
...
@@ -38,8 +38,14 @@ static word s_Truth6[6] =
0xFFFFFFFF00000000
};
// ! = not; (a + b) = a and b; [a + b] = a xor b; <abc> = ITE( a, b, c )
/*
This code performs truth-table-based decomposition for 6-variable functions.
Representation of operations:
! = not;
(ab) = a and b;
[ab] = a xor b;
<abc> = ITE( a, b, c )
*/
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
...
...
@@ -173,28 +179,6 @@ 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_DsdPerformReplace2
(
char
*
pBuffer
,
int
PosStart
,
int
Pos
,
int
Symb
,
char
*
pNext
)
{
char
*
pTemp
,
*
pStop
=
pTemp
=
pBuffer
+
Pos
;
int
i
,
Len
=
strlen
(
pNext
);
do
{
for
(
pTemp
=
pBuffer
+
Pos
-
1
;
pTemp
>=
pBuffer
+
PosStart
;
pTemp
[
Len
-
1
]
=
*
pTemp
,
pTemp
--
)
if
(
pTemp
<
pStop
&&
*
pTemp
==
(
char
)
Symb
)
{
for
(
i
=
0
;
i
<
Len
;
i
++
)
pTemp
[
i
]
=
pNext
[
i
];
Pos
+=
Len
-
1
;
pStop
=
pTemp
;
// check if there is symbol left
for
(
;
pTemp
>=
pBuffer
+
PosStart
;
pTemp
--
)
if
(
*
pTemp
==
(
char
)
Symb
)
break
;
break
;
}
}
while
(
pTemp
>=
pBuffer
+
PosStart
);
return
Pos
;
}
static
inline
int
Dau_DsdPerformReplace
(
char
*
pBuffer
,
int
PosStart
,
int
Pos
,
int
Symb
,
char
*
pNext
)
{
static
char
pTemp
[
DAU_MAX_STR
+
20
];
...
...
@@ -218,12 +202,13 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
int
pVarsNew
[
6
],
nVarsNew
,
PosStart
;
int
v
,
u
,
vBest
,
CountBest
;
assert
(
Pos
<
DAU_MAX_STR
);
//
copy remaining variables
//
perform support minimization
nVarsNew
=
0
;
for
(
v
=
0
;
v
<
nVars
;
v
++
)
if
(
Dau_DsdVarPres
(
t
,
pVars
[
v
]
)
)
pVarsNew
[
nVarsNew
++
]
=
pVars
[
v
];
assert
(
nVarsNew
>
0
);
// special case when function is a var
if
(
nVarsNew
==
1
)
{
if
(
t
==
s_Truth6
[
pVarsNew
[
0
]
]
)
...
...
@@ -240,12 +225,13 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
assert
(
0
);
return
Pos
;
}
// decompose on the output side
for
(
v
=
0
;
v
<
nVarsNew
;
v
++
)
{
Cof0
[
v
]
=
Dau_DsdCof0
(
t
,
pVarsNew
[
v
]
);
Cof1
[
v
]
=
Dau_DsdCof1
(
t
,
pVarsNew
[
v
]
);
assert
(
Cof0
[
v
]
!=
Cof1
[
v
]
);
if
(
Cof0
[
v
]
==
0
)
if
(
Cof0
[
v
]
==
0
)
// ax
{
pBuffer
[
Pos
++
]
=
'('
;
pBuffer
[
Pos
++
]
=
'a'
+
pVarsNew
[
v
];
...
...
@@ -253,7 +239,7 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
pBuffer
[
Pos
++
]
=
')'
;
return
Pos
;
}
if
(
Cof0
[
v
]
==
~
0
)
if
(
Cof0
[
v
]
==
~
0
)
// !(ax)
{
pBuffer
[
Pos
++
]
=
'!'
;
pBuffer
[
Pos
++
]
=
'('
;
...
...
@@ -262,7 +248,7 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
pBuffer
[
Pos
++
]
=
')'
;
return
Pos
;
}
if
(
Cof1
[
v
]
==
0
)
if
(
Cof1
[
v
]
==
0
)
// !ax
{
pBuffer
[
Pos
++
]
=
'('
;
pBuffer
[
Pos
++
]
=
'!'
;
...
...
@@ -271,7 +257,7 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
pBuffer
[
Pos
++
]
=
')'
;
return
Pos
;
}
if
(
Cof1
[
v
]
==
~
0
)
if
(
Cof1
[
v
]
==
~
0
)
// !(!ax)
{
pBuffer
[
Pos
++
]
=
'!'
;
pBuffer
[
Pos
++
]
=
'('
;
...
...
@@ -281,7 +267,7 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
pBuffer
[
Pos
++
]
=
')'
;
return
Pos
;
}
if
(
Cof0
[
v
]
==
~
Cof1
[
v
]
)
if
(
Cof0
[
v
]
==
~
Cof1
[
v
]
)
// a^x
{
pBuffer
[
Pos
++
]
=
'['
;
pBuffer
[
Pos
++
]
=
'a'
+
pVarsNew
[
v
];
...
...
@@ -290,6 +276,7 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
return
Pos
;
}
}
// decompose on the input side
for
(
v
=
0
;
v
<
nVarsNew
;
v
++
)
for
(
u
=
v
+
1
;
u
<
nVarsNew
;
u
++
)
{
...
...
@@ -338,7 +325,7 @@ int Dau_DsdPerform_rec( word t, char * pBuffer, int Pos, int * pVars, int nVars
return
Pos
;
}
}
//
look for MUX
//
find best variable for MUX decomposition
vBest
=
-
1
;
CountBest
=
10
;
for
(
v
=
0
;
v
<
nVarsNew
;
v
++
)
...
...
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