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
d35b0585
Commit
d35b0585
authored
May 18, 2021
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding command &extract.
parent
91a2eafc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
1 deletions
+84
-1
src/base/abci/abc.c
+68
-0
src/base/abci/abcExtract.c
+16
-1
No files found.
src/base/abci/abc.c
View file @
d35b0585
...
...
@@ -437,6 +437,7 @@ static int Abc_CommandAbc9Dsd ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandAbc9Bidec
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Shrink
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Fx
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Extract
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Balance
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9BalanceLut
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Resub
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -1163,6 +1164,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&bidec"
,
Abc_CommandAbc9Bidec
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&shrink"
,
Abc_CommandAbc9Shrink
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&fx"
,
Abc_CommandAbc9Fx
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&extract"
,
Abc_CommandAbc9Extract
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&b"
,
Abc_CommandAbc9Balance
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&blut"
,
Abc_CommandAbc9BalanceLut
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&resub"
,
Abc_CommandAbc9Resub
,
0
);
...
...
@@ -34938,6 +34940,72 @@ usage:
SeeAlso []
***********************************************************************/
int
Abc_CommandAbc9Extract
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
Gia_Man_t
*
Abc_NtkShareXorGia
(
Gia_Man_t
*
p
,
int
nMultiSize
,
int
fAnd
,
int
fVerbose
);
Gia_Man_t
*
pTemp
;
int
nMultiSize
=
3
;
int
c
,
fAnds
=
0
;
int
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Kavh"
))
!=
EOF
)
{
switch
(
c
)
{
case
'K'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-K
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nMultiSize
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nMultiSize
<
0
)
goto
usage
;
break
;
case
'a'
:
fAnds
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
break
;
default:
goto
usage
;
}
}
if
(
pAbc
->
pGia
==
NULL
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9Shrink(): There is no AIG.
\n
"
);
return
1
;
}
pTemp
=
Abc_NtkShareXorGia
(
pAbc
->
pGia
,
nMultiSize
,
fAnds
,
fVerbose
);
Abc_FrameUpdateGia
(
pAbc
,
pTemp
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &extract [-K <num>] [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
extract shared logic for XOR-rich circuits
\n
"
);
Abc_Print
(
-
2
,
"
\t
-K <num> : the minimum gate size to consider for extraction [default = %d]
\n
"
,
nMultiSize
);
Abc_Print
(
-
2
,
"
\t
-a : toogle extracting ANDs instead of XORs [default = %s]
\n
"
,
fAnds
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : print 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_CommandAbc9Balance
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Gia_Man_t
*
pTemp
=
NULL
;
src/base/abci/abcExtract.c
View file @
d35b0585
...
...
@@ -19,6 +19,7 @@
***********************************************************************/
#include "base/abc/abc.h"
#include "aig/gia/giaAig.h"
ABC_NAMESPACE_IMPL_START
...
...
@@ -741,7 +742,21 @@ Abc_Ntk_t * Abc_NtkShareXor( Abc_Ntk_t * pNtk, int nMultiSize, int fAnd, int fVe
Abc_ShaManStop
(
p
);
return
pNtkNew
;
}
Gia_Man_t
*
Abc_NtkShareXorGia
(
Gia_Man_t
*
p
,
int
nMultiSize
,
int
fAnd
,
int
fVerbose
)
{
extern
Aig_Man_t
*
Abc_NtkToDar
(
Abc_Ntk_t
*
pNtk
,
int
fExors
,
int
fRegisters
);
extern
Abc_Ntk_t
*
Abc_NtkFromAigPhase
(
Aig_Man_t
*
pMan
);
Aig_Man_t
*
pMan
=
Gia_ManToAig
(
p
,
0
);
Abc_Ntk_t
*
pNtk
=
Abc_NtkFromAigPhase
(
pMan
);
Abc_Ntk_t
*
pNtkNew
=
Abc_NtkShareXor
(
pNtk
,
nMultiSize
,
fAnd
,
fVerbose
);
Aig_Man_t
*
pAig
=
Abc_NtkToDar
(
pNtkNew
,
0
,
0
);
Gia_Man_t
*
pNew
=
Gia_ManFromAig
(
pAig
);
Abc_NtkDelete
(
pNtkNew
);
Abc_NtkDelete
(
pNtk
);
Aig_ManStop
(
pAig
);
Aig_ManStop
(
pMan
);
return
pNew
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
...
...
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