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
795b5a6c
Commit
795b5a6c
authored
Mar 11, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added command 'nodedup' to duplicate nodes with high fanout.
parent
2e97ffdd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
125 additions
and
0 deletions
+125
-0
src/base/abc/abcNtk.c
+44
-0
src/base/abci/abc.c
+81
-0
No files found.
src/base/abc/abcNtk.c
View file @
795b5a6c
...
@@ -1784,6 +1784,50 @@ void Abc_NtkUnpermute( Abc_Ntk_t * pNtk )
...
@@ -1784,6 +1784,50 @@ void Abc_NtkUnpermute( Abc_Ntk_t * pNtk )
Vec_IntFreeP
(
&
pNtk
->
vObjPerm
);
Vec_IntFreeP
(
&
pNtk
->
vObjPerm
);
}
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Ntk_t
*
Abc_NtkNodeDup
(
Abc_Ntk_t
*
pNtkInit
,
int
nLimit
,
int
fVerbose
)
{
Vec_Ptr_t
*
vNodes
,
*
vFanouts
;
Abc_Ntk_t
*
pNtk
;
Abc_Obj_t
*
pObj
,
*
pObjNew
,
*
pFanin
,
*
pFanout
;
int
i
,
k
;
pNtk
=
Abc_NtkDup
(
pNtkInit
);
vNodes
=
Vec_PtrAlloc
(
100
);
vFanouts
=
Vec_PtrAlloc
(
100
);
do
{
Vec_PtrClear
(
vNodes
);
Abc_NtkForEachNode
(
pNtk
,
pObj
,
i
)
if
(
Abc_ObjFanoutNum
(
pObj
)
>=
nLimit
)
Vec_PtrPush
(
vNodes
,
pObj
);
Vec_PtrForEachEntry
(
Abc_Obj_t
*
,
vNodes
,
pObj
,
i
)
{
pObjNew
=
Abc_NtkDupObj
(
pNtk
,
pObj
,
0
);
Abc_ObjForEachFanin
(
pObj
,
pFanin
,
k
)
Abc_ObjAddFanin
(
pObjNew
,
pFanin
);
Abc_NodeCollectFanouts
(
pObj
,
vFanouts
);
Vec_PtrShrink
(
vFanouts
,
nLimit
/
2
);
Vec_PtrForEachEntry
(
Abc_Obj_t
*
,
vFanouts
,
pFanout
,
k
)
Abc_ObjPatchFanin
(
pFanout
,
pObj
,
pObjNew
);
}
if
(
fVerbose
)
printf
(
"Duplicated %d nodes.
\n
"
,
Vec_PtrSize
(
vNodes
)
);
}
while
(
Vec_PtrSize
(
vNodes
)
>
0
);
Vec_PtrFree
(
vFanouts
);
Vec_PtrFree
(
vNodes
);
return
pNtk
;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
/// END OF FILE ///
...
...
src/base/abci/abc.c
View file @
795b5a6c
...
@@ -154,6 +154,7 @@ static int Abc_CommandDouble ( Abc_Frame_t * pAbc, int argc, cha
...
@@ -154,6 +154,7 @@ static int Abc_CommandDouble ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandInter
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandInter
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandBb2Wb
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandBb2Wb
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandOutdec
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandOutdec
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandNodeDup
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandQuaVar
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandQuaVar
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
@@ -596,6 +597,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
...
@@ -596,6 +597,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"inter"
,
Abc_CommandInter
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"inter"
,
Abc_CommandInter
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"bb2wb"
,
Abc_CommandBb2Wb
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"bb2wb"
,
Abc_CommandBb2Wb
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"outdec"
,
Abc_CommandOutdec
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"outdec"
,
Abc_CommandOutdec
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"nodedup"
,
Abc_CommandNodeDup
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"test"
,
Abc_CommandTest
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"test"
,
Abc_CommandTest
,
0
);
// Cmd_CommandAdd( pAbc, "Various", "qbf_solve", Abc_CommandTest, 0 );
// Cmd_CommandAdd( pAbc, "Various", "qbf_solve", Abc_CommandTest, 0 );
...
@@ -8720,6 +8722,82 @@ usage:
...
@@ -8720,6 +8722,82 @@ usage:
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Abc_CommandNodeDup
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
Abc_Ntk_t
*
Abc_NtkNodeDup
(
Abc_Ntk_t
*
pNtk
,
int
nLimit
,
int
fVerbose
);
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
Abc_Ntk_t
*
pNtkRes
;
int
c
,
nLimit
=
30
;
int
fVerbose
=
0
;
// set defaults
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Nvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'N'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-N
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nLimit
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pNtk
==
NULL
)
{
Abc_Print
(
-
1
,
"Empty network.
\n
"
);
return
1
;
}
if
(
Abc_NtkIsStrash
(
pNtk
)
)
{
Abc_Print
(
-
1
,
"Only works for logic networks.
\n
"
);
return
1
;
}
if
(
nLimit
<
2
)
{
Abc_Print
(
-
1
,
"The fanout limit should be more than 1.
\n
"
);
return
1
;
}
pNtkRes
=
Abc_NtkNodeDup
(
pNtk
,
nLimit
,
fVerbose
);
if
(
pNtkRes
==
NULL
)
{
Abc_Print
(
-
1
,
"Command has failed.
\n
"
);
return
0
;
}
Abc_FrameReplaceCurrentNetwork
(
pAbc
,
pNtkRes
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: nodedup [-Nvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
duplicates internal nodes with high fanout
\n
"
);
Abc_Print
(
-
2
,
"
\t
-N num : the number of fanouts to start duplication [default = %d]
\n
"
,
nLimit
);
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_CommandTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
...
@@ -8845,6 +8923,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -8845,6 +8923,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
extern
Abc_Ntk_t
*
Abc_NtkFromAigPhase
(
Aig_Man_t
*
pMan
);
extern
Abc_Ntk_t
*
Abc_NtkFromAigPhase
(
Aig_Man_t
*
pMan
);
extern
Vec_Vec_t
*
Saig_IsoDetectFast
(
Aig_Man_t
*
pAig
);
extern
Vec_Vec_t
*
Saig_IsoDetectFast
(
Aig_Man_t
*
pAig
);
extern
Aig_Man_t
*
Abc_NtkToDarBmc
(
Abc_Ntk_t
*
pNtk
,
Vec_Int_t
**
pvMap
);
extern
Aig_Man_t
*
Abc_NtkToDarBmc
(
Abc_Ntk_t
*
pNtk
,
Vec_Int_t
**
pvMap
);
extern
void
Abc2_NtkTestGia
(
char
*
pFileName
,
int
fVerbose
);
if
(
pNtk
)
if
(
pNtk
)
{
{
...
@@ -8858,6 +8937,8 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -8858,6 +8937,8 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
}
}
Aig_ManStop
(
pAig
);
Aig_ManStop
(
pAig
);
}
}
// Abc2_NtkTestGia( "", 1 );
}
}
return
0
;
return
0
;
...
...
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