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
02972e53
Commit
02972e53
authored
Oct 05, 2017
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to truth table manipulation.
parent
fbdf438d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
95 deletions
+34
-95
src/base/acb/acbPush.c
+2
-2
src/misc/util/utilTruth.h
+32
-93
No files found.
src/base/acb/acbPush.c
View file @
02972e53
...
...
@@ -46,7 +46,7 @@ void Acb_ObjPushToFanout( Acb_Ntk_t * p, int iObj, int iFaninIndex, int iFanout
{
word
c0
,
uTruthObjNew
=
0
,
uTruthObj
=
Acb_ObjTruth
(
p
,
iObj
),
Gate
;
word
c1
,
uTruthFanNew
=
0
,
uTruthFan
=
Acb_ObjTruth
(
p
,
iFanout
);
int
DecType
=
Abc_Tt
CheckOutAnd
(
uTruthObj
,
iFaninIndex
,
&
uTruthObjNew
);
int
DecType
=
Abc_Tt
6CheckOutDec
(
uTruthObj
,
iFaninIndex
,
&
uTruthObjNew
);
int
iFanin
=
Acb_ObjFanin
(
p
,
iObj
,
iFaninIndex
);
int
iFanoutObjIndex
=
Acb_ObjWhatFanin
(
p
,
iFanout
,
iObj
);
int
iFanoutFaninIndex
=
Acb_ObjWhatFanin
(
p
,
iFanout
,
iFanin
);
...
...
@@ -274,7 +274,7 @@ static inline int Acb_ObjFindFanoutPushableIndex( Acb_Ntk_t * p, int iObj )
{
int
k
,
iFanin
,
*
pFanins
;
Acb_ObjForEachFaninFast
(
p
,
iObj
,
pFanins
,
iFanin
,
k
)
if
(
Abc_Tt
CheckOutAnd
(
Acb_ObjTruth
(
p
,
iObj
),
k
,
NULL
)
>=
0
)
if
(
Abc_Tt
6CheckOutDec
(
Acb_ObjTruth
(
p
,
iObj
),
k
,
NULL
)
>=
0
)
return
k
;
return
-
1
;
}
...
...
src/misc/util/utilTruth.h
View file @
02972e53
...
...
@@ -2354,7 +2354,7 @@ static inline int Abc_Tt6EsopVerify( word t, int nVars )
SeeAlso []
***********************************************************************/
static
inline
int
Abc_Tt
CheckOutAnd
(
word
t
,
int
i
,
word
*
pOut
)
static
inline
int
Abc_Tt
6CheckOutDec
(
word
t
,
int
i
,
word
*
pOut
)
{
word
c0
=
Abc_Tt6Cofactor0
(
t
,
i
);
word
c1
=
Abc_Tt6Cofactor1
(
t
,
i
);
...
...
@@ -2386,142 +2386,81 @@ static inline int Abc_TtCheckOutAnd( word t, int i, word * pOut )
}
return
-
1
;
}
static
inline
int
Abc_TtCheckOut
And7
(
word
*
t
,
int
i
,
word
*
pOut
)
static
inline
int
Abc_TtCheckOut
Dec
(
word
*
pTruth
,
int
nVars
,
int
v
,
word
*
pOut
)
{
assert
(
i
<
7
);
if
(
i
==
6
)
{
word
c0
=
t
[
0
];
word
c1
=
t
[
1
];
assert
(
c0
!=
c1
);
if
(
c0
==
0
)
// F = i * G
{
if
(
pOut
)
pOut
[
0
]
=
pOut
[
1
]
=
c1
;
return
0
;
}
if
(
c1
==
0
)
// F = ~i * G
{
if
(
pOut
)
pOut
[
0
]
=
pOut
[
1
]
=
c0
;
return
1
;
}
if
(
~
c0
==
0
)
// F = ~i + G
{
if
(
pOut
)
pOut
[
0
]
=
pOut
[
1
]
=
c1
;
return
2
;
}
if
(
~
c1
==
0
)
// F = i + G
{
if
(
pOut
)
pOut
[
0
]
=
pOut
[
1
]
=
c0
;
return
3
;
}
if
(
c0
==
~
c1
)
// F = i # G
{
if
(
pOut
)
pOut
[
0
]
=
pOut
[
1
]
=
c0
;
return
4
;
}
}
else
{
int
k
,
Res
[
2
];
for
(
k
=
0
;
k
<
2
;
k
++
)
if
(
(
Res
[
k
]
=
Abc_TtCheckOutAnd
(
t
[
k
],
i
,
pOut
+
k
))
==
-
1
||
Res
[
0
]
!=
Res
[
k
]
)
return
-
1
;
return
Res
[
0
];
}
return
-
1
;
}
static
inline
int
Abc_TtCheckOutAnd8
(
word
*
t
,
int
i
,
word
*
pOut
)
{
assert
(
i
<
8
);
if
(
i
==
7
)
{
word
*
c0
=
t
;
word
*
c1
=
t
+
2
;
assert
(
c0
[
0
]
!=
c1
[
0
]
||
c0
[
1
]
!=
c1
[
1
]
);
if
(
c0
[
0
]
==
0
&&
c0
[
1
]
==
0
)
// F = i * G
word
Cof0
[
4
],
Cof1
[
4
];
int
nWords
=
Abc_TtWordNum
(
nVars
);
assert
(
nVars
<=
8
);
Abc_TtCofactor0p
(
Cof0
,
pTruth
,
nWords
,
v
);
Abc_TtCofactor1p
(
Cof1
,
pTruth
,
nWords
,
v
);
assert
(
!
Abc_TtEqual
(
Cof0
,
Cof1
,
nWords
)
);
if
(
Abc_TtIsConst0
(
Cof0
,
nWords
)
)
//if ( c0 == 0 ) // F = i * G
{
if
(
pOut
)
pOut
[
0
]
=
pOut
[
2
]
=
c1
[
0
],
pOut
[
1
]
=
pOut
[
3
]
=
c1
[
1
]
;
if
(
pOut
)
Abc_TtCopy
(
pOut
,
Cof1
,
nWords
,
0
);
//*pOut = c1
;
return
0
;
}
if
(
c1
[
0
]
==
0
&&
c1
[
1
]
==
0
)
// F = ~i * G
if
(
Abc_TtIsConst0
(
Cof1
,
nWords
)
)
//if ( c1
== 0 ) // F = ~i * G
{
if
(
pOut
)
pOut
[
0
]
=
pOut
[
2
]
=
c0
[
0
],
pOut
[
1
]
=
pOut
[
3
]
=
c0
[
1
]
;
if
(
pOut
)
Abc_TtCopy
(
pOut
,
Cof0
,
nWords
,
0
);
//*pOut = c0
;
return
1
;
}
if
(
~
c0
[
0
]
==
0
&&
~
c0
[
1
]
==
0
)
// F = ~i + G
if
(
Abc_TtIsConst1
(
Cof0
,
nWords
)
)
//if ( ~c0
== 0 ) // F = ~i + G
{
if
(
pOut
)
pOut
[
0
]
=
pOut
[
2
]
=
c1
[
0
],
pOut
[
1
]
=
pOut
[
3
]
=
c1
[
1
]
;
if
(
pOut
)
Abc_TtCopy
(
pOut
,
Cof1
,
nWords
,
0
);
//*pOut = c1
;
return
2
;
}
if
(
~
c1
[
0
]
==
0
&&
~
c1
[
1
]
==
0
)
// F = i + G
if
(
Abc_TtIsConst1
(
Cof1
,
nWords
)
)
//if ( ~c1
== 0 ) // F = i + G
{
if
(
pOut
)
pOut
[
0
]
=
pOut
[
2
]
=
c0
[
0
],
pOut
[
1
]
=
pOut
[
3
]
=
c0
[
1
]
;
if
(
pOut
)
Abc_TtCopy
(
pOut
,
Cof0
,
nWords
,
0
);
//*pOut = c0
;
return
3
;
}
if
(
c0
[
0
]
==
~
c1
[
0
]
&&
c0
[
1
]
==
~
c1
[
1
]
)
// F = i # G
if
(
Abc_TtOpposite
(
Cof0
,
Cof1
,
nWords
)
)
//if ( c0 == ~c1 )
// F = i # G
{
if
(
pOut
)
pOut
[
0
]
=
pOut
[
2
]
=
c0
[
0
],
pOut
[
1
]
=
pOut
[
3
]
=
c0
[
1
]
;
if
(
pOut
)
Abc_TtCopy
(
pOut
,
Cof0
,
nWords
,
0
);
//*pOut = c0
;
return
4
;
}
}
else
if
(
i
==
6
)
{
int
k
,
Res
[
2
];
for
(
k
=
0
;
k
<
2
;
k
++
)
if
(
(
Res
[
k
]
=
Abc_TtCheckOutAnd7
(
t
+
2
*
k
,
i
,
pOut
+
2
*
k
))
==
-
1
||
Res
[
0
]
!=
Res
[
k
]
)
return
-
1
;
return
Res
[
0
];
}
else
{
int
k
,
Res
[
4
];
for
(
k
=
0
;
k
<
4
;
k
++
)
if
(
(
Res
[
k
]
=
Abc_TtCheckOutAnd
(
t
[
k
],
i
,
pOut
+
k
))
==
-
1
||
Res
[
0
]
!=
Res
[
k
]
)
return
-
1
;
return
Res
[
0
];
}
return
-
1
;
}
static
inline
word
Abc_TtCheckDecOutOne7
(
word
*
t
,
int
*
piVar
,
int
*
pType
)
{
int
v
,
Type
,
Type2
;
word
Out
;
int
v
,
Type
,
Type2
;
word
Out
[
2
]
;
for
(
v
=
6
;
v
>=
0
;
v
--
)
if
(
(
Type
=
Abc_TtCheckOut
And7
(
t
,
v
,
NULL
))
!=
-
1
)
if
(
(
Type
=
Abc_TtCheckOut
Dec
(
t
,
7
,
v
,
NULL
))
!=
-
1
)
{
Abc_TtSwapVars
(
t
,
7
,
v
,
6
);
Type2
=
Abc_TtCheckOut
And7
(
t
,
6
,
&
Out
);
Abc_TtSwapVars
(
t
,
7
,
6
,
v
);
Type2
=
Abc_TtCheckOut
Dec
(
t
,
7
,
6
,
Out
);
assert
(
Type
==
Type2
);
*
piVar
=
v
;
*
pType
=
Type
;
return
Out
;
return
Out
[
0
]
;
}
return
0
;
}
static
inline
word
Abc_TtCheckDecOutOne8
(
word
*
t
,
int
*
piVar1
,
int
*
piVar2
,
int
*
pType1
,
int
*
pType2
)
{
int
v
,
Type1
,
Type12
,
Type2
,
Type22
;
word
Out
[
2
],
Out2
;
int
v
,
Type1
,
Type12
,
Type2
,
Type22
;
word
Out
[
4
],
Out2
[
2
]
;
for
(
v
=
7
;
v
>=
0
;
v
--
)
if
(
(
Type1
=
Abc_TtCheckOut
And8
(
t
,
v
,
NULL
))
!=
-
1
)
if
(
(
Type1
=
Abc_TtCheckOut
Dec
(
t
,
8
,
v
,
NULL
))
!=
-
1
)
{
Abc_TtSwapVars
(
t
,
8
,
v
,
7
);
Type12
=
Abc_TtCheckOut
And8
(
t
,
7
,
Out
);
Abc_TtSwapVars
(
t
,
8
,
7
,
v
);
Type12
=
Abc_TtCheckOut
Dec
(
t
,
8
,
7
,
Out
);
assert
(
Type1
==
Type12
);
*
piVar1
=
v
;
*
p
iVar2
=
Type1
;
*
p
Type1
=
Type1
;
break
;
}
if
(
v
==
-
1
)
return
0
;
for
(
v
=
6
;
v
>=
0
;
v
--
)
if
(
(
Type2
=
Abc_TtCheckOut
And7
(
Out
,
v
,
NULL
))
!=
-
1
&&
Abc_Lit2Var
(
Type2
)
==
Abc_Lit2Var
(
Type1
)
)
if
(
(
Type2
=
Abc_TtCheckOut
Dec
(
Out
,
7
,
v
,
NULL
))
!=
-
1
&&
Abc_Lit2Var
(
Type2
)
==
Abc_Lit2Var
(
Type1
)
)
{
Abc_TtSwapVars
(
Out
,
7
,
v
,
6
);
Type22
=
Abc_TtCheckOut
And7
(
t
,
6
,
&
Out2
);
Abc_TtSwapVars
(
Out
,
7
,
6
,
v
);
Type22
=
Abc_TtCheckOut
Dec
(
Out
,
7
,
6
,
Out2
);
assert
(
Type2
==
Type22
);
*
piVar2
=
v
;
*
pType2
=
Type2
;
assert
(
*
piVar2
<
*
piVar1
);
return
Out2
;
return
Out2
[
0
]
;
}
return
0
;
}
...
...
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