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
1779f545
Commit
1779f545
authored
Jan 15, 2019
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Procedures to generate constant-argument multipliers.
parent
32a687ba
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
318 additions
and
3 deletions
+318
-3
abclib.dsp
+4
-0
src/base/abci/abc.c
+193
-0
src/misc/extra/extraUtilCfs.c
+15
-0
src/misc/extra/extraUtilGen.c
+64
-0
src/misc/extra/extraUtilMacc.c
+41
-3
src/misc/extra/module.make
+1
-0
No files found.
abclib.dsp
View file @
1779f545
...
...
@@ -3711,6 +3711,10 @@ SOURCE=.\src\misc\extra\extraUtilFile.c
# End Source File
# Begin Source File
SOURCE=.\src\misc\extra\extraUtilGen.c
# End Source File
# Begin Source File
SOURCE=.\src\misc\extra\extraUtilMacc.c
# End Source File
# Begin Source File
...
...
src/base/abci/abc.c
View file @
1779f545
...
...
@@ -535,6 +535,9 @@ static int Abc_CommandAbc9Gla2Vta ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandAbc9Fla2Gla
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Gla2Fla
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Gen
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Cfs
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Test
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
extern
int
Abc_CommandAbcLivenessToSafety
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -1234,6 +1237,9 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Liveness"
,
"kcs"
,
Abc_CommandCS_kLiveness
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Liveness"
,
"nck"
,
Abc_CommandNChooseK
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"gen"
,
Abc_CommandAbc9Gen
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"cfs"
,
Abc_CommandAbc9Cfs
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&test"
,
Abc_CommandAbc9Test
,
0
);
{
// extern Mf_ManTruthCount();
...
...
@@ -45431,6 +45437,193 @@ usage:
SeeAlso []
***********************************************************************/
int
Abc_CommandAbc9Gen
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
Gia_Man_t
*
Extra_CommandGen
(
int
Algo
,
int
LutSize
,
int
nLuts
,
int
nLevels
,
int
fVerbose
);
Gia_Man_t
*
pTemp
=
NULL
;
int
Algo
=
0
;
int
LutSize
=
6
;
int
nLuts
=
256
;
int
nLevels
=
8
;
int
c
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"AKNLvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'A'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-A
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
Algo
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
Algo
<
0
)
goto
usage
;
break
;
case
'K'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-K
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
LutSize
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
LutSize
<
0
)
goto
usage
;
break
;
case
'N'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-N
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nLuts
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nLuts
<
0
)
goto
usage
;
break
;
case
'L'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-L
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nLevels
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nLevels
<
0
)
goto
usage
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
pTemp
=
Extra_CommandGen
(
Algo
,
LutSize
,
nLuts
,
nLevels
,
fVerbose
);
Abc_FrameUpdateGia
(
pAbc
,
pTemp
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &gen [-AKNLvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
generates network
\n
"
);
Abc_Print
(
-
2
,
"
\t
-A num : the generation algorithm [default = %d]
\n
"
,
Algo
);
Abc_Print
(
-
2
,
"
\t
-K num : the number of LUT inputs [default = %d]
\n
"
,
LutSize
);
Abc_Print
(
-
2
,
"
\t
-N num : the number of LUTs on one level [default = %d]
\n
"
,
nLuts
);
Abc_Print
(
-
2
,
"
\t
-L num : the number of LUT levels [default = %d]
\n
"
,
nLevels
);
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_CommandAbc9Cfs
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
void
Extra_CommandCfs
(
int
Limit
,
int
Reps
,
int
UnseenUse
,
int
RareUse
,
int
fVerbose
);
int
Limit
=
0
;
int
Reps
=
1
;
int
UnseenUse
=
2
;
int
RareUse
=
2
;
int
c
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"LNURvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'L'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-L
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
Limit
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
Limit
<
0
)
goto
usage
;
break
;
case
'N'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-N
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
Reps
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
Reps
<
0
)
goto
usage
;
break
;
case
'U'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-U
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
UnseenUse
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
UnseenUse
<
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
;
}
RareUse
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
RareUse
<
0
)
goto
usage
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
Extra_CommandCfs
(
Limit
,
Reps
,
UnseenUse
,
RareUse
,
fVerbose
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &cfs [-LNURvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs simulation
\n
"
);
Abc_Print
(
-
2
,
"
\t
-L num : the limit on the number of occurrences [default = %d]
\n
"
,
Limit
);
Abc_Print
(
-
2
,
"
\t
-N num : the number of repetions of each pattern [default = %d]
\n
"
,
Reps
);
Abc_Print
(
-
2
,
"
\t
-U num : what to do with unseen patterns [default = %d]
\n
"
,
UnseenUse
);
Abc_Print
(
-
2
,
"
\t
-R num : what to do with rare patterns [default = %d]
\n
"
,
RareUse
);
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_CommandAbc9Test
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
// Gia_Man_t * pTemp = NULL;
src/misc/extra/extraUtilCfs.c
View file @
1779f545
...
...
@@ -37,6 +37,21 @@ ABC_NAMESPACE_IMPL_START
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Extra_CommandCfs
(
int
Limit
,
int
Reps
,
int
UnseenUse
,
int
RareUse
,
int
fVerbose
)
{
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/misc/extra/extraUtilGen.c
0 → 100644
View file @
1779f545
/**CFile****************************************************************
FileName [extraUtilGen.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [extra]
Synopsis [CF simulation.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: extraUtilGen.c,v 1.0 2003/02/01 00:00:00 alanmi Exp $]
***********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "aig/gia/gia.h"
#include "misc/vec/vecMem.h"
#include "misc/extra/extra.h"
#include "misc/util/utilTruth.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Extra_CommandGen
(
int
Algo
,
int
LutSize
,
int
nLuts
,
int
nLevels
,
int
fVerbose
)
{
return
NULL
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
src/misc/extra/extraUtilMacc.c
View file @
1779f545
...
...
@@ -49,6 +49,22 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
void
Macc_ConstMultSpecOne2
(
FILE
*
pFile
,
int
n
,
int
nBits
,
int
nWidth
)
{
int
nTotal
=
nWidth
+
nBits
;
int
Bound
=
1
<<
(
nBits
-
1
);
assert
(
-
Bound
<=
n
&&
n
<
Bound
);
fprintf
(
pFile
,
"// %d-bit multiplier-accumulator with constant %d generated by ABC on %s
\n
"
,
nTotal
,
n
,
Extra_TimeStamp
()
);
fprintf
(
pFile
,
"module mulacc%03d%s (
\n
"
,
Abc_AbsInt
(
n
),
n
<
0
?
"_neg"
:
"_pos"
);
fprintf
(
pFile
,
" input [%d:0] i,
\n
"
,
nTotal
-
1
);
fprintf
(
pFile
,
" input [%d:0] s,
\n
"
,
nTotal
-
1
);
fprintf
(
pFile
,
" output [%d:0] o
\n
"
,
nTotal
-
1
);
fprintf
(
pFile
,
");
\n
"
);
fprintf
(
pFile
,
" wire [%d:0] c = %d
\'
h%x;
\n
"
,
nTotal
-
1
,
nTotal
,
Abc_AbsInt
(
n
)
);
fprintf
(
pFile
,
" wire [%d:0] m = i * c;
\n
"
,
nTotal
-
1
);
fprintf
(
pFile
,
" assign o = s %c m;
\n
"
,
n
<
0
?
'-'
:
'+'
);
fprintf
(
pFile
,
"endmodule
\n\n
"
);
}
void
Macc_ConstMultSpecOne
(
FILE
*
pFile
,
int
n
,
int
nBits
,
int
nWidth
)
{
int
nTotal
=
nWidth
+
nBits
;
...
...
@@ -76,9 +92,9 @@ void Macc_ConstMultSpecTest()
FILE
*
pFile
;
for
(
i
=
-
Bound
;
i
<
Bound
;
i
++
)
{
sprintf
(
Buffer
,
"const_mul//
spec
%03d.v"
,
0xFF
&
i
);
sprintf
(
Buffer
,
"const_mul//
macc_spec_
%03d.v"
,
0xFF
&
i
);
pFile
=
fopen
(
Buffer
,
"wb"
);
Macc_ConstMultSpecOne
(
pFile
,
i
,
nBits
,
nWidth
);
Macc_ConstMultSpecOne
2
(
pFile
,
i
,
nBits
,
nWidth
);
fclose
(
pFile
);
}
}
...
...
@@ -272,6 +288,28 @@ void Macc_ConstMultGenMacc( FILE * pFile, unsigned * p, int n, int nBits, int nW
}
fprintf
(
pFile
,
"endmodule
\n\n
"
);
}
void
Macc_ConstMultGenMacc2
(
FILE
*
pFile
,
unsigned
*
p
,
int
n
,
int
nBits
,
int
nWidth
)
{
int
nTotal
=
nWidth
+
nBits
;
int
Bound
=
1
<<
(
nBits
-
1
);
char
Sign
=
n
<
0
?
'N'
:
'n'
;
assert
(
-
Bound
<=
n
&&
n
<
Bound
);
fprintf
(
pFile
,
"// %d-bit multiplier-accumulator by constant %d generated by ABC on %s
\n
"
,
nTotal
,
n
,
Extra_TimeStamp
()
);
fprintf
(
pFile
,
"module macc%03d%s (
\n
"
,
Abc_AbsInt
(
n
),
n
<
0
?
"_neg"
:
"_pos"
);
fprintf
(
pFile
,
" input [%d:0] i,
\n
"
,
nTotal
-
1
);
fprintf
(
pFile
,
" input [%d:0] s,
\n
"
,
nTotal
-
1
);
fprintf
(
pFile
,
" output [%d:0] o
\n
"
,
nTotal
-
1
);
fprintf
(
pFile
,
");
\n
"
);
if
(
n
==
0
)
fprintf
(
pFile
,
" assign o = s;
\n
"
);
else
{
fprintf
(
pFile
,
" wire [%d:0] n1 = i;
\n
"
,
nTotal
-
1
);
Macc_ConstMultGenOne_rec
(
pFile
,
p
,
n
,
nBits
,
nWidth
);
fprintf
(
pFile
,
" assign o = s + %c%d;
\n
"
,
Sign
,
Abc_AbsInt
(
n
)
);
}
fprintf
(
pFile
,
"endmodule
\n\n
"
);
}
void
Macc_ConstMultGenTest
()
{
int
nBits
=
8
;
...
...
@@ -285,7 +323,7 @@ void Macc_ConstMultGenTest()
{
sprintf
(
Buffer
,
"const_mul//macc%03d.v"
,
0xFF
&
i
);
pFile
=
fopen
(
Buffer
,
"wb"
);
Macc_ConstMultGenMacc
(
pFile
,
p
,
i
,
nBits
,
nWidth
);
Macc_ConstMultGenMacc
2
(
pFile
,
p
,
i
,
nBits
,
nWidth
);
fclose
(
pFile
);
}
ABC_FREE
(
p
);
...
...
src/misc/extra/module.make
View file @
1779f545
...
...
@@ -5,6 +5,7 @@ SRC += src/misc/extra/extraUtilBitMatrix.c \
src/misc/extra/extraUtilDsd.c
\
src/misc/extra/extraUtilEnum.c
\
src/misc/extra/extraUtilFile.c
\
src/misc/extra/extraUtilGen.c
\
src/misc/extra/extraUtilMacc.c
\
src/misc/extra/extraUtilMaj.c
\
src/misc/extra/extraUtilMemory.c
\
...
...
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