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
7d82819d
Commit
7d82819d
authored
Jan 26, 2017
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding visualization of word-level networks Wlc_Ntk_t.
parent
3c8c807a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
287 additions
and
8 deletions
+287
-8
abclib.dsp
+4
-0
src/base/wlc/module.make
+1
-0
src/base/wlc/wlc.h
+11
-1
src/base/wlc/wlcAbs.c
+2
-2
src/base/wlc/wlcCom.c
+116
-0
src/base/wlc/wlcNtk.c
+152
-4
src/base/wlc/wlcReadVer.c
+1
-1
src/base/wlc/wlcShow.c
+0
-0
No files found.
abclib.dsp
View file @
7d82819d
...
...
@@ -799,6 +799,10 @@ SOURCE=.\src\base\wlc\wlcReadVer.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wlc\wlcShow.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wlc\wlcSim.c
# End Source File
# Begin Source File
...
...
src/base/wlc/module.make
View file @
7d82819d
...
...
@@ -7,6 +7,7 @@ SRC += src/base/wlc/wlcAbs.c \
src/base/wlc/wlcReadSmt.c
\
src/base/wlc/wlcReadVer.c
\
src/base/wlc/wlcSim.c
\
src/base/wlc/wlcShow.c
\
src/base/wlc/wlcStdin.c
\
src/base/wlc/wlcWin.c
\
src/base/wlc/wlcWriteVer.c
src/base/wlc/wlc.h
View file @
7d82819d
...
...
@@ -157,6 +157,7 @@ struct Wlc_Ntk_t_
Vec_Int_t
vTravIds
;
// trav IDs of the objects
Vec_Int_t
vCopies
;
// object first bits
Vec_Int_t
vBits
;
// object mapping into AIG nodes
Vec_Int_t
vLevels
;
// object levels
};
static
inline
int
Wlc_NtkObjNum
(
Wlc_Ntk_t
*
p
)
{
return
p
->
iObj
-
1
;
}
...
...
@@ -206,6 +207,8 @@ static inline int Wlc_ObjSign( Wlc_Obj_t * p )
static
inline
int
*
Wlc_ObjConstValue
(
Wlc_Obj_t
*
p
)
{
assert
(
p
->
Type
==
WLC_OBJ_CONST
);
return
Wlc_ObjFanins
(
p
);
}
static
inline
int
Wlc_ObjTableId
(
Wlc_Obj_t
*
p
)
{
assert
(
p
->
Type
==
WLC_OBJ_TABLE
);
return
p
->
Fanins
[
1
];
}
static
inline
word
*
Wlc_ObjTable
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
)
{
return
(
word
*
)
Vec_PtrEntry
(
p
->
vTables
,
Wlc_ObjTableId
(
pObj
)
);
}
static
inline
int
Wlc_ObjLevelId
(
Wlc_Ntk_t
*
p
,
int
iObj
)
{
return
Vec_IntEntry
(
&
p
->
vLevels
,
iObj
);
}
static
inline
int
Wlc_ObjLevel
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
)
{
return
Wlc_ObjLevelId
(
p
,
Wlc_ObjId
(
p
,
pObj
)
);
}
static
inline
void
Wlc_NtkCleanCopy
(
Wlc_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vCopies
,
p
->
nObjsAlloc
,
0
);
}
static
inline
int
Wlc_NtkHasCopy
(
Wlc_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vCopies
)
>
0
;
}
...
...
@@ -230,6 +233,8 @@ static inline Wlc_Obj_t * Wlc_ObjFoToFi( Wlc_Ntk_t * p, Wlc_Obj_t * pObj )
#define Wlc_NtkForEachObj( p, pObj, i ) \
for ( i = 1; (i < Wlc_NtkObjNumMax(p)) && (((pObj) = Wlc_NtkObj(p, i)), 1); i++ )
#define Wlc_NtkForEachObjReverse( p, pObj, i ) \
for ( i = Wlc_NtkObjNumMax(p) - 1; (i > 0) && (((pObj) = Wlc_NtkObj(p, i)), 1); i-- )
#define Wlc_NtkForEachObjVec( vVec, p, pObj, i ) \
for ( i = 0; (i < Vec_IntSize(vVec)) && (((pObj) = Wlc_NtkObj(p, Vec_IntEntry(vVec, i))), 1); i++ )
#define Wlc_NtkForEachPi( p, pPi, i ) \
...
...
@@ -266,6 +271,7 @@ extern Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int i
/*=== wlcCom.c ========================================================*/
extern
void
Wlc_SetNtk
(
Abc_Frame_t
*
pAbc
,
Wlc_Ntk_t
*
pNtk
);
/*=== wlcNtk.c ========================================================*/
extern
char
*
Wlc_ObjTypeName
(
Wlc_Obj_t
*
p
);
extern
Wlc_Ntk_t
*
Wlc_NtkAlloc
(
char
*
pName
,
int
nObjsAlloc
);
extern
int
Wlc_ObjAlloc
(
Wlc_Ntk_t
*
p
,
int
Type
,
int
Signed
,
int
End
,
int
Beg
);
extern
int
Wlc_ObjCreate
(
Wlc_Ntk_t
*
p
,
int
Type
,
int
Signed
,
int
End
,
int
Beg
,
Vec_Int_t
*
vFanins
);
...
...
@@ -275,12 +281,16 @@ extern char * Wlc_ObjName( Wlc_Ntk_t * p, int iObj );
extern
void
Wlc_ObjUpdateType
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
,
int
Type
);
extern
void
Wlc_ObjAddFanins
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
,
Vec_Int_t
*
vFanins
);
extern
void
Wlc_NtkFree
(
Wlc_Ntk_t
*
p
);
extern
int
Wlc_NtkCreateLevels
(
Wlc_Ntk_t
*
p
);
extern
int
Wlc_NtkCreateLevelsRev
(
Wlc_Ntk_t
*
p
);
extern
void
Wlc_NtkPrintNode
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
);
extern
void
Wlc_NtkPrintNodeArray
(
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vArray
);
extern
void
Wlc_NtkPrintNodes
(
Wlc_Ntk_t
*
p
,
int
Type
);
extern
void
Wlc_NtkPrintStats
(
Wlc_Ntk_t
*
p
,
int
fDistrib
,
int
fVerbose
);
extern
Wlc_Ntk_t
*
Wlc_NtkDupDfs
(
Wlc_Ntk_t
*
p
);
extern
Wlc_Ntk_t
*
Wlc_NtkDupDfs
(
Wlc_Ntk_t
*
p
,
int
fMarked
);
extern
void
Wlc_NtkTransferNames
(
Wlc_Ntk_t
*
pNew
,
Wlc_Ntk_t
*
p
);
extern
void
Wlc_NtkCleanMarks
(
Wlc_Ntk_t
*
p
);
extern
void
Wlc_NtkMarkCone
(
Wlc_Ntk_t
*
p
,
int
iPo
);
extern
Wlc_Ntk_t
*
Wlc_NtkDupSingleNodes
(
Wlc_Ntk_t
*
p
);
/*=== wlcReadSmt.c ========================================================*/
extern
Wlc_Ntk_t
*
Wlc_ReadSmtBuffer
(
char
*
pFileName
,
char
*
pBuffer
,
char
*
pLimit
,
int
fOldParser
,
int
fPrintTree
);
...
...
src/base/wlc/wlcAbs.c
View file @
7d82819d
...
...
@@ -173,7 +173,7 @@ Wlc_Ntk_t * Wlc_NtkAbstractNodes( Wlc_Ntk_t * p, Vec_Int_t * vNodesInit )
if
(
vNodes
!=
vNodesInit
)
Vec_IntFree
(
vNodes
);
// reconstruct topological order
pNew
=
Wlc_NtkDupDfs
(
p
);
pNew
=
Wlc_NtkDupDfs
(
p
,
0
);
Wlc_NtkTransferNames
(
pNew
,
p
);
return
pNew
;
}
...
...
@@ -278,7 +278,7 @@ Wlc_Ntk_t * Wlc_NtkUifNodePairs( Wlc_Ntk_t * p, Vec_Int_t * vPairsInit )
if
(
vPairs
!=
vPairsInit
)
Vec_IntFree
(
vPairs
);
// reconstruct topological order
pNew
=
Wlc_NtkDupDfs
(
p
);
pNew
=
Wlc_NtkDupDfs
(
p
,
0
);
Wlc_NtkTransferNames
(
pNew
,
p
);
return
pNew
;
}
...
...
src/base/wlc/wlcCom.c
View file @
7d82819d
...
...
@@ -31,8 +31,10 @@ ABC_NAMESPACE_IMPL_START
static
int
Abc_CommandReadWlc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandWriteWlc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandPs
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandCone
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandBlast
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandProfile
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandShow
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandInvPs
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -68,8 +70,10 @@ void Wlc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%read"
,
Abc_CommandReadWlc
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%write"
,
Abc_CommandWriteWlc
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%ps"
,
Abc_CommandPs
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%cone"
,
Abc_CommandCone
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%blast"
,
Abc_CommandBlast
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%profile"
,
Abc_CommandProfile
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%show"
,
Abc_CommandShow
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%test"
,
Abc_CommandTest
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"inv_ps"
,
Abc_CommandInvPs
,
0
);
...
...
@@ -343,6 +347,70 @@ usage:
SeeAlso []
******************************************************************************/
int
Abc_CommandCone
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Wlc_Ntk_t
*
pNtk
=
Wlc_AbcGetNtk
(
pAbc
);
int
c
,
iOutput
=
-
1
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Ovh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'O'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-O
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
iOutput
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
iOutput
<
0
)
goto
usage
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pNtk
==
NULL
)
{
Abc_Print
(
1
,
"Abc_CommandCone(): There is no current design.
\n
"
);
return
0
;
}
if
(
iOutput
<
0
||
iOutput
>=
Wlc_NtkPoNum
(
pNtk
)
)
{
Abc_Print
(
1
,
"Abc_CommandCone(): Illegal output index (%d) (should be 0 <= num < %d).
\n
"
,
iOutput
,
Wlc_NtkPoNum
(
pNtk
)
);
return
0
;
}
printf
(
"Extracting output %d.
\n
"
,
iOutput
);
Wlc_NtkMarkCone
(
pNtk
,
iOutput
);
pNtk
=
Wlc_NtkDupDfs
(
pNtk
,
1
);
Wlc_AbcUpdateNtk
(
pAbc
,
pNtk
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: %%cone [-O num] [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
extracts cone of the given word-level output
\n
"
);
Abc_Print
(
-
2
,
"
\t
-O num : zero-based index of the word-level output to extract [default = %d]
\n
"
,
iOutput
);
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_CommandBlast
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Wlc_Ntk_t
*
pNtk
=
Wlc_AbcGetNtk
(
pAbc
);
...
...
@@ -481,6 +549,54 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandShow
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
void
Wlc_NtkShow
(
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vBold
);
Wlc_Ntk_t
*
pNtk
=
Wlc_AbcGetNtk
(
pAbc
);
int
c
,
fVerbose
=
0
;
// set defaults
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"vh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'v'
:
fVerbose
^=
1
;
break
;
default:
goto
usage
;
}
}
if
(
pNtk
==
NULL
)
{
Abc_Print
(
-
1
,
"Empty network.
\n
"
);
return
1
;
}
Wlc_NtkShow
(
pNtk
,
NULL
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: %%show [-h]
\n
"
);
Abc_Print
(
-
2
,
" visualizes the network structure using DOT and GSVIEW
\n
"
);
#ifdef WIN32
Abc_Print
(
-
2
,
"
\"
dot.exe
\"
and
\"
gsview32.exe
\"
should be set in the paths
\n
"
);
Abc_Print
(
-
2
,
" (
\"
gsview32.exe
\"
may be in
\"
C:
\\
Program Files
\\
Ghostgum
\\
gsview
\\\"
)
\n
"
);
#endif
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function********************************************************************
Synopsis []
...
...
src/base/wlc/wlcNtk.c
View file @
7d82819d
...
...
@@ -88,6 +88,8 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
NULL
// 54: unused
};
char
*
Wlc_ObjTypeName
(
Wlc_Obj_t
*
p
)
{
return
Wlc_Names
[
p
->
Type
];
}
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
...
...
@@ -224,6 +226,7 @@ void Wlc_NtkFree( Wlc_Ntk_t * p )
ABC_FREE
(
p
->
vValues
.
pArray
);
ABC_FREE
(
p
->
vCopies
.
pArray
);
ABC_FREE
(
p
->
vBits
.
pArray
);
ABC_FREE
(
p
->
vLevels
.
pArray
);
ABC_FREE
(
p
->
pInits
);
ABC_FREE
(
p
->
pObjs
);
ABC_FREE
(
p
->
pName
);
...
...
@@ -246,6 +249,81 @@ int Wlc_NtkMemUsage( Wlc_Ntk_t * p )
/**Function*************************************************************
Synopsis [Assigns object levels.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Wlc_NtkCreateLevels
(
Wlc_Ntk_t
*
p
)
{
Wlc_Obj_t
*
pObj
;
int
i
,
k
,
iFanin
,
Level
,
LevelMax
=
0
;
Vec_IntFill
(
&
p
->
vLevels
,
Wlc_NtkObjNumMax
(
p
),
0
);
Wlc_NtkForEachObj
(
p
,
pObj
,
i
)
{
Level
=
0
;
Wlc_ObjForEachFanin
(
pObj
,
iFanin
,
k
)
Level
=
Abc_MaxInt
(
Level
,
Wlc_ObjLevelId
(
p
,
iFanin
)
+
1
);
Vec_IntWriteEntry
(
&
p
->
vLevels
,
i
,
Level
);
LevelMax
=
Abc_MaxInt
(
LevelMax
,
Level
);
}
return
LevelMax
;
}
int
Wlc_NtkCreateLevelsRev
(
Wlc_Ntk_t
*
p
)
{
Wlc_Obj_t
*
pObj
;
int
i
,
k
,
iFanin
,
Level
,
LevelMax
=
0
;
Vec_IntFill
(
&
p
->
vLevels
,
Wlc_NtkObjNumMax
(
p
),
0
);
Wlc_NtkForEachObjReverse
(
p
,
pObj
,
i
)
{
if
(
Wlc_ObjIsCi
(
pObj
)
)
continue
;
Level
=
Wlc_ObjLevel
(
p
,
pObj
)
+
1
;
Wlc_ObjForEachFanin
(
pObj
,
iFanin
,
k
)
Vec_IntUpdateEntry
(
&
p
->
vLevels
,
iFanin
,
Level
);
LevelMax
=
Abc_MaxInt
(
LevelMax
,
Level
);
}
// reverse the values
Wlc_NtkForEachObj
(
p
,
pObj
,
i
)
Vec_IntWriteEntry
(
&
p
->
vLevels
,
i
,
LevelMax
-
Wlc_ObjLevelId
(
p
,
i
)
);
Wlc_NtkForEachCi
(
p
,
pObj
,
i
)
Vec_IntWriteEntry
(
&
p
->
vLevels
,
Wlc_ObjId
(
p
,
pObj
),
0
);
return
LevelMax
;
}
/**Function*************************************************************
Synopsis [Collects statistics for each side of the miter.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Wlc_NtkCollectStats
(
Wlc_Ntk_t
*
p
,
int
nObjs
[
2
][
WLC_OBJ_NUMBER
]
)
{
Wlc_Obj_t
*
pObj
;
int
n
,
i
;
if
(
Wlc_NtkPoNum
(
p
)
!=
2
)
return
;
for
(
n
=
0
;
n
<
2
;
n
++
)
{
Wlc_NtkMarkCone
(
p
,
n
);
Wlc_NtkForEachObj
(
p
,
pObj
,
i
)
if
(
pObj
->
Mark
)
nObjs
[
n
][
pObj
->
Type
]
++
;
}
Wlc_NtkCleanMarks
(
p
);
}
/**Function*************************************************************
Synopsis [Prints distribution of operator types.]
Description []
...
...
@@ -300,11 +378,13 @@ void Wlc_NtkPrintDistribSortOne( Vec_Ptr_t * vTypes, Vec_Ptr_t * vOccurs, int Ty
}
void
Wlc_NtkPrintDistrib
(
Wlc_Ntk_t
*
p
,
int
fVerbose
)
{
int
nObjs
[
2
][
WLC_OBJ_NUMBER
]
=
{{
0
}};
// counter of objects of each type
Wlc_Obj_t
*
pObj
,
*
pObjRange
=
NULL
;
int
nCountRange
=
0
;
Vec_Ptr_t
*
vTypes
,
*
vOccurs
;
Vec_Int_t
*
vAnds
=
Vec_IntStart
(
WLC_OBJ_NUMBER
);
word
Sign
;
int
i
,
k
,
s
,
s0
,
s1
;
Wlc_NtkCollectStats
(
p
,
nObjs
);
// allocate statistics arrays
vTypes
=
Vec_PtrStart
(
WLC_OBJ_NUMBER
);
vOccurs
=
Vec_PtrStart
(
WLC_OBJ_NUMBER
);
...
...
@@ -435,28 +515,40 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose )
else
if
(
pObj
->
Type
==
WLC_OBJ_ARI_SQUARE
)
Vec_IntAddToEntry
(
vAnds
,
WLC_OBJ_ARI_SQUARE
,
5
*
Wlc_ObjRange
(
Wlc_ObjFanin0
(
p
,
pObj
))
*
Wlc_ObjRange
(
Wlc_ObjFanin1
(
p
,
pObj
))
);
}
if
(
nCountRange
)
if
(
nCountRange
&&
Vec_IntSize
(
&
p
->
vNameIds
)
>
0
)
{
printf
(
"Warning: %d objects of the design have non-zero-based ranges.
\n
"
,
nCountRange
);
printf
(
"In particular, object %6d with name
\"
%s
\"
has range %d=[%d:%d]
\n
"
,
Wlc_ObjId
(
p
,
pObjRange
),
Abc_NamStr
(
p
->
pManName
,
Wlc_ObjNameId
(
p
,
Wlc_ObjId
(
p
,
pObjRange
))),
Wlc_ObjRange
(
pObjRange
),
pObjRange
->
End
,
pObjRange
->
Beg
);
}
// print by occurrence
printf
(
"ID : name occurrence
and2 (occurrence)<output_range>=<input_range>.<input_range> ...
\n
"
);
printf
(
"ID : name occurrence
%s and2 (occurrence)<output_range>=<input_range>.<input_range> ...
\n
"
,
Wlc_NtkPoNum
(
p
)
==
2
?
" Left Share Right"
:
"
"
);
for
(
i
=
0
;
i
<
WLC_OBJ_NUMBER
;
i
++
)
{
Vec_Wrd_t
*
vType
=
(
Vec_Wrd_t
*
)
Vec_PtrEntry
(
vTypes
,
i
);
Vec_Wrd_t
*
vOccur
=
(
Vec_Wrd_t
*
)
Vec_PtrEntry
(
vOccurs
,
i
);
if
(
p
->
nObjs
[
i
]
==
0
)
continue
;
printf
(
"%2d : %-8s %6d%8d "
,
i
,
Wlc_Names
[
i
],
p
->
nObjs
[
i
],
Vec_IntEntry
(
vAnds
,
i
)
);
printf
(
"%2d : %-8s %6d"
,
i
,
Wlc_Names
[
i
],
p
->
nObjs
[
i
]
);
if
(
Wlc_NtkPoNum
(
p
)
==
2
)
{
printf
(
" "
);
printf
(
"%6d"
,
nObjs
[
0
][
i
]
);
printf
(
"%6d"
,
nObjs
[
0
][
i
]
+
nObjs
[
1
][
i
]
-
p
->
nObjs
[
i
]
);
printf
(
"%6d"
,
nObjs
[
1
][
i
]
);
}
printf
(
"%8d "
,
Vec_IntEntry
(
vAnds
,
i
)
);
// sort by occurence
Wlc_NtkPrintDistribSortOne
(
vTypes
,
vOccurs
,
i
);
Vec_WrdForEachEntry
(
vType
,
Sign
,
k
)
{
Wlc_NtkPrintDistribFromSign
(
Sign
,
&
s
,
&
s0
,
&
s1
);
if
(
((
k
%
6
)
==
5
&&
s1
)
||
((
k
%
8
)
==
7
&&
!
s1
)
)
{
printf
(
"
\n
"
);
if
(
Wlc_NtkPoNum
(
p
)
==
2
)
printf
(
" "
);
}
printf
(
"(%d)"
,
(
int
)
Vec_WrdEntry
(
vOccur
,
k
)
);
printf
(
"%s%d"
,
Abc_LitIsCompl
(
s
)
?
"-"
:
""
,
Abc_Lit2Var
(
s
)
);
if
(
s0
)
...
...
@@ -623,7 +715,7 @@ void Wlc_NtkDupDfs_rec( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p, int iObj, Vec_Int_t * v
Wlc_NtkDupDfs_rec
(
pNew
,
p
,
iFanin
,
vFanins
);
Wlc_ObjDup
(
pNew
,
p
,
iObj
,
vFanins
);
}
Wlc_Ntk_t
*
Wlc_NtkDupDfs
(
Wlc_Ntk_t
*
p
)
Wlc_Ntk_t
*
Wlc_NtkDupDfs
(
Wlc_Ntk_t
*
p
,
int
fMarked
)
{
Wlc_Ntk_t
*
pNew
;
Wlc_Obj_t
*
pObj
;
...
...
@@ -634,10 +726,13 @@ Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p )
pNew
=
Wlc_NtkAlloc
(
p
->
pName
,
p
->
nObjsAlloc
);
pNew
->
fSmtLib
=
p
->
fSmtLib
;
Wlc_NtkForEachCi
(
p
,
pObj
,
i
)
if
(
!
fMarked
||
pObj
->
Mark
)
Wlc_ObjDup
(
pNew
,
p
,
Wlc_ObjId
(
p
,
pObj
),
vFanins
);
Wlc_NtkForEachCo
(
p
,
pObj
,
i
)
if
(
!
fMarked
||
pObj
->
Mark
)
Wlc_NtkDupDfs_rec
(
pNew
,
p
,
Wlc_ObjId
(
p
,
pObj
),
vFanins
);
Wlc_NtkForEachCo
(
p
,
pObj
,
i
)
if
(
!
fMarked
||
pObj
->
Mark
)
Wlc_ObjSetCo
(
pNew
,
Wlc_ObjCopyObj
(
pNew
,
p
,
pObj
),
pObj
->
fIsFi
);
if
(
p
->
vInits
)
pNew
->
vInits
=
Vec_IntDup
(
p
->
vInits
);
...
...
@@ -668,6 +763,59 @@ void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p )
/**Function*************************************************************
Synopsis [Select the cone of the given output.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Wlc_NtkCleanMarks
(
Wlc_Ntk_t
*
p
)
{
Wlc_Obj_t
*
pObj
;
int
i
;
Wlc_NtkForEachObj
(
p
,
pObj
,
i
)
pObj
->
Mark
=
0
;
}
void
Wlc_NtkMarkCone_rec
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
,
Vec_Int_t
*
vFlops
)
{
int
i
,
iFanin
;
if
(
pObj
->
Mark
)
return
;
pObj
->
Mark
=
1
;
if
(
Wlc_ObjIsCi
(
pObj
)
)
{
if
(
!
Wlc_ObjIsPi
(
pObj
)
)
Vec_IntPush
(
vFlops
,
Wlc_ObjCiId
(
pObj
)
);
return
;
}
Wlc_ObjForEachFanin
(
pObj
,
iFanin
,
i
)
Wlc_NtkMarkCone_rec
(
p
,
Wlc_NtkObj
(
p
,
iFanin
),
vFlops
);
}
void
Wlc_NtkMarkCone
(
Wlc_Ntk_t
*
p
,
int
iPo
)
{
Vec_Int_t
*
vFlops
;
Wlc_Obj_t
*
pObj
;
int
i
,
CiId
,
CoId
;
Wlc_NtkCleanMarks
(
p
);
Wlc_NtkForEachPi
(
p
,
pObj
,
i
)
pObj
->
Mark
=
1
;
vFlops
=
Vec_IntAlloc
(
100
);
Wlc_NtkForEachPo
(
p
,
pObj
,
i
)
if
(
i
==
iPo
)
Wlc_NtkMarkCone_rec
(
p
,
pObj
,
vFlops
);
Vec_IntForEachEntry
(
vFlops
,
CiId
,
i
)
{
CoId
=
Wlc_NtkPoNum
(
p
)
+
CiId
-
Wlc_NtkPiNum
(
p
);
Wlc_NtkMarkCone_rec
(
p
,
Wlc_NtkCo
(
p
,
CoId
),
vFlops
);
}
Vec_IntFree
(
vFlops
);
}
/**Function*************************************************************
Synopsis [Duplicates the network by copying each node.]
Description []
...
...
src/base/wlc/wlcReadVer.c
View file @
7d82819d
...
...
@@ -1265,7 +1265,7 @@ Wlc_Ntk_t * Wlc_ReadVer( char * pFileName, char * pStr )
if
(
!
Wlc_PrsDerive
(
p
)
)
goto
finish
;
// derive topological order
pNtk
=
Wlc_NtkDupDfs
(
p
->
pNtk
);
pNtk
=
Wlc_NtkDupDfs
(
p
->
pNtk
,
0
);
Wlc_NtkTransferNames
(
pNtk
,
p
->
pNtk
);
pNtk
->
pSpec
=
Abc_UtilStrsav
(
pFileName
);
finish:
...
...
src/base/wlc/wlcShow.c
0 → 100644
View file @
7d82819d
This diff is collapsed.
Click to expand it.
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