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
df34a262
Commit
df34a262
authored
Jan 20, 2016
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generating sorting network as a PLA file.
parent
f5ee46eb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
3 deletions
+52
-3
src/base/pla/plaCom.c
+11
-3
src/base/pla/plaMan.c
+41
-0
No files found.
src/base/pla/plaCom.c
View file @
df34a262
...
@@ -290,15 +290,17 @@ usage:
...
@@ -290,15 +290,17 @@ usage:
******************************************************************************/
******************************************************************************/
int
Abc_CommandGen
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandGen
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
extern
void
Pla_GenSorter
(
int
nVars
);
Pla_Man_t
*
p
=
NULL
;
Pla_Man_t
*
p
=
NULL
;
int
nInputs
=
8
;
int
nInputs
=
8
;
int
nOutputs
=
1
;
int
nOutputs
=
1
;
int
nCubes
=
20
;
int
nCubes
=
20
;
int
Seed
=
0
;
int
Seed
=
0
;
int
fSorter
=
0
;
int
fPrimes
=
0
;
int
fPrimes
=
0
;
int
c
,
fVerbose
=
0
;
int
c
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"IOPSpvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"IOPS
s
pvh"
)
)
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
{
{
...
@@ -346,6 +348,9 @@ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -346,6 +348,9 @@ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
Seed
<
0
)
if
(
Seed
<
0
)
goto
usage
;
goto
usage
;
break
;
break
;
case
's'
:
fSorter
^=
1
;
break
;
case
'p'
:
case
'p'
:
fPrimes
^=
1
;
fPrimes
^=
1
;
break
;
break
;
...
@@ -358,7 +363,9 @@ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -358,7 +363,9 @@ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv )
goto
usage
;
goto
usage
;
}
}
}
}
if
(
fPrimes
)
if
(
fSorter
)
Pla_GenSorter
(
nInputs
);
else
if
(
fPrimes
)
p
=
Pla_ManPrimesDetector
(
nInputs
);
p
=
Pla_ManPrimesDetector
(
nInputs
);
else
else
{
{
...
@@ -370,12 +377,13 @@ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -370,12 +377,13 @@ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv )
Pla_AbcUpdateMan
(
pAbc
,
p
);
Pla_AbcUpdateMan
(
pAbc
,
p
);
return
0
;
return
0
;
usage:
usage:
Abc_Print
(
-
2
,
"usage: |gen [-IOPS num] [-pvh]
\n
"
);
Abc_Print
(
-
2
,
"usage: |gen [-IOPS num] [-
s
pvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
generate random or specialized SOP
\n
"
);
Abc_Print
(
-
2
,
"
\t
generate random or specialized SOP
\n
"
);
Abc_Print
(
-
2
,
"
\t
-I num : the number of inputs [default = %d]
\n
"
,
nInputs
);
Abc_Print
(
-
2
,
"
\t
-I num : the number of inputs [default = %d]
\n
"
,
nInputs
);
Abc_Print
(
-
2
,
"
\t
-O num : the number of outputs [default = %d]
\n
"
,
nOutputs
);
Abc_Print
(
-
2
,
"
\t
-O num : the number of outputs [default = %d]
\n
"
,
nOutputs
);
Abc_Print
(
-
2
,
"
\t
-P num : the number of products [default = %d]
\n
"
,
nCubes
);
Abc_Print
(
-
2
,
"
\t
-P num : the number of products [default = %d]
\n
"
,
nCubes
);
Abc_Print
(
-
2
,
"
\t
-S num : ramdom seed (0 <= num <= 1000) [default = %d]
\n
"
,
Seed
);
Abc_Print
(
-
2
,
"
\t
-S num : ramdom seed (0 <= num <= 1000) [default = %d]
\n
"
,
Seed
);
Abc_Print
(
-
2
,
"
\t
-s : toggle generating sorter as a PLA file [default = %s]
\n
"
,
fSorter
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-p : toggle generating prime detector [default = %s]
\n
"
,
fPrimes
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-p : toggle generating prime detector [default = %s]
\n
"
,
fPrimes
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
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
"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
...
...
src/base/pla/plaMan.c
View file @
df34a262
...
@@ -32,6 +32,47 @@ ABC_NAMESPACE_IMPL_START
...
@@ -32,6 +32,47 @@ ABC_NAMESPACE_IMPL_START
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Generates PLA description of a sorter.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Pla_GenSorter
(
int
nVars
)
{
int
i
,
k
,
Count
,
nMints
=
(
1
<<
nVars
);
char
Buffer
[
20
];
FILE
*
pFile
;
sprintf
(
Buffer
,
"sorter%02d.pla"
,
nVars
);
pFile
=
fopen
(
Buffer
,
"wb"
);
fprintf
(
pFile
,
"# This file was generated by ABC on %s.
\n
"
,
Extra_TimeStamp
()
);
fprintf
(
pFile
,
".i %d
\n
"
,
nVars
);
fprintf
(
pFile
,
".o %d
\n
"
,
nVars
);
fprintf
(
pFile
,
".p %d
\n
"
,
nMints
-
1
);
for
(
i
=
1
;
i
<
nMints
;
i
++
)
{
Count
=
0
;
for
(
k
=
nVars
-
1
;
k
>=
0
;
k
--
)
{
Count
+=
((
i
>>
k
)
&
1
);
fprintf
(
pFile
,
"%d"
,
(
i
>>
k
)
&
1
);
}
fprintf
(
pFile
,
" "
);
for
(
k
=
0
;
k
<
Count
;
k
++
)
fprintf
(
pFile
,
"1"
);
for
(
;
k
<
nVars
;
k
++
)
fprintf
(
pFile
,
"0"
);
fprintf
(
pFile
,
"
\n
"
);
}
fprintf
(
pFile
,
".end
\n
"
);
fclose
(
pFile
);
}
/**Function*************************************************************
Synopsis [Generates prime detector for the given bit-widths.]
Synopsis [Generates prime detector for the given bit-widths.]
Description []
Description []
...
...
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