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
890ff42c
Commit
890ff42c
authored
May 25, 2019
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding command &print_truth to print truth tables for primary outputs.
parent
91b54281
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
0 deletions
+123
-0
src/aig/gia/giaTruth.c
+34
-0
src/base/abci/abc.c
+89
-0
No files found.
src/aig/gia/giaTruth.c
View file @
890ff42c
...
...
@@ -63,6 +63,40 @@ static inline word * Gla_ObjTruthDup( Gia_Man_t * p, word * pDst, word * pSrc, i
SeeAlso []
***********************************************************************/
word
Gia_LutComputeTruth6Simple_rec
(
Gia_Man_t
*
p
,
int
iObj
)
{
word
Truth0
,
Truth1
,
Truth
;
Gia_Obj_t
*
pObj
=
Gia_ManObj
(
p
,
iObj
);
if
(
Gia_ObjIsConst0
(
pObj
)
)
return
0
;
if
(
Gia_ObjIsCi
(
pObj
)
)
return
s_Truths6
[
Gia_ObjCioId
(
pObj
)];
Truth0
=
Gia_LutComputeTruth6Simple_rec
(
p
,
Gia_ObjFaninId0
(
pObj
,
iObj
)
);
Truth1
=
Gia_LutComputeTruth6Simple_rec
(
p
,
Gia_ObjFaninId1
(
pObj
,
iObj
)
);
Truth0
=
Gia_ObjFaninC0
(
pObj
)
?
~
Truth0
:
Truth0
;
Truth1
=
Gia_ObjFaninC1
(
pObj
)
?
~
Truth1
:
Truth1
;
Truth
=
Gia_ObjIsXor
(
pObj
)
?
Truth0
^
Truth1
:
Truth0
&
Truth1
;
return
Truth
;
}
word
Gia_LutComputeTruth6Simple
(
Gia_Man_t
*
p
,
int
iPo
)
{
Gia_Obj_t
*
pObj
=
Gia_ManPo
(
p
,
iPo
);
word
Truth
=
Gia_LutComputeTruth6Simple_rec
(
p
,
Gia_ObjFaninId0p
(
p
,
pObj
)
);
return
Gia_ObjFaninC0
(
pObj
)
?
~
Truth
:
Truth
;
}
/**Function*************************************************************
Synopsis [Compute truth table.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
word
Gia_LutComputeTruth6_rec
(
Gia_Man_t
*
p
,
int
iNode
,
Vec_Wrd_t
*
vTruths
)
{
Gia_Obj_t
*
pObj
;
...
...
src/base/abci/abc.c
View file @
890ff42c
...
...
@@ -389,6 +389,7 @@ static int Abc_CommandAbc9PFan ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandAbc9PSig
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Status
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9MuxProfile
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9PrintTruth
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Unate
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Rex2Gia
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9RexWalk
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -1086,6 +1087,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&psig"
,
Abc_CommandAbc9PSig
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&status"
,
Abc_CommandAbc9Status
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&profile"
,
Abc_CommandAbc9MuxProfile
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&print_truth"
,
Abc_CommandAbc9PrintTruth
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&unate"
,
Abc_CommandAbc9Unate
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&rex2gia"
,
Abc_CommandAbc9Rex2Gia
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&rexwalk"
,
Abc_CommandAbc9RexWalk
,
0
);
...
...
@@ -30694,6 +30696,93 @@ usage:
SeeAlso []
***********************************************************************/
int
Abc_CommandAbc9PrintTruth
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
word
Gia_LutComputeTruth6Simple
(
Gia_Man_t
*
p
,
int
iPo
);
int
i
,
c
,
iOutNum
=
0
,
nOutRange
=
-
1
,
fVerbose
=
0
;
word
Truth
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"ORvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'O'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-O
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
iOutNum
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
iOutNum
<
0
)
goto
usage
;
break
;
case
'R'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-R
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nOutRange
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nOutRange
<
0
)
goto
usage
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pAbc
->
pGia
==
NULL
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9PrintTruth(): There is no AIG.
\n
"
);
return
1
;
}
if
(
Gia_ManPiNum
(
pAbc
->
pGia
)
>
6
)
{
Abc_Print
(
-
1
,
"The number of inputs of the AIG exceeds 6.
\n
"
);
return
1
;
}
if
(
iOutNum
<
0
||
iOutNum
+
nOutRange
>
Gia_ManPoNum
(
pAbc
->
pGia
)
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9PrintTruth(): Range of outputs to extract is incorrect.
\n
"
);
return
1
;
}
if
(
nOutRange
==
-
1
)
nOutRange
=
Gia_ManCoNum
(
pAbc
->
pGia
);
for
(
i
=
iOutNum
;
i
<
iOutNum
+
nOutRange
;
i
++
)
{
Truth
=
Gia_LutComputeTruth6Simple
(
pAbc
->
pGia
,
i
);
printf
(
"Output %8d : "
,
i
);
Extra_PrintHex
(
stdout
,
(
unsigned
*
)
&
Truth
,
Gia_ManCiNum
(
pAbc
->
pGia
)
);
printf
(
"
\n
"
);
}
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &print_truth [-OR num] [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
prints truth tables of outputs in hex notation
\n
"
);
Abc_Print
(
-
2
,
"
\t
-O num : the index of first PO to print [default = %d]
\n
"
,
iOutNum
);
Abc_Print
(
-
2
,
"
\t
-R num : (optional) the number of outputs to extract [default = all]
\n
"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandAbc9Unate
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
void
Gia_ManCheckUnateTest
(
Gia_Man_t
*
p
,
int
fComputeAll
,
int
fVerbose
);
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