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
1a5a11cb
Commit
1a5a11cb
authored
Jan 15, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various transformations of Cba_Ntk_t.
parent
c7e3c8f3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
32 deletions
+59
-32
src/base/cba/cba.h
+3
-3
src/base/cba/cbaBlast.c
+37
-18
src/base/cba/cbaBuild.c
+2
-2
src/base/cba/cbaCom.c
+3
-1
src/base/cba/cbaSimple.c
+14
-8
No files found.
src/base/cba/cba.h
View file @
1a5a11cb
...
...
@@ -308,9 +308,9 @@ static inline Cba_Man_t * Cba_ManAlloc( char * pFileName )
Cba_Man_t
*
p
=
ABC_CALLOC
(
Cba_Man_t
,
1
);
p
->
pName
=
Extra_FileDesignName
(
pFileName
);
p
->
pSpec
=
Abc_UtilStrsav
(
pFileName
);
p
->
pNames
=
Abc_NamStart
(
1000
,
2
0
);
p
->
pModels
=
Abc_NamStart
(
1000
,
2
0
);
p
->
pFuncs
=
Abc_NamStart
(
1000
,
2
0
);
p
->
pNames
=
Abc_NamStart
(
1000
,
2
4
);
p
->
pModels
=
Abc_NamStart
(
1000
,
2
4
);
p
->
pFuncs
=
Abc_NamStart
(
1000
,
2
4
);
Vec_SetAlloc_
(
&
p
->
Mem
,
20
);
Vec_PtrPush
(
&
p
->
vNtks
,
NULL
);
p
->
iRoot
=
1
;
...
...
src/base/cba/cbaBlast.c
View file @
1a5a11cb
...
...
@@ -42,36 +42,47 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
int
Cba_ManAddBarbuf
(
Gia_Man_t
*
pNew
,
int
iRes
,
Cba_Man_t
*
p
,
int
iLNtk
,
int
iLObj
,
int
iRNtk
,
int
iRObj
)
int
Cba_ManAddBarbuf
(
Gia_Man_t
*
pNew
,
int
iRes
,
Cba_Man_t
*
p
,
int
iLNtk
,
int
iLObj
,
int
iRNtk
,
int
iRObj
,
Vec_Int_t
*
vMap
)
{
// if ( iRes == 0 || iRes == 1 )
// return iRes;
int
iBufLit
,
iIdLit
;
if
(
iRes
==
0
||
iRes
==
1
)
return
iRes
;
assert
(
iRes
>
0
);
if
(
vMap
&&
Abc_Lit2Var
(
iRes
)
<
Vec_IntSize
(
vMap
)
&&
(
iIdLit
=
Vec_IntEntry
(
vMap
,
Abc_Lit2Var
(
iRes
)))
>=
0
&&
Vec_IntEntry
(
p
->
vBuf2LeafNtk
,
Abc_Lit2Var
(
iIdLit
))
==
iLNtk
&&
Vec_IntEntry
(
p
->
vBuf2RootNtk
,
Abc_Lit2Var
(
iIdLit
))
==
iRNtk
)
return
Abc_LitNotCond
(
Vec_IntEntry
(
pNew
->
vBarBufs
,
Abc_Lit2Var
(
iIdLit
)),
Abc_LitIsCompl
(
iRes
)
^
Abc_LitIsCompl
(
iIdLit
)
);
Vec_IntPush
(
p
->
vBuf2LeafNtk
,
iLNtk
);
Vec_IntPush
(
p
->
vBuf2LeafObj
,
iLObj
);
Vec_IntPush
(
p
->
vBuf2RootNtk
,
iRNtk
);
Vec_IntPush
(
p
->
vBuf2RootObj
,
iRObj
);
return
Gia_ManAppendBuf
(
pNew
,
iRes
);
iBufLit
=
Gia_ManAppendBuf
(
pNew
,
iRes
);
if
(
vMap
)
{
Vec_IntSetEntryFull
(
vMap
,
Abc_Lit2Var
(
iRes
),
Abc_Var2Lit
(
Vec_IntSize
(
pNew
->
vBarBufs
),
Abc_LitIsCompl
(
iRes
))
);
Vec_IntPush
(
pNew
->
vBarBufs
,
iBufLit
);
}
return
iBufLit
;
}
int
Cba_ManExtract_rec
(
Gia_Man_t
*
pNew
,
Cba_Ntk_t
*
p
,
int
i
)
int
Cba_ManExtract_rec
(
Gia_Man_t
*
pNew
,
Cba_Ntk_t
*
p
,
int
i
,
Vec_Int_t
*
vMap
)
{
int
iRes
=
Cba_NtkCopy
(
p
,
i
);
if
(
iRes
>=
0
)
return
iRes
;
if
(
Cba_ObjIsCo
(
p
,
i
)
)
iRes
=
Cba_ManExtract_rec
(
pNew
,
p
,
Cba_ObjFanin0
(
p
,
i
)
);
iRes
=
Cba_ManExtract_rec
(
pNew
,
p
,
Cba_ObjFanin0
(
p
,
i
)
,
vMap
);
else
if
(
Cba_ObjIsBo
(
p
,
i
)
)
{
Cba_Ntk_t
*
pBox
=
Cba_ObjBoModel
(
p
,
i
);
int
iObj
=
Cba_NtkPo
(
pBox
,
Cba_ObjCioIndex
(
p
,
i
)
);
iRes
=
Cba_ManExtract_rec
(
pNew
,
pBox
,
iObj
);
iRes
=
Cba_ManAddBarbuf
(
pNew
,
iRes
,
p
->
pDesign
,
Cba_NtkId
(
p
),
i
,
Cba_NtkId
(
pBox
),
iObj
);
iRes
=
Cba_ManExtract_rec
(
pNew
,
pBox
,
iObj
,
vMap
);
iRes
=
Cba_ManAddBarbuf
(
pNew
,
iRes
,
p
->
pDesign
,
Cba_NtkId
(
p
),
i
,
Cba_NtkId
(
pBox
),
iObj
,
vMap
);
}
else
if
(
Cba_ObjIsPi
(
p
,
i
)
)
{
Cba_Ntk_t
*
pHost
=
Cba_NtkHostNtk
(
p
);
int
iObj
=
Cba_ObjBoxBi
(
pHost
,
Cba_NtkHostObj
(
p
),
Cba_ObjCioIndex
(
p
,
i
)
);
iRes
=
Cba_ManExtract_rec
(
pNew
,
pHost
,
iObj
);
iRes
=
Cba_ManAddBarbuf
(
pNew
,
iRes
,
p
->
pDesign
,
Cba_NtkId
(
p
),
i
,
Cba_NtkId
(
pHost
),
iObj
);
iRes
=
Cba_ManExtract_rec
(
pNew
,
pHost
,
iObj
,
vMap
);
iRes
=
Cba_ManAddBarbuf
(
pNew
,
iRes
,
p
->
pDesign
,
Cba_NtkId
(
p
),
i
,
Cba_NtkId
(
pHost
),
iObj
,
vMap
);
}
else
if
(
Cba_ObjIsNode
(
p
,
i
)
)
{
...
...
@@ -89,15 +100,15 @@ int Cba_ManExtract_rec( Gia_Man_t * pNew, Cba_Ntk_t * p, int i )
else
if
(
pFanins
[
0
]
==
1
)
{
if
(
Type
==
CBA_NODE_BUF
)
iRes
=
Cba_ManExtract_rec
(
pNew
,
p
,
pFanins
[
1
]
);
iRes
=
Cba_ManExtract_rec
(
pNew
,
p
,
pFanins
[
1
]
,
vMap
);
else
if
(
Type
==
CBA_NODE_INV
)
iRes
=
Abc_LitNot
(
Cba_ManExtract_rec
(
pNew
,
p
,
pFanins
[
1
]
)
);
iRes
=
Abc_LitNot
(
Cba_ManExtract_rec
(
pNew
,
p
,
pFanins
[
1
]
,
vMap
)
);
else
assert
(
0
);
}
else
{
for
(
k
=
0
;
k
<
pFanins
[
0
];
k
++
)
pLits
[
k
]
=
Cba_ManExtract_rec
(
pNew
,
p
,
pFanins
[
k
+
1
]
);
pLits
[
k
]
=
Cba_ManExtract_rec
(
pNew
,
p
,
pFanins
[
k
+
1
]
,
vMap
);
if
(
Type
==
CBA_NODE_AND
)
iRes
=
Gia_ManHashAnd
(
pNew
,
pLits
[
0
],
pLits
[
1
]
);
else
if
(
Type
==
CBA_NODE_OR
)
...
...
@@ -117,6 +128,7 @@ Gia_Man_t * Cba_ManExtract( Cba_Man_t * p, int fVerbose )
{
Cba_Ntk_t
*
pRoot
=
Cba_ManRoot
(
p
);
Gia_Man_t
*
pNew
,
*
pTemp
;
Vec_Int_t
*
vMap
=
NULL
;
int
i
,
iObj
;
Vec_IntFreeP
(
&
p
->
vBuf2LeafNtk
);
Vec_IntFreeP
(
&
p
->
vBuf2LeafObj
);
...
...
@@ -132,12 +144,21 @@ Gia_Man_t * Cba_ManExtract( Cba_Man_t * p, int fVerbose )
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
Vec_IntFill
(
&
p
->
vCopies
,
Cba_ManObjNum
(
p
),
-
1
);
// primary inputs
Cba_NtkForEachPi
(
pRoot
,
iObj
,
i
)
Cba_NtkSetCopy
(
pRoot
,
iObj
,
Gia_ManAppendCi
(
pNew
)
);
// internal nodes
Gia_ManHashAlloc
(
pNew
);
pNew
->
vBarBufs
=
Vec_IntAlloc
(
10000
);
vMap
=
Vec_IntStartFull
(
10000
);
Cba_NtkForEachPo
(
pRoot
,
iObj
,
i
)
Cba_ManExtract_rec
(
pNew
,
pRoot
,
iObj
);
Cba_ManExtract_rec
(
pNew
,
pRoot
,
iObj
,
vMap
);
Vec_IntFreeP
(
&
vMap
);
Gia_ManHashStop
(
pNew
);
// primary outputs
Cba_NtkForEachPo
(
pRoot
,
iObj
,
i
)
Gia_ManAppendCo
(
pNew
,
Cba_NtkCopy
(
pRoot
,
iObj
)
);
assert
(
Vec_IntSize
(
p
->
vBuf2LeafNtk
)
==
pNew
->
nBufs
);
...
...
@@ -146,9 +167,6 @@ Gia_Man_t * Cba_ManExtract( Cba_Man_t * p, int fVerbose )
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
Gia_ManPrintStats
(
pNew
,
NULL
);
// pNew = Gia_ManSweepHierarchy( pTemp = pNew );
// Gia_ManStop( pTemp );
// Gia_ManPrintStats( pNew, NULL );
return
pNew
;
}
...
...
@@ -302,7 +320,8 @@ void Cba_NtkInsertGia( Cba_Man_t * p, Gia_Man_t * pGia )
// create node and connect POs
Gia_ManForEachPo
(
pGia
,
pObj
,
i
)
Cba_NtkCreateAndConnectBuffer
(
pGia
,
pObj
,
pRoot
,
Cba_NtkPo
(
pRoot
,
i
)
);
assert
(
Cba_NtkObjNum
(
pRoot
)
==
pRoot
->
nObjs
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
assert
(
Cba_NtkObjNum
(
pNtk
)
==
pNtk
->
nObjs
);
}
Cba_Man_t
*
Cba_ManInsertGia
(
Cba_Man_t
*
p
,
Gia_Man_t
*
pGia
)
{
...
...
src/base/cba/cbaBuild.c
View file @
1a5a11cb
...
...
@@ -47,8 +47,6 @@ void Cba_BoxRemap( Cba_Ntk_t * pNtk, int iBox, Vec_Int_t * vMap )
Cba_Ntk_t
*
pBoxModel
=
Cba_ObjBoxModel
(
pNtk
,
iBox
);
Vec_Int_t
*
vFanins
=
Cba_ObjFaninVec
(
pNtk
,
iBox
);
int
i
,
NameId
;
Vec_IntForEachEntry
(
vMap
,
NameId
,
i
)
assert
(
NameId
==
-
1
);
// map formal names into I/O indexes
Cba_NtkForEachPi
(
pBoxModel
,
NameId
,
i
)
{
...
...
@@ -79,6 +77,8 @@ void Cba_NtkRemapBoxes( Cba_Ntk_t * pNtk, Vec_Int_t * vMap )
Cba_NtkForEachObjType
(
pNtk
,
Type
,
iBox
)
if
(
Type
==
CBA_OBJ_BOX
)
Cba_BoxRemap
(
pNtk
,
iBox
,
vMap
);
Vec_IntForEachEntry
(
vMap
,
Type
,
iBox
)
assert
(
Type
==
-
1
);
}
// create maps of NameId and boxes
void
Cba_NtkFindNonDriven
(
Cba_Ntk_t
*
pNtk
,
Vec_Int_t
*
vMap
,
int
nObjCount
,
Vec_Int_t
*
vNonDriven
)
...
...
src/base/cba/cbaCom.c
View file @
1a5a11cb
...
...
@@ -317,7 +317,9 @@ int Cba_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
extern
void
Cba_ManReadDesExperiment
(
Abc_Ntk_t
*
pNtk
);
Abc_Ntk_t
*
pAbcNtk
;
//Cba_Ntk_t * pNtk = Cba_AbcGetNtk(pAbc);
char
*
pFileName
=
"c/hie/dump/1/netlist_1.v"
;
// char * pFileName = "c/hie/dump/1/netlist_1.v";
// char * pFileName = "c/hie/dump/3/netlist_18.v";
char
*
pFileName
=
"c/hie/dump/1/netlist_0.v"
;
int
c
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"vh"
)
)
!=
EOF
)
...
...
src/base/cba/cbaSimple.c
View file @
1a5a11cb
...
...
@@ -601,7 +601,7 @@ void Cba_PrsReadBoxes( Cba_Man_t * p, Vec_Ptr_t * vBoxes, Vec_Int_t * vTypesCur,
Vec_IntPush
(
vFaninsCur
,
Cba_ManHandleArray
(
p
,
Cba_PrsReadList
(
p
,
vBox
,
vList
,
0
,
1
))
);
}
}
void
Cba_PrsReadModule
(
Cba_Man_t
*
p
,
Vec_Ptr_t
*
vNtk
)
void
Cba_PrsReadModule
(
Cba_Man_t
*
p
,
Cba_Ntk_t
*
pNtk
,
Vec_Ptr_t
*
vNtk
)
{
Vec_Int_t
*
vInputsCur
=
Vec_IntAlloc
(
1000
);
Vec_Int_t
*
vOutputsCur
=
Vec_IntAlloc
(
1000
);
...
...
@@ -612,7 +612,6 @@ void Cba_PrsReadModule( Cba_Man_t * p, Vec_Ptr_t * vNtk )
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
);
Cba_PrsReadList
(
p
,
(
Vec_Ptr_t
*
)
Vec_PtrEntry
(
vNtk
,
2
),
vOutputsCur
,
-
1
,
-
1
);
Cba_PrsReadNodes
(
p
,
(
Vec_Ptr_t
*
)
Vec_PtrEntry
(
vNtk
,
3
),
vTypesCur
,
vFuncsCur
,
vInstIdsCur
,
vFaninsCur
,
vList
);
...
...
@@ -640,7 +639,9 @@ Cba_Man_t * Cba_PrsReadPtr( Vec_Ptr_t * vDes )
Vec_Ptr_t
*
vNtk
;
int
i
;
Cba_Man_t
*
p
=
Cba_ManAlloc
(
(
char
*
)
Vec_PtrEntry
(
vDes
,
0
)
);
Vec_PtrForEachEntryStart
(
Vec_Ptr_t
*
,
vDes
,
vNtk
,
i
,
1
)
Cba_PrsReadModule
(
p
,
vNtk
);
Cba_NtkAlloc
(
p
,
(
char
*
)
Vec_PtrEntry
(
vNtk
,
0
)
);
Vec_PtrForEachEntryStart
(
Vec_Ptr_t
*
,
vDes
,
vNtk
,
i
,
1
)
Cba_PrsReadModule
(
p
,
Cba_ManNtk
(
p
,
i
),
vNtk
);
return
p
;
}
...
...
@@ -669,37 +670,41 @@ void Cba_ManReadDesExperiment( Abc_Ntk_t * pNtk )
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
// dump
pFileName
=
Extra_FileNameGenericAppend
(
pNtk
->
pDesign
->
pName
,
"_out1.blif"
);
Ptr_ManDumpBlif
(
pFileName
,
vDes
);
//
Ptr_ManDumpBlif( pFileName, vDes );
printf
(
"Finished writing output file
\"
%s
\"
. "
,
pFileName
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
clk
=
Abc_Clock
();
// derive CBA from Ptr
p
=
Cba_PrsReadPtr
(
vDes
);
Ptr_ManFreeDes
(
vDes
);
// dump
pFileName
=
Extra_FileNameGenericAppend
(
pNtk
->
pDesign
->
pName
,
"_out2.blif"
);
Cba_PrsWriteBlif
(
pFileName
,
p
);
//
Cba_PrsWriteBlif( pFileName, p );
printf
(
"Finished writing output file
\"
%s
\"
. "
,
pFileName
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
// Abc_NamPrint( p->pNames );
clk
=
Abc_Clock
();
// build CBA from CBA
p
=
Cba_ManBuild
(
pTemp
=
p
);
Cba_ManFree
(
pTemp
);
// dump
pFileName
=
Extra_FileNameGenericAppend
(
pNtk
->
pDesign
->
pName
,
"_out3.blif"
);
Cba_ManWriteBlif
(
pFileName
,
p
);
//
Cba_ManWriteBlif( pFileName, p );
printf
(
"Finished writing output file
\"
%s
\"
. "
,
pFileName
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
clk
=
Abc_Clock
();
// duplicate CBA
p
=
Cba_ManDup
(
pTemp
=
p
);
Cba_ManFree
(
pTemp
);
// dump
pFileName
=
Extra_FileNameGenericAppend
(
pNtk
->
pDesign
->
pName
,
"_out4.blif"
);
Cba_ManWriteBlif
(
pFileName
,
p
);
//
Cba_ManWriteBlif( pFileName, p );
printf
(
"Finished writing output file
\"
%s
\"
. "
,
pFileName
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
clk
=
Abc_Clock
();
// CBA->GIA->CBA
p
=
Cba_ManBlastTest
(
pTemp
=
p
);
...
...
@@ -709,6 +714,7 @@ void Cba_ManReadDesExperiment( Abc_Ntk_t * pNtk )
Cba_ManWriteBlif
(
pFileName
,
p
);
printf
(
"Finished writing output file
\"
%s
\"
. "
,
pFileName
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
clk
=
Abc_Clock
();
Cba_ManFree
(
p
);
}
...
...
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