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
e363727c
Commit
e363727c
authored
Feb 11, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several improvements to CBA data-structure.
parent
8cabdcb5
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
197 additions
and
66 deletions
+197
-66
src/base/cba/cba.h
+52
-12
src/base/cba/cbaBlast.c
+3
-3
src/base/cba/cbaCba.c
+21
-9
src/base/cba/cbaNtk.c
+66
-35
src/base/cba/cbaPrsBuild.c
+4
-4
src/base/cba/cbaPtrAbc.c
+2
-2
src/base/cba/cbaReadVer.c
+1
-1
src/base/cba/cbaWriteVer.c
+48
-0
No files found.
src/base/cba/cba.h
View file @
e363727c
...
...
@@ -48,8 +48,8 @@ typedef enum {
CBA_OBJ_BO
,
// 4: box output
CBA_OBJ_BOX
,
// 5: box
CBA_BOX_C
0
,
CBA_BOX_C
1
,
CBA_BOX_C
F
,
CBA_BOX_C
T
,
CBA_BOX_CX
,
CBA_BOX_CZ
,
CBA_BOX_BUF
,
...
...
@@ -71,7 +71,7 @@ typedef enum {
CBA_BOX_RXOR
,
CBA_BOX_RXNOR
,
CBA_BOX_N
1
MUX
,
CBA_BOX_NMUX
,
CBA_BOX_SEL
,
CBA_BOX_PSEL
,
CBA_BOX_ENC
,
...
...
@@ -159,7 +159,6 @@ struct Cba_Man_t_
int
iRoot
;
// root network
int
nNtks
;
// number of current networks
Cba_Ntk_t
*
pNtks
;
// networks
Vec_Int_t
vInfo
;
// box info
// user data
Vec_Int_t
vBuf2RootNtk
;
Vec_Int_t
vBuf2RootObj
;
...
...
@@ -173,6 +172,7 @@ struct Cba_Man_t_
static
inline
char
*
Cba_ManName
(
Cba_Man_t
*
p
)
{
return
p
->
pName
;
}
static
inline
char
*
Cba_ManSpec
(
Cba_Man_t
*
p
)
{
return
p
->
pSpec
;
}
static
inline
int
Cba_ManNtkNum
(
Cba_Man_t
*
p
)
{
return
p
->
nNtks
;
}
static
inline
int
Cba_ManPrimNum
(
Cba_Man_t
*
p
)
{
return
Abc_NamObjNumMax
(
p
->
pMods
)
-
Cba_ManNtkNum
(
p
);
}
static
inline
int
Cba_ManNtkIsOk
(
Cba_Man_t
*
p
,
int
i
)
{
return
i
>=
0
&&
i
<
Cba_ManNtkNum
(
p
);
}
static
inline
Cba_Ntk_t
*
Cba_ManNtk
(
Cba_Man_t
*
p
,
int
i
)
{
return
Cba_ManNtkIsOk
(
p
,
i
)
?
p
->
pNtks
+
i
:
NULL
;
}
static
inline
int
Cba_ManNtkFindId
(
Cba_Man_t
*
p
,
char
*
pName
)
{
return
Abc_NamStrFind
(
p
->
pMods
,
pName
)
-
1
;
}
...
...
@@ -180,7 +180,6 @@ static inline Cba_Ntk_t * Cba_ManNtkFind( Cba_Man_t * p, char * pName ) { r
static
inline
Cba_Ntk_t
*
Cba_ManRoot
(
Cba_Man_t
*
p
)
{
return
Cba_ManNtk
(
p
,
p
->
iRoot
);
}
static
inline
char
*
Cba_ManStr
(
Cba_Man_t
*
p
,
int
i
)
{
return
Abc_NamStr
(
p
->
pStrs
,
i
);
}
static
inline
int
Cba_ManStrId
(
Cba_Man_t
*
p
,
char
*
pStr
)
{
return
Abc_NamStrFind
(
p
->
pStrs
,
pStr
);
}
static
inline
int
Cba_ManInfoNum
(
Cba_Man_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vInfo
)
>>
2
;
}
static
inline
int
Cba_NtkId
(
Cba_Ntk_t
*
p
)
{
int
i
=
p
-
p
->
pDesign
->
pNtks
;
assert
(
Cba_ManNtkIsOk
(
p
->
pDesign
,
i
));
return
i
;
}
static
inline
Cba_Man_t
*
Cba_NtkMan
(
Cba_Ntk_t
*
p
)
{
return
p
->
pDesign
;
}
...
...
@@ -271,6 +270,47 @@ static inline Cba_Ntk_t * Cba_BoxBiNtk( Cba_Ntk_t * p, int i ) { r
static
inline
Cba_Ntk_t
*
Cba_BoxBoNtk
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Cba_ManNtk
(
p
->
pDesign
,
Cba_BoxBoNtkId
(
p
,
i
)
);
}
static
inline
char
*
Cba_BoxNtkName
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Abc_NamStr
(
p
->
pDesign
->
pMods
,
Cba_BoxNtkId
(
p
,
i
)
);
}
static
inline
int
Cba_CharIsDigit
(
char
c
)
{
return
c
>=
'0'
&&
c
<=
'9'
;
}
static
inline
int
Cba_NtkNamePoNum
(
char
*
pName
)
{
int
Multi
=
1
,
Counter
=
0
;
char
*
pTemp
=
pName
+
strlen
(
pName
)
-
1
;
assert
(
Cba_CharIsDigit
(
*
pTemp
)
);
for
(
;
pName
<
pTemp
&&
Cba_CharIsDigit
(
*
pTemp
);
pTemp
--
,
Multi
*=
10
)
Counter
+=
Multi
*
(
*
pTemp
-
'0'
);
return
Counter
;
}
static
inline
int
Cba_NtkNamePiNum
(
char
*
pName
)
{
char
*
pTemp
;
int
CounterAll
=
0
,
Counter
=
0
;
for
(
pTemp
=
pName
;
*
pTemp
;
pTemp
++
)
{
if
(
Cba_CharIsDigit
(
*
pTemp
)
)
Counter
=
10
*
Counter
+
*
pTemp
-
'0'
;
else
CounterAll
+=
Counter
,
Counter
=
0
;
}
return
CounterAll
;
}
static
inline
int
Cba_NtkNameRanges
(
char
*
pName
,
int
*
pRanges
,
char
*
pSymbs
)
{
char
Symb
,
*
pTemp
;
int
nSigs
=
0
,
Num
=
0
;
assert
(
!
strncmp
(
pName
,
"ABC"
,
3
)
);
for
(
pTemp
=
pName
;
*
pTemp
&&
!
Cba_CharIsDigit
(
*
pTemp
);
pTemp
++
);
assert
(
Cba_CharIsDigit
(
*
pTemp
)
);
Symb
=
*
(
pTemp
-
1
);
for
(
;
*
pTemp
;
pTemp
++
)
{
if
(
Cba_CharIsDigit
(
*
pTemp
)
)
Num
=
10
*
Num
+
*
pTemp
-
'0'
;
else
pSymbs
[
nSigs
]
=
Symb
,
Symb
=
*
pTemp
,
pRanges
[
nSigs
++
]
=
Num
,
Num
=
0
;
}
assert
(
Num
>
0
);
pSymbs
[
nSigs
]
=
Symb
,
pRanges
[
nSigs
++
]
=
Num
;
return
nSigs
;
}
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
...
...
@@ -590,7 +630,6 @@ static inline void Cba_ManFree( Cba_Man_t * p )
Vec_IntErase
(
&
p
->
vBuf2LeafObj
);
Vec_IntErase
(
&
p
->
vBuf2RootNtk
);
Vec_IntErase
(
&
p
->
vBuf2RootObj
);
Vec_IntErase
(
&
p
->
vInfo
);
Abc_NamDeref
(
p
->
pStrs
);
Abc_NamDeref
(
p
->
pMods
);
ABC_FREE
(
p
->
pName
);
...
...
@@ -649,6 +688,7 @@ static inline void Cba_ManPrintStats( Cba_Man_t * p, int nModules, int fVerbose
printf
(
"%-12s : "
,
Cba_ManName
(
p
)
);
printf
(
"pi =%5d "
,
Cba_NtkPiNum
(
pRoot
)
);
printf
(
"po =%5d "
,
Cba_NtkPoNum
(
pRoot
)
);
printf
(
"pri =%4d "
,
Cba_ManPrimNum
(
p
)
);
printf
(
"mod =%6d "
,
Cba_ManNtkNum
(
p
)
);
printf
(
"box =%7d "
,
Cba_ManNodeNum
(
p
)
);
printf
(
"obj =%7d "
,
Cba_ManObjNum
(
p
)
);
...
...
@@ -679,8 +719,8 @@ static inline void Cba_ManPrintStats( Cba_Man_t * p, int nModules, int fVerbose
***********************************************************************/
static
inline
Cba_ObjType_t
Ptr_SopToType
(
char
*
pSop
)
{
if
(
!
strcmp
(
pSop
,
" 0
\n
"
)
)
return
CBA_BOX_C
0
;
if
(
!
strcmp
(
pSop
,
" 1
\n
"
)
)
return
CBA_BOX_C
1
;
if
(
!
strcmp
(
pSop
,
" 0
\n
"
)
)
return
CBA_BOX_C
F
;
if
(
!
strcmp
(
pSop
,
" 1
\n
"
)
)
return
CBA_BOX_C
T
;
if
(
!
strcmp
(
pSop
,
"1 1
\n
"
)
)
return
CBA_BOX_BUF
;
if
(
!
strcmp
(
pSop
,
"0 1
\n
"
)
)
return
CBA_BOX_INV
;
if
(
!
strcmp
(
pSop
,
"11 1
\n
"
)
)
return
CBA_BOX_AND
;
...
...
@@ -717,8 +757,8 @@ static inline char * Ptr_SopToTypeName( char * pSop )
}
static
inline
char
*
Ptr_TypeToName
(
Cba_ObjType_t
Type
)
{
if
(
Type
==
CBA_BOX_C
0
)
return
"const0"
;
if
(
Type
==
CBA_BOX_C
1
)
return
"const1"
;
if
(
Type
==
CBA_BOX_C
F
)
return
"const0"
;
if
(
Type
==
CBA_BOX_C
T
)
return
"const1"
;
if
(
Type
==
CBA_BOX_BUF
)
return
"buf"
;
if
(
Type
==
CBA_BOX_INV
)
return
"not"
;
if
(
Type
==
CBA_BOX_AND
)
return
"and"
;
...
...
@@ -735,8 +775,8 @@ static inline char * Ptr_TypeToName( Cba_ObjType_t Type )
}
static
inline
char
*
Ptr_TypeToSop
(
Cba_ObjType_t
Type
)
{
if
(
Type
==
CBA_BOX_C
0
)
return
" 0
\n
"
;
if
(
Type
==
CBA_BOX_C
1
)
return
" 1
\n
"
;
if
(
Type
==
CBA_BOX_C
F
)
return
" 0
\n
"
;
if
(
Type
==
CBA_BOX_C
T
)
return
" 1
\n
"
;
if
(
Type
==
CBA_BOX_BUF
)
return
"1 1
\n
"
;
if
(
Type
==
CBA_BOX_INV
)
return
"0 1
\n
"
;
if
(
Type
==
CBA_BOX_AND
)
return
"11 1
\n
"
;
...
...
src/base/cba/cbaBlast.c
View file @
e363727c
...
...
@@ -151,9 +151,9 @@ int Cba_ManExtract_rec( Gia_Man_t * pNew, Cba_Ntk_t * p, int i, int fBuffers, Ve
Cba_ObjType_t
Type
=
Cba_ObjType
(
p
,
iBox
);
if
(
nLits
==
0
)
{
if
(
Type
==
CBA_BOX_C
0
)
if
(
Type
==
CBA_BOX_C
F
)
iRes
=
0
;
else
if
(
Type
==
CBA_BOX_C
1
)
else
if
(
Type
==
CBA_BOX_C
T
)
iRes
=
1
;
else
assert
(
0
);
}
...
...
@@ -307,7 +307,7 @@ void Cba_NtkCreateAndConnectBuffer( Gia_Man_t * pGia, Gia_Obj_t * pObj, Cba_Ntk_
}
else
{
Cba_ObjAlloc
(
p
,
pGia
&&
Gia_ObjFaninC0
(
pObj
)
?
CBA_BOX_C
1
:
CBA_BOX_C0
,
-
1
);
Cba_ObjAlloc
(
p
,
pGia
&&
Gia_ObjFaninC0
(
pObj
)
?
CBA_BOX_C
T
:
CBA_BOX_CF
,
-
1
);
}
iObj
=
Cba_ObjAlloc
(
p
,
CBA_OBJ_BO
,
-
1
);
Cba_ObjSetName
(
p
,
iObj
,
Cba_ObjName
(
p
,
iTerm
)
);
...
...
src/base/cba/cbaCba.c
View file @
e363727c
...
...
@@ -113,16 +113,15 @@ Cba_Man_t * Cba_ManReadCbaInt( Vec_Str_t * vOut )
Cba_Man_t
*
p
;
Cba_Ntk_t
*
pNtk
;
char
Buffer
[
1000
]
=
"#"
;
int
i
,
NameId
,
Pos
=
0
,
Num1
,
Num2
,
Num3
;
int
i
,
NameId
,
Pos
=
0
,
nNtks
,
nPrims
,
Num1
,
Num2
,
Num3
;
while
(
Buffer
[
0
]
==
'#'
)
if
(
!
CbaManReadCbaLine
(
vOut
,
&
Pos
,
Buffer
,
Buffer
+
1000
)
)
return
NULL
;
if
(
!
CbaManReadCbaNameAndNums
(
Buffer
,
&
Num1
,
&
Num2
,
&
Num3
)
)
if
(
!
CbaManReadCbaNameAndNums
(
Buffer
,
&
nNtks
,
&
nPrims
,
&
Num3
)
)
return
NULL
;
// start manager
assert
(
Num1
>
0
&&
Num2
>=
0
);
p
=
Cba_ManAlloc
(
Buffer
,
Num1
);
Vec_IntGrow
(
&
p
->
vInfo
,
4
*
Num2
);
assert
(
nNtks
>
0
&&
nPrims
>
0
);
p
=
Cba_ManAlloc
(
Buffer
,
nNtks
);
// start networks
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
{
...
...
@@ -143,8 +142,16 @@ Cba_Man_t * Cba_ManReadCbaInt( Vec_Str_t * vOut )
// read networks
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManReadCbaNtk
(
vOut
,
&
Pos
,
pNtk
);
Cba_ManReadCbaVecInt
(
vOut
,
&
Pos
,
&
p
->
vInfo
,
4
*
Vec_IntSize
(
&
p
->
vInfo
)
);
// read primitives
for
(
i
=
0
;
i
<
nPrims
;
i
++
)
{
char
*
pName
=
Vec_StrEntryP
(
vOut
,
Pos
);
Abc_NamStrFindOrAdd
(
p
->
pMods
,
pName
,
NULL
);
Pos
+=
strlen
(
pName
)
+
1
;
}
assert
(
Pos
==
Vec_StrSize
(
vOut
)
);
assert
(
Cba_ManNtkNum
(
p
)
==
nNtks
);
assert
(
Cba_ManPrimNum
(
p
)
==
nPrims
);
return
p
;
}
Cba_Man_t
*
Cba_ManReadCba
(
char
*
pFileName
)
...
...
@@ -200,11 +207,11 @@ void Cba_ManWriteCbaNtk( Vec_Str_t * vOut, Cba_Ntk_t * pNtk )
void
Cba_ManWriteCbaInt
(
Vec_Str_t
*
vOut
,
Cba_Man_t
*
p
)
{
char
Buffer
[
1000
];
Cba_Ntk_t
*
pNtk
;
int
i
;
Cba_Ntk_t
*
pNtk
;
int
i
,
nPrims
=
Cba_ManPrimNum
(
p
)
;
sprintf
(
Buffer
,
"# Design
\"
%s
\"
written by ABC on %s
\n
"
,
Cba_ManName
(
p
),
Extra_TimeStamp
()
);
Vec_StrPrintStr
(
vOut
,
Buffer
);
// write short info
sprintf
(
Buffer
,
"%s %d %d
\n
"
,
Cba_ManName
(
p
),
Cba_ManNtkNum
(
p
),
Cba_Man
Info
Num
(
p
)
);
sprintf
(
Buffer
,
"%s %d %d
\n
"
,
Cba_ManName
(
p
),
Cba_ManNtkNum
(
p
),
Cba_Man
Prim
Num
(
p
)
);
Vec_StrPrintStr
(
vOut
,
Buffer
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
{
...
...
@@ -213,7 +220,12 @@ void Cba_ManWriteCbaInt( Vec_Str_t * vOut, Cba_Man_t * p )
}
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManWriteCbaNtk
(
vOut
,
pNtk
);
Vec_StrPushBuffer
(
vOut
,
(
char
*
)
Vec_IntArray
(
&
p
->
vInfo
),
16
*
Cba_ManInfoNum
(
p
)
);
for
(
i
=
0
;
i
<
nPrims
;
i
++
)
{
char
*
pName
=
Abc_NamStr
(
p
->
pMods
,
Cba_ManNtkNum
(
p
)
+
i
);
Vec_StrPrintStr
(
vOut
,
pName
);
Vec_StrPush
(
vOut
,
'\0'
);
}
}
void
Cba_ManWriteCba
(
char
*
pFileName
,
Cba_Man_t
*
p
)
{
...
...
src/base/cba/cbaNtk.c
View file @
e363727c
...
...
@@ -41,60 +41,91 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
void
Cba_ManAssignInternNamesNtk
(
Cba_Ntk_t
*
p
)
int
Cba_ManSetInternOne
(
Cba_Ntk_t
*
p
,
int
iTerm
,
Vec_Int_t
*
vMa
p
)
{
char
Buffer
[
100
];
int
i
,
iObj
,
iTerm
,
NameId
,
fFound
,
nNameLess
=
0
;
int
nDigits
=
Abc_Base10Log
(
Cba_NtkObjNum
(
p
)
);
// PI/PO should have NameId
if
(
!
Cba_ObjName
(
p
,
iTerm
)
)
return
1
;
assert
(
Vec_IntEntry
(
vMap
,
Cba_ObjName
(
p
,
iTerm
))
==
0
);
Vec_IntWriteEntry
(
vMap
,
Cba_ObjName
(
p
,
iTerm
),
iTerm
+
1
);
return
0
;
}
int
Cba_ManAssignInternOne
(
Cba_Ntk_t
*
p
,
int
iTerm
,
Vec_Int_t
*
vMap
)
{
char
Buffer
[
16
];
int
i
=
0
,
NameId
,
nDigits
;
if
(
Cba_ObjName
(
p
,
iTerm
)
)
return
0
;
do
{
nDigits
=
Abc_Base10Log
(
Cba_NtkObjNum
(
p
)
);
if
(
i
==
0
)
sprintf
(
Buffer
,
"%s%0*d"
,
"_n_"
,
nDigits
,
iTerm
);
else
sprintf
(
Buffer
,
"%s%0*d_%d"
,
"_n_"
,
nDigits
,
iTerm
,
++
i
);
NameId
=
Abc_NamStrFindOrAdd
(
p
->
pDesign
->
pStrs
,
Buffer
,
NULL
);
}
while
(
Vec_IntEntry
(
vMap
,
NameId
)
);
Cba_ObjSetName
(
p
,
iTerm
,
NameId
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
iTerm
+
1
);
return
1
;
}
void
Cba_ManAssignInternNamesNtk
(
Cba_Ntk_t
*
p
,
Vec_Int_t
*
vMap
)
{
int
i
,
iObj
,
iTerm
,
nNameless
=
0
;
if
(
!
Cba_NtkHasNames
(
p
)
)
Cba_NtkStartNames
(
p
);
// set all names
Cba_NtkForEachPi
(
p
,
iObj
,
i
)
assert
(
Cba_ObjName
(
p
,
iObj
)
);
nNameless
+=
Cba_ManSetInternOne
(
p
,
iObj
,
vMap
);
Cba_NtkForEachPo
(
p
,
iObj
,
i
)
assert
(
Cba_ObjName
(
p
,
iObj
)
);
// user BI/BO should have NameId
Cba_NtkForEachBoxUser
(
p
,
iObj
)
nNameless
+=
Cba_ManSetInternOne
(
p
,
iObj
,
vMap
);
Cba_NtkForEachBox
(
p
,
iObj
)
{
Cba_BoxForEachBi
(
p
,
iObj
,
iTerm
,
i
)
assert
(
Cba_ObjName
(
p
,
iTerm
)
);
nNameless
+=
Cba_ManSetInternOne
(
p
,
iTerm
,
vMap
);
Cba_BoxForEachBo
(
p
,
iObj
,
iTerm
,
i
)
assert
(
Cba_ObjName
(
p
,
iTerm
)
);
nNameless
+=
Cba_ManSetInternOne
(
p
,
iTerm
,
vMap
);
}
// check missing IDs
Cba_NtkForEachBoxPrim
(
p
,
iObj
)
if
(
nNameless
)
{
int
nNameless2
=
0
;
// generate new names
Cba_NtkForEachPi
(
p
,
iObj
,
i
)
nNameless2
+=
Cba_ManAssignInternOne
(
p
,
iObj
,
vMap
);
Cba_NtkForEachPo
(
p
,
iObj
,
i
)
nNameless2
+=
Cba_ManAssignInternOne
(
p
,
iObj
,
vMap
);
Cba_NtkForEachBox
(
p
,
iObj
)
{
Cba_BoxForEachBi
(
p
,
iObj
,
iTerm
,
i
)
nNameLess
+=
!
Cba_ObjName
(
p
,
iTerm
);
nNameless2
+=
Cba_ManAssignInternOne
(
p
,
iTerm
,
vMap
);
Cba_BoxForEachBo
(
p
,
iObj
,
iTerm
,
i
)
nNameLess
+=
!
Cba_ObjName
(
p
,
iTerm
);
nNameless2
+=
Cba_ManAssignInternOne
(
p
,
iTerm
,
vMap
);
}
if
(
!
nNameLess
)
return
;
// create names for prim BO
Cba_NtkForEachBoxPrim
(
p
,
iObj
)
Cba_BoxForEachBo
(
p
,
iObj
,
iTerm
,
i
)
{
if
(
Cba_ObjName
(
p
,
iTerm
)
)
continue
;
sprintf
(
Buffer
,
"%s%0*d"
,
"_n_"
,
nDigits
,
iTerm
);
NameId
=
Abc_NamStrFindOrAdd
(
p
->
pDesign
->
pStrs
,
Buffer
,
&
fFound
);
//assert( !fFound );
Cba_ObjSetName
(
p
,
iTerm
,
NameId
);
assert
(
nNameless
==
nNameless2
);
if
(
nNameless
)
printf
(
"Generated unique names for %d objects in network
\"
%s
\"
.
\n
"
,
nNameless
,
Cba_NtkName
(
p
)
);
}
// transfer names for prim BI
Cba_NtkForEachBoxPrim
(
p
,
iObj
)
Cba_BoxForEachBi
(
p
,
iObj
,
iTerm
,
i
)
// unmark all names
Cba_NtkForEachPi
(
p
,
iObj
,
i
)
Vec_IntWriteEntry
(
vMap
,
Cba_ObjName
(
p
,
iObj
),
0
);
Cba_NtkForEachPo
(
p
,
iObj
,
i
)
Vec_IntWriteEntry
(
vMap
,
Cba_ObjName
(
p
,
iObj
),
0
);
Cba_NtkForEachBox
(
p
,
iObj
)
{
if
(
Cba_ObjName
(
p
,
iTerm
)
)
continue
;
assert
(
Cba_ObjName
(
p
,
Cba_ObjFanin
(
p
,
iTerm
))
);
Cba_ObjSetName
(
p
,
iTerm
,
Cba_ObjName
(
p
,
Cba_ObjFanin
(
p
,
iTerm
))
);
Cba_BoxForEachBi
(
p
,
iObj
,
iTerm
,
i
)
Vec_IntWriteEntry
(
vMap
,
Cba_ObjName
(
p
,
iTerm
),
0
)
;
Cba_BoxForEachBo
(
p
,
iObj
,
iTerm
,
i
)
Vec_IntWriteEntry
(
vMap
,
Cba_ObjName
(
p
,
iTerm
),
0
);
}
}
void
Cba_ManAssignInternNames
(
Cba_Man_t
*
p
)
{
Vec_Int_t
*
vMap
=
Vec_IntStart
(
Cba_ManObjNum
(
p
)
);
Cba_Ntk_t
*
pNtk
;
int
i
;
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManAssignInternNamesNtk
(
pNtk
);
Cba_ManAssignInternNamesNtk
(
pNtk
,
vMap
);
Vec_IntFree
(
vMap
);
}
...
...
src/base/cba/cbaPrsBuild.c
View file @
e363727c
...
...
@@ -262,7 +262,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
iTerm
=
Cba_BoxBi
(
pNew
,
iObj
,
i
/
2
);
if
(
Vec_IntEntry
(
vMap
,
NameId
)
==
-
1
)
{
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C
0
,
0
,
1
,
-
1
);
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C
F
,
0
,
1
,
-
1
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
iConst0
+
1
);
if
(
iNonDriven
==
-
1
)
iNonDriven
=
NameId
;
...
...
@@ -284,7 +284,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
iTerm
=
Cba_BoxBi
(
pNew
,
iObj
,
Index
);
if
(
Vec_IntEntry
(
vMap
,
NameId
)
==
-
1
)
{
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C
0
,
0
,
1
,
-
1
);
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C
F
,
0
,
1
,
-
1
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
iConst0
+
1
);
if
(
iNonDriven
==
-
1
)
iNonDriven
=
NameId
;
...
...
@@ -305,7 +305,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
iTerm
=
Cba_BoxBi
(
pNew
,
iObj
,
i
/
2
);
if
(
Vec_IntEntry
(
vMap
,
NameId
)
==
-
1
)
{
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C
0
,
0
,
1
,
-
1
);
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C
F
,
0
,
1
,
-
1
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
iConst0
+
1
);
if
(
iNonDriven
==
-
1
)
iNonDriven
=
NameId
;
...
...
@@ -319,7 +319,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
Prs_NtkForEachPo
(
pNtk
,
NameId
,
i
)
if
(
Vec_IntEntry
(
vMap
,
NameId
)
==
-
1
)
{
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C
0
,
0
,
1
,
-
1
);
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C
F
,
0
,
1
,
-
1
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
iConst0
+
1
);
if
(
iNonDriven
==
-
1
)
iNonDriven
=
NameId
;
...
...
src/base/cba/cbaPtrAbc.c
View file @
e363727c
...
...
@@ -240,8 +240,8 @@ void Ptr_ManExperiment( Abc_Ntk_t * pNtk )
***********************************************************************/
static
inline
int
Ptr_NameToType
(
char
*
pSop
)
{
if
(
!
strcmp
(
pSop
,
"Const0T"
)
)
return
CBA_BOX_C
0
;
if
(
!
strcmp
(
pSop
,
"Const1T"
)
)
return
CBA_BOX_C
1
;
if
(
!
strcmp
(
pSop
,
"Const0T"
)
)
return
CBA_BOX_C
F
;
if
(
!
strcmp
(
pSop
,
"Const1T"
)
)
return
CBA_BOX_C
T
;
if
(
!
strcmp
(
pSop
,
"BufT"
)
)
return
CBA_BOX_BUF
;
if
(
!
strcmp
(
pSop
,
"InvT"
)
)
return
CBA_BOX_INV
;
if
(
!
strcmp
(
pSop
,
"AndT"
)
)
return
CBA_BOX_AND
;
...
...
src/base/cba/cbaReadVer.c
View file @
e363727c
...
...
@@ -183,7 +183,7 @@ const char * s_KnownModules[100] = {
static
inline
int
Prs_ManIsKnownModule
(
Prs_Man_t
*
p
,
char
*
pName
)
{
int
i
;
for
(
i
=
CBA_BOX_C
0
;
s_KnownModules
[
i
];
i
++
)
for
(
i
=
CBA_BOX_C
F
;
s_KnownModules
[
i
];
i
++
)
if
(
!
strncmp
(
pName
,
s_KnownModules
[
i
],
strlen
(
s_KnownModules
[
i
]))
)
return
i
;
return
0
;
...
...
src/base/cba/cbaWriteVer.c
View file @
e363727c
...
...
@@ -275,6 +275,54 @@ void Cba_ManWriteVerilogBoxes( FILE * pFile, Cba_Ntk_t * p )
fprintf
(
pFile
,
"%s.%s(%s)"
,
Cba_BoxBiNum
(
p
,
i
)
?
", "
:
""
,
Mio_GateReadOutName
(
pGate
),
Cba_ObjNameStr
(
p
,
iTerm
)
);
fprintf
(
pFile
,
");
\n
"
);
}
else
if
(
Cba_BoxNtkId
(
p
,
i
)
)
{
int
pRanges
[
8
];
char
pSymbs
[
8
];
char
*
pName
=
Cba_BoxNtkName
(
p
,
i
);
int
nSigs
=
Cba_NtkNameRanges
(
pName
,
pRanges
,
pSymbs
);
int
s
,
k
,
iTerm
,
nInputs
=
0
;
fprintf
(
pFile
,
" %s ( "
,
pName
);
for
(
s
=
0
;
s
<
nSigs
-
1
;
s
++
)
{
fprintf
(
pFile
,
"%s.%c("
,
nInputs
?
", "
:
""
,
pSymbs
[
s
]
);
if
(
pRanges
[
s
]
==
1
)
{
iTerm
=
Cba_BoxBi
(
p
,
i
,
nInputs
++
);
fprintf
(
pFile
,
"%s"
,
Cba_ObjNameStr
(
p
,
iTerm
)
);
}
else
{
assert
(
pRanges
[
s
]
>
1
);
fprintf
(
pFile
,
"{"
);
for
(
k
=
0
;
k
<
pRanges
[
s
];
k
++
)
{
iTerm
=
Cba_BoxBi
(
p
,
i
,
nInputs
++
);
fprintf
(
pFile
,
"%s%s"
,
k
?
", "
:
""
,
Cba_ObjNameStr
(
p
,
iTerm
)
);
}
fprintf
(
pFile
,
"}"
);
}
fprintf
(
pFile
,
")"
);
}
assert
(
nInputs
==
Cba_BoxBiNum
(
p
,
i
)
);
fprintf
(
pFile
,
"%s.%c("
,
nInputs
?
", "
:
""
,
pSymbs
[
nSigs
-
1
]
);
if
(
pRanges
[
nSigs
-
1
]
==
1
)
{
iTerm
=
Cba_BoxBo
(
p
,
i
,
0
);
fprintf
(
pFile
,
"%s"
,
Cba_ObjNameStr
(
p
,
iTerm
)
);
}
else
{
assert
(
pRanges
[
nSigs
-
1
]
>
1
);
fprintf
(
pFile
,
"{"
);
for
(
k
=
0
;
k
<
pRanges
[
nSigs
-
1
];
k
++
)
{
iTerm
=
Cba_BoxBo
(
p
,
i
,
k
);
fprintf
(
pFile
,
"%s%s"
,
k
?
", "
:
""
,
Cba_ObjNameStr
(
p
,
iTerm
)
);
}
fprintf
(
pFile
,
"}"
);
}
fprintf
(
pFile
,
") );
\n
"
);
}
else
{
Cba_ObjType_t
Type
=
Cba_ObjType
(
p
,
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