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
d261e617
Commit
d261e617
authored
Oct 10, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added command to transform GIA into the file with truth tables for each output.
parent
c9fbac5f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
src/base/io/io.c
+77
-0
No files found.
src/base/io/io.c
View file @
d261e617
...
...
@@ -69,6 +69,7 @@ static int IoCommandWriteVerilog( Abc_Frame_t * pAbc, int argc, char **argv );
static
int
IoCommandWriteVerLib
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
IoCommandWriteSortCnf
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
IoCommandWriteTruth
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
IoCommandWriteTruths
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
IoCommandWriteStatus
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
IoCommandWriteSmv
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -133,6 +134,7 @@ void Io_Init( Abc_Frame_t * pAbc )
// Cmd_CommandAdd( pAbc, "I/O", "write_verlib", IoCommandWriteVerLib, 0 );
Cmd_CommandAdd
(
pAbc
,
"I/O"
,
"write_sorter_cnf"
,
IoCommandWriteSortCnf
,
0
);
Cmd_CommandAdd
(
pAbc
,
"I/O"
,
"write_truth"
,
IoCommandWriteTruth
,
0
);
Cmd_CommandAdd
(
pAbc
,
"I/O"
,
"&write_truths"
,
IoCommandWriteTruths
,
0
);
Cmd_CommandAdd
(
pAbc
,
"I/O"
,
"write_status"
,
IoCommandWriteStatus
,
0
);
Cmd_CommandAdd
(
pAbc
,
"I/O"
,
"write_smv"
,
IoCommandWriteSmv
,
0
);
}
...
...
@@ -2714,6 +2716,81 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
IoCommandWriteTruths
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Gia_Obj_t
*
pObj
;
char
*
pFileName
;
FILE
*
pFile
;
unsigned
*
pTruth
;
int
fReverse
=
0
;
int
c
,
i
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"rh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'r'
:
fReverse
^=
1
;
break
;
case
'h'
:
goto
usage
;
default
:
goto
usage
;
}
}
if
(
pAbc
->
pGia
==
NULL
)
{
Abc_Print
(
-
1
,
"IoCommandWriteTruths(): There is no AIG.
\n
"
);
return
1
;
}
if
(
Gia_ManPiNum
(
pAbc
->
pGia
)
>
16
)
{
Abc_Print
(
-
1
,
"IoCommandWriteTruths(): Can write truth tables up to 16 inputs.
\n
"
);
return
0
;
}
if
(
argc
!=
globalUtilOptind
+
1
)
goto
usage
;
// get the input file name
pFileName
=
argv
[
globalUtilOptind
];
// convert to logic
pFile
=
fopen
(
pFileName
,
"w"
);
if
(
pFile
==
NULL
)
{
printf
(
"Cannot open file
\"
%s
\"
for writing.
\n
"
,
pFileName
);
return
0
;
}
Gia_ManForEachCo
(
pAbc
->
pGia
,
pObj
,
i
)
{
pTruth
=
Gia_ObjComputeTruthTable
(
pAbc
->
pGia
,
pObj
);
Extra_PrintHex
(
pFile
,
pTruth
,
Gia_ManPiNum
(
pAbc
->
pGia
)
);
fprintf
(
pFile
,
"
\n
"
);
}
fclose
(
pFile
);
return
0
;
usage
:
fprintf
(
pAbc
->
Err
,
"usage: &write_truths [-rh] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
writes truth tables of each PO of GIA manager into a file
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-r : toggle reversing bits in the truth table [default = %s]
\n
"
,
fReverse
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : print the help massage
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
file : the name of the file to write
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
...
...
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