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
a7fcdf20
Commit
a7fcdf20
authored
Sep 27, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Performance balancing command &b.
parent
a695d708
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
106 additions
and
17 deletions
+106
-17
abclib.dsp
+4
-0
src/aig/gia/gia.h
+12
-2
src/aig/gia/giaBalance.c
+0
-0
src/aig/gia/giaDup.c
+1
-1
src/aig/gia/giaMuxes.c
+10
-10
src/aig/gia/giaUtil.c
+3
-3
src/aig/gia/module.make
+1
-0
src/base/abci/abc.c
+74
-0
src/map/mpm/mpmAbc.c
+1
-1
No files found.
abclib.dsp
View file @
a7fcdf20
...
@@ -3599,6 +3599,10 @@ SOURCE=.\src\aig\gia\giaAigerExt.c
...
@@ -3599,6 +3599,10 @@ SOURCE=.\src\aig\gia\giaAigerExt.c
# End Source File
# End Source File
# Begin Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaBalance.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaBidec.c
SOURCE=.\src\aig\gia\giaBidec.c
# End Source File
# End Source File
# Begin Source File
# Begin Source File
...
...
src/aig/gia/gia.h
View file @
a7fcdf20
...
@@ -178,6 +178,9 @@ struct Gia_Man_t_
...
@@ -178,6 +178,9 @@ struct Gia_Man_t_
Vec_Int_t
*
vTtNodes
;
// internal nodes
Vec_Int_t
*
vTtNodes
;
// internal nodes
Vec_Ptr_t
*
vTtInputs
;
// truth tables for constant and primary inputs
Vec_Ptr_t
*
vTtInputs
;
// truth tables for constant and primary inputs
Vec_Wrd_t
*
vTtMemory
;
// truth tables for internal nodes
Vec_Wrd_t
*
vTtMemory
;
// truth tables for internal nodes
// balancing
Vec_Int_t
*
vStore
;
// node storage
Vec_Int_t
*
vSuper
;
// supergate
};
};
...
@@ -371,7 +374,9 @@ static inline int Gia_ObjIsCi( Gia_Obj_t * pObj ) {
...
@@ -371,7 +374,9 @@ static inline int Gia_ObjIsCi( Gia_Obj_t * pObj ) {
static
inline
int
Gia_ObjIsCo
(
Gia_Obj_t
*
pObj
)
{
return
pObj
->
fTerm
&&
pObj
->
iDiff0
!=
GIA_NONE
;
}
static
inline
int
Gia_ObjIsCo
(
Gia_Obj_t
*
pObj
)
{
return
pObj
->
fTerm
&&
pObj
->
iDiff0
!=
GIA_NONE
;
}
static
inline
int
Gia_ObjIsAnd
(
Gia_Obj_t
*
pObj
)
{
return
!
pObj
->
fTerm
&&
pObj
->
iDiff0
!=
GIA_NONE
;
}
static
inline
int
Gia_ObjIsAnd
(
Gia_Obj_t
*
pObj
)
{
return
!
pObj
->
fTerm
&&
pObj
->
iDiff0
!=
GIA_NONE
;
}
static
inline
int
Gia_ObjIsXor
(
Gia_Obj_t
*
pObj
)
{
return
Gia_ObjIsAnd
(
pObj
)
&&
pObj
->
iDiff0
<
pObj
->
iDiff1
;
}
static
inline
int
Gia_ObjIsXor
(
Gia_Obj_t
*
pObj
)
{
return
Gia_ObjIsAnd
(
pObj
)
&&
pObj
->
iDiff0
<
pObj
->
iDiff1
;
}
static
inline
int
Gia_ObjIsMux
(
Gia_Man_t
*
p
,
int
iObj
)
{
return
p
->
pMuxes
&&
p
->
pMuxes
[
iObj
]
>
0
;
}
static
inline
int
Gia_ObjIsMuxId
(
Gia_Man_t
*
p
,
int
iObj
)
{
return
p
->
pMuxes
&&
p
->
pMuxes
[
iObj
]
>
0
;
}
static
inline
int
Gia_ObjIsMux
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
return
Gia_ObjIsMuxId
(
p
,
Gia_ObjId
(
p
,
pObj
)
);
}
static
inline
int
Gia_ObjIsAndReal
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
return
Gia_ObjIsAnd
(
pObj
)
&&
pObj
->
iDiff0
>
pObj
->
iDiff1
&&
!
Gia_ObjIsMux
(
p
,
pObj
);
}
static
inline
int
Gia_ObjIsBuf
(
Gia_Obj_t
*
pObj
)
{
return
pObj
->
iDiff0
==
pObj
->
iDiff1
&&
pObj
->
iDiff0
!=
GIA_NONE
;
}
static
inline
int
Gia_ObjIsBuf
(
Gia_Obj_t
*
pObj
)
{
return
pObj
->
iDiff0
==
pObj
->
iDiff1
&&
pObj
->
iDiff0
!=
GIA_NONE
;
}
static
inline
int
Gia_ObjIsCand
(
Gia_Obj_t
*
pObj
)
{
return
Gia_ObjIsAnd
(
pObj
)
||
Gia_ObjIsCi
(
pObj
);
}
static
inline
int
Gia_ObjIsCand
(
Gia_Obj_t
*
pObj
)
{
return
Gia_ObjIsAnd
(
pObj
)
||
Gia_ObjIsCi
(
pObj
);
}
static
inline
int
Gia_ObjIsConst0
(
Gia_Obj_t
*
pObj
)
{
return
pObj
->
iDiff0
==
GIA_NONE
&&
pObj
->
iDiff1
==
GIA_NONE
;
}
static
inline
int
Gia_ObjIsConst0
(
Gia_Obj_t
*
pObj
)
{
return
pObj
->
iDiff0
==
GIA_NONE
&&
pObj
->
iDiff1
==
GIA_NONE
;
}
...
@@ -445,6 +450,9 @@ static inline void Gia_ObjSetLevelId( Gia_Man_t * p, int Id, int l ) {
...
@@ -445,6 +450,9 @@ static inline void Gia_ObjSetLevelId( Gia_Man_t * p, int Id, int l ) {
static
inline
void
Gia_ObjSetLevel
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
int
l
)
{
Gia_ObjSetLevelId
(
p
,
Gia_ObjId
(
p
,
pObj
),
l
);
}
static
inline
void
Gia_ObjSetLevel
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
int
l
)
{
Gia_ObjSetLevelId
(
p
,
Gia_ObjId
(
p
,
pObj
),
l
);
}
static
inline
void
Gia_ObjSetCoLevel
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
assert
(
Gia_ObjIsCo
(
pObj
)
);
Gia_ObjSetLevel
(
p
,
pObj
,
Gia_ObjLevel
(
p
,
Gia_ObjFanin0
(
pObj
))
);
}
static
inline
void
Gia_ObjSetCoLevel
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
assert
(
Gia_ObjIsCo
(
pObj
)
);
Gia_ObjSetLevel
(
p
,
pObj
,
Gia_ObjLevel
(
p
,
Gia_ObjFanin0
(
pObj
))
);
}
static
inline
void
Gia_ObjSetAndLevel
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
assert
(
Gia_ObjIsAnd
(
pObj
)
);
Gia_ObjSetLevel
(
p
,
pObj
,
1
+
Abc_MaxInt
(
Gia_ObjLevel
(
p
,
Gia_ObjFanin0
(
pObj
)),
Gia_ObjLevel
(
p
,
Gia_ObjFanin1
(
pObj
)))
);
}
static
inline
void
Gia_ObjSetAndLevel
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
assert
(
Gia_ObjIsAnd
(
pObj
)
);
Gia_ObjSetLevel
(
p
,
pObj
,
1
+
Abc_MaxInt
(
Gia_ObjLevel
(
p
,
Gia_ObjFanin0
(
pObj
)),
Gia_ObjLevel
(
p
,
Gia_ObjFanin1
(
pObj
)))
);
}
static
inline
void
Gia_ObjSetXorLevel
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
assert
(
Gia_ObjIsXor
(
pObj
)
);
Gia_ObjSetLevel
(
p
,
pObj
,
2
+
Abc_MaxInt
(
Gia_ObjLevel
(
p
,
Gia_ObjFanin0
(
pObj
)),
Gia_ObjLevel
(
p
,
Gia_ObjFanin1
(
pObj
)))
);
}
static
inline
void
Gia_ObjSetMuxLevel
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
assert
(
Gia_ObjIsMux
(
p
,
pObj
)
);
Gia_ObjSetLevel
(
p
,
pObj
,
2
+
Abc_MaxInt
(
Abc_MaxInt
(
Gia_ObjLevel
(
p
,
Gia_ObjFanin0
(
pObj
)),
Gia_ObjLevel
(
p
,
Gia_ObjFanin1
(
pObj
))),
Gia_ObjLevel
(
p
,
Gia_ObjFanin2
(
p
,
pObj
)))
);
}
static
inline
void
Gia_ObjSetGateLevel
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
){
if
(
Gia_ObjIsMux
(
p
,
pObj
)
)
Gia_ObjSetMuxLevel
(
p
,
pObj
);
else
if
(
Gia_ObjIsXor
(
pObj
)
)
Gia_ObjSetXorLevel
(
p
,
pObj
);
else
if
(
Gia_ObjIsAnd
(
pObj
)
)
Gia_ObjSetAndLevel
(
p
,
pObj
);
}
static
inline
int
Gia_ObjNum
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
return
(
int
)(
unsigned
char
)
Vec_StrGetEntry
(
p
->
vTtNums
,
Gia_ObjId
(
p
,
pObj
));
}
static
inline
int
Gia_ObjNum
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
return
(
int
)(
unsigned
char
)
Vec_StrGetEntry
(
p
->
vTtNums
,
Gia_ObjId
(
p
,
pObj
));
}
static
inline
void
Gia_ObjSetNum
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
int
n
)
{
assert
(
n
>=
0
&&
n
<
254
);
Vec_StrSetEntry
(
p
->
vTtNums
,
Gia_ObjId
(
p
,
pObj
),
(
char
)
n
);
}
static
inline
void
Gia_ObjSetNum
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
int
n
)
{
assert
(
n
>=
0
&&
n
<
254
);
Vec_StrSetEntry
(
p
->
vTtNums
,
Gia_ObjId
(
p
,
pObj
),
(
char
)
n
);
}
...
@@ -499,6 +507,7 @@ static inline Gia_Obj_t * Gia_ManAppendObj( Gia_Man_t * p )
...
@@ -499,6 +507,7 @@ static inline Gia_Obj_t * Gia_ManAppendObj( Gia_Man_t * p )
int
nObjNew
=
Abc_MinInt
(
2
*
p
->
nObjsAlloc
,
(
1
<<
29
)
);
int
nObjNew
=
Abc_MinInt
(
2
*
p
->
nObjsAlloc
,
(
1
<<
29
)
);
if
(
p
->
nObjs
==
(
1
<<
29
)
)
if
(
p
->
nObjs
==
(
1
<<
29
)
)
printf
(
"Hard limit on the number of nodes (2^29) is reached. Quitting...
\n
"
),
exit
(
1
);
printf
(
"Hard limit on the number of nodes (2^29) is reached. Quitting...
\n
"
),
exit
(
1
);
assert
(
p
->
nObjs
<
nObjNew
);
if
(
p
->
fVerbose
)
if
(
p
->
fVerbose
)
printf
(
"Extending GIA object storage: %d -> %d.
\n
"
,
p
->
nObjsAlloc
,
nObjNew
);
printf
(
"Extending GIA object storage: %d -> %d.
\n
"
,
p
->
nObjsAlloc
,
nObjNew
);
assert
(
p
->
nObjsAlloc
>
0
);
assert
(
p
->
nObjsAlloc
>
0
);
...
@@ -887,7 +896,7 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re
...
@@ -887,7 +896,7 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re
#define Gia_ManForEachAndReverse( p, pObj, i ) \
#define Gia_ManForEachAndReverse( p, pObj, i ) \
for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) if ( !Gia_ObjIsAnd(pObj) ) {} else
for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) if ( !Gia_ObjIsAnd(pObj) ) {} else
#define Gia_ManForEachMux( p, pObj, i ) \
#define Gia_ManForEachMux( p, pObj, i ) \
for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsMux(p, i) ) {} else
for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsMux
Id
(p, i) ) {} else
#define Gia_ManForEachCi( p, pObj, i ) \
#define Gia_ManForEachCi( p, pObj, i ) \
for ( i = 0; (i < Vec_IntSize(p->vCis)) && ((pObj) = Gia_ManCi(p, i)); i++ )
for ( i = 0; (i < Vec_IntSize(p->vCis)) && ((pObj) = Gia_ManCi(p, i)); i++ )
#define Gia_ManForEachCo( p, pObj, i ) \
#define Gia_ManForEachCo( p, pObj, i ) \
...
@@ -920,6 +929,7 @@ extern void Gia_DumpAiger( Gia_Man_t * p, char * pFilePrefix, int
...
@@ -920,6 +929,7 @@ extern void Gia_DumpAiger( Gia_Man_t * p, char * pFilePrefix, int
extern
Vec_Str_t
*
Gia_AigerWriteIntoMemoryStr
(
Gia_Man_t
*
p
);
extern
Vec_Str_t
*
Gia_AigerWriteIntoMemoryStr
(
Gia_Man_t
*
p
);
extern
Vec_Str_t
*
Gia_AigerWriteIntoMemoryStrPart
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vCis
,
Vec_Int_t
*
vAnds
,
Vec_Int_t
*
vCos
,
int
nRegs
);
extern
Vec_Str_t
*
Gia_AigerWriteIntoMemoryStrPart
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vCis
,
Vec_Int_t
*
vAnds
,
Vec_Int_t
*
vCos
,
int
nRegs
);
extern
void
Gia_AigerWriteSimple
(
Gia_Man_t
*
pInit
,
char
*
pFileName
);
extern
void
Gia_AigerWriteSimple
(
Gia_Man_t
*
pInit
,
char
*
pFileName
);
extern
Gia_Man_t
*
Gia_ManBalance
(
Gia_Man_t
*
p
,
int
fSimpleAnd
,
int
fVerbose
);
/*=== giaBidec.c ===========================================================*/
/*=== giaBidec.c ===========================================================*/
extern
unsigned
*
Gia_ManConvertAigToTruth
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pRoot
,
Vec_Int_t
*
vLeaves
,
Vec_Int_t
*
vTruth
,
Vec_Int_t
*
vVisited
);
extern
unsigned
*
Gia_ManConvertAigToTruth
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pRoot
,
Vec_Int_t
*
vLeaves
,
Vec_Int_t
*
vTruth
,
Vec_Int_t
*
vVisited
);
extern
Gia_Man_t
*
Gia_ManPerformBidec
(
Gia_Man_t
*
p
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManPerformBidec
(
Gia_Man_t
*
p
,
int
fVerbose
);
...
...
src/aig/gia/giaBalance.c
0 → 100644
View file @
a7fcdf20
This diff is collapsed.
Click to expand it.
src/aig/gia/giaDup.c
View file @
a7fcdf20
...
@@ -928,7 +928,7 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
...
@@ -928,7 +928,7 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
{
{
if
(
Gia_ObjIsXor
(
pObj
)
)
if
(
Gia_ObjIsXor
(
pObj
)
)
pObj
->
Value
=
Gia_ManAppendXorReal
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
pObj
->
Value
=
Gia_ManAppendXorReal
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
else
if
(
Gia_ObjIsMux
(
p
,
i
)
)
else
if
(
Gia_ObjIsMux
(
p
,
pObj
)
)
pObj
->
Value
=
Gia_ManAppendMuxReal
(
pNew
,
Gia_ObjFanin2Copy
(
p
,
pObj
),
Gia_ObjFanin1Copy
(
pObj
),
Gia_ObjFanin0Copy
(
pObj
)
);
pObj
->
Value
=
Gia_ManAppendMuxReal
(
pNew
,
Gia_ObjFanin2Copy
(
p
,
pObj
),
Gia_ObjFanin1Copy
(
pObj
),
Gia_ObjFanin0Copy
(
pObj
)
);
else
else
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
...
...
src/aig/gia/giaMuxes.c
View file @
a7fcdf20
...
@@ -113,7 +113,7 @@ Gia_Man_t * Gia_ManDupNoMuxes( Gia_Man_t * p )
...
@@ -113,7 +113,7 @@ Gia_Man_t * Gia_ManDupNoMuxes( Gia_Man_t * p )
Gia_ManHashStart
(
pNew
);
Gia_ManHashStart
(
pNew
);
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
{
{
if
(
Gia_ObjIsMux
(
p
,
i
)
)
if
(
Gia_ObjIsMux
Id
(
p
,
i
)
)
pObj
->
Value
=
Gia_ManHashMux
(
pNew
,
Gia_ObjFanin2Copy
(
p
,
pObj
),
Gia_ObjFanin1Copy
(
pObj
),
Gia_ObjFanin0Copy
(
pObj
)
);
pObj
->
Value
=
Gia_ManHashMux
(
pNew
,
Gia_ObjFanin2Copy
(
p
,
pObj
),
Gia_ObjFanin1Copy
(
pObj
),
Gia_ObjFanin0Copy
(
pObj
)
);
else
if
(
Gia_ObjIsXor
(
pObj
)
)
else
if
(
Gia_ObjIsXor
(
pObj
)
)
pObj
->
Value
=
Gia_ManHashXor
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
pObj
->
Value
=
Gia_ManHashXor
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
...
@@ -170,7 +170,7 @@ Gia_Man_t * Gia_ManDupMuxesTest( Gia_Man_t * p )
...
@@ -170,7 +170,7 @@ Gia_Man_t * Gia_ManDupMuxesTest( Gia_Man_t * p )
int
Gia_MuxRef_rec
(
Gia_Man_t
*
p
,
int
iObj
)
int
Gia_MuxRef_rec
(
Gia_Man_t
*
p
,
int
iObj
)
{
{
Gia_Obj_t
*
pObj
;
Gia_Obj_t
*
pObj
;
if
(
!
Gia_ObjIsMux
(
p
,
iObj
)
)
if
(
!
Gia_ObjIsMux
Id
(
p
,
iObj
)
)
return
0
;
return
0
;
pObj
=
Gia_ManObj
(
p
,
iObj
);
pObj
=
Gia_ManObj
(
p
,
iObj
);
if
(
Gia_ObjRefInc
(
p
,
pObj
)
)
if
(
Gia_ObjRefInc
(
p
,
pObj
)
)
...
@@ -182,7 +182,7 @@ int Gia_MuxRef_rec( Gia_Man_t * p, int iObj )
...
@@ -182,7 +182,7 @@ int Gia_MuxRef_rec( Gia_Man_t * p, int iObj )
int
Gia_MuxRef
(
Gia_Man_t
*
p
,
int
iObj
)
int
Gia_MuxRef
(
Gia_Man_t
*
p
,
int
iObj
)
{
{
Gia_Obj_t
*
pObj
=
Gia_ManObj
(
p
,
iObj
);
Gia_Obj_t
*
pObj
=
Gia_ManObj
(
p
,
iObj
);
assert
(
Gia_ObjIsMux
(
p
,
iObj
)
);
assert
(
Gia_ObjIsMux
Id
(
p
,
iObj
)
);
return
Gia_MuxRef_rec
(
p
,
Gia_ObjFaninId0p
(
p
,
pObj
)
)
+
return
Gia_MuxRef_rec
(
p
,
Gia_ObjFaninId0p
(
p
,
pObj
)
)
+
Gia_MuxRef_rec
(
p
,
Gia_ObjFaninId1p
(
p
,
pObj
)
)
+
Gia_MuxRef_rec
(
p
,
Gia_ObjFaninId1p
(
p
,
pObj
)
)
+
Gia_MuxRef_rec
(
p
,
Gia_ObjFaninId2p
(
p
,
pObj
)
)
+
1
;
Gia_MuxRef_rec
(
p
,
Gia_ObjFaninId2p
(
p
,
pObj
)
)
+
1
;
...
@@ -190,7 +190,7 @@ int Gia_MuxRef( Gia_Man_t * p, int iObj )
...
@@ -190,7 +190,7 @@ int Gia_MuxRef( Gia_Man_t * p, int iObj )
int
Gia_MuxDeref_rec
(
Gia_Man_t
*
p
,
int
iObj
)
int
Gia_MuxDeref_rec
(
Gia_Man_t
*
p
,
int
iObj
)
{
{
Gia_Obj_t
*
pObj
;
Gia_Obj_t
*
pObj
;
if
(
!
Gia_ObjIsMux
(
p
,
iObj
)
)
if
(
!
Gia_ObjIsMux
Id
(
p
,
iObj
)
)
return
0
;
return
0
;
pObj
=
Gia_ManObj
(
p
,
iObj
);
pObj
=
Gia_ManObj
(
p
,
iObj
);
if
(
Gia_ObjRefDec
(
p
,
pObj
)
)
if
(
Gia_ObjRefDec
(
p
,
pObj
)
)
...
@@ -202,7 +202,7 @@ int Gia_MuxDeref_rec( Gia_Man_t * p, int iObj )
...
@@ -202,7 +202,7 @@ int Gia_MuxDeref_rec( Gia_Man_t * p, int iObj )
int
Gia_MuxDeref
(
Gia_Man_t
*
p
,
int
iObj
)
int
Gia_MuxDeref
(
Gia_Man_t
*
p
,
int
iObj
)
{
{
Gia_Obj_t
*
pObj
=
Gia_ManObj
(
p
,
iObj
);
Gia_Obj_t
*
pObj
=
Gia_ManObj
(
p
,
iObj
);
assert
(
Gia_ObjIsMux
(
p
,
iObj
)
);
assert
(
Gia_ObjIsMux
Id
(
p
,
iObj
)
);
return
Gia_MuxDeref_rec
(
p
,
Gia_ObjFaninId0p
(
p
,
pObj
)
)
+
return
Gia_MuxDeref_rec
(
p
,
Gia_ObjFaninId0p
(
p
,
pObj
)
)
+
Gia_MuxDeref_rec
(
p
,
Gia_ObjFaninId1p
(
p
,
pObj
)
)
+
Gia_MuxDeref_rec
(
p
,
Gia_ObjFaninId1p
(
p
,
pObj
)
)
+
Gia_MuxDeref_rec
(
p
,
Gia_ObjFaninId2p
(
p
,
pObj
)
)
+
1
;
Gia_MuxDeref_rec
(
p
,
Gia_ObjFaninId2p
(
p
,
pObj
)
)
+
1
;
...
@@ -210,7 +210,7 @@ int Gia_MuxDeref( Gia_Man_t * p, int iObj )
...
@@ -210,7 +210,7 @@ int Gia_MuxDeref( Gia_Man_t * p, int iObj )
int
Gia_MuxMffcSize
(
Gia_Man_t
*
p
,
int
iObj
)
int
Gia_MuxMffcSize
(
Gia_Man_t
*
p
,
int
iObj
)
{
{
int
Count1
,
Count2
;
int
Count1
,
Count2
;
if
(
!
Gia_ObjIsMux
(
p
,
iObj
)
)
if
(
!
Gia_ObjIsMux
Id
(
p
,
iObj
)
)
return
0
;
return
0
;
Count1
=
Gia_MuxDeref
(
p
,
iObj
);
Count1
=
Gia_MuxDeref
(
p
,
iObj
);
Count2
=
Gia_MuxRef
(
p
,
iObj
);
Count2
=
Gia_MuxRef
(
p
,
iObj
);
...
@@ -232,10 +232,10 @@ int Gia_MuxMffcSize( Gia_Man_t * p, int iObj )
...
@@ -232,10 +232,10 @@ int Gia_MuxMffcSize( Gia_Man_t * p, int iObj )
void
Gia_MuxStructPrint_rec
(
Gia_Man_t
*
p
,
int
iObj
,
int
fFirst
)
void
Gia_MuxStructPrint_rec
(
Gia_Man_t
*
p
,
int
iObj
,
int
fFirst
)
{
{
Gia_Obj_t
*
pObj
=
Gia_ManObj
(
p
,
iObj
);
Gia_Obj_t
*
pObj
=
Gia_ManObj
(
p
,
iObj
);
if
(
!
fFirst
&&
(
!
Gia_ObjIsMux
(
p
,
iObj
)
||
Gia_ObjRefNumId
(
p
,
iObj
)
>
0
)
)
if
(
!
fFirst
&&
(
!
Gia_ObjIsMux
Id
(
p
,
iObj
)
||
Gia_ObjRefNumId
(
p
,
iObj
)
>
0
)
)
return
;
return
;
printf
(
" [(%s"
,
Gia_ObjFaninC2
(
p
,
pObj
)
?
"!"
:
""
);
printf
(
" [(%s"
,
Gia_ObjFaninC2
(
p
,
pObj
)
?
"!"
:
""
);
if
(
!
Gia_ObjIsMux
(
p
,
Gia_ObjFaninId2p
(
p
,
pObj
))
)
if
(
!
Gia_ObjIsMux
Id
(
p
,
Gia_ObjFaninId2p
(
p
,
pObj
))
)
printf
(
"%d"
,
Gia_ObjFaninId2p
(
p
,
pObj
)
);
printf
(
"%d"
,
Gia_ObjFaninId2p
(
p
,
pObj
)
);
else
else
Gia_MuxStructPrint_rec
(
p
,
Gia_ObjFaninId2p
(
p
,
pObj
),
0
);
Gia_MuxStructPrint_rec
(
p
,
Gia_ObjFaninId2p
(
p
,
pObj
),
0
);
...
@@ -248,7 +248,7 @@ void Gia_MuxStructPrint_rec( Gia_Man_t * p, int iObj, int fFirst )
...
@@ -248,7 +248,7 @@ void Gia_MuxStructPrint_rec( Gia_Man_t * p, int iObj, int fFirst )
void
Gia_MuxStructPrint
(
Gia_Man_t
*
p
,
int
iObj
)
void
Gia_MuxStructPrint
(
Gia_Man_t
*
p
,
int
iObj
)
{
{
int
Count1
,
Count2
;
int
Count1
,
Count2
;
assert
(
Gia_ObjIsMux
(
p
,
iObj
)
);
assert
(
Gia_ObjIsMux
Id
(
p
,
iObj
)
);
Count1
=
Gia_MuxDeref
(
p
,
iObj
);
Count1
=
Gia_MuxDeref
(
p
,
iObj
);
Gia_MuxStructPrint_rec
(
p
,
iObj
,
1
);
Gia_MuxStructPrint_rec
(
p
,
iObj
,
1
);
Count2
=
Gia_MuxRef
(
p
,
iObj
);
Count2
=
Gia_MuxRef
(
p
,
iObj
);
...
@@ -287,7 +287,7 @@ void Gia_ManMuxProfiling( Gia_Man_t * p )
...
@@ -287,7 +287,7 @@ void Gia_ManMuxProfiling( Gia_Man_t * p )
Total
++
;
Total
++
;
nRefs
=
Gia_ObjRefNumId
(
pNew
,
i
);
nRefs
=
Gia_ObjRefNumId
(
pNew
,
i
);
assert
(
nRefs
>
0
);
assert
(
nRefs
>
0
);
if
(
nRefs
>
1
||
!
Gia_ObjIsMux
(
pNew
,
Vec_IntEntry
(
vFans
,
i
))
)
if
(
nRefs
>
1
||
!
Gia_ObjIsMux
Id
(
pNew
,
Vec_IntEntry
(
vFans
,
i
))
)
{
{
Roots
++
;
Roots
++
;
Size
=
Gia_MuxMffcSize
(
pNew
,
i
);
Size
=
Gia_MuxMffcSize
(
pNew
,
i
);
...
...
src/aig/gia/giaUtil.c
View file @
a7fcdf20
...
@@ -557,7 +557,7 @@ void Gia_ManCreateRefs( Gia_Man_t * p )
...
@@ -557,7 +557,7 @@ void Gia_ManCreateRefs( Gia_Man_t * p )
{
{
Gia_ObjRefFanin0Inc
(
p
,
pObj
);
Gia_ObjRefFanin0Inc
(
p
,
pObj
);
Gia_ObjRefFanin1Inc
(
p
,
pObj
);
Gia_ObjRefFanin1Inc
(
p
,
pObj
);
if
(
Gia_ObjIsMux
(
p
,
i
)
)
if
(
Gia_ObjIsMux
Id
(
p
,
i
)
)
Gia_ObjRefFanin2Inc
(
p
,
pObj
);
Gia_ObjRefFanin2Inc
(
p
,
pObj
);
}
}
else
if
(
Gia_ObjIsCo
(
pObj
)
)
else
if
(
Gia_ObjIsCo
(
pObj
)
)
...
@@ -1128,7 +1128,7 @@ void Gia_ObjPrint( Gia_Man_t * p, Gia_Obj_t * pObj )
...
@@ -1128,7 +1128,7 @@ void Gia_ObjPrint( Gia_Man_t * p, Gia_Obj_t * pObj )
printf
(
"XOR( %4d%s, %4d%s )"
,
printf
(
"XOR( %4d%s, %4d%s )"
,
Gia_ObjFaninId0p
(
p
,
pObj
),
(
Gia_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
),
Gia_ObjFaninId0p
(
p
,
pObj
),
(
Gia_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
),
Gia_ObjFaninId1p
(
p
,
pObj
),
(
Gia_ObjFaninC1
(
pObj
)
?
"
\'
"
:
" "
)
);
Gia_ObjFaninId1p
(
p
,
pObj
),
(
Gia_ObjFaninC1
(
pObj
)
?
"
\'
"
:
" "
)
);
else
if
(
Gia_ObjIsMux
(
p
,
Gia_ObjId
(
p
,
pObj
))
)
else
if
(
Gia_ObjIsMux
Id
(
p
,
Gia_ObjId
(
p
,
pObj
))
)
printf
(
"MUX( %4d%s, %4d%s, %4d%s )"
,
printf
(
"MUX( %4d%s, %4d%s, %4d%s )"
,
Gia_ObjFaninId2p
(
p
,
pObj
),
(
Gia_ObjFaninC2
(
p
,
pObj
)
?
"
\'
"
:
" "
),
Gia_ObjFaninId2p
(
p
,
pObj
),
(
Gia_ObjFaninC2
(
p
,
pObj
)
?
"
\'
"
:
" "
),
Gia_ObjFaninId1p
(
p
,
pObj
),
(
Gia_ObjFaninC1
(
pObj
)
?
"
\'
"
:
" "
),
Gia_ObjFaninId1p
(
p
,
pObj
),
(
Gia_ObjFaninC1
(
pObj
)
?
"
\'
"
:
" "
),
...
@@ -1482,7 +1482,7 @@ Vec_Int_t * Gia_ManFirstFanouts( Gia_Man_t * p )
...
@@ -1482,7 +1482,7 @@ Vec_Int_t * Gia_ManFirstFanouts( Gia_Man_t * p )
Vec_IntWriteEntry
(
vFans
,
Gia_ObjFaninId0p
(
p
,
pObj
),
i
);
Vec_IntWriteEntry
(
vFans
,
Gia_ObjFaninId0p
(
p
,
pObj
),
i
);
if
(
Vec_IntEntry
(
vFans
,
Gia_ObjFaninId1p
(
p
,
pObj
))
==
0
)
if
(
Vec_IntEntry
(
vFans
,
Gia_ObjFaninId1p
(
p
,
pObj
))
==
0
)
Vec_IntWriteEntry
(
vFans
,
Gia_ObjFaninId1p
(
p
,
pObj
),
i
);
Vec_IntWriteEntry
(
vFans
,
Gia_ObjFaninId1p
(
p
,
pObj
),
i
);
if
(
Gia_ObjIsMux
(
p
,
i
)
&&
Vec_IntEntry
(
vFans
,
Gia_ObjFaninId2p
(
p
,
pObj
))
==
0
)
if
(
Gia_ObjIsMux
Id
(
p
,
i
)
&&
Vec_IntEntry
(
vFans
,
Gia_ObjFaninId2p
(
p
,
pObj
))
==
0
)
Vec_IntWriteEntry
(
vFans
,
Gia_ObjFaninId2p
(
p
,
pObj
),
i
);
Vec_IntWriteEntry
(
vFans
,
Gia_ObjFaninId2p
(
p
,
pObj
),
i
);
}
}
else
if
(
Gia_ObjIsCo
(
pObj
)
)
else
if
(
Gia_ObjIsCo
(
pObj
)
)
...
...
src/aig/gia/module.make
View file @
a7fcdf20
SRC
+=
src/aig/gia/giaAig.c
\
SRC
+=
src/aig/gia/giaAig.c
\
src/aig/gia/giaAiger.c
\
src/aig/gia/giaAiger.c
\
src/aig/gia/giaAigerExt.c
\
src/aig/gia/giaAigerExt.c
\
src/aig/gia/giaBalance.c
\
src/aig/gia/giaBidec.c
\
src/aig/gia/giaBidec.c
\
src/aig/gia/giaCCof.c
\
src/aig/gia/giaCCof.c
\
src/aig/gia/giaCex.c
\
src/aig/gia/giaCex.c
\
...
...
src/base/abci/abc.c
View file @
a7fcdf20
...
@@ -350,6 +350,7 @@ static int Abc_CommandAbc9Enable ( Abc_Frame_t * pAbc, int argc, cha
...
@@ -350,6 +350,7 @@ static int Abc_CommandAbc9Enable ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandAbc9Dc2
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Dc2
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Bidec
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Bidec
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Shrink
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Shrink
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Balance
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Miter
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Miter
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Miter2
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Miter2
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Append
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Append
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
@@ -908,6 +909,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
...
@@ -908,6 +909,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&dc2"
,
Abc_CommandAbc9Dc2
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&dc2"
,
Abc_CommandAbc9Dc2
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&bidec"
,
Abc_CommandAbc9Bidec
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&bidec"
,
Abc_CommandAbc9Bidec
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&shrink"
,
Abc_CommandAbc9Shrink
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&shrink"
,
Abc_CommandAbc9Shrink
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&b"
,
Abc_CommandAbc9Balance
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&miter"
,
Abc_CommandAbc9Miter
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&miter"
,
Abc_CommandAbc9Miter
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&miter2"
,
Abc_CommandAbc9Miter2
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&miter2"
,
Abc_CommandAbc9Miter2
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&append"
,
Abc_CommandAbc9Append
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&append"
,
Abc_CommandAbc9Append
,
0
);
...
@@ -27405,6 +27407,78 @@ usage:
...
@@ -27405,6 +27407,78 @@ usage:
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Abc_CommandAbc9Balance
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Gia_Man_t
*
pTemp
=
NULL
;
int
c
,
fVerbose
=
0
;
int
fSimpleAnd
=
0
;
int
fKeepLevel
=
0
;
int
nFanoutMax
=
50
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Nlavh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'N'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-N
\"
should be followed by a char string.
\n
"
);
goto
usage
;
}
nFanoutMax
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nFanoutMax
<
0
)
goto
usage
;
break
;
case
'l'
:
fKeepLevel
^=
1
;
break
;
case
'a'
:
fSimpleAnd
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pAbc
->
pGia
==
NULL
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9Balance(): There is no AIG.
\n
"
);
return
1
;
}
if
(
Gia_ManHasMapping
(
pAbc
->
pGia
)
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9Balance(): The current AIG is mapped.
\n
"
);
return
1
;
}
pTemp
=
Gia_ManBalance
(
pAbc
->
pGia
,
fSimpleAnd
,
fVerbose
);
Abc_FrameUpdateGia
(
pAbc
,
pTemp
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &b [-avh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs AIG balancing to reduce delay
\n
"
);
Abc_Print
(
-
2
,
"
\t
-a : toggle using AND instead of AND/XOR/MUX [default = %s]
\n
"
,
fSimpleAnd
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandAbc9Miter
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandAbc9Miter
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
FILE
*
pFile
;
FILE
*
pFile
;
src/map/mpm/mpmAbc.c
View file @
a7fcdf20
...
@@ -91,7 +91,7 @@ Mig_Man_t * Mig_ManCreate( void * pGia )
...
@@ -91,7 +91,7 @@ Mig_Man_t * Mig_ManCreate( void * pGia )
Gia_ManConst0
(
p
)
->
Value
=
0
;
Gia_ManConst0
(
p
)
->
Value
=
0
;
Gia_ManForEachObj1
(
p
,
pObj
,
i
)
Gia_ManForEachObj1
(
p
,
pObj
,
i
)
{
{
if
(
Gia_ObjIsMux
(
p
,
i
)
)
if
(
Gia_ObjIsMux
Id
(
p
,
i
)
)
pObj
->
Value
=
Mig_ManAppendMux
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
),
Gia_ObjFanin2Copy
(
p
,
pObj
)
);
pObj
->
Value
=
Mig_ManAppendMux
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
),
Gia_ObjFanin2Copy
(
p
,
pObj
)
);
else
if
(
Gia_ObjIsXor
(
pObj
)
)
else
if
(
Gia_ObjIsXor
(
pObj
)
)
pObj
->
Value
=
Mig_ManAppendXor
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
pObj
->
Value
=
Mig_ManAppendXor
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
...
...
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