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
8db0b9c0
Commit
8db0b9c0
authored
Apr 28, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving local BDD construction from local SOPs and local AIGs.
parent
b09926e8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
17 deletions
+79
-17
src/base/abc/abcFunc.c
+79
-17
No files found.
src/base/abc/abcFunc.c
View file @
8db0b9c0
...
@@ -113,8 +113,9 @@ DdNode * Abc_ConvertSopToBdd( DdManager * dd, char * pSop, DdNode ** pbVars )
...
@@ -113,8 +113,9 @@ DdNode * Abc_ConvertSopToBdd( DdManager * dd, char * pSop, DdNode ** pbVars )
int
Abc_NtkSopToBdd
(
Abc_Ntk_t
*
pNtk
)
int
Abc_NtkSopToBdd
(
Abc_Ntk_t
*
pNtk
)
{
{
Abc_Obj_t
*
pNode
;
Abc_Obj_t
*
pNode
;
DdManager
*
dd
;
DdManager
*
dd
,
*
ddTemp
=
NULL
;
int
nFaninsMax
,
i
;
Vec_Int_t
*
vFanins
=
NULL
;
int
nFaninsMax
,
i
,
k
,
iVar
;
assert
(
Abc_NtkHasSop
(
pNtk
)
);
assert
(
Abc_NtkHasSop
(
pNtk
)
);
...
@@ -122,13 +123,49 @@ int Abc_NtkSopToBdd( Abc_Ntk_t * pNtk )
...
@@ -122,13 +123,49 @@ int Abc_NtkSopToBdd( Abc_Ntk_t * pNtk )
nFaninsMax
=
Abc_NtkGetFaninMax
(
pNtk
);
nFaninsMax
=
Abc_NtkGetFaninMax
(
pNtk
);
if
(
nFaninsMax
==
0
)
if
(
nFaninsMax
==
0
)
printf
(
"Warning: The network has only constant nodes.
\n
"
);
printf
(
"Warning: The network has only constant nodes.
\n
"
);
dd
=
Cudd_Init
(
nFaninsMax
,
0
,
CUDD_UNIQUE_SLOTS
,
CUDD_CACHE_SLOTS
,
0
);
dd
=
Cudd_Init
(
nFaninsMax
,
0
,
CUDD_UNIQUE_SLOTS
,
CUDD_CACHE_SLOTS
,
0
);
// start temporary manager for reordered local functions
if
(
nFaninsMax
>
10
)
{
ddTemp
=
Cudd_Init
(
nFaninsMax
,
0
,
CUDD_UNIQUE_SLOTS
,
CUDD_CACHE_SLOTS
,
0
);
Cudd_AutodynEnable
(
ddTemp
,
CUDD_REORDER_SYMM_SIFT
);
vFanins
=
Vec_IntAlloc
(
nFaninsMax
);
}
// convert each node from SOP to BDD
// convert each node from SOP to BDD
Abc_NtkForEachNode
(
pNtk
,
pNode
,
i
)
Abc_NtkForEachNode
(
pNtk
,
pNode
,
i
)
{
{
assert
(
pNode
->
pData
);
assert
(
pNode
->
pData
);
if
(
Abc_ObjFaninNum
(
pNode
)
>
10
)
{
DdNode
*
pFunc
=
Abc_ConvertSopToBdd
(
ddTemp
,
(
char
*
)
pNode
->
pData
,
NULL
);
if
(
pFunc
==
NULL
)
{
printf
(
"Abc_NtkSopToBdd: Error while converting SOP into BDD.
\n
"
);
return
0
;
}
Cudd_Ref
(
pFunc
);
// find variable mapping
Vec_IntFill
(
vFanins
,
Abc_ObjFaninNum
(
pNode
),
-
1
);
for
(
k
=
iVar
=
0
;
k
<
nFaninsMax
;
k
++
)
if
(
ddTemp
->
invperm
[
k
]
<
Abc_ObjFaninNum
(
pNode
)
)
Vec_IntWriteEntry
(
vFanins
,
ddTemp
->
invperm
[
k
],
iVar
++
);
assert
(
iVar
==
Abc_ObjFaninNum
(
pNode
)
);
// transfer to the main manager
pNode
->
pData
=
Extra_TransferPermute
(
ddTemp
,
dd
,
pFunc
,
Vec_IntArray
(
vFanins
)
);
Cudd_Ref
(
(
DdNode
*
)
pNode
->
pData
);
Cudd_RecursiveDeref
(
ddTemp
,
pFunc
);
// update variable order
Vec_IntClear
(
vFanins
);
for
(
k
=
0
;
k
<
nFaninsMax
;
k
++
)
if
(
ddTemp
->
invperm
[
k
]
<
Abc_ObjFaninNum
(
pNode
)
)
Vec_IntPush
(
vFanins
,
Vec_IntEntry
(
&
pNode
->
vFanins
,
ddTemp
->
invperm
[
k
])
);
for
(
k
=
0
;
k
<
Abc_ObjFaninNum
(
pNode
);
k
++
)
Vec_IntWriteEntry
(
&
pNode
->
vFanins
,
k
,
Vec_IntEntry
(
vFanins
,
k
)
);
}
else
{
pNode
->
pData
=
Abc_ConvertSopToBdd
(
dd
,
(
char
*
)
pNode
->
pData
,
NULL
);
pNode
->
pData
=
Abc_ConvertSopToBdd
(
dd
,
(
char
*
)
pNode
->
pData
,
NULL
);
if
(
pNode
->
pData
==
NULL
)
if
(
pNode
->
pData
==
NULL
)
{
{
...
@@ -137,7 +174,14 @@ int Abc_NtkSopToBdd( Abc_Ntk_t * pNtk )
...
@@ -137,7 +174,14 @@ int Abc_NtkSopToBdd( Abc_Ntk_t * pNtk )
}
}
Cudd_Ref
(
(
DdNode
*
)
pNode
->
pData
);
Cudd_Ref
(
(
DdNode
*
)
pNode
->
pData
);
}
}
}
if
(
ddTemp
)
{
// printf( "Reorderings performed = %d.\n", Cudd_ReadReorderings(ddTemp) );
Extra_StopManager
(
ddTemp
);
}
Vec_IntFreeP
(
&
vFanins
);
Mem_FlexStop
(
(
Mem_Flex_t
*
)
pNtk
->
pManFunc
,
0
);
Mem_FlexStop
(
(
Mem_Flex_t
*
)
pNtk
->
pManFunc
,
0
);
pNtk
->
pManFunc
=
dd
;
pNtk
->
pManFunc
=
dd
;
...
@@ -675,8 +719,9 @@ int Abc_NtkAigToBdd( Abc_Ntk_t * pNtk )
...
@@ -675,8 +719,9 @@ int Abc_NtkAigToBdd( Abc_Ntk_t * pNtk )
{
{
Abc_Obj_t
*
pNode
;
Abc_Obj_t
*
pNode
;
Hop_Man_t
*
pMan
;
Hop_Man_t
*
pMan
;
DdManager
*
dd
;
DdManager
*
dd
,
*
ddTemp
=
NULL
;
int
nFaninsMax
,
i
;
Vec_Int_t
*
vFanins
=
NULL
;
int
nFaninsMax
,
i
,
k
,
iVar
;
assert
(
Abc_NtkHasAig
(
pNtk
)
);
assert
(
Abc_NtkHasAig
(
pNtk
)
);
...
@@ -687,32 +732,49 @@ int Abc_NtkAigToBdd( Abc_Ntk_t * pNtk )
...
@@ -687,32 +732,49 @@ int Abc_NtkAigToBdd( Abc_Ntk_t * pNtk )
dd
=
Cudd_Init
(
nFaninsMax
,
0
,
CUDD_UNIQUE_SLOTS
,
CUDD_CACHE_SLOTS
,
0
);
dd
=
Cudd_Init
(
nFaninsMax
,
0
,
CUDD_UNIQUE_SLOTS
,
CUDD_CACHE_SLOTS
,
0
);
// start temporary manager for reordered local functions
ddTemp
=
Cudd_Init
(
nFaninsMax
,
0
,
CUDD_UNIQUE_SLOTS
,
CUDD_CACHE_SLOTS
,
0
);
Cudd_AutodynEnable
(
ddTemp
,
CUDD_REORDER_SYMM_SIFT
);
vFanins
=
Vec_IntAlloc
(
nFaninsMax
);
// set the mapping of elementary AIG nodes into the elementary BDD nodes
// set the mapping of elementary AIG nodes into the elementary BDD nodes
pMan
=
(
Hop_Man_t
*
)
pNtk
->
pManFunc
;
pMan
=
(
Hop_Man_t
*
)
pNtk
->
pManFunc
;
assert
(
Hop_ManPiNum
(
pMan
)
>=
nFaninsMax
);
assert
(
Hop_ManPiNum
(
pMan
)
>=
nFaninsMax
);
for
(
i
=
0
;
i
<
nFaninsMax
;
i
++
)
for
(
i
=
0
;
i
<
nFaninsMax
;
i
++
)
{
Hop_ManPi
(
pMan
,
i
)
->
pData
=
Cudd_bddIthVar
(
ddTemp
,
i
);
Hop_ManPi
(
pMan
,
i
)
->
pData
=
Cudd_bddIthVar
(
dd
,
i
);
Cudd_Ref
(
(
DdNode
*
)
Hop_ManPi
(
pMan
,
i
)
->
pData
);
}
// convert each node from SOP to BDD
// convert each node from SOP to BDD
Abc_NtkForEachNode
(
pNtk
,
pNode
,
i
)
Abc_NtkForEachNode
(
pNtk
,
pNode
,
i
)
{
{
assert
(
pNode
->
pData
);
DdNode
*
pFunc
=
Abc_ConvertAigToBdd
(
ddTemp
,
(
Hop_Obj_t
*
)
pNode
->
pData
);
pNode
->
pData
=
Abc_ConvertAigToBdd
(
dd
,
(
Hop_Obj_t
*
)
pNode
->
pData
);
if
(
pFunc
==
NULL
)
if
(
pNode
->
pData
==
NULL
)
{
{
printf
(
"Abc_Ntk
SopToBdd: Error while converting SOP
into BDD.
\n
"
);
printf
(
"Abc_Ntk
AigToBdd: Error while converting AIG
into BDD.
\n
"
);
return
0
;
return
0
;
}
}
Cudd_Ref
(
pFunc
);
// find variable mapping
Vec_IntFill
(
vFanins
,
Abc_ObjFaninNum
(
pNode
),
-
1
);
for
(
k
=
iVar
=
0
;
k
<
nFaninsMax
;
k
++
)
if
(
ddTemp
->
invperm
[
k
]
<
Abc_ObjFaninNum
(
pNode
)
)
Vec_IntWriteEntry
(
vFanins
,
ddTemp
->
invperm
[
k
],
iVar
++
);
assert
(
iVar
==
Abc_ObjFaninNum
(
pNode
)
);
// transfer to the main manager
pNode
->
pData
=
Extra_TransferPermute
(
ddTemp
,
dd
,
pFunc
,
Vec_IntArray
(
vFanins
)
);
Cudd_Ref
(
(
DdNode
*
)
pNode
->
pData
);
Cudd_Ref
(
(
DdNode
*
)
pNode
->
pData
);
Cudd_RecursiveDeref
(
ddTemp
,
pFunc
);
// update variable order
Vec_IntClear
(
vFanins
);
for
(
k
=
0
;
k
<
nFaninsMax
;
k
++
)
if
(
ddTemp
->
invperm
[
k
]
<
Abc_ObjFaninNum
(
pNode
)
)
Vec_IntPush
(
vFanins
,
Vec_IntEntry
(
&
pNode
->
vFanins
,
ddTemp
->
invperm
[
k
])
);
for
(
k
=
0
;
k
<
Abc_ObjFaninNum
(
pNode
);
k
++
)
Vec_IntWriteEntry
(
&
pNode
->
vFanins
,
k
,
Vec_IntEntry
(
vFanins
,
k
)
);
}
}
// dereference intermediate BDD nodes
// printf( "Reorderings performed = %d.\n", Cudd_ReadReorderings(ddTemp) );
for
(
i
=
0
;
i
<
nFaninsMax
;
i
++
)
Extra_StopManager
(
ddTemp
);
Cudd_RecursiveDeref
(
dd
,
(
DdNode
*
)
Hop_ManPi
(
pMan
,
i
)
->
pData
);
Vec_IntFreeP
(
&
vFanins
);
Hop_ManStop
(
(
Hop_Man_t
*
)
pNtk
->
pManFunc
);
Hop_ManStop
(
(
Hop_Man_t
*
)
pNtk
->
pManFunc
);
pNtk
->
pManFunc
=
dd
;
pNtk
->
pManFunc
=
dd
;
...
...
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