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
95ea102d
Commit
95ea102d
authored
Feb 25, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started PO partitioning command.
parent
69dd1337
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
168 additions
and
0 deletions
+168
-0
src/aig/gia/giaCone.c
+168
-0
No files found.
src/aig/gia/giaCone.c
View file @
95ea102d
...
...
@@ -27,9 +27,174 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
typedef
struct
Opa_Man_t_
Opa_Man_t
;
struct
Opa_Man_t_
{
Gia_Man_t
*
pGia
;
Vec_Int_t
*
vFront
;
Vec_Int_t
*
pvParts
;
int
*
pId2Part
;
int
nParts
;
};
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
Opa_Man_t
*
Opa_ManStart
(
Gia_Man_t
*
pGia
)
{
Opa_Man_t
*
p
;
Gia_Obj_t
*
pObj
;
int
i
;
p
=
ABC_CALLOC
(
Opa_Man_t
,
1
);
p
->
pGia
=
pGia
;
p
->
pvParts
=
ABC_CALLOC
(
Vec_Int_t
,
Gia_ManPoNum
(
pGia
)
);
p
->
pId2Part
=
ABC_FALLOC
(
int
,
Gia_ManObjNum
(
pGia
)
);
p
->
vFront
=
Vec_IntAlloc
(
100
);
Gia_ManForEachPo
(
pGia
,
pObj
,
i
)
{
Vec_IntPush
(
p
->
pvParts
+
i
,
Gia_ObjId
(
pGia
,
pObj
)
);
p
->
pId2Part
[
Gia_ObjId
(
pGia
,
pObj
)]
=
i
;
Vec_IntPush
(
p
->
vFront
,
Gia_ObjId
(
pGia
,
pObj
)
);
}
p
->
nParts
=
Gia_ManPoNum
(
pGia
);
return
p
;
}
static
inline
void
Opa_ManStop
(
Opa_Man_t
*
p
)
{
int
i
;
Vec_IntFree
(
p
->
vFront
);
for
(
i
=
0
;
i
<
Gia_ManPoNum
(
p
->
pGia
);
i
++
)
ABC_FREE
(
p
->
pvParts
[
i
].
pArray
);
ABC_FREE
(
p
->
pvParts
);
ABC_FREE
(
p
->
pId2Part
);
ABC_FREE
(
p
);
}
static
inline
void
Opa_ManPrint
(
Opa_Man_t
*
p
)
{
int
i
,
k
;
printf
(
"Groups:
\n
"
);
for
(
i
=
0
;
i
<
Gia_ManPoNum
(
p
->
pGia
);
i
++
)
{
if
(
p
->
pvParts
[
i
].
nSize
==
0
)
continue
;
printf
(
"%3d : "
,
i
);
for
(
k
=
0
;
k
<
p
->
pvParts
[
i
].
nSize
;
k
++
)
printf
(
"%d "
,
p
->
pvParts
[
i
].
pArray
[
k
]
);
printf
(
"
\n
"
);
}
}
static
inline
void
Opa_ManPrint2
(
Opa_Man_t
*
p
)
{
Gia_Obj_t
*
pObj
;
int
i
,
k
,
Count
;
printf
(
"Groups %d: "
,
p
->
nParts
);
for
(
i
=
0
;
i
<
Gia_ManPoNum
(
p
->
pGia
);
i
++
)
{
if
(
p
->
pvParts
[
i
].
nSize
==
0
)
continue
;
// count POs in this group
Count
=
0
;
Gia_ManForEachObjVec
(
p
->
pvParts
+
i
,
p
->
pGia
,
pObj
,
k
)
Count
+=
Gia_ObjIsPo
(
p
->
pGia
,
pObj
);
printf
(
"%d "
,
Count
);
}
printf
(
"
\n
"
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Opa_ManMoveOne
(
Opa_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
Gia_Obj_t
*
pFanin
)
{
int
iObj
=
Gia_ObjId
(
p
->
pGia
,
pObj
);
int
iFanin
=
Gia_ObjId
(
p
->
pGia
,
pFanin
);
if
(
iFanin
==
0
)
return
;
assert
(
p
->
pId2Part
[
iObj
]
>=
0
);
if
(
p
->
pId2Part
[
iFanin
]
==
-
1
)
{
p
->
pId2Part
[
iFanin
]
=
p
->
pId2Part
[
iObj
];
Vec_IntPush
(
p
->
pvParts
+
p
->
pId2Part
[
iObj
],
iFanin
);
assert
(
Gia_ObjIsCi
(
pFanin
)
||
Gia_ObjIsAnd
(
pFanin
)
);
if
(
Gia_ObjIsAnd
(
pFanin
)
)
Vec_IntPush
(
p
->
vFront
,
iFanin
);
else
if
(
Gia_ObjIsRo
(
p
->
pGia
,
pFanin
)
)
{
pFanin
=
Gia_ObjRoToRi
(
p
->
pGia
,
pFanin
);
iFanin
=
Gia_ObjId
(
p
->
pGia
,
pFanin
);
assert
(
p
->
pId2Part
[
iFanin
]
==
-
1
);
p
->
pId2Part
[
iFanin
]
=
p
->
pId2Part
[
iObj
];
Vec_IntPush
(
p
->
pvParts
+
p
->
pId2Part
[
iObj
],
iFanin
);
Vec_IntPush
(
p
->
vFront
,
iFanin
);
}
}
else
if
(
p
->
pId2Part
[
iObj
]
!=
p
->
pId2Part
[
iFanin
]
)
{
Vec_Int_t
*
vPartObj
=
p
->
pvParts
+
p
->
pId2Part
[
iObj
];
Vec_Int_t
*
vPartFan
=
p
->
pvParts
+
p
->
pId2Part
[
iFanin
];
int
iTemp
,
i
;
// printf( "Moving %d to %d (%d -> %d)\n", iObj, iFanin, Vec_IntSize(vPartObj), Vec_IntSize(vPartFan) );
// add group of iObj to group of iFanin
assert
(
Vec_IntSize
(
vPartObj
)
>
0
);
Vec_IntForEachEntry
(
vPartObj
,
iTemp
,
i
)
{
Vec_IntPush
(
vPartFan
,
iTemp
);
p
->
pId2Part
[
iTemp
]
=
p
->
pId2Part
[
iFanin
];
}
Vec_IntShrink
(
vPartObj
,
0
);
p
->
nParts
--
;
}
}
void
Opa_ManPerform
(
Gia_Man_t
*
pGia
)
{
Opa_Man_t
*
p
;
Gia_Obj_t
*
pObj
;
int
i
;
p
=
Opa_ManStart
(
pGia
);
//Opa_ManPrint2( p );
Gia_ManForEachObjVec
(
p
->
vFront
,
pGia
,
pObj
,
i
)
{
// printf( "*** Object %d ", Gia_ObjId(pGia, pObj) );
if
(
Gia_ObjIsAnd
(
pObj
)
)
{
Opa_ManMoveOne
(
p
,
pObj
,
Gia_ObjFanin0
(
pObj
)
);
Opa_ManMoveOne
(
p
,
pObj
,
Gia_ObjFanin1
(
pObj
)
);
}
else
if
(
Gia_ObjIsCo
(
pObj
)
)
Opa_ManMoveOne
(
p
,
pObj
,
Gia_ObjFanin0
(
pObj
)
);
else
assert
(
0
);
if
(
i
%
10
==
0
)
printf
(
"%d "
,
p
->
nParts
);
//Opa_ManPrint2( p );
if
(
p
->
nParts
==
1
)
break
;
}
printf
(
"
\n
"
);
Opa_ManStop
(
p
);
}
/**Function*************************************************************
...
...
@@ -99,6 +264,7 @@ int Gia_ManConeMark( Gia_Man_t * p, int iOut, int Limit )
***********************************************************************/
Gia_Man_t
*
Gia_ManConeExtract
(
Gia_Man_t
*
p
,
int
iOut
,
int
nDelta
,
int
nOutsMin
,
int
nOutsMax
)
{
/*
int i, Count = 0;
// mark nodes belonging to output 'iOut'
for ( i = 0; i < Gia_ManPoNum(p); i++ )
...
...
@@ -107,6 +273,8 @@ Gia_Man_t * Gia_ManConeExtract( Gia_Man_t * p, int iOut, int nDelta, int nOutsMi
printf( "%d out of %d\n", Count, Gia_ManPoNum(p) );
// add other outputs as long as they are nDelta away
*/
Opa_ManPerform
(
p
);
return
NULL
;
}
...
...
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