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
e17234d9
Commit
e17234d9
authored
Mar 03, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to the CBA package.
parent
7441908f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
18 deletions
+29
-18
src/base/cba/cba.h
+2
-2
src/base/cba/cbaNtk.c
+24
-5
src/base/cba/cbaWriteBlif.c
+0
-10
src/base/cba/cbaWriteVer.c
+3
-1
No files found.
src/base/cba/cba.h
View file @
e17234d9
...
@@ -286,8 +286,8 @@ static inline int Cba_ObjFanin( Cba_Ntk_t * p, int i ) { a
...
@@ -286,8 +286,8 @@ static inline int Cba_ObjFanin( Cba_Ntk_t * p, int i ) { a
static
inline
int
Cba_ObjIndex
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
Cba_ObjIsCio
(
p
,
i
));
return
Vec_IntEntry
(
&
p
->
vIndex
,
i
);
}
static
inline
int
Cba_ObjIndex
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
Cba_ObjIsCio
(
p
,
i
));
return
Vec_IntEntry
(
&
p
->
vIndex
,
i
);
}
static
inline
int
Cba_ObjNameInt
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
!
Cba_ObjIsCo
(
p
,
i
));
return
Vec_IntEntry
(
&
p
->
vName
,
i
);
}
static
inline
int
Cba_ObjNameInt
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
!
Cba_ObjIsCo
(
p
,
i
));
return
Vec_IntEntry
(
&
p
->
vName
,
i
);
}
static
inline
int
Cba_ObjName
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Cba_ObjIsCo
(
p
,
i
)
?
Cba_ObjNameInt
(
p
,
Cba_ObjFanin
(
p
,
i
))
:
Cba_ObjNameInt
(
p
,
i
);
}
static
inline
int
Cba_ObjName
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Cba_ObjIsCo
(
p
,
i
)
?
Cba_ObjNameInt
(
p
,
Cba_ObjFanin
(
p
,
i
))
:
Cba_ObjNameInt
(
p
,
i
);
}
static
inline
Cba_NameType_t
Cba_ObjNameType
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
!
Cba_ObjIsCo
(
p
,
i
));
return
Cba_NameType
(
Cba_ObjName
(
p
,
i
)
);
}
static
inline
Cba_NameType_t
Cba_ObjNameType
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Cba_NameType
(
Cba_ObjName
(
p
,
i
)
);
}
static
inline
int
Cba_ObjNameId
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
!
Cba_ObjIsCo
(
p
,
i
));
return
Abc_Lit2Var2
(
Cba_ObjName
(
p
,
i
)
);
}
static
inline
int
Cba_ObjNameId
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Abc_Lit2Var2
(
Cba_ObjName
(
p
,
i
)
);
}
static
inline
char
*
Cba_ObjNameStr
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
Cba_ObjNameType
(
p
,
i
)
<=
CBA_NAME_WORD
);
return
Cba_NtkStr
(
p
,
Cba_ObjNameId
(
p
,
i
));
}
static
inline
char
*
Cba_ObjNameStr
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
Cba_ObjNameType
(
p
,
i
)
<=
CBA_NAME_WORD
);
return
Cba_NtkStr
(
p
,
Cba_ObjNameId
(
p
,
i
));
}
static
inline
int
Cba_ObjCopy
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Vec_IntEntry
(
&
p
->
vCopy
,
i
);
}
static
inline
int
Cba_ObjCopy
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Vec_IntEntry
(
&
p
->
vCopy
,
i
);
}
static
inline
int
Cba_ObjFanout
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
Cba_ObjIsCi
(
p
,
i
));
return
Vec_IntEntry
(
&
p
->
vFanout
,
i
);
}
static
inline
int
Cba_ObjFanout
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
Cba_ObjIsCi
(
p
,
i
));
return
Vec_IntEntry
(
&
p
->
vFanout
,
i
);
}
...
...
src/base/cba/cbaNtk.c
View file @
e17234d9
...
@@ -273,18 +273,18 @@ void Cba_ManDeriveFanout( Cba_Man_t * p )
...
@@ -273,18 +273,18 @@ void Cba_ManDeriveFanout( Cba_Man_t * p )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Cba_ManAssignInternTwo
(
Cba_Ntk_t
*
p
,
int
iNum
,
int
nDigits
,
int
fPis
,
Vec_Int_t
*
vMap
)
int
Cba_ManAssignInternTwo
(
Cba_Ntk_t
*
p
,
int
iNum
,
int
nDigits
,
char
*
pPref
,
Vec_Int_t
*
vMap
)
{
{
char
Buffer
[
16
];
int
i
,
NameId
=
0
;
char
Buffer
[
16
];
int
i
,
NameId
=
0
;
for
(
i
=
0
;
!
NameId
||
Vec_IntEntry
(
vMap
,
NameId
);
i
++
)
for
(
i
=
0
;
!
NameId
||
Vec_IntEntry
(
vMap
,
NameId
);
i
++
)
{
{
if
(
i
==
0
)
if
(
i
==
0
)
sprintf
(
Buffer
,
"%s%0*d"
,
fPis
?
"i"
:
"n"
,
nDigits
,
iNum
);
sprintf
(
Buffer
,
"%s%0*d"
,
pPref
,
nDigits
,
iNum
);
else
else
sprintf
(
Buffer
,
"%s%0*d_%d"
,
fPis
?
"i"
:
"n"
,
nDigits
,
iNum
,
i
);
sprintf
(
Buffer
,
"%s%0*d_%d"
,
pPref
,
nDigits
,
iNum
,
i
);
NameId
=
Abc_NamStrFindOrAdd
(
p
->
pDesign
->
pStrs
,
Buffer
,
NULL
);
NameId
=
Abc_NamStrFindOrAdd
(
p
->
pDesign
->
pStrs
,
Buffer
,
NULL
);
}
}
Vec_IntWriteEntry
(
vMap
,
NameId
,
iNum
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
1
);
return
NameId
;
return
NameId
;
}
}
int
Cba_ManAssignCountNames
(
Cba_Ntk_t
*
p
)
int
Cba_ManAssignCountNames
(
Cba_Ntk_t
*
p
)
...
@@ -307,6 +307,13 @@ void Cba_ManAssignInternWordNamesNtk( Cba_Ntk_t * p, Vec_Int_t * vMap )
...
@@ -307,6 +307,13 @@ void Cba_ManAssignInternWordNamesNtk( Cba_Ntk_t * p, Vec_Int_t * vMap )
if
(
!
Cba_NtkHasNames
(
p
)
)
if
(
!
Cba_NtkHasNames
(
p
)
)
Cba_NtkStartNames
(
p
);
Cba_NtkStartNames
(
p
);
nDigits
=
Abc_Base10Log
(
Cba_ManAssignCountNames
(
p
)
);
nDigits
=
Abc_Base10Log
(
Cba_ManAssignCountNames
(
p
)
);
// populate map with the currently used names
Cba_NtkForEachCi
(
p
,
iObj
)
if
(
Cba_ObjNameInt
(
p
,
iObj
)
)
Vec_IntWriteEntry
(
vMap
,
Cba_ObjNameId
(
p
,
iObj
),
1
);
Cba_NtkForEachBox
(
p
,
iObj
)
if
(
Cba_ObjNameInt
(
p
,
iObj
)
)
Vec_IntWriteEntry
(
vMap
,
Cba_ObjNameId
(
p
,
iObj
),
1
);
// assign CI names
// assign CI names
Cba_NtkForEachCi
(
p
,
iObj
)
Cba_NtkForEachCi
(
p
,
iObj
)
{
{
...
@@ -325,7 +332,7 @@ void Cba_ManAssignInternWordNamesNtk( Cba_Ntk_t * p, Vec_Int_t * vMap )
...
@@ -325,7 +332,7 @@ void Cba_ManAssignInternWordNamesNtk( Cba_Ntk_t * p, Vec_Int_t * vMap )
{
{
//int Type = Cba_ObjType(p, iObj);
//int Type = Cba_ObjType(p, iObj);
int
Range
=
Cba_ObjIsPi
(
p
,
iObj
)
?
Cba_ObjPiRange
(
p
,
iObj
)
:
Cba_BoxBoRange
(
p
,
iObj
);
int
Range
=
Cba_ObjIsPi
(
p
,
iObj
)
?
Cba_ObjPiRange
(
p
,
iObj
)
:
Cba_BoxBoRange
(
p
,
iObj
);
iName
=
Cba_ManAssignInternTwo
(
p
,
nNames
++
,
nDigits
,
Cba_ObjIsPi
(
p
,
iObj
),
vMap
);
iName
=
Cba_ManAssignInternTwo
(
p
,
nNames
++
,
nDigits
,
Cba_ObjIsPi
(
p
,
iObj
)
?
"i"
:
"n"
,
vMap
);
if
(
Range
==
1
)
if
(
Range
==
1
)
Cba_ObjSetName
(
p
,
iObj
,
Abc_Var2Lit2
(
iName
,
CBA_NAME_BIN
)
);
Cba_ObjSetName
(
p
,
iObj
,
Abc_Var2Lit2
(
iName
,
CBA_NAME_BIN
)
);
else
else
...
@@ -358,14 +365,25 @@ void Cba_ManAssignInternWordNamesNtk( Cba_Ntk_t * p, Vec_Int_t * vMap )
...
@@ -358,14 +365,25 @@ void Cba_ManAssignInternWordNamesNtk( Cba_Ntk_t * p, Vec_Int_t * vMap )
}
}
assert
(
nPis
==
Cba_NtkPiNum
(
p
)
);
assert
(
nPis
==
Cba_NtkPiNum
(
p
)
);
assert
(
nPos
==
Cba_NtkPoNum
(
p
)
);
assert
(
nPos
==
Cba_NtkPoNum
(
p
)
);
// assign instance names
nDigits
=
Abc_Base10Log
(
Cba_NtkObjNum
(
p
)
);
Cba_NtkForEachBox
(
p
,
iObj
)
if
(
!
Cba_ObjNameInt
(
p
,
iObj
)
)
{
iName
=
Cba_ManAssignInternTwo
(
p
,
iObj
,
nDigits
,
"g"
,
vMap
);
Cba_ObjSetName
(
p
,
iObj
,
Abc_Var2Lit2
(
iName
,
CBA_NAME_BIN
)
);
}
// unmark all names
// unmark all names
Cba_NtkForEachPi
(
p
,
iObj
,
k
)
Cba_NtkForEachPi
(
p
,
iObj
,
k
)
if
(
Cba_ObjNameType
(
p
,
iObj
)
<=
CBA_NAME_WORD
)
if
(
Cba_ObjNameType
(
p
,
iObj
)
<=
CBA_NAME_WORD
)
Vec_IntWriteEntry
(
vMap
,
Cba_ObjNameId
(
p
,
iObj
),
0
);
Vec_IntWriteEntry
(
vMap
,
Cba_ObjNameId
(
p
,
iObj
),
0
);
Cba_NtkForEachBox
(
p
,
iObj
)
Cba_NtkForEachBox
(
p
,
iObj
)
{
Vec_IntWriteEntry
(
vMap
,
Cba_ObjNameId
(
p
,
iObj
),
0
);
Cba_BoxForEachBo
(
p
,
iObj
,
iTerm
,
k
)
Cba_BoxForEachBo
(
p
,
iObj
,
iTerm
,
k
)
if
(
Cba_ObjNameType
(
p
,
iTerm
)
<=
CBA_NAME_WORD
)
if
(
Cba_ObjNameType
(
p
,
iTerm
)
<=
CBA_NAME_WORD
)
Vec_IntWriteEntry
(
vMap
,
Cba_ObjNameId
(
p
,
iTerm
),
0
);
Vec_IntWriteEntry
(
vMap
,
Cba_ObjNameId
(
p
,
iTerm
),
0
);
}
// printf( "Generated %d word-level names.\n", nNames-1 );
// printf( "Generated %d word-level names.\n", nNames-1 );
}
}
void
Cba_ManAssignInternWordNames
(
Cba_Man_t
*
p
)
void
Cba_ManAssignInternWordNames
(
Cba_Man_t
*
p
)
...
@@ -374,6 +392,7 @@ void Cba_ManAssignInternWordNames( Cba_Man_t * p )
...
@@ -374,6 +392,7 @@ void Cba_ManAssignInternWordNames( Cba_Man_t * p )
Cba_Ntk_t
*
pNtk
;
int
i
;
Cba_Ntk_t
*
pNtk
;
int
i
;
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManAssignInternWordNamesNtk
(
pNtk
,
vMap
);
Cba_ManAssignInternWordNamesNtk
(
pNtk
,
vMap
);
assert
(
Vec_IntCountEntry
(
vMap
,
0
)
==
Vec_IntSize
(
vMap
)
);
Vec_IntFree
(
vMap
);
Vec_IntFree
(
vMap
);
}
}
...
...
src/base/cba/cbaWriteBlif.c
View file @
e17234d9
...
@@ -132,12 +132,7 @@ void Cba_ManWriteBlifGate( FILE * pFile, Cba_Ntk_t * p, Mio_Gate_t * pGate, Vec_
...
@@ -132,12 +132,7 @@ void Cba_ManWriteBlifGate( FILE * pFile, Cba_Ntk_t * p, Mio_Gate_t * pGate, Vec_
{
{
int
iFanin
,
i
;
int
iFanin
,
i
;
Vec_IntForEachEntry
(
vFanins
,
iFanin
,
i
)
Vec_IntForEachEntry
(
vFanins
,
iFanin
,
i
)
{
if
(
Cba_ObjIsCo
(
p
,
iFanin
)
)
iFanin
=
Cba_ObjFanin
(
p
,
iFanin
);
assert
(
Cba_ObjIsCi
(
p
,
iFanin
)
);
fprintf
(
pFile
,
" %s=%s"
,
Mio_GateReadPinName
(
pGate
,
i
),
Cba_ObjNameStr
(
p
,
iFanin
)
);
fprintf
(
pFile
,
" %s=%s"
,
Mio_GateReadPinName
(
pGate
,
i
),
Cba_ObjNameStr
(
p
,
iFanin
)
);
}
fprintf
(
pFile
,
" %s=%s"
,
Mio_GateReadOutName
(
pGate
),
Cba_ObjNameStr
(
p
,
iObj
)
);
fprintf
(
pFile
,
" %s=%s"
,
Mio_GateReadOutName
(
pGate
),
Cba_ObjNameStr
(
p
,
iObj
)
);
fprintf
(
pFile
,
"
\n
"
);
fprintf
(
pFile
,
"
\n
"
);
}
}
...
@@ -145,12 +140,7 @@ void Cba_ManWriteBlifArray( FILE * pFile, Cba_Ntk_t * p, Vec_Int_t * vFanins, in
...
@@ -145,12 +140,7 @@ void Cba_ManWriteBlifArray( FILE * pFile, Cba_Ntk_t * p, Vec_Int_t * vFanins, in
{
{
int
iFanin
,
i
;
int
iFanin
,
i
;
Vec_IntForEachEntry
(
vFanins
,
iFanin
,
i
)
Vec_IntForEachEntry
(
vFanins
,
iFanin
,
i
)
{
if
(
Cba_ObjIsCo
(
p
,
iFanin
)
)
iFanin
=
Cba_ObjFanin
(
p
,
iFanin
);
assert
(
Cba_ObjIsCi
(
p
,
iFanin
)
);
fprintf
(
pFile
,
" %s"
,
Cba_ObjNameStr
(
p
,
iFanin
)
);
fprintf
(
pFile
,
" %s"
,
Cba_ObjNameStr
(
p
,
iFanin
)
);
}
if
(
iObj
>=
0
)
if
(
iObj
>=
0
)
fprintf
(
pFile
,
" %s"
,
Cba_ObjNameStr
(
p
,
iObj
)
);
fprintf
(
pFile
,
" %s"
,
Cba_ObjNameStr
(
p
,
iObj
)
);
fprintf
(
pFile
,
"
\n
"
);
fprintf
(
pFile
,
"
\n
"
);
...
...
src/base/cba/cbaWriteVer.c
View file @
e17234d9
...
@@ -397,8 +397,10 @@ static inline void Cba_ManWriteGate( Cba_Ntk_t * p, int iObj )
...
@@ -397,8 +397,10 @@ static inline void Cba_ManWriteGate( Cba_Ntk_t * p, int iObj )
char
*
pGateName
=
Abc_NamStr
(
p
->
pDesign
->
pMods
,
Cba_BoxNtkId
(
p
,
iObj
));
char
*
pGateName
=
Abc_NamStr
(
p
->
pDesign
->
pMods
,
Cba_BoxNtkId
(
p
,
iObj
));
Mio_Library_t
*
pLib
=
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
(
Abc_FrameGetGlobalFrame
()
);
Mio_Library_t
*
pLib
=
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
(
Abc_FrameGetGlobalFrame
()
);
Mio_Gate_t
*
pGate
=
Mio_LibraryReadGateByName
(
pLib
,
pGateName
,
NULL
);
Mio_Gate_t
*
pGate
=
Mio_LibraryReadGateByName
(
pLib
,
pGateName
,
NULL
);
Vec_StrPrintStr
(
vStr
,
"
"
);
Vec_StrPrintStr
(
vStr
,
" "
);
Vec_StrPrintStr
(
vStr
,
pGateName
);
Vec_StrPrintStr
(
vStr
,
pGateName
);
Vec_StrPrintStr
(
vStr
,
" "
);
Vec_StrPrintStr
(
vStr
,
Cba_ObjName
(
p
,
iObj
)
?
Cba_ObjNameStr
(
p
,
iObj
)
:
""
);
Vec_StrPrintStr
(
vStr
,
" ("
);
Vec_StrPrintStr
(
vStr
,
" ("
);
Cba_BoxForEachBi
(
p
,
iObj
,
iTerm
,
k
)
Cba_BoxForEachBi
(
p
,
iObj
,
iTerm
,
k
)
{
{
...
...
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