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
a0413c9a
Commit
a0413c9a
authored
Sep 27, 2018
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding command 'cof' to replace node by a constant.
parent
5528d1b1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
17 deletions
+112
-17
src/base/abc/abc.h
+1
-0
src/base/abc/abcFanio.c
+24
-0
src/base/abci/abc.c
+87
-17
No files found.
src/base/abc/abc.h
View file @
a0413c9a
...
@@ -657,6 +657,7 @@ extern ABC_DLL void Abc_ObjPatchFanoutFanin( Abc_Obj_t * pObj, int
...
@@ -657,6 +657,7 @@ extern ABC_DLL void Abc_ObjPatchFanoutFanin( Abc_Obj_t * pObj, int
extern
ABC_DLL
Abc_Obj_t
*
Abc_ObjInsertBetween
(
Abc_Obj_t
*
pNodeIn
,
Abc_Obj_t
*
pNodeOut
,
Abc_ObjType_t
Type
);
extern
ABC_DLL
Abc_Obj_t
*
Abc_ObjInsertBetween
(
Abc_Obj_t
*
pNodeIn
,
Abc_Obj_t
*
pNodeOut
,
Abc_ObjType_t
Type
);
extern
ABC_DLL
void
Abc_ObjTransferFanout
(
Abc_Obj_t
*
pObjOld
,
Abc_Obj_t
*
pObjNew
);
extern
ABC_DLL
void
Abc_ObjTransferFanout
(
Abc_Obj_t
*
pObjOld
,
Abc_Obj_t
*
pObjNew
);
extern
ABC_DLL
void
Abc_ObjReplace
(
Abc_Obj_t
*
pObjOld
,
Abc_Obj_t
*
pObjNew
);
extern
ABC_DLL
void
Abc_ObjReplace
(
Abc_Obj_t
*
pObjOld
,
Abc_Obj_t
*
pObjNew
);
extern
ABC_DLL
void
Abc_ObjReplaceByConstant
(
Abc_Obj_t
*
pNode
,
int
fConst1
);
extern
ABC_DLL
int
Abc_ObjFanoutFaninNum
(
Abc_Obj_t
*
pFanout
,
Abc_Obj_t
*
pFanin
);
extern
ABC_DLL
int
Abc_ObjFanoutFaninNum
(
Abc_Obj_t
*
pFanout
,
Abc_Obj_t
*
pFanin
);
/*=== abcFanOrder.c ==========================================================*/
/*=== abcFanOrder.c ==========================================================*/
extern
ABC_DLL
int
Abc_NtkMakeLegit
(
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
int
Abc_NtkMakeLegit
(
Abc_Ntk_t
*
pNtk
);
...
...
src/base/abc/abcFanio.c
View file @
a0413c9a
...
@@ -337,6 +337,30 @@ void Abc_ObjReplace( Abc_Obj_t * pNodeOld, Abc_Obj_t * pNodeNew )
...
@@ -337,6 +337,30 @@ void Abc_ObjReplace( Abc_Obj_t * pNodeOld, Abc_Obj_t * pNodeNew )
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Replaces a node by a constant.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_ObjReplaceByConstant
(
Abc_Obj_t
*
pNode
,
int
fConst1
)
{
Abc_Obj_t
*
pNodeNew
;
assert
(
Abc_NtkIsLogic
(
pNode
->
pNtk
)
);
assert
(
!
Abc_ObjIsCo
(
pNode
)
);
pNodeNew
=
fConst1
?
Abc_NtkCreateNodeConst1
(
pNode
->
pNtk
)
:
Abc_NtkCreateNodeConst0
(
pNode
->
pNtk
);
// transfer the fanouts to the old node
Abc_ObjTransferFanout
(
pNode
,
pNodeNew
);
// remove the old node
if
(
Abc_ObjIsNode
(
pNode
)
)
Abc_NtkDeleteObj_rec
(
pNode
,
1
);
}
/**Function*************************************************************
Synopsis [Returns the index of the fanin in the fanin list of the fanout.]
Synopsis [Returns the index of the fanin in the fanin list of the fanout.]
Description []
Description []
...
...
src/base/abci/abc.c
View file @
a0413c9a
...
@@ -186,6 +186,7 @@ static int Abc_CommandExtSeqDcs ( Abc_Frame_t * pAbc, int argc, cha
...
@@ -186,6 +186,7 @@ static int Abc_CommandExtSeqDcs ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandReach
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandReach
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandCone
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandCone
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandNode
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandNode
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandCof
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTopmost
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTopmost
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTopAnd
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTopAnd
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTrim
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTrim
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
@@ -880,8 +881,9 @@ void Abc_Init( Abc_Frame_t * pAbc )
...
@@ -880,8 +881,9 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"reach"
,
Abc_CommandReach
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"reach"
,
Abc_CommandReach
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"cone"
,
Abc_CommandCone
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"cone"
,
Abc_CommandCone
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"node"
,
Abc_CommandNode
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"node"
,
Abc_CommandNode
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"cof"
,
Abc_CommandCof
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"topmost"
,
Abc_CommandTopmost
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"topmost"
,
Abc_CommandTopmost
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"topand"
,
Abc_CommandTopAnd
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"topand"
,
Abc_CommandTopAnd
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"trim"
,
Abc_CommandTrim
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"trim"
,
Abc_CommandTrim
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"short_names"
,
Abc_CommandShortNames
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"short_names"
,
Abc_CommandShortNames
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"move_names"
,
Abc_CommandMoveNames
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"move_names"
,
Abc_CommandMoveNames
,
0
);
...
@@ -3089,21 +3091,18 @@ int Abc_CommandShowBdd( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -3089,21 +3091,18 @@ int Abc_CommandShowBdd( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
fGlobal
)
if
(
fGlobal
)
{
{
if
(
!
Abc_NtkIsStrash
(
pNtk
)
)
Abc_Ntk_t
*
pTemp
=
Abc_NtkIsStrash
(
pNtk
)
?
pNtk
:
Abc_NtkStrash
(
pNtk
,
0
,
0
,
0
);
{
Abc_NtkShowBdd
(
pTemp
);
Abc_Print
(
-
1
,
"Visualizing BDDs can only be done for AIGs (run
\"
strash
\"
).
\n
"
);
if
(
pTemp
!=
pNtk
)
return
1
;
Abc_NtkDelete
(
pTemp
)
;
}
return
0
;
}
}
else
if
(
!
Abc_NtkIsBddLogic
(
pNtk
)
)
{
{
if
(
!
Abc_NtkIsBddLogic
(
pNtk
)
)
Abc_Print
(
-
1
,
"Visualizing BDDs can only be done for logic BDD networks (run
\"
bdd
\"
).
\n
"
);
{
return
1
;
Abc_Print
(
-
1
,
"Visualizing BDDs can only be done for logic BDD networks (run
\"
bdd
\"
).
\n
"
);
return
1
;
}
}
}
if
(
argc
>
globalUtilOptind
+
1
)
if
(
argc
>
globalUtilOptind
+
1
)
{
{
Abc_Print
(
-
1
,
"Wrong number of auguments.
\n
"
);
Abc_Print
(
-
1
,
"Wrong number of auguments.
\n
"
);
...
@@ -3127,10 +3126,7 @@ int Abc_CommandShowBdd( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -3127,10 +3126,7 @@ int Abc_CommandShowBdd( Abc_Frame_t * pAbc, int argc, char ** argv )
return
1
;
return
1
;
}
}
}
}
if
(
fGlobal
)
Abc_NodeShowBdd
(
pNode
);
Abc_NtkShowBdd
(
pNtk
);
else
Abc_NodeShowBdd
(
pNode
);
return
0
;
return
0
;
usage:
usage:
...
@@ -11243,6 +11239,80 @@ usage:
...
@@ -11243,6 +11239,80 @@ usage:
return
1
;
return
1
;
}
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandCof
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Abc_Ntk_t
*
pNtk
;
Abc_Obj_t
*
pNode
;
int
c
,
Const
;
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
// set defaults
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"h"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pNtk
==
NULL
)
{
Abc_Print
(
-
1
,
"Empty network.
\n
"
);
return
1
;
}
if
(
!
Abc_NtkIsLogic
(
pNtk
)
)
{
Abc_Print
(
-
1
,
"Currently can only be applied to a logic network.
\n
"
);
return
1
;
}
if
(
argc
!=
globalUtilOptind
+
2
)
{
Abc_Print
(
-
1
,
"Wrong number of auguments.
\n
"
);
goto
usage
;
}
pNode
=
Abc_NtkFindNode
(
pNtk
,
argv
[
globalUtilOptind
]
);
if
(
pNode
==
NULL
)
{
Abc_Print
(
-
1
,
"Cannot find node
\"
%s
\"
.
\n
"
,
argv
[
globalUtilOptind
]
);
return
1
;
}
Const
=
atoi
(
argv
[
globalUtilOptind
+
1
]
);
if
(
Const
!=
0
&&
Const
!=
1
)
{
Abc_Print
(
-
1
,
"Constant should be 0 or 1.
\n
"
,
argv
[
globalUtilOptind
+
1
]
);
return
1
;
}
Abc_ObjReplaceByConstant
(
pNode
,
Const
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: cof [-h] <node> <const>
\n
"
);
Abc_Print
(
-
2
,
"
\t
replaces one node in a logic network by constant 0 or 1
\n
"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
Abc_Print
(
-
2
,
"
\t
<node> : the node to replace
\n
"
);
Abc_Print
(
-
2
,
"
\t
<const> : the constant to replace the node with
\n
"
);
Abc_Print
(
-
2
,
"
\t
name : the node name
\n
"
);
return
1
;
}
/**Function*************************************************************
/**Function*************************************************************
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