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
e27edf5e
Commit
e27edf5e
authored
Jan 15, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various transformations of Cba_Ntk_t.
parent
8ac8923a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
196 deletions
+86
-196
src/base/cba/cba.h
+0
-0
src/base/cba/cbaBlast.c
+0
-0
src/base/cba/cbaBuild.c
+0
-0
src/base/cba/cbaNtk.c
+49
-78
src/base/cba/cbaSimple.c
+35
-78
src/base/cba/cbaWriteBlif.c
+1
-1
src/base/cba/cbaWriteVer.c
+1
-39
No files found.
src/base/cba/cba.h
View file @
e27edf5e
This diff is collapsed.
Click to expand it.
src/base/cba/cbaBlast.c
View file @
e27edf5e
This diff is collapsed.
Click to expand it.
src/base/cba/cbaBuild.c
View file @
e27edf5e
This diff is collapsed.
Click to expand it.
src/base/cba/cbaNtk.c
View file @
e27edf5e
...
...
@@ -47,7 +47,7 @@ void Cba_ManAssignInternNamesNtk( Cba_Ntk_t * p )
int
nDigits
=
Abc_Base10Log
(
Cba_NtkObjNum
(
p
)
);
Cba_NtkForEachObjType
(
p
,
Type
,
i
)
{
if
(
Type
==
CBA_OBJ_NODE
)
if
(
Type
==
CBA_OBJ_NODE
&&
Cba_ObjNameId
(
p
,
i
)
==
-
1
)
{
char
Buffer
[
100
];
sprintf
(
Buffer
,
"%s%0*d"
,
"_n_"
,
nDigits
,
i
);
...
...
@@ -92,20 +92,6 @@ int Cba_ManObjNum( Cba_Man_t * p )
}
return
Count
;
}
void
Cba_ManSetNtkBoxes
(
Cba_Man_t
*
p
)
{
Cba_Ntk_t
*
pNtk
,
*
pBox
;
int
i
,
k
,
Type
;
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkForEachObjType
(
pNtk
,
Type
,
k
)
if
(
Type
==
CBA_OBJ_BOX
)
{
pBox
=
Cba_ObjBoxModel
(
pNtk
,
k
);
assert
(
pBox
->
iBoxNtk
==
0
);
pBox
->
iBoxNtk
=
i
;
pBox
->
iBoxObj
=
k
;
}
}
/**Function*************************************************************
...
...
@@ -118,61 +104,74 @@ void Cba_ManSetNtkBoxes( Cba_Man_t * p )
SeeAlso []
***********************************************************************/
void
Cba_ObjDup
(
Cba_Ntk_t
*
pNew
,
Cba_Ntk_t
*
p
,
int
iObj
)
// duplicate PI/PO/boxes
void
Cba_ObjDupStart
(
Cba_Ntk_t
*
pNew
,
Cba_Ntk_t
*
p
,
int
iObj
)
{
if
(
Cba_ObjIsPi
(
p
,
iObj
)
)
Vec_IntWriteEntry
(
&
pNew
->
vInputs
,
Cba_ObjFuncId
(
p
New
,
iObj
),
pNew
->
nObjs
);
Vec_IntWriteEntry
(
&
pNew
->
vInputs
,
Cba_ObjFuncId
(
p
,
iObj
),
pNew
->
nObjs
);
if
(
Cba_ObjIsPo
(
p
,
iObj
)
)
Vec_IntWriteEntry
(
&
pNew
->
vOutputs
,
Cba_ObjFuncId
(
pNew
,
iObj
),
pNew
->
nObjs
);
if
(
Cba_ObjIsBox
(
p
,
iObj
)
)
Vec_IntPush
(
&
pNew
->
vBoxes
,
pNew
->
nObjs
);
Vec_IntWriteEntry
(
&
pNew
->
vOutputs
,
Cba_ObjFuncId
(
p
,
iObj
),
pNew
->
nObjs
);
Vec_IntWriteEntry
(
&
pNew
->
vTypes
,
pNew
->
nObjs
,
Cba_ObjType
(
p
,
iObj
)
);
Vec_IntWriteEntry
(
&
pNew
->
vFuncs
,
pNew
->
nObjs
,
Cba_ObjFuncId
(
p
New
,
iObj
)
);
Vec_IntWriteEntry
(
&
pNew
->
vFuncs
,
pNew
->
nObjs
,
Cba_ObjFuncId
(
p
,
iObj
)
);
Vec_IntWriteEntry
(
&
pNew
->
vNameIds
,
pNew
->
nObjs
,
Cba_ObjNameId
(
p
,
iObj
)
);
if
(
Cba_ObjIsBox
(
p
,
iObj
)
)
Cba_NtkSetHost
(
Cba_ObjBoxModel
(
pNew
,
pNew
->
nObjs
),
Cba_NtkId
(
pNew
),
pNew
->
nObjs
);
if
(
Cba_ObjIsBox
(
p
,
iObj
)
)
Vec_IntPush
(
&
pNew
->
vBoxes
,
pNew
->
nObjs
);
Cba_NtkSetCopy
(
p
,
iObj
,
pNew
->
nObjs
++
);
}
// allocates memory
Cba_Ntk_t
*
Cba_NtkDupAlloc
(
Cba_Man_t
*
pNew
,
Cba_Ntk_t
*
pNtk
,
int
nObjs
)
{
Cba_Ntk_t
*
pNtkNew
=
Cba_NtkAlloc
(
pNew
,
Cba_NtkName
(
pNtk
)
);
Cba_ManFetchArray
(
pNew
,
&
pNtkNew
->
vInputs
,
Cba_NtkPiNum
(
pNtk
)
);
Cba_ManFetchArray
(
pNew
,
&
pNtkNew
->
vOutputs
,
Cba_NtkPoNum
(
pNtk
)
);
Cba_ManFetchArray
(
pNew
,
&
pNtkNew
->
vTypes
,
nObjs
);
Cba_ManFetchArray
(
pNew
,
&
pNtkNew
->
vFuncs
,
nObjs
);
Cba_ManFetchArray
(
pNew
,
&
pNtkNew
->
vFanins
,
nObjs
);
Cba_ManFetchArray
(
pNew
,
&
pNtkNew
->
vNameIds
,
nObjs
);
Cba_ManFetchArray
(
pNew
,
&
pNtkNew
->
vBoxes
,
Cba_NtkBoxNum
(
pNtk
)
);
Vec_IntShrink
(
&
pNtkNew
->
vBoxes
,
0
);
return
pNtkNew
;
}
// duplicate PI/PO/boxes
int
Cba_NtkDupStart
(
Cba_Ntk_t
*
pNew
,
Cba_Ntk_t
*
p
)
void
Cba_NtkDupStart
(
Cba_Ntk_t
*
pNew
,
Cba_Ntk_t
*
p
)
{
int
i
,
k
,
iObj
;
int
i
,
k
,
iObj
,
iTerm
;
assert
(
Vec_IntSize
(
&
pNew
->
vBoxes
)
==
0
);
pNew
->
nObjs
=
0
;
Cba_NtkForEachPi
(
p
,
iObj
,
i
)
Cba_ObjDup
(
pNew
,
p
,
iObj
);
Cba_ObjDup
Start
(
pNew
,
p
,
iObj
);
Cba_NtkForEachPo
(
p
,
iObj
,
i
)
Cba_ObjDup
(
pNew
,
p
,
iObj
);
Cba_ObjDup
Start
(
pNew
,
p
,
iObj
);
Cba_NtkForEachBox
(
p
,
iObj
,
i
)
{
Cba_Ntk_t
*
pBox
=
Cba_ObjBoxModel
(
p
,
iObj
);
for
(
k
=
0
;
k
<
Cba_NtkPiNum
(
pBox
);
k
++
)
Cba_ObjDup
(
pNew
,
p
,
Cba_ObjBoxBi
(
p
,
iObj
,
k
)
);
Cba_ObjDup
(
pNew
,
p
,
iObj
);
for
(
k
=
0
;
k
<
Cba_NtkPoNum
(
pBox
);
k
++
)
Cba_ObjDup
(
pNew
,
p
,
Cba_ObjBoxBo
(
p
,
iObj
,
k
)
);
Cba_BoxForEachBi
(
p
,
iObj
,
iTerm
,
k
)
Cba_ObjDup
Start
(
pNew
,
p
,
iTerm
);
Cba_ObjDup
Start
(
pNew
,
p
,
iObj
);
Cba_BoxForEachBo
(
p
,
iObj
,
iTerm
,
k
)
Cba_ObjDup
Start
(
pNew
,
p
,
iTerm
);
}
return
pNew
->
nObjs
;
assert
(
Cba_NtkBoxNum
(
p
)
==
Cba_NtkBoxNum
(
pNew
)
);
}
Cba_Man_t
*
Cba_ManDupStart
(
Cba_Man_t
*
p
,
Vec_Int_t
*
vNtkSizes
)
{
Cba_Ntk_t
*
pNtk
;
int
i
;
Cba_Man_t
*
pNew
=
Cba_ManClone
(
p
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkResize
(
Cba_ManNtk
(
pNew
,
i
),
vNtkSizes
?
Vec_IntEntry
(
vNtkSizes
,
i
)
:
Cba_NtkObjNum
(
pNtk
)
);
Vec_IntFill
(
&
p
->
vCopies
,
Cba_ManObjNum
(
p
),
-
1
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkDupStart
(
Cba_ManNtk
(
pNew
,
i
),
pNtk
);
return
pNew
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
// duplicate internal nodes
void
Cba_NtkDupNodes
(
Cba_Ntk_t
*
pNew
,
Cba_Ntk_t
*
p
,
Vec_Int_t
*
vTemp
)
{
Vec_Int_t
*
vFanins
;
int
i
,
k
,
Type
,
iTerm
,
iObj
;
// dup nodes
Cba_NtkForEachNode
(
p
,
iObj
)
Cba_ObjDup
(
pNew
,
p
,
iObj
);
Cba_ObjDupStart
(
pNew
,
p
,
iObj
);
assert
(
pNew
->
nObjs
==
Cba_NtkObjNum
(
pNew
)
);
// connect
Cba_NtkForEachObjType
(
p
,
Type
,
i
)
{
...
...
@@ -190,33 +189,6 @@ void Cba_NtkDupNodes( Cba_Ntk_t * pNew, Cba_Ntk_t * p, Vec_Int_t * vTemp )
Vec_IntPush
(
vTemp
,
Cba_NtkCopy
(
p
,
iTerm
)
);
Vec_IntWriteEntry
(
&
pNew
->
vFanins
,
Cba_NtkCopy
(
p
,
i
),
Cba_ManHandleArray
(
pNew
->
pDesign
,
vTemp
)
);
}
}
// finalize network
void
Cba_NtkDupFinish
(
Cba_Ntk_t
*
pNew
)
{
int
iObj
;
// add constant drivers
Cba_NtkForEachCo
(
pNew
,
iObj
)
{
}
// restrict
Vec_IntShrink
(
&
pNew
->
vTypes
,
pNew
->
nObjs
);
Vec_IntShrink
(
&
pNew
->
vFuncs
,
pNew
->
nObjs
);
Vec_IntShrink
(
&
pNew
->
vFanins
,
pNew
->
nObjs
);
Vec_IntShrink
(
&
pNew
->
vNameIds
,
pNew
->
nObjs
);
}
Cba_Man_t
*
Cba_ManDupStart
(
Cba_Man_t
*
p
,
Vec_Int_t
*
vObjCounts
)
{
Cba_Ntk_t
*
pNtk
;
int
i
;
Cba_Man_t
*
pNew
=
Cba_ManAlloc
(
Cba_ManName
(
p
)
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkDupAlloc
(
pNew
,
pNtk
,
vObjCounts
?
Cba_NtkObjNum
(
pNtk
)
:
Vec_IntEntry
(
vObjCounts
,
i
)
);
Vec_IntFill
(
&
p
->
vCopies
,
Cba_ManObjNum
(
pNew
),
-
1
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkDupStart
(
Cba_ManNtk
(
pNew
,
i
),
pNtk
);
return
pNew
;
}
Cba_Man_t
*
Cba_ManDup
(
Cba_Man_t
*
p
)
{
...
...
@@ -225,13 +197,12 @@ Cba_Man_t * Cba_ManDup( Cba_Man_t * p )
Cba_Man_t
*
pNew
=
Cba_ManDupStart
(
p
,
NULL
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkDupNodes
(
Cba_ManNtk
(
pNew
,
i
),
pNtk
,
vTemp
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_NtkDupFinish
(
Cba_ManNtk
(
pNew
,
i
)
);
Vec_IntClear
(
vTemp
);
Vec_IntFree
(
vTemp
);
return
pNew
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/base/cba/cbaSimple.c
View file @
e27edf5e
...
...
@@ -36,33 +36,6 @@ node = array containing output name, followed by node type, followed by input
box = array containing model name, instance name, followed by pairs of formal/actual names for each port
*/
typedef
enum
{
PTR_OBJ_NONE
,
// 0: non-existent object
PTR_OBJ_CONST0
,
// 1: constant node
PTR_OBJ_PI
,
// 2: primary input
PTR_OBJ_PO
,
// 3: primary output
PTR_OBJ_FAN
,
// 4: box output
PTR_OBJ_FLOP
,
// 5: flip-flop
PTR_OBJ_BOX
,
// 6: box
PTR_OBJ_NODE
,
// 7: logic node
PTR_OBJ_C0
,
// 8: logic node
PTR_OBJ_C1
,
// 9: logic node
PTR_OBJ_BUF
,
// 0: logic node
PTR_OBJ_INV
,
// 1: logic node
PTR_OBJ_AND
,
// 2: logic node
PTR_OBJ_OR
,
// 3: logic node
PTR_OBJ_XOR
,
// 4: logic node
PTR_OBJ_NAND
,
// 5: logic node
PTR_OBJ_NOR
,
// 6: logic node
PTR_OBJ_XNOR
,
// 7: logic node
PTR_OBJ_MUX
,
// 8: logic node
PTR_OBJ_MAJ
,
// 9: logic node
PTR_VOID
// 0: placeholder
}
Ptr_ObjType_t
;
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
...
...
@@ -78,44 +51,7 @@ typedef enum {
SeeAlso []
***********************************************************************/
char
*
Ptr_TypeToName
(
Ptr_ObjType_t
Type
)
{
if
(
Type
==
PTR_OBJ_BUF
)
return
"buf"
;
if
(
Type
==
PTR_OBJ_INV
)
return
"not"
;
if
(
Type
==
PTR_OBJ_AND
)
return
"and"
;
if
(
Type
==
PTR_OBJ_OR
)
return
"or"
;
if
(
Type
==
PTR_OBJ_XOR
)
return
"xor"
;
if
(
Type
==
PTR_OBJ_XNOR
)
return
"xnor"
;
assert
(
0
);
return
"???"
;
}
char
*
Ptr_TypeToSop
(
int
Type
)
{
if
(
Type
==
PTR_OBJ_BUF
)
return
"1 1
\n
"
;
if
(
Type
==
PTR_OBJ_INV
)
return
"0 1
\n
"
;
if
(
Type
==
PTR_OBJ_AND
)
return
"11 1
\n
"
;
if
(
Type
==
PTR_OBJ_OR
)
return
"00 0
\n
"
;
if
(
Type
==
PTR_OBJ_XOR
)
return
"01 1
\n
10 1
\n
"
;
if
(
Type
==
PTR_OBJ_XNOR
)
return
"00 1
\n
11 1
\n
"
;
assert
(
0
);
return
"???"
;
}
Ptr_ObjType_t
Ptr_SopToType
(
char
*
pSop
)
{
if
(
!
strcmp
(
pSop
,
"1 1
\n
"
)
)
return
PTR_OBJ_BUF
;
if
(
!
strcmp
(
pSop
,
"0 1
\n
"
)
)
return
PTR_OBJ_INV
;
if
(
!
strcmp
(
pSop
,
"11 1
\n
"
)
)
return
PTR_OBJ_AND
;
if
(
!
strcmp
(
pSop
,
"00 0
\n
"
)
)
return
PTR_OBJ_OR
;
if
(
!
strcmp
(
pSop
,
"-1 1
\n
1- 1
\n
"
)
)
return
PTR_OBJ_OR
;
if
(
!
strcmp
(
pSop
,
"1- 1
\n
-1 1
\n
"
)
)
return
PTR_OBJ_OR
;
if
(
!
strcmp
(
pSop
,
"01 1
\n
10 1
\n
"
)
)
return
PTR_OBJ_XOR
;
if
(
!
strcmp
(
pSop
,
"10 1
\n
01 1
\n
"
)
)
return
PTR_OBJ_XOR
;
if
(
!
strcmp
(
pSop
,
"11 1
\n
00 1
\n
"
)
)
return
PTR_OBJ_XNOR
;
if
(
!
strcmp
(
pSop
,
"00 1
\n
11 1
\n
"
)
)
return
PTR_OBJ_XNOR
;
assert
(
0
);
return
PTR_OBJ_NONE
;
}
Ptr_ObjType_t
Ptr_HopToType
(
Abc_Obj_t
*
pObj
)
Cba_NodeType_t
Ptr_HopToType
(
Abc_Obj_t
*
pObj
)
{
static
word
uTruth
,
uTruths6
[
3
]
=
{
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
),
...
...
@@ -124,14 +60,14 @@ Ptr_ObjType_t Ptr_HopToType( Abc_Obj_t * pObj )
};
assert
(
Abc_ObjIsNode
(
pObj
)
);
uTruth
=
Hop_ManComputeTruth6
(
(
Hop_Man_t
*
)
Abc_ObjNtk
(
pObj
)
->
pManFunc
,
(
Hop_Obj_t
*
)
pObj
->
pData
,
Abc_ObjFaninNum
(
pObj
)
);
if
(
uTruth
==
uTruths6
[
0
]
)
return
PTR_OBJ
_BUF
;
if
(
uTruth
==
~
uTruths6
[
0
]
)
return
PTR_OBJ
_INV
;
if
(
uTruth
==
(
uTruths6
[
0
]
&
uTruths6
[
1
])
)
return
PTR_OBJ
_AND
;
if
(
uTruth
==
(
uTruths6
[
0
]
|
uTruths6
[
1
])
)
return
PTR_OBJ
_OR
;
if
(
uTruth
==
(
uTruths6
[
0
]
^
uTruths6
[
1
])
)
return
PTR_OBJ
_XOR
;
if
(
uTruth
==
(
uTruths6
[
0
]
^~
uTruths6
[
1
])
)
return
PTR_OBJ
_XNOR
;
if
(
uTruth
==
uTruths6
[
0
]
)
return
CBA_NODE
_BUF
;
if
(
uTruth
==
~
uTruths6
[
0
]
)
return
CBA_NODE
_INV
;
if
(
uTruth
==
(
uTruths6
[
0
]
&
uTruths6
[
1
])
)
return
CBA_NODE
_AND
;
if
(
uTruth
==
(
uTruths6
[
0
]
|
uTruths6
[
1
])
)
return
CBA_NODE
_OR
;
if
(
uTruth
==
(
uTruths6
[
0
]
^
uTruths6
[
1
])
)
return
CBA_NODE
_XOR
;
if
(
uTruth
==
(
uTruths6
[
0
]
^~
uTruths6
[
1
])
)
return
CBA_NODE
_XNOR
;
assert
(
0
);
return
PTR_OBJ
_NONE
;
return
CBA_NODE
_NONE
;
}
/**Function*************************************************************
...
...
@@ -315,11 +251,9 @@ void Ptr_ManDumpModuleBlif( FILE * pFile, Vec_Ptr_t * vNtk )
fprintf
(
pFile
,
"
\n
"
);
fprintf
(
pFile
,
".outputs"
);
Ptr_ManDumpSignalsBlif
(
pFile
,
(
Vec_Ptr_t
*
)
Vec_PtrEntry
(
vNtk
,
2
),
1
);
fprintf
(
pFile
,
"
\n\n
"
);
Ptr_ManDumpNodesBlif
(
pFile
,
(
Vec_Ptr_t
*
)
Vec_PtrEntry
(
vNtk
,
3
)
);
fprintf
(
pFile
,
"
\n
"
);
Ptr_ManDumpNodesBlif
(
pFile
,
(
Vec_Ptr_t
*
)
Vec_PtrEntry
(
vNtk
,
3
)
);
Ptr_ManDumpBoxesBlif
(
pFile
,
(
Vec_Ptr_t
*
)
Vec_PtrEntry
(
vNtk
,
4
)
);
fprintf
(
pFile
,
"
\n
"
);
fprintf
(
pFile
,
".end
\n\n
"
);
}
void
Ptr_ManDumpBlif
(
char
*
pFileName
,
Vec_Ptr_t
*
vDes
)
...
...
@@ -352,7 +286,7 @@ void Ptr_ManDumpBlif( char * pFileName, Vec_Ptr_t * vDes )
void
Ptr_ManDumpNodeVerilog
(
FILE
*
pFile
,
Vec_Ptr_t
*
vNode
)
{
char
*
pName
;
int
i
;
fprintf
(
pFile
,
"%s"
,
Ptr_TypeToName
(
(
Ptr_Obj
Type_t
)
Abc_Ptr2Int
(
Vec_PtrEntry
(
vNode
,
1
))
)
);
fprintf
(
pFile
,
"%s"
,
Ptr_TypeToName
(
(
Cba_Node
Type_t
)
Abc_Ptr2Int
(
Vec_PtrEntry
(
vNode
,
1
))
)
);
fprintf
(
pFile
,
"( %s"
,
(
char
*
)
Vec_PtrEntry
(
vNode
,
0
)
);
Vec_PtrForEachEntryStart
(
char
*
,
vNode
,
pName
,
i
,
2
)
fprintf
(
pFile
,
", %s"
,
pName
);
...
...
@@ -651,7 +585,7 @@ void Cba_PrsReadNodes( Cba_Man_t * p, Vec_Ptr_t * vNodes, Vec_Int_t * vTypesCur,
Vec_PtrForEachEntry
(
Vec_Ptr_t
*
,
vNodes
,
vNode
,
i
)
{
Vec_IntPush
(
vTypesCur
,
CBA_OBJ_NODE
);
Vec_IntPush
(
vFuncsCur
,
(
Ptr_Obj
Type_t
)
Abc_Ptr2Int
(
Vec_PtrEntry
(
vNode
,
1
))
);
Vec_IntPush
(
vFuncsCur
,
(
Cba_Node
Type_t
)
Abc_Ptr2Int
(
Vec_PtrEntry
(
vNode
,
1
))
);
Vec_IntPush
(
vInstIdsCur
,
0
);
Vec_IntPush
(
vFaninsCur
,
Cba_ManHandleArray
(
p
,
Cba_PrsReadList
(
p
,
vNode
,
vList
,
1
,
-
1
))
);
}
...
...
@@ -676,6 +610,7 @@ void Cba_PrsReadModule( Cba_Man_t * p, Vec_Ptr_t * vNtk )
Vec_Int_t
*
vInstIdsCur
=
Vec_IntAlloc
(
1000
);
Vec_Int_t
*
vFaninsCur
=
Vec_IntAlloc
(
1000
);
Vec_Int_t
*
vList
=
Vec_IntAlloc
(
1000
);
Vec_Int_t
*
vBoxes
=
Vec_IntStart
(
Vec_PtrSize
((
Vec_Ptr_t
*
)
Vec_PtrEntry
(
vNtk
,
4
))
);
Cba_Ntk_t
*
pNtk
=
Cba_NtkAlloc
(
p
,
(
char
*
)
Vec_PtrEntry
(
vNtk
,
0
)
);
Cba_PrsReadList
(
p
,
(
Vec_Ptr_t
*
)
Vec_PtrEntry
(
vNtk
,
1
),
vInputsCur
,
-
1
,
-
1
);
...
...
@@ -689,6 +624,7 @@ void Cba_PrsReadModule( Cba_Man_t * p, Vec_Ptr_t * vNtk )
Cba_ManSetupArray
(
p
,
&
pNtk
->
vFuncs
,
vFuncsCur
);
Cba_ManSetupArray
(
p
,
&
pNtk
->
vInstIds
,
vInstIdsCur
);
Cba_ManSetupArray
(
p
,
&
pNtk
->
vFanins
,
vFaninsCur
);
Cba_ManSetupArray
(
p
,
&
pNtk
->
vBoxes
,
vBoxes
);
Vec_IntFree
(
vInputsCur
);
Vec_IntFree
(
vOutputsCur
);
...
...
@@ -697,6 +633,7 @@ void Cba_PrsReadModule( Cba_Man_t * p, Vec_Ptr_t * vNtk )
Vec_IntFree
(
vInstIdsCur
);
Vec_IntFree
(
vFaninsCur
);
Vec_IntFree
(
vList
);
Vec_IntFree
(
vBoxes
);
}
Cba_Man_t
*
Cba_PrsReadPtr
(
Vec_Ptr_t
*
vDes
)
{
...
...
@@ -721,6 +658,7 @@ Cba_Man_t * Cba_PrsReadPtr( Vec_Ptr_t * vDes )
***********************************************************************/
void
Cba_ManReadDesExperiment
(
Abc_Ntk_t
*
pNtk
)
{
extern
Cba_Man_t
*
Cba_ManBlastTest
(
Cba_Man_t
*
p
);
abctime
clk
=
Abc_Clock
();
Cba_Man_t
*
p
,
*
pTemp
;
char
*
pFileName
;
...
...
@@ -751,9 +689,28 @@ void Cba_ManReadDesExperiment( Abc_Ntk_t * pNtk )
// dump
pFileName
=
Extra_FileNameGenericAppend
(
pNtk
->
pDesign
->
pName
,
"_out3.blif"
);
Cba_ManWriteBlif
(
pFileName
,
p
);
Cba_ManFree
(
p
);
printf
(
"Finished writing output file
\"
%s
\"
. "
,
pFileName
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
// duplicate CBA
p
=
Cba_ManDup
(
pTemp
=
p
);
Cba_ManFree
(
pTemp
);
// dump
pFileName
=
Extra_FileNameGenericAppend
(
pNtk
->
pDesign
->
pName
,
"_out4.blif"
);
Cba_ManWriteBlif
(
pFileName
,
p
);
printf
(
"Finished writing output file
\"
%s
\"
. "
,
pFileName
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
// CBA->GIA->CBA
p
=
Cba_ManBlastTest
(
pTemp
=
p
);
Cba_ManFree
(
pTemp
);
// dump
pFileName
=
Extra_FileNameGenericAppend
(
pNtk
->
pDesign
->
pName
,
"_out5.blif"
);
Cba_ManWriteBlif
(
pFileName
,
p
);
printf
(
"Finished writing output file
\"
%s
\"
. "
,
pFileName
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
Cba_ManFree
(
p
);
}
////////////////////////////////////////////////////////////////////////
...
...
src/base/cba/cbaWriteBlif.c
View file @
e27edf5e
...
...
@@ -75,7 +75,7 @@ void Cba_PrsWriteBlifLines( FILE * pFile, Cba_Ntk_t * p )
else
if
(
Type
==
CBA_OBJ_BOX
)
// .names/assign/box2 (no formal/actual binding)
{
fprintf
(
pFile
,
".subckt"
);
fprintf
(
pFile
,
" %s"
,
Cba_
ObjFuncStr
(
p
,
i
)
);
fprintf
(
pFile
,
" %s"
,
Cba_
NtkName
(
Cba_ObjBoxModel
(
p
,
i
)
)
);
Cba_PrsWriteBlifArray2
(
pFile
,
p
,
Cba_ObjFaninVec
(
p
,
i
)
);
}
else
if
(
Type
==
CBA_OBJ_LATCH
)
// .names/assign/box2 (no formal/actual binding)
...
...
src/base/cba/cbaWriteVer.c
View file @
e27edf5e
...
...
@@ -26,44 +26,6 @@ ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/*
// node types during parsing
typedef enum {
CBA_NODE_NONE = 0, // 0: unused
CBA_NODE_CONST, // 1: constant
CBA_NODE_BUF, // 2: buffer
CBA_NODE_INV, // 3: inverter
CBA_NODE_AND, // 4: AND
CBA_NODE_OR, // 5: OR
CBA_NODE_XOR, // 6: XOR
CBA_NODE_NAND, // 7: NAND
CBA_NODE_NOR, // 8: NOR
CBA_NODE_XNOR, // 9 .XNOR
CBA_NODE_MUX, // 10: MUX
CBA_NODE_MAJ, // 11: MAJ
CBA_NODE_KNOWN // 12: unknown
CBA_NODE_UNKNOWN // 13: unknown
} Cba_NodeType_t;
*/
const
char
*
s_NodeTypes
[
CBA_NODE_UNKNOWN
+
1
]
=
{
NULL
,
// 0: unused
"const"
,
// 1: constant
"buf"
,
// 2: buffer
"not"
,
// 3: inverter
"and"
,
// 4: AND
"nand"
,
// 5: OR
"or"
,
// 6: XOR
"nor"
,
// 7: NAND
"xor"
,
// 8: NOR
"xnor"
,
// 9: .XNOR
"mux"
,
// 10: MUX
"maj"
,
// 11: MAJ
"???"
// 12: known
"???"
// 13: unknown
};
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
...
...
@@ -139,7 +101,7 @@ void Cba_PrsWriteVerilogNodes( FILE * pFile, Cba_Ntk_t * p )
Func
=
Cba_ObjFuncId
(
p
,
i
);
if
(
Func
>=
CBA_NODE_BUF
&&
Func
<=
CBA_NODE_XNOR
)
{
fprintf
(
pFile
,
" %s ("
,
s_NodeTypes
[
Func
]
);
fprintf
(
pFile
,
" %s ("
,
Ptr_TypeToName
(
Func
)
);
Cba_PrsWriteVerilogArray2
(
pFile
,
p
,
Cba_ObjFaninVec
(
p
,
i
)
);
fprintf
(
pFile
,
");
\n
"
);
}
...
...
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