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
712f46ca
Commit
712f46ca
authored
May 25, 2019
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding command 'symfun' to generate truth table of a symmetric function.
parent
890ff42c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
src/base/abci/abc.c
+75
-0
No files found.
src/base/abci/abc.c
View file @
712f46ca
...
@@ -315,6 +315,7 @@ static int Abc_CommandSynch ( Abc_Frame_t * pAbc, int argc, cha
...
@@ -315,6 +315,7 @@ static int Abc_CommandSynch ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandClockGate
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandClockGate
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandExtWin
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandExtWin
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandInsWin
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandInsWin
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandSymFun
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandPermute
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandPermute
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandUnpermute
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandUnpermute
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandCubeEnum
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandCubeEnum
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
@@ -1010,6 +1011,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
...
@@ -1010,6 +1011,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"clockgate"
,
Abc_CommandClockGate
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"clockgate"
,
Abc_CommandClockGate
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"extwin"
,
Abc_CommandExtWin
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"extwin"
,
Abc_CommandExtWin
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"inswin"
,
Abc_CommandInsWin
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"inswin"
,
Abc_CommandInsWin
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"symfun"
,
Abc_CommandSymFun
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"permute"
,
Abc_CommandPermute
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"permute"
,
Abc_CommandPermute
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"unpermute"
,
Abc_CommandUnpermute
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"unpermute"
,
Abc_CommandUnpermute
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"cubeenum"
,
Abc_CommandCubeEnum
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"cubeenum"
,
Abc_CommandCubeEnum
,
0
);
...
@@ -22970,6 +22972,79 @@ usage:
...
@@ -22970,6 +22972,79 @@ usage:
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Abc_CommandSymFun
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Vec_Bit_t
*
vMints
;
char
*
pStr
;
int
nVars
=
5
;
int
c
,
m
,
k
,
Count
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Nh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'N'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-N
\"
should be followed by a file name.
\n
"
);
goto
usage
;
}
nVars
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
break
;
case
'h'
:
goto
usage
;
default:
Abc_Print
(
-
2
,
"Unknown switch.
\n
"
);
goto
usage
;
}
}
if
(
argc
!=
globalUtilOptind
+
1
)
{
Abc_Print
(
-
1
,
"Not enough command-line arguments.
\n
"
);
return
1
;
}
if
(
nVars
<
2
||
nVars
>
9
)
{
Abc_Print
(
-
1
,
"The number of variables should be between 2 and 9.
\n
"
);
return
1
;
}
vMints
=
Vec_BitStart
(
1
<<
nVars
);
pStr
=
argv
[
globalUtilOptind
];
while
(
*
pStr
)
{
for
(
m
=
0
;
m
<
(
1
<<
nVars
);
m
++
)
{
Count
=
0
;
for
(
k
=
0
;
k
<
nVars
;
k
++
)
Count
+=
(
m
>>
k
)
&
1
;
if
(
*
pStr
==
'0'
+
Count
)
Vec_BitWriteEntry
(
vMints
,
m
,
1
);
}
pStr
++
;
}
Extra_PrintHex
(
stdout
,
(
unsigned
*
)
Vec_BitArray
(
vMints
),
nVars
);
printf
(
"
\n
"
);
Vec_BitFree
(
vMints
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: symfun [-h] <ones>
\n
"
);
Abc_Print
(
-
2
,
"
\t
prints truth table of a symmetric function up to 9 inputs
\n
"
);
Abc_Print
(
-
2
,
"
\t
<ones> : the counts of ones in the inputs when the function is one
\n
"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandPermute
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandPermute
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
extern
Abc_Ntk_t
*
Abc_NtkRestrashRandom
(
Abc_Ntk_t
*
pNtk
);
extern
Abc_Ntk_t
*
Abc_NtkRestrashRandom
(
Abc_Ntk_t
*
pNtk
);
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