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
14d985a8
Unverified
Commit
14d985a8
authored
Oct 18, 2018
by
alanminko
Committed by
GitHub
Oct 18, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13 from hriener/exorcism
exorcism.
parents
18943f64
95523936
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
21 deletions
+133
-21
src/base/abci/abc.c
+69
-21
src/base/exor/exor.c
+64
-0
No files found.
src/base/abci/abc.c
View file @
14d985a8
...
@@ -43576,10 +43576,16 @@ usage:
...
@@ -43576,10 +43576,16 @@ usage:
int
Abc_CommandAbc9Exorcism
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandAbc9Exorcism
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
extern
int
Abc_ExorcismMain
(
Vec_Wec_t
*
vEsop
,
int
nIns
,
int
nOuts
,
char
*
pFileNameOut
,
int
Quality
,
int
Verbosity
,
int
nCubesMax
,
int
fUseQCost
);
extern
int
Abc_ExorcismMain
(
Vec_Wec_t
*
vEsop
,
int
nIns
,
int
nOuts
,
char
*
pFileNameOut
,
int
Quality
,
int
Verbosity
,
int
nCubesMax
,
int
fUseQCost
);
extern
Vec_Wec_t
*
Abc_ExorcismNtk2Esop
(
Abc_Ntk_t
*
pNtk
);
extern
Gia_Man_t
*
Eso_ManCompute
(
Gia_Man_t
*
pGia
,
int
fVerbose
,
Vec_Wec_t
**
pvRes
);
extern
Gia_Man_t
*
Eso_ManCompute
(
Gia_Man_t
*
pGia
,
int
fVerbose
,
Vec_Wec_t
**
pvRes
);
Vec_Wec_t
*
vEsop
=
NULL
;
Vec_Wec_t
*
vEsop
=
NULL
;
Abc_Ntk_t
*
pNtk
=
NULL
;
char
*
pFileNameIn
=
NULL
;
char
*
pFileNameOut
=
NULL
;
char
*
pFileNameOut
=
NULL
;
int
c
,
Quality
=
2
,
Verbosity
=
0
,
nCubesMax
=
20000
,
fUseQCost
=
0
,
fVerbose
=
0
;
int
c
,
Quality
=
2
,
Verbosity
=
0
,
nCubesMax
=
20000
,
fUseQCost
=
0
,
fVerbose
=
0
;
int
nInputs
,
nOutputs
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"QVCqvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"QVCqvh"
)
)
!=
EOF
)
{
{
...
@@ -43630,30 +43636,72 @@ int Abc_CommandAbc9Exorcism( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -43630,30 +43636,72 @@ int Abc_CommandAbc9Exorcism( Abc_Frame_t * pAbc, int argc, char ** argv )
goto
usage
;
goto
usage
;
}
}
}
}
if
(
pAbc
->
pGia
==
NULL
)
if
(
argc
==
globalUtilOptind
+
2
)
{
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9Exorcism(): There is no AIG.
\n
"
)
;
pFileNameIn
=
argv
[
globalUtilOptind
]
;
return
0
;
pFileNameOut
=
argv
[
globalUtilOptind
+
1
]
;
}
}
// get the output file name
else
if
(
argc
==
globalUtilOptind
+
1
)
if
(
argc
==
globalUtilOptind
+
1
)
{
pFileNameOut
=
argv
[
globalUtilOptind
];
pFileNameOut
=
argv
[
globalUtilOptind
];
// generate starting cover and run minimization
}
Eso_ManCompute
(
pAbc
->
pGia
,
fVerbose
,
&
vEsop
);
else
Abc_ExorcismMain
(
vEsop
,
Gia_ManCiNum
(
pAbc
->
pGia
),
Gia_ManCoNum
(
pAbc
->
pGia
),
pFileNameOut
,
Quality
,
Verbosity
,
nCubesMax
,
fUseQCost
);
{
Vec_WecFree
(
vEsop
);
Abc_Print
(
-
1
,
"Abc_CommandAbc9Exorcism(): Argument error.
\n
"
);
return
0
;
goto
usage
;
}
usage:
Abc_Print
(
-
2
,
"usage: &exorcism [-Q N] [-V N] [-C N] -q <file>
\n
"
);
if
(
pAbc
->
pGia
==
NULL
&&
pFileNameIn
==
NULL
)
Abc_Print
(
-
2
,
" performs heuristic exclusive sum-of-project minimization
\n
"
);
{
Abc_Print
(
-
2
,
" -Q N : minimization quality [default = %d]
\n
"
,
Quality
);
Abc_Print
(
-
1
,
"Abc_CommandAbc9Exorcism(): There is neither an AIG nor an ESOP-PLA file.
\n
"
);
Abc_Print
(
-
2
,
" increasing this number improves quality and adds to runtime
\n
"
);
return
0
;
Abc_Print
(
-
2
,
" -V N : verbosity level [default = %d]
\n
"
,
Verbosity
);
}
Abc_Print
(
-
2
,
" 0 = no output; 1 = outline; 2 = verbose
\n
"
);
Abc_Print
(
-
2
,
" -C N : maximum number of cubes in startign cover [default = %d]
\n
"
,
nCubesMax
);
if
(
pFileNameIn
)
Abc_Print
(
-
2
,
" -q : toggle using quantum cost [default = %s]
\n
"
,
fUseQCost
?
"yes"
:
"no"
);
{
Abc_Print
(
-
2
,
" <file>: the output file name in ESOP-PLA format
\n
"
);
pNtk
=
Io_ReadPla
(
pFileNameIn
,
0
,
0
,
0
,
/* no preprocessing = */
1
,
/* check = */
1
);
if
(
pNtk
==
NULL
)
{
printf
(
"Reading PLA file has failed.
\n
"
);
return
1
;
}
nInputs
=
Abc_NtkCiNum
(
pNtk
);
nOutputs
=
Abc_NtkCoNum
(
pNtk
);
vEsop
=
Abc_ExorcismNtk2Esop
(
pNtk
);
if
(
vEsop
==
NULL
)
{
printf
(
"Converting PLA to ESOP failed.
\n
"
);
return
1
;
}
}
else
if
(
pAbc
->
pGia
)
{
// generate starting cover
nInputs
=
Gia_ManCiNum
(
pAbc
->
pGia
);
nOutputs
=
Gia_ManCoNum
(
pAbc
->
pGia
);
Eso_ManCompute
(
pAbc
->
pGia
,
fVerbose
,
&
vEsop
);
}
if
(
vEsop
)
{
// run minimization
Abc_ExorcismMain
(
vEsop
,
nInputs
,
nOutputs
,
pFileNameOut
,
Quality
,
Verbosity
,
nCubesMax
,
fUseQCost
);
Vec_WecFree
(
vEsop
);
}
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &exorcism [-Q N] [-V N] [-C N] -q [file_in] <file_out>
\n
"
);
Abc_Print
(
-
2
,
" performs heuristic exclusive sum-of-project minimization
\n
"
);
Abc_Print
(
-
2
,
" -Q N : minimization quality [default = %d]
\n
"
,
Quality
);
Abc_Print
(
-
2
,
" increasing this number improves quality and adds to runtime
\n
"
);
Abc_Print
(
-
2
,
" -V N : verbosity level [default = %d]
\n
"
,
Verbosity
);
Abc_Print
(
-
2
,
" 0 = no output; 1 = outline; 2 = verbose
\n
"
);
Abc_Print
(
-
2
,
" -C N : maximum number of cubes in startign cover [default = %d]
\n
"
,
nCubesMax
);
Abc_Print
(
-
2
,
" -q : toggle using quantum cost [default = %s]
\n
"
,
fUseQCost
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
" [file_in] : optional input file in ESOP-PLA format (otherwise current AIG is used)
\n
"
);
Abc_Print
(
-
2
,
" <file_out> : output file in ESOP-PLA format
\n
"
);
Abc_Print
(
-
2
,
"
\n
"
);
Abc_Print
(
-
2
,
"
\n
"
);
return
1
;
return
1
;
}
}
src/base/exor/exor.c
View file @
14d985a8
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
#include "exor.h"
#include "exor.h"
#include "base/abc/abc.h"
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
...
@@ -947,6 +948,69 @@ int Abc_ExorcismMain( Vec_Wec_t * vEsop, int nIns, int nOuts, char * pFileNameOu
...
@@ -947,6 +948,69 @@ int Abc_ExorcismMain( Vec_Wec_t * vEsop, int nIns, int nOuts, char * pFileNameOu
return
1
;
return
1
;
}
}
Vec_Wec_t
*
Abc_ExorcismNtk2Esop
(
Abc_Ntk_t
*
pNtk
)
{
Vec_Wec_t
*
vEsop
=
NULL
;
Abc_Obj_t
*
pNode
,
*
pFanin
,
*
pDriver
;
char
*
pCube
;
int
nIns
,
nOuts
,
nProducts
,
nFanins
,
i
,
k
;
nIns
=
Abc_NtkCiNum
(
pNtk
);
nOuts
=
Abc_NtkCoNum
(
pNtk
);
nProducts
=
0
;
Abc_NtkForEachCo
(
pNtk
,
pNode
,
i
)
{
pDriver
=
Abc_ObjFanin0Ntk
(
Abc_ObjFanin0
(
pNode
)
);
if
(
!
Abc_ObjIsNode
(
pDriver
)
)
{
nProducts
++
;
continue
;
}
if
(
Abc_NodeIsConst
(
pDriver
)
)
{
if
(
Abc_NodeIsConst1
(
pDriver
)
)
nProducts
++
;
continue
;
}
nProducts
+=
Abc_SopGetCubeNum
((
char
*
)
pDriver
->
pData
);
}
Abc_NtkForEachCi
(
pNtk
,
pNode
,
i
)
pNode
->
pCopy
=
(
Abc_Obj_t
*
)(
ABC_PTRUINT_T
)
i
;
vEsop
=
Vec_WecAlloc
(
nProducts
+
1
);
Abc_NtkForEachCo
(
pNtk
,
pNode
,
i
)
{
pDriver
=
Abc_ObjFanin0Ntk
(
Abc_ObjFanin0
(
pNode
)
);
if
(
Abc_NodeIsConst
(
pDriver
)
)
continue
;
nFanins
=
Abc_ObjFaninNum
(
pDriver
);
Abc_SopForEachCube
(
(
char
*
)
pDriver
->
pData
,
nFanins
,
pCube
)
{
Vec_Int_t
*
vCubeIn
=
Vec_WecPushLevel
(
vEsop
);
Vec_IntGrow
(
vCubeIn
,
nIns
+
2
);
Abc_ObjForEachFanin
(
pDriver
,
pFanin
,
k
)
{
pFanin
=
Abc_ObjFanin0Ntk
(
pFanin
);
assert
(
(
int
)(
ABC_PTRUINT_T
)
pFanin
->
pCopy
<
nIns
);
if
(
pCube
[
k
]
==
'0'
)
{
Vec_IntPush
(
vCubeIn
,
2
*
k
+
1
);
}
else
if
(
pCube
[
k
]
==
'1'
)
{
Vec_IntPush
(
vCubeIn
,
2
*
k
);
}
}
Vec_IntPush
(
vCubeIn
,
-
(
i
+
1
)
);
}
}
return
vEsop
;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
...
...
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