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
089a8bbf
Commit
089a8bbf
authored
Feb 09, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several improvements to CBA data-structure.
parent
fd877c3f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
126 additions
and
35 deletions
+126
-35
src/base/cba/cba.h
+1
-0
src/base/cba/cbaBlast.c
+12
-0
src/base/cba/cbaNtk.c
+2
-4
src/base/cba/cbaPrs.h
+1
-1
src/base/cba/cbaPrsBuild.c
+108
-28
src/base/cba/cbaReadVer.c
+1
-1
src/base/cba/cbaWriteVer.c
+1
-1
No files found.
src/base/cba/cba.h
View file @
089a8bbf
...
...
@@ -757,6 +757,7 @@ extern void Abc_FrameImportPtr( Vec_Ptr_t * vPtr );
extern
Vec_Ptr_t
*
Abc_FrameExportPtr
();
/*=== cbaBlast.c =============================================================*/
extern
int
Cba_NtkBuildLibrary
(
Cba_Man_t
*
p
);
extern
Gia_Man_t
*
Cba_ManExtract
(
Cba_Man_t
*
p
,
int
fBuffers
,
int
fVerbose
);
extern
Cba_Man_t
*
Cba_ManInsertGia
(
Cba_Man_t
*
p
,
Gia_Man_t
*
pGia
);
extern
void
*
Cba_ManInsertAbc
(
Cba_Man_t
*
p
,
void
*
pAbc
);
...
...
src/base/cba/cbaBlast.c
View file @
089a8bbf
...
...
@@ -22,6 +22,7 @@
#include "base/abc/abc.h"
#include "map/mio/mio.h"
#include "bool/dec/dec.h"
#include "base/main/mainInt.h"
ABC_NAMESPACE_IMPL_START
...
...
@@ -489,6 +490,17 @@ void Cba_NtkPrepareLibrary( Cba_Man_t * p, Mio_Library_t * pLib )
Abc_NamStrFindOrAdd
(
p
->
pMods
,
Mio_GateReadName
(
pGate
),
NULL
);
assert
(
Abc_NamObjNumMax
(
p
->
pMods
)
>
1
);
}
int
Cba_NtkBuildLibrary
(
Cba_Man_t
*
p
)
{
int
RetValue
=
1
;
Mio_Library_t
*
pLib
=
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
(
Abc_FrameGetGlobalFrame
()
);
if
(
pLib
==
NULL
)
printf
(
"The standard cell library is not available.
\n
"
),
RetValue
=
0
;
else
Cba_NtkPrepareLibrary
(
p
,
pLib
);
p
->
pMioLib
=
pLib
;
return
RetValue
;
}
void
Cba_NtkInsertNtk
(
Cba_Man_t
*
p
,
Abc_Ntk_t
*
pNtk
)
{
Cba_Ntk_t
*
pCbaNtk
,
*
pRoot
=
Cba_ManRoot
(
p
);
...
...
src/base/cba/cbaNtk.c
View file @
089a8bbf
...
...
@@ -278,17 +278,15 @@ Cba_Man_t * Cba_ManCollapse( Cba_Man_t * p )
Cba_ObjAlloc
(
pRootNew
,
CBA_OBJ_PO
,
Vec_IntEntry
(
vSigs
,
i
)
);
assert
(
Cba_NtkObjNum
(
pRootNew
)
==
Cba_NtkObjNumAlloc
(
pRootNew
)
);
Vec_IntFree
(
vSigs
);
/*
// transfer PI/PO names
if
(
Cba_NtkHasNames
(
pRoot
)
)
{
Cba_NtkStartNames
(
pRootNew
);
Cba_NtkForEachP
o
( pRoot, iObj, i )
Cba_ObjSetName( pRootNew, Cba_NtkP
o
(pRootNew, i), Cba_ObjName(pRoot, iObj) );
Cba_NtkForEachP
i
(
pRoot
,
iObj
,
i
)
Cba_ObjSetName
(
pRootNew
,
Cba_NtkP
i
(
pRootNew
,
i
),
Cba_ObjName
(
pRoot
,
iObj
)
);
Cba_NtkForEachPo
(
pRoot
,
iObj
,
i
)
Cba_ObjSetName
(
pRootNew
,
Cba_NtkPo
(
pRootNew
,
i
),
Cba_ObjName
(
pRoot
,
iObj
)
);
}
*/
return
pNew
;
}
...
...
src/base/cba/cbaPrs.h
View file @
089a8bbf
...
...
@@ -100,7 +100,7 @@ struct Prs_Man_t_
char
ErrorStr
[
1000
];
// error
};
static
inline
Prs_Ntk_t
*
Prs_ManNtk
(
Vec_Ptr_t
*
vPrs
,
int
i
)
{
return
(
Prs_Ntk_t
*
)
Vec_PtrEntry
(
vPrs
,
i
);
}
static
inline
Prs_Ntk_t
*
Prs_ManNtk
(
Vec_Ptr_t
*
vPrs
,
int
i
)
{
return
i
>=
0
&&
i
<
Vec_PtrSize
(
vPrs
)
?
(
Prs_Ntk_t
*
)
Vec_PtrEntry
(
vPrs
,
i
)
:
NULL
;
}
static
inline
Prs_Ntk_t
*
Prs_ManRoot
(
Vec_Ptr_t
*
vPrs
)
{
return
Prs_ManNtk
(
vPrs
,
0
);
}
static
inline
Abc_Nam_t
*
Prs_ManNameMan
(
Vec_Ptr_t
*
vPrs
)
{
return
Prs_ManRoot
(
vPrs
)
->
pStrs
;
}
...
...
src/base/cba/cbaPrsBuild.c
View file @
089a8bbf
...
...
@@ -20,6 +20,8 @@
#include "cba.h"
#include "cbaPrs.h"
#include "map/mio/mio.h"
#include "base/main/main.h"
ABC_NAMESPACE_IMPL_START
...
...
@@ -42,6 +44,33 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
int
Prs_ManIsMapped
(
Prs_Ntk_t
*
pNtk
)
{
Vec_Int_t
*
vSigs
;
int
iBox
;
Mio_Library_t
*
pLib
=
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
(
Abc_FrameGetGlobalFrame
()
);
if
(
pLib
==
NULL
)
return
0
;
Prs_NtkForEachBox
(
pNtk
,
vSigs
,
iBox
)
if
(
!
Prs_BoxIsNode
(
pNtk
,
iBox
)
)
{
int
NtkId
=
Prs_BoxNtk
(
pNtk
,
iBox
);
if
(
Mio_LibraryReadGateByName
(
pLib
,
Prs_NtkStr
(
pNtk
,
NtkId
),
NULL
)
)
return
1
;
}
return
0
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Prs_ManVecFree
(
Vec_Ptr_t
*
vPrs
)
{
Prs_Ntk_t
*
pNtk
;
int
i
;
...
...
@@ -109,6 +138,12 @@ void Prs_ManRemapOne( Vec_Int_t * vSigs, Prs_Ntk_t * pNtkBox, Vec_Int_t * vMap )
Prs_NtkForEachPo
(
pNtkBox
,
NameId
,
i
)
Vec_IntWriteEntry
(
vMap
,
NameId
,
-
1
);
}
void
Prs_ManRemapGate
(
Vec_Int_t
*
vSigs
)
{
int
i
,
FormId
;
Vec_IntForEachEntry
(
vSigs
,
FormId
,
i
)
Vec_IntWriteEntry
(
vSigs
,
i
,
i
/
2
+
1
),
i
++
;
}
void
Prs_ManRemapBoxes
(
Cba_Man_t
*
pNew
,
Vec_Ptr_t
*
vDes
,
Prs_Ntk_t
*
pNtk
,
Vec_Int_t
*
vMap
)
{
Vec_Int_t
*
vSigs
;
int
iBox
;
...
...
@@ -118,7 +153,10 @@ void Prs_ManRemapBoxes( Cba_Man_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Ve
int
NtkId
=
Prs_BoxNtk
(
pNtk
,
iBox
);
int
NtkIdNew
=
Cba_ManNtkFindId
(
pNew
,
Prs_NtkStr
(
pNtk
,
NtkId
)
);
Prs_BoxSetNtk
(
pNtk
,
iBox
,
NtkIdNew
);
Prs_ManRemapOne
(
vSigs
,
Prs_ManNtk
(
vDes
,
NtkIdNew
),
vMap
);
if
(
NtkId
<
Cba_ManNtkNum
(
pNew
)
)
Prs_ManRemapOne
(
vSigs
,
Prs_ManNtk
(
vDes
,
NtkIdNew
),
vMap
);
else
Prs_ManRemapGate
(
vSigs
);
}
}
void
Prs_ManCleanMap
(
Prs_Ntk_t
*
pNtk
,
Vec_Int_t
*
vMap
)
...
...
@@ -157,24 +195,40 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
if
(
!
Prs_BoxIsNode
(
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
)
);
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
)
if
(
pNtkBox
==
NULL
)
{
i
++
;
if
(
--
Index
<
Prs_NtkPiNum
(
pNtkBox
)
)
continue
;
assert
(
Index
-
Prs_NtkPiNum
(
pNtkBox
)
<
Prs_NtkPoNum
(
pNtkBox
)
);
iObj
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_GATE
,
Vec_IntSize
(
vSigs
)
/
2
-
1
,
1
,
Prs_BoxNtk
(
pNtk
,
iBox
)
+
1
);
// +1 to map NtkId into gate name
Cba_ObjSetName
(
pNew
,
iObj
,
Prs_BoxName
(
pNtk
,
iBox
)
);
// consider box output
NameId
=
Vec_IntEntry
(
vSigs
,
i
);
NameId
=
Vec_IntEntry
Last
(
vSigs
);
NameId
=
Prs_NtkSigName
(
pNtk
,
NameId
);
if
(
Vec_IntEntry
(
vMap
,
NameId
)
!=
-
1
)
printf
(
"Box output name %d is already driven.
\n
"
,
NameId
);
iTerm
=
Cba_BoxBo
(
pNew
,
iObj
,
Index
-
Prs_NtkPiNum
(
pNtkBox
)
);
iTerm
=
Cba_BoxBo
(
pNew
,
iObj
,
0
);
Cba_ObjSetName
(
pNew
,
iTerm
,
NameId
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
iTerm
);
}
else
{
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_NtkSetHost
(
Cba_ManNtk
(
pNew
->
pDesign
,
Prs_BoxNtk
(
pNtk
,
iBox
)),
Cba_NtkId
(
pNew
),
iObj
);
Vec_IntForEachEntry
(
vSigs
,
Index
,
i
)
{
i
++
;
if
(
--
Index
<
Prs_NtkPiNum
(
pNtkBox
)
)
continue
;
assert
(
Index
-
Prs_NtkPiNum
(
pNtkBox
)
<
Prs_NtkPoNum
(
pNtkBox
)
);
// consider box output
NameId
=
Vec_IntEntry
(
vSigs
,
i
);
NameId
=
Prs_NtkSigName
(
pNtk
,
NameId
);
if
(
Vec_IntEntry
(
vMap
,
NameId
)
!=
-
1
)
printf
(
"Box output name %d is already driven.
\n
"
,
NameId
);
iTerm
=
Cba_BoxBo
(
pNew
,
iObj
,
Index
-
Prs_NtkPiNum
(
pNtkBox
)
);
Cba_ObjSetName
(
pNew
,
iTerm
,
NameId
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
iTerm
);
}
}
// remember box
Vec_IntPush
(
vBoxes
,
iObj
);
}
...
...
@@ -198,24 +252,47 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
{
pNtkBox
=
Prs_ManNtk
(
vDes
,
Prs_BoxNtk
(
pNtk
,
iBox
)
);
iObj
=
Vec_IntEntry
(
vBoxes
,
iBox
);
Vec_IntForEachEntry
(
vSigs
,
Index
,
i
)
if
(
pNtkBox
==
NULL
)
{
i
++
;
if
(
--
Index
>=
Prs_NtkPiNum
(
pNtkBox
)
)
continue
;
NameId
=
Vec_IntEntry
(
vSigs
,
i
);
NameId
=
Prs_NtkSigName
(
pNtk
,
NameId
);
iTerm
=
Cba_BoxBi
(
pNew
,
iObj
,
Index
);
if
(
Vec_IntEntry
(
vMap
,
NameId
)
==
-
1
)
Vec_IntForEachEntryStop
(
vSigs
,
Index
,
i
,
Vec_IntSize
(
vSigs
)
-
2
)
{
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C0
,
0
,
1
,
-
1
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
iConst0
+
1
);
if
(
iNonDriven
==
-
1
)
iNonDriven
=
NameId
;
nNonDriven
++
;
i
++
;
NameId
=
Vec_IntEntry
(
vSigs
,
i
);
NameId
=
Prs_NtkSigName
(
pNtk
,
NameId
);
iTerm
=
Cba_BoxBi
(
pNew
,
iObj
,
i
/
2
);
if
(
Vec_IntEntry
(
vMap
,
NameId
)
==
-
1
)
{
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C0
,
0
,
1
,
-
1
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
iConst0
+
1
);
if
(
iNonDriven
==
-
1
)
iNonDriven
=
NameId
;
nNonDriven
++
;
}
Cba_ObjSetFanin
(
pNew
,
iTerm
,
Vec_IntEntry
(
vMap
,
NameId
)
);
Cba_ObjSetName
(
pNew
,
iTerm
,
NameId
);
}
}
else
{
Vec_IntForEachEntry
(
vSigs
,
Index
,
i
)
{
i
++
;
if
(
--
Index
>=
Prs_NtkPiNum
(
pNtkBox
)
)
continue
;
NameId
=
Vec_IntEntry
(
vSigs
,
i
);
NameId
=
Prs_NtkSigName
(
pNtk
,
NameId
);
iTerm
=
Cba_BoxBi
(
pNew
,
iObj
,
Index
);
if
(
Vec_IntEntry
(
vMap
,
NameId
)
==
-
1
)
{
iConst0
=
Cba_BoxAlloc
(
pNew
,
CBA_BOX_C0
,
0
,
1
,
-
1
);
Vec_IntWriteEntry
(
vMap
,
NameId
,
iConst0
+
1
);
if
(
iNonDriven
==
-
1
)
iNonDriven
=
NameId
;
nNonDriven
++
;
}
Cba_ObjSetFanin
(
pNew
,
iTerm
,
Vec_IntEntry
(
vMap
,
NameId
)
);
Cba_ObjSetName
(
pNew
,
iTerm
,
NameId
);
}
Cba_ObjSetFanin
(
pNew
,
iTerm
,
Vec_IntEntry
(
vMap
,
NameId
)
);
Cba_ObjSetName
(
pNew
,
iTerm
,
NameId
);
}
}
else
...
...
@@ -279,8 +356,11 @@ Cba_Man_t * Prs_ManBuildCba( char * pFileName, Vec_Ptr_t * vDes )
pNew
->
pStrs
=
Abc_NamRef
(
pNtk
->
pStrs
);
Vec_PtrForEachEntry
(
Prs_Ntk_t
*
,
vDes
,
pNtk
,
i
)
Cba_NtkAlloc
(
Cba_ManNtk
(
pNew
,
i
),
Prs_NtkId
(
pNtk
),
Prs_NtkPiNum
(
pNtk
),
Prs_NtkPoNum
(
pNtk
),
Prs_NtkCountObjects
(
pNtk
)
);
Vec_PtrForEachEntry
(
Prs_Ntk_t
*
,
vDes
,
pNtk
,
i
)
Prs_ManBuildNtk
(
Cba_ManNtk
(
pNew
,
i
),
vDes
,
pNtk
,
vMap
,
vTmp
);
if
(
(
pNtk
->
fMapped
||
(
pNtk
->
fSlices
&&
Prs_ManIsMapped
(
pNtk
)))
&&
!
Cba_NtkBuildLibrary
(
pNew
)
)
Cba_ManFree
(
pNew
),
pNew
=
NULL
;
else
Vec_PtrForEachEntry
(
Prs_Ntk_t
*
,
vDes
,
pNtk
,
i
)
Prs_ManBuildNtk
(
Cba_ManNtk
(
pNew
,
i
),
vDes
,
pNtk
,
vMap
,
vTmp
);
assert
(
Vec_IntCountEntry
(
vMap
,
-
1
)
==
Vec_IntSize
(
vMap
)
);
Vec_IntFree
(
vMap
);
Vec_IntFree
(
vTmp
);
...
...
src/base/cba/cbaReadVer.c
View file @
089a8bbf
...
...
@@ -774,7 +774,7 @@ Vec_Ptr_t * Prs_ManReadVerilog( char * pFileName )
if
(
p
==
NULL
)
return
NULL
;
Prs_NtkAddVerilogDirectives
(
p
);
Prs_ManReadDesign
(
p
);
Prs_ManReadDesign
(
p
);
//Prs_ManPrintModules( p );
if
(
Prs_ManErrorPrint
(
p
)
)
ABC_SWAP
(
Vec_Ptr_t
*
,
vPrs
,
p
->
vNtks
);
...
...
src/base/cba/cbaWriteVer.c
View file @
089a8bbf
...
...
@@ -330,7 +330,7 @@ void Cba_ManWriteVerilogNtk( FILE * pFile, Cba_Ntk_t * p, Vec_Int_t * vMap, Vec_
for
(
s
=
0
;
s
<
2
;
s
++
)
{
fprintf
(
pFile
,
" "
);
Cba_ManWriteVerilogSignalList
(
pFile
,
p
,
s
,
s
==
2
,
1
,
vWires
);
Cba_ManWriteVerilogSignalList
(
pFile
,
p
,
s
,
s
==
1
,
1
,
vWires
);
fprintf
(
pFile
,
"
\n
"
);
}
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