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
a704e9c9
Commit
a704e9c9
authored
Feb 01, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements and tuning of CBA.
parent
e32026cf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
12 deletions
+31
-12
src/base/cba/cba.h
+14
-8
src/base/cba/cbaCom.c
+16
-4
src/base/cba/cbaPrsBuild.c
+1
-0
No files found.
src/base/cba/cba.h
View file @
a704e9c9
...
@@ -182,6 +182,7 @@ static inline Cba_Man_t * Cba_NtkMan( Cba_Ntk_t * p ) { r
...
@@ -182,6 +182,7 @@ static inline Cba_Man_t * Cba_NtkMan( Cba_Ntk_t * p ) { r
static
inline
int
Cba_NtkNameId
(
Cba_Ntk_t
*
p
)
{
return
p
->
NameId
;
}
static
inline
int
Cba_NtkNameId
(
Cba_Ntk_t
*
p
)
{
return
p
->
NameId
;
}
static
inline
char
*
Cba_NtkName
(
Cba_Ntk_t
*
p
)
{
return
Cba_ManStr
(
p
->
pDesign
,
Cba_NtkNameId
(
p
));
}
static
inline
char
*
Cba_NtkName
(
Cba_Ntk_t
*
p
)
{
return
Cba_ManStr
(
p
->
pDesign
,
Cba_NtkNameId
(
p
));
}
static
inline
int
Cba_NtkCopy
(
Cba_Ntk_t
*
p
)
{
return
p
->
iCopy
;
}
static
inline
int
Cba_NtkCopy
(
Cba_Ntk_t
*
p
)
{
return
p
->
iCopy
;
}
static
inline
Cba_Ntk_t
*
Cba_NtkCopyNtk
(
Cba_Man_t
*
pNew
,
Cba_Ntk_t
*
p
)
{
return
Cba_ManNtk
(
pNew
,
Cba_NtkCopy
(
p
));
}
static
inline
void
Cba_NtkSetCopy
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
p
->
iCopy
==
-
1
);
p
->
iCopy
=
i
;
}
static
inline
void
Cba_NtkSetCopy
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
p
->
iCopy
==
-
1
);
p
->
iCopy
=
i
;
}
static
inline
int
Cba_NtkObjNum
(
Cba_Ntk_t
*
p
)
{
return
Vec_StrSize
(
&
p
->
vType
);
}
static
inline
int
Cba_NtkObjNum
(
Cba_Ntk_t
*
p
)
{
return
Vec_StrSize
(
&
p
->
vType
);
}
...
@@ -240,7 +241,7 @@ static inline int Cba_ObjCopy( Cba_Ntk_t * p, int i ) { r
...
@@ -240,7 +241,7 @@ static inline int Cba_ObjCopy( Cba_Ntk_t * p, int i ) { r
static
inline
char
*
Cba_ObjNameStr
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Cba_NtkStr
(
p
,
Cba_ObjName
(
p
,
i
));
}
static
inline
char
*
Cba_ObjNameStr
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Cba_NtkStr
(
p
,
Cba_ObjName
(
p
,
i
));
}
static
inline
char
*
Cba_ObjRangeStr
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Cba_NtkStr
(
p
,
Cba_ObjRange
(
p
,
i
));
}
static
inline
char
*
Cba_ObjRangeStr
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Cba_NtkStr
(
p
,
Cba_ObjRange
(
p
,
i
));
}
static
inline
void
Cba_ObjSetFanin
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
assert
(
Cba_ObjFanin
(
p
,
i
)
==
-
1
);
Vec_IntWriteEntry
(
&
p
->
vFanin
,
i
,
x
);
}
static
inline
void
Cba_ObjSetFanin
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
assert
(
Cba_ObjFanin
(
p
,
i
)
==
-
1
);
Vec_IntWriteEntry
(
&
p
->
vFanin
,
i
,
x
);
}
static
inline
void
Cba_ObjSetName
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
assert
(
Cba_ObjName
(
p
,
i
)
==
0
);
Vec_IntWriteEntry
(
&
p
->
vName
,
i
,
x
);
}
static
inline
void
Cba_ObjSetName
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
/*assert(Cba_ObjName(p, i) == 0);*/
Vec_IntWriteEntry
(
&
p
->
vName
,
i
,
x
);
}
static
inline
void
Cba_ObjSetRange
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
assert
(
Cba_ObjRange
(
p
,
i
)
==
0
);
Vec_IntWriteEntry
(
&
p
->
vRange
,
i
,
x
);
}
static
inline
void
Cba_ObjSetRange
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
assert
(
Cba_ObjRange
(
p
,
i
)
==
0
);
Vec_IntWriteEntry
(
&
p
->
vRange
,
i
,
x
);
}
static
inline
void
Cba_ObjSetCopy
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
assert
(
Cba_ObjCopy
(
p
,
i
)
==
-
1
);
Vec_IntWriteEntry
(
&
p
->
vCopy
,
i
,
x
);
}
static
inline
void
Cba_ObjSetCopy
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
assert
(
Cba_ObjCopy
(
p
,
i
)
==
-
1
);
Vec_IntWriteEntry
(
&
p
->
vCopy
,
i
,
x
);
}
...
@@ -357,8 +358,6 @@ static inline int Cba_ObjAlloc( Cba_Ntk_t * p, Cba_ObjType_t Type, int Index, in
...
@@ -357,8 +358,6 @@ static inline int Cba_ObjAlloc( Cba_Ntk_t * p, Cba_ObjType_t Type, int Index, in
static
inline
int
Cba_ObjDup
(
Cba_Ntk_t
*
pNew
,
Cba_Ntk_t
*
p
,
int
i
)
static
inline
int
Cba_ObjDup
(
Cba_Ntk_t
*
pNew
,
Cba_Ntk_t
*
p
,
int
i
)
{
{
int
iObj
=
Cba_ObjAlloc
(
pNew
,
Cba_ObjType
(
p
,
i
),
Cba_ObjIndex
(
p
,
i
),
-
1
);
int
iObj
=
Cba_ObjAlloc
(
pNew
,
Cba_ObjType
(
p
,
i
),
Cba_ObjIndex
(
p
,
i
),
-
1
);
if
(
Cba_ObjIsBox
(
p
,
i
)
&&
Cba_BoxNtk
(
p
,
i
)
)
Cba_BoxSetNtkId
(
pNew
,
iObj
,
Cba_NtkCopy
(
Cba_BoxNtk
(
p
,
i
))
);
if
(
Cba_NtkHasNames
(
p
)
&&
Cba_NtkHasNames
(
pNew
)
)
if
(
Cba_NtkHasNames
(
p
)
&&
Cba_NtkHasNames
(
pNew
)
)
Cba_ObjSetName
(
pNew
,
iObj
,
Cba_ObjName
(
p
,
i
)
);
Cba_ObjSetName
(
pNew
,
iObj
,
Cba_ObjName
(
p
,
i
)
);
if
(
Cba_NtkHasRanges
(
p
)
&&
Cba_NtkHasRanges
(
pNew
)
)
if
(
Cba_NtkHasRanges
(
p
)
&&
Cba_NtkHasRanges
(
pNew
)
)
...
@@ -382,6 +381,8 @@ static inline int Cba_BoxDup( Cba_Ntk_t * pNew, Cba_Ntk_t * p, int iBox )
...
@@ -382,6 +381,8 @@ static inline int Cba_BoxDup( Cba_Ntk_t * pNew, Cba_Ntk_t * p, int iBox )
Cba_BoxForEachBiReverse
(
p
,
iBox
,
iTerm
,
i
)
Cba_BoxForEachBiReverse
(
p
,
iBox
,
iTerm
,
i
)
Cba_ObjDup
(
pNew
,
p
,
iTerm
);
Cba_ObjDup
(
pNew
,
p
,
iTerm
);
iBoxNew
=
Cba_ObjDup
(
pNew
,
p
,
iBox
);
iBoxNew
=
Cba_ObjDup
(
pNew
,
p
,
iBox
);
if
(
Cba_BoxNtk
(
p
,
iBox
)
)
Cba_BoxSetNtkId
(
pNew
,
iBoxNew
,
Cba_NtkCopy
(
Cba_BoxNtk
(
p
,
iBox
))
);
Cba_BoxForEachBo
(
p
,
iBox
,
iTerm
,
i
)
Cba_BoxForEachBo
(
p
,
iBox
,
iTerm
,
i
)
Cba_ObjDup
(
pNew
,
p
,
iTerm
);
Cba_ObjDup
(
pNew
,
p
,
iTerm
);
return
iBoxNew
;
return
iBoxNew
;
...
@@ -437,7 +438,7 @@ static inline void Cba_NtkDup( Cba_Ntk_t * pNew, Cba_Ntk_t * p )
...
@@ -437,7 +438,7 @@ static inline void Cba_NtkDup( Cba_Ntk_t * pNew, Cba_Ntk_t * p )
Cba_ObjDup
(
pNew
,
p
,
iObj
);
Cba_ObjDup
(
pNew
,
p
,
iObj
);
Cba_NtkForEachCo
(
p
,
iObj
)
Cba_NtkForEachCo
(
p
,
iObj
)
Cba_ObjSetFanin
(
pNew
,
Cba_ObjCopy
(
p
,
iObj
),
Cba_ObjCopy
(
p
,
Cba_ObjFanin
(
p
,
iObj
))
);
Cba_ObjSetFanin
(
pNew
,
Cba_ObjCopy
(
p
,
iObj
),
Cba_ObjCopy
(
p
,
Cba_ObjFanin
(
p
,
iObj
))
);
//Cba_NtkFreeCopies( p );
//Cba_NtkFreeCopies( p );
// needed for host ntk
assert
(
Cba_NtkObjNum
(
pNew
)
==
Cba_NtkAllocNum
(
pNew
)
);
assert
(
Cba_NtkObjNum
(
pNew
)
==
Cba_NtkAllocNum
(
pNew
)
);
}
}
static
inline
void
Cba_NtkDupUserBoxes
(
Cba_Ntk_t
*
pNew
,
Cba_Ntk_t
*
p
)
static
inline
void
Cba_NtkDupUserBoxes
(
Cba_Ntk_t
*
pNew
,
Cba_Ntk_t
*
p
)
...
@@ -542,17 +543,20 @@ static inline Cba_Man_t * Cba_ManDup( Cba_Man_t * p )
...
@@ -542,17 +543,20 @@ static inline Cba_Man_t * Cba_ManDup( Cba_Man_t * p )
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkSetCopy
(
pNtk
,
i
);
Cba_NtkSetCopy
(
pNtk
,
i
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkDup
(
Cba_
ManNtk
(
pNew
,
i
),
pNtk
);
Cba_NtkDup
(
Cba_
NtkCopyNtk
(
pNew
,
pNtk
),
pNtk
);
return
pNew
;
return
pNew
;
}
}
static
inline
Cba_Man_t
*
Cba_ManDupUserBoxes
(
Cba_Man_t
*
p
)
static
inline
Cba_Man_t
*
Cba_ManDupUserBoxes
(
Cba_Man_t
*
p
)
{
{
Cba_Ntk_t
*
pNtk
;
int
i
;
Cba_Ntk_t
*
pNtk
,
*
pHost
;
int
i
;
Cba_Man_t
*
pNew
=
Cba_ManStart
(
p
,
Cba_ManNtkNum
(
p
)
);
Cba_Man_t
*
pNew
=
Cba_ManStart
(
p
,
Cba_ManNtkNum
(
p
)
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkSetCopy
(
pNtk
,
i
);
Cba_NtkSetCopy
(
pNtk
,
i
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkDupUserBoxes
(
Cba_ManNtk
(
pNew
,
i
),
pNtk
);
Cba_NtkDupUserBoxes
(
Cba_NtkCopyNtk
(
pNew
,
pNtk
),
pNtk
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
if
(
(
pHost
=
Cba_NtkHostNtk
(
pNtk
))
)
Cba_NtkSetHost
(
Cba_NtkCopyNtk
(
pNew
,
pNtk
),
Cba_NtkCopy
(
pHost
),
Cba_ObjCopy
(
pHost
,
Cba_NtkHostObj
(
pNtk
))
);
return
pNew
;
return
pNew
;
}
}
...
@@ -617,7 +621,7 @@ static inline int Cba_ManBoxNum( Cba_Man_t * p )
...
@@ -617,7 +621,7 @@ static inline int Cba_ManBoxNum( Cba_Man_t * p )
pNtk
->
Count
=
-
1
;
pNtk
->
Count
=
-
1
;
return
Cba_ManBoxNum_rec
(
Cba_ManRoot
(
p
)
);
return
Cba_ManBoxNum_rec
(
Cba_ManRoot
(
p
)
);
}
}
static
inline
void
Cba_ManPrintStats
(
Cba_Man_t
*
p
,
int
fVerbose
)
static
inline
void
Cba_ManPrintStats
(
Cba_Man_t
*
p
,
int
nModules
,
int
fVerbose
)
{
{
Cba_Ntk_t
*
pNtk
;
int
i
;
Cba_Ntk_t
*
pNtk
;
int
i
;
Cba_Ntk_t
*
pRoot
=
Cba_ManRoot
(
p
);
Cba_Ntk_t
*
pRoot
=
Cba_ManRoot
(
p
);
...
@@ -632,6 +636,8 @@ static inline void Cba_ManPrintStats( Cba_Man_t * p, int fVerbose )
...
@@ -632,6 +636,8 @@ static inline void Cba_ManPrintStats( Cba_Man_t * p, int fVerbose )
Cba_ManBoxNum
(
p
);
Cba_ManBoxNum
(
p
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
{
{
if
(
i
==
nModules
)
break
;
printf
(
"Module %5d : "
,
i
);
printf
(
"Module %5d : "
,
i
);
Cba_NtkPrintStats
(
pNtk
);
Cba_NtkPrintStats
(
pNtk
);
}
}
...
...
src/base/cba/cbaCom.c
View file @
a704e9c9
...
@@ -295,12 +295,23 @@ usage:
...
@@ -295,12 +295,23 @@ usage:
int
Cba_CommandPs
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Cba_CommandPs
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
Cba_Man_t
*
p
=
Cba_AbcGetMan
(
pAbc
);
Cba_Man_t
*
p
=
Cba_AbcGetMan
(
pAbc
);
int
c
,
fVerbose
=
0
;
int
c
,
nModules
=
0
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"vh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"
M
vh"
)
)
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
{
{
case
'M'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-M
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nModules
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nModules
<
0
)
goto
usage
;
break
;
case
'v'
:
case
'v'
:
fVerbose
^=
1
;
fVerbose
^=
1
;
break
;
break
;
...
@@ -315,11 +326,12 @@ int Cba_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -315,11 +326,12 @@ int Cba_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
1
,
"Cba_CommandPs(): There is no current design.
\n
"
);
Abc_Print
(
1
,
"Cba_CommandPs(): There is no current design.
\n
"
);
return
0
;
return
0
;
}
}
Cba_ManPrintStats
(
p
,
fVerbose
);
Cba_ManPrintStats
(
p
,
nModules
,
fVerbose
);
return
0
;
return
0
;
usage:
usage:
Abc_Print
(
-
2
,
"usage: @ps [-vh]
\n
"
);
Abc_Print
(
-
2
,
"usage: @ps [-
M num] [-
vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
prints statistics
\n
"
);
Abc_Print
(
-
2
,
"
\t
prints statistics
\n
"
);
Abc_Print
(
-
2
,
"
\t
-M num : the number of first modules to report [default = %d]
\n
"
,
nModules
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
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
"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
return
1
;
...
...
src/base/cba/cbaPrsBuild.c
View file @
a704e9c9
...
@@ -159,6 +159,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
...
@@ -159,6 +159,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
pNtkBox
=
Prs_ManNtk
(
vDes
,
Prs_BoxNtk
(
pNtk
,
iBox
)
);
pNtkBox
=
Prs_ManNtk
(
vDes
,
Prs_BoxNtk
(
pNtk
,
iBox
)
);
iObj
=
Cba_BoxAlloc
(
pNew
,
CBA_OBJ_BOX
,
Prs_NtkPiNum
(
pNtkBox
),
Prs_NtkPoNum
(
pNtkBox
),
Prs_BoxNtk
(
pNtk
,
iBox
)
);
iObj
=
Cba_BoxAlloc
(
pNew
,
CBA_OBJ_BOX
,
Prs_NtkPiNum
(
pNtkBox
),
Prs_NtkPoNum
(
pNtkBox
),
Prs_BoxNtk
(
pNtk
,
iBox
)
);
Cba_ObjSetName
(
pNew
,
iObj
,
Prs_BoxName
(
pNtk
,
iBox
)
);
Cba_ObjSetName
(
pNew
,
iObj
,
Prs_BoxName
(
pNtk
,
iBox
)
);
Cba_NtkSetHost
(
Cba_ManNtk
(
pNew
->
pDesign
,
Prs_BoxNtk
(
pNtk
,
iBox
)),
Cba_NtkId
(
pNew
),
iObj
);
Vec_IntForEachEntry
(
vSigs
,
Index
,
i
)
Vec_IntForEachEntry
(
vSigs
,
Index
,
i
)
{
{
i
++
;
i
++
;
...
...
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