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
2afef15a
Commit
2afef15a
authored
May 17, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding support of XOR/MUX in GIA.
parent
e04ded56
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
272 additions
and
36 deletions
+272
-36
src/aig/gia/gia.h
+0
-0
src/aig/gia/giaAiger.c
+1
-0
src/aig/gia/giaDup.c
+136
-1
src/aig/gia/giaHash.c
+121
-34
src/aig/gia/giaMan.c
+1
-0
src/aig/gia/giaScl.c
+2
-1
src/aig/gia/giaUtil.c
+11
-0
No files found.
src/aig/gia/gia.h
View file @
2afef15a
This diff is collapsed.
Click to expand it.
src/aig/gia/giaAiger.c
View file @
2afef15a
...
@@ -1014,6 +1014,7 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
...
@@ -1014,6 +1014,7 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
unsigned
char
*
pBuffer
;
unsigned
char
*
pBuffer
;
unsigned
uLit0
,
uLit1
,
uLit
;
unsigned
uLit0
,
uLit1
,
uLit
;
// assert( Gia_ManIsNormalized(pInit) );
// assert( Gia_ManIsNormalized(pInit) );
assert
(
pInit
->
nXors
==
0
&&
pInit
->
nMuxes
==
0
);
if
(
Gia_ManCoNum
(
pInit
)
==
0
)
if
(
Gia_ManCoNum
(
pInit
)
==
0
)
{
{
...
...
src/aig/gia/giaDup.c
View file @
2afef15a
...
@@ -752,6 +752,8 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
...
@@ -752,6 +752,8 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
int
i
,
nRos
=
0
,
nRis
=
0
;
int
i
,
nRos
=
0
,
nRis
=
0
;
Gia_ManFillValue
(
p
);
Gia_ManFillValue
(
p
);
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
if
(
p
->
pMuxes
)
pNew
->
pMuxes
=
ABC_CALLOC
(
unsigned
,
pNew
->
nObjsAlloc
);
pNew
->
nConstrs
=
p
->
nConstrs
;
pNew
->
nConstrs
=
p
->
nConstrs
;
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
...
@@ -762,7 +764,14 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
...
@@ -762,7 +764,14 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
continue
;
continue
;
pObj
->
fMark0
=
0
;
pObj
->
fMark0
=
0
;
if
(
Gia_ObjIsAnd
(
pObj
)
)
if
(
Gia_ObjIsAnd
(
pObj
)
)
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
{
if
(
Gia_ObjIsXor
(
pObj
)
)
pObj
->
Value
=
Gia_ManAppendXorReal
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
else
if
(
Gia_ObjIsMux
(
p
,
pObj
)
)
pObj
->
Value
=
Gia_ManAppendMuxReal
(
pNew
,
Gia_ObjFanin2Copy
(
p
,
pObj
),
Gia_ObjFanin1Copy
(
pObj
),
Gia_ObjFanin0Copy
(
pObj
)
);
else
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
}
else
if
(
Gia_ObjIsCi
(
pObj
)
)
else
if
(
Gia_ObjIsCi
(
pObj
)
)
{
{
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
...
@@ -2350,6 +2359,132 @@ Gia_Man_t * Gia_ManDupFromVecs( Gia_Man_t * p, Vec_Int_t * vCis, Vec_Int_t * vAn
...
@@ -2350,6 +2359,132 @@ Gia_Man_t * Gia_ManDupFromVecs( Gia_Man_t * p, Vec_Int_t * vCis, Vec_Int_t * vAn
return
pNew
;
return
pNew
;
}
}
/**Function*************************************************************
Synopsis [Derives GIA with MUXes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManDupMuxes
(
Gia_Man_t
*
p
)
{
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Obj_t
*
pObj
,
*
pFan0
,
*
pFan1
,
*
pFanC
;
int
i
;
assert
(
p
->
pMuxes
==
NULL
);
// start the new manager
pNew
=
Gia_ManStart
(
5000
);
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
pNew
->
pMuxes
=
ABC_CALLOC
(
unsigned
,
pNew
->
nObjsAlloc
);
// create constant
Gia_ManConst0
(
p
)
->
Value
=
0
;
// create PIs
Gia_ManForEachCi
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
// create internal nodes
Gia_ManHashStart
(
pNew
);
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
{
if
(
!
Gia_ObjIsMuxType
(
pObj
)
)
pObj
->
Value
=
Gia_ManHashAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
else
if
(
Gia_ObjRecognizeExor
(
pObj
,
&
pFan0
,
&
pFan1
)
)
pObj
->
Value
=
Gia_ManHashXorReal
(
pNew
,
Gia_ObjLitCopy
(
p
,
Gia_ObjToLit
(
p
,
pFan0
)),
Gia_ObjLitCopy
(
p
,
Gia_ObjToLit
(
p
,
pFan1
))
);
else
{
pFanC
=
Gia_ObjRecognizeMux
(
pObj
,
&
pFan1
,
&
pFan0
);
pObj
->
Value
=
Gia_ManHashMuxReal
(
pNew
,
Gia_ObjLitCopy
(
p
,
Gia_ObjToLit
(
p
,
pFanC
)),
Gia_ObjLitCopy
(
p
,
Gia_ObjToLit
(
p
,
pFan1
)),
Gia_ObjLitCopy
(
p
,
Gia_ObjToLit
(
p
,
pFan0
))
);
}
}
Gia_ManHashStop
(
pNew
);
// create ROs
Gia_ManForEachCo
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
// perform cleanup
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
return
pNew
;
}
/**Function*************************************************************
Synopsis [Derives GIA without MUXes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManDupNoMuxes
(
Gia_Man_t
*
p
)
{
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Obj_t
*
pObj
;
int
i
;
assert
(
p
->
pMuxes
!=
NULL
);
// start the new manager
pNew
=
Gia_ManStart
(
5000
);
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
// create constant
Gia_ManConst0
(
p
)
->
Value
=
0
;
// create PIs
Gia_ManForEachCi
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
// create internal nodes
Gia_ManHashStart
(
pNew
);
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
{
if
(
Gia_ObjIsMux
(
p
,
pObj
)
)
pObj
->
Value
=
Gia_ManHashMux
(
pNew
,
Gia_ObjFanin2Copy
(
p
,
pObj
),
Gia_ObjFanin1Copy
(
pObj
),
Gia_ObjFanin0Copy
(
pObj
)
);
else
if
(
Gia_ObjIsXor
(
pObj
)
)
pObj
->
Value
=
Gia_ManHashXor
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
else
pObj
->
Value
=
Gia_ManHashAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
}
Gia_ManHashStop
(
pNew
);
// create ROs
Gia_ManForEachCo
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
// perform cleanup
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
return
pNew
;
}
/**Function*************************************************************
Synopsis [Test these procedures.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManDupMuxesTest
(
Gia_Man_t
*
p
)
{
Gia_Man_t
*
pNew
,
*
pNew2
;
pNew
=
Gia_ManDupMuxes
(
p
);
pNew2
=
Gia_ManDupNoMuxes
(
pNew
);
Gia_ManPrintStats
(
p
,
0
,
0
,
0
);
Gia_ManPrintStats
(
pNew
,
0
,
0
,
0
);
Gia_ManPrintStats
(
pNew2
,
0
,
0
,
0
);
Gia_ManStop
(
pNew
);
// Gia_ManStop( pNew2 );
return
pNew2
;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
src/aig/gia/giaHash.c
View file @
2afef15a
...
@@ -33,7 +33,7 @@ ABC_NAMESPACE_IMPL_START
...
@@ -33,7 +33,7 @@ ABC_NAMESPACE_IMPL_START
/**Function*************************************************************
/**Function*************************************************************
Synopsis [
Hashing the node
.]
Synopsis [
Returns the place where this node is stored (or should be stored)
.]
Description []
Description []
...
@@ -42,35 +42,25 @@ ABC_NAMESPACE_IMPL_START
...
@@ -42,35 +42,25 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
static
inline
int
Gia_ManHashOne
(
int
iLit0
,
int
iLit1
,
int
TableSize
)
static
inline
int
Gia_ManHashOne
(
int
iLit0
,
int
iLit1
,
int
iLitC
,
int
TableSize
)
{
{
unsigned
Key
=
0
;
unsigned
Key
=
iLitC
*
2011
;
assert
(
iLit0
<
iLit1
);
Key
+=
Abc_Lit2Var
(
iLit0
)
*
7937
;
Key
^=
Abc_Lit2Var
(
iLit0
)
*
7937
;
Key
+=
Abc_Lit2Var
(
iLit1
)
*
2971
;
Key
^=
Abc_Lit2Var
(
iLit1
)
*
2971
;
Key
+=
Abc_LitIsCompl
(
iLit0
)
*
911
;
Key
^=
Abc_LitIsCompl
(
iLit0
)
*
911
;
Key
+=
Abc_LitIsCompl
(
iLit1
)
*
353
;
Key
^=
Abc_LitIsCompl
(
iLit1
)
*
353
;
return
(
int
)(
Key
%
TableSize
);
return
(
int
)(
Key
%
TableSize
);
}
}
static
inline
int
*
Gia_ManHashFind
(
Gia_Man_t
*
p
,
int
iLit0
,
int
iLit1
,
int
iLitC
)
/**Function*************************************************************
Synopsis [Returns the place where this node is stored (or should be stored).]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
*
Gia_ManHashFind
(
Gia_Man_t
*
p
,
int
iLit0
,
int
iLit1
)
{
{
Gia_Obj_t
*
pThis
;
Gia_Obj_t
*
pThis
;
int
*
pPlace
=
p
->
pHTable
+
Gia_ManHashOne
(
iLit0
,
iLit1
,
p
->
nHTable
);
int
*
pPlace
=
p
->
pHTable
+
Gia_ManHashOne
(
iLit0
,
iLit1
,
iLitC
,
p
->
nHTable
);
assert
(
p
->
pMuxes
||
iLit0
<
iLit1
);
assert
(
iLit0
<
iLit1
||
(
!
Abc_LitIsCompl
(
iLit0
)
&&
!
Abc_LitIsCompl
(
iLit1
))
);
assert
(
iLitC
==
-
1
||
!
Abc_LitIsCompl
(
iLit1
)
);
for
(
pThis
=
(
*
pPlace
)
?
Gia_ManObj
(
p
,
Abc_Lit2Var
(
*
pPlace
))
:
NULL
;
pThis
;
for
(
pThis
=
(
*
pPlace
)
?
Gia_ManObj
(
p
,
Abc_Lit2Var
(
*
pPlace
))
:
NULL
;
pThis
;
pPlace
=
(
int
*
)
&
pThis
->
Value
,
pThis
=
(
*
pPlace
)
?
Gia_ManObj
(
p
,
Abc_Lit2Var
(
*
pPlace
))
:
NULL
)
pPlace
=
(
int
*
)
&
pThis
->
Value
,
pThis
=
(
*
pPlace
)
?
Gia_ManObj
(
p
,
Abc_Lit2Var
(
*
pPlace
))
:
NULL
)
if
(
Gia_ObjFaninLit0p
(
p
,
pThis
)
==
iLit0
&&
Gia_ObjFaninLit1p
(
p
,
pThis
)
==
iLit1
)
if
(
Gia_ObjFaninLit0p
(
p
,
pThis
)
==
iLit0
&&
Gia_ObjFaninLit1p
(
p
,
pThis
)
==
iLit1
&&
(
p
->
pMuxes
==
NULL
||
Gia_ObjFaninLit2p
(
p
,
pThis
)
==
iLitC
)
)
break
;
break
;
return
pPlace
;
return
pPlace
;
}
}
...
@@ -92,7 +82,7 @@ int Gia_ManHashLookup( Gia_Man_t * p, Gia_Obj_t * p0, Gia_Obj_t * p1 )
...
@@ -92,7 +82,7 @@ int Gia_ManHashLookup( Gia_Man_t * p, Gia_Obj_t * p0, Gia_Obj_t * p1 )
int
iLit1
=
Gia_ObjToLit
(
p
,
p1
);
int
iLit1
=
Gia_ObjToLit
(
p
,
p1
);
if
(
iLit0
>
iLit1
)
if
(
iLit0
>
iLit1
)
iLit0
^=
iLit1
,
iLit1
^=
iLit0
,
iLit0
^=
iLit1
;
iLit0
^=
iLit1
,
iLit1
^=
iLit0
,
iLit0
^=
iLit1
;
return
*
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
);
return
*
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
,
-
1
);
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -132,7 +122,7 @@ void Gia_ManHashStart( Gia_Man_t * p )
...
@@ -132,7 +122,7 @@ void Gia_ManHashStart( Gia_Man_t * p )
Gia_ManCleanValue
(
p
);
Gia_ManCleanValue
(
p
);
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
{
{
pPlace
=
Gia_ManHashFind
(
p
,
Gia_ObjFaninLit0
(
pObj
,
i
),
Gia_ObjFaninLit1
(
pObj
,
i
)
);
pPlace
=
Gia_ManHashFind
(
p
,
Gia_ObjFaninLit0
(
pObj
,
i
),
Gia_ObjFaninLit1
(
pObj
,
i
)
,
Gia_ObjFaninLit2
(
p
,
i
)
);
assert
(
*
pPlace
==
0
);
assert
(
*
pPlace
==
0
);
*
pPlace
=
Abc_Var2Lit
(
i
,
0
);
*
pPlace
=
Abc_Var2Lit
(
i
,
0
);
}
}
...
@@ -186,7 +176,7 @@ void Gia_ManHashResize( Gia_Man_t * p )
...
@@ -186,7 +176,7 @@ void Gia_ManHashResize( Gia_Man_t * p )
iNext
=
(
pThis
?
pThis
->
Value
:
0
)
)
iNext
=
(
pThis
?
pThis
->
Value
:
0
)
)
{
{
pThis
->
Value
=
0
;
pThis
->
Value
=
0
;
pPlace
=
Gia_ManHashFind
(
p
,
Gia_ObjFaninLit0p
(
p
,
pThis
),
Gia_ObjFaninLit1p
(
p
,
pThis
)
);
pPlace
=
Gia_ManHashFind
(
p
,
Gia_ObjFaninLit0p
(
p
,
pThis
),
Gia_ObjFaninLit1p
(
p
,
pThis
)
,
Gia_ObjFaninLit2p
(
p
,
pThis
)
);
assert
(
*
pPlace
==
0
);
// should not be there
assert
(
*
pPlace
==
0
);
// should not be there
*
pPlace
=
Abc_Var2Lit
(
Gia_ObjId
(
p
,
pThis
),
0
);
*
pPlace
=
Abc_Var2Lit
(
Gia_ObjId
(
p
,
pThis
),
0
);
assert
(
*
pPlace
!=
0
);
assert
(
*
pPlace
!=
0
);
...
@@ -463,7 +453,104 @@ static inline Gia_Obj_t * Gia_ManAddStrash( Gia_Man_t * p, Gia_Obj_t * p0, Gia_O
...
@@ -463,7 +453,104 @@ static inline Gia_Obj_t * Gia_ManAddStrash( Gia_Man_t * p, Gia_Obj_t * p0, Gia_O
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Rehashes AIG with mapping.]
Synopsis [Hashes XOR gate.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Gia_ManHashXorReal
(
Gia_Man_t
*
p
,
int
iLit0
,
int
iLit1
)
{
int
fCompl
=
0
;
assert
(
p
->
fAddStrash
==
0
);
if
(
iLit0
<
2
)
return
iLit0
?
Abc_LitNot
(
iLit1
)
:
iLit1
;
if
(
iLit1
<
2
)
return
iLit1
?
Abc_LitNot
(
iLit0
)
:
iLit0
;
if
(
iLit0
==
iLit1
)
return
0
;
if
(
iLit0
==
Abc_LitNot
(
iLit1
)
)
return
1
;
if
(
(
p
->
nObjs
&
0xFF
)
==
0
&&
2
*
p
->
nHTable
<
Gia_ManAndNum
(
p
)
)
Gia_ManHashResize
(
p
);
if
(
iLit0
<
iLit1
)
iLit0
^=
iLit1
,
iLit1
^=
iLit0
,
iLit0
^=
iLit1
;
if
(
Abc_LitIsCompl
(
iLit0
)
)
iLit0
=
Abc_LitNot
(
iLit0
),
fCompl
^=
1
;
if
(
Abc_LitIsCompl
(
iLit1
)
)
iLit1
=
Abc_LitNot
(
iLit1
),
fCompl
^=
1
;
{
int
*
pPlace
=
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
,
-
1
);
if
(
*
pPlace
)
{
p
->
nHashHit
++
;
return
Abc_LitNotCond
(
*
pPlace
,
fCompl
);
}
p
->
nHashMiss
++
;
if
(
p
->
nObjs
<
p
->
nObjsAlloc
)
*
pPlace
=
Gia_ManAppendXorReal
(
p
,
iLit0
,
iLit1
);
else
{
int
iNode
=
Gia_ManAppendXorReal
(
p
,
iLit0
,
iLit1
);
pPlace
=
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
,
-
1
);
assert
(
*
pPlace
==
0
);
*
pPlace
=
iNode
;
}
return
Abc_LitNotCond
(
*
pPlace
,
fCompl
);
}
}
/**Function*************************************************************
Synopsis [Hashes MUX gate.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Gia_ManHashMuxReal
(
Gia_Man_t
*
p
,
int
iLitC
,
int
iLit1
,
int
iLit0
)
{
int
fCompl
=
0
;
assert
(
p
->
fAddStrash
==
0
);
assert
(
iLit0
>
1
&&
iLit1
>
1
&&
iLitC
>
1
);
if
(
iLit0
==
iLit1
)
return
iLit0
;
if
(
Abc_Lit2Var
(
iLit0
)
==
Abc_Lit2Var
(
iLit1
)
)
return
Gia_ManHashXorReal
(
p
,
iLitC
,
iLit0
);
if
(
iLit0
>
iLit1
)
iLit0
^=
iLit1
,
iLit1
^=
iLit0
,
iLit0
^=
iLit1
,
iLitC
=
Abc_LitNot
(
iLitC
);
if
(
Abc_LitIsCompl
(
iLit1
)
)
iLit0
=
Abc_LitNot
(
iLit0
),
iLit1
=
Abc_LitNot
(
iLit1
),
fCompl
=
1
;
{
int
*
pPlace
=
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
,
iLitC
);
if
(
*
pPlace
)
{
p
->
nHashHit
++
;
return
Abc_LitNotCond
(
*
pPlace
,
fCompl
);
}
p
->
nHashMiss
++
;
if
(
p
->
nObjs
<
p
->
nObjsAlloc
)
*
pPlace
=
Gia_ManAppendMuxReal
(
p
,
iLitC
,
iLit1
,
iLit0
);
else
{
int
iNode
=
Gia_ManAppendMuxReal
(
p
,
iLitC
,
iLit1
,
iLit0
);
pPlace
=
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
,
iLitC
);
assert
(
*
pPlace
==
0
);
*
pPlace
=
iNode
;
}
return
Abc_LitNotCond
(
*
pPlace
,
fCompl
);
}
}
/**Function*************************************************************
Synopsis [Hashes AND gate.]
Description []
Description []
...
@@ -493,7 +580,7 @@ int Gia_ManHashAnd( Gia_Man_t * p, int iLit0, int iLit1 )
...
@@ -493,7 +580,7 @@ int Gia_ManHashAnd( Gia_Man_t * p, int iLit0, int iLit1 )
if
(
iLit0
>
iLit1
)
if
(
iLit0
>
iLit1
)
iLit0
^=
iLit1
,
iLit1
^=
iLit0
,
iLit0
^=
iLit1
;
iLit0
^=
iLit1
,
iLit1
^=
iLit0
,
iLit0
^=
iLit1
;
{
{
int
*
pPlace
=
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
);
int
*
pPlace
=
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
,
-
1
);
if
(
*
pPlace
)
if
(
*
pPlace
)
{
{
p
->
nHashHit
++
;
p
->
nHashHit
++
;
...
@@ -505,7 +592,7 @@ int Gia_ManHashAnd( Gia_Man_t * p, int iLit0, int iLit1 )
...
@@ -505,7 +592,7 @@ int Gia_ManHashAnd( Gia_Man_t * p, int iLit0, int iLit1 )
else
else
{
{
int
iNode
=
Gia_ManAppendAnd
(
p
,
iLit0
,
iLit1
);
int
iNode
=
Gia_ManAppendAnd
(
p
,
iLit0
,
iLit1
);
pPlace
=
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
);
pPlace
=
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
,
-
1
);
assert
(
*
pPlace
==
0
);
assert
(
*
pPlace
==
0
);
return
*
pPlace
=
iNode
;
return
*
pPlace
=
iNode
;
}
}
...
@@ -518,7 +605,7 @@ int Gia_ManHashOr( Gia_Man_t * p, int iLit0, int iLit1 )
...
@@ -518,7 +605,7 @@ int Gia_ManHashOr( Gia_Man_t * p, int iLit0, int iLit1 )
/**Function*************************************************************
/**Function*************************************************************
Synopsis [
Rehashes AIG with mapping.
]
Synopsis []
Description []
Description []
...
@@ -540,7 +627,7 @@ int Gia_ManHashAndTry( Gia_Man_t * p, int iLit0, int iLit1 )
...
@@ -540,7 +627,7 @@ int Gia_ManHashAndTry( Gia_Man_t * p, int iLit0, int iLit1 )
if
(
iLit0
>
iLit1
)
if
(
iLit0
>
iLit1
)
iLit0
^=
iLit1
,
iLit1
^=
iLit0
,
iLit0
^=
iLit1
;
iLit0
^=
iLit1
,
iLit1
^=
iLit0
,
iLit0
^=
iLit1
;
{
{
int
*
pPlace
=
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
);
int
*
pPlace
=
Gia_ManHashFind
(
p
,
iLit0
,
iLit1
,
-
1
);
if
(
*
pPlace
)
if
(
*
pPlace
)
return
*
pPlace
;
return
*
pPlace
;
return
-
1
;
return
-
1
;
...
@@ -549,7 +636,7 @@ int Gia_ManHashAndTry( Gia_Man_t * p, int iLit0, int iLit1 )
...
@@ -549,7 +636,7 @@ int Gia_ManHashAndTry( Gia_Man_t * p, int iLit0, int iLit1 )
/**Function*************************************************************
/**Function*************************************************************
Synopsis [
Rehashes AIG with mapping.
]
Synopsis []
Description []
Description []
...
@@ -568,7 +655,7 @@ int Gia_ManHashXor( Gia_Man_t * p, int iLit0, int iLit1 )
...
@@ -568,7 +655,7 @@ int Gia_ManHashXor( Gia_Man_t * p, int iLit0, int iLit1 )
/**Function*************************************************************
/**Function*************************************************************
Synopsis [
Rehashes AIG with mapping.
]
Synopsis []
Description []
Description []
...
@@ -586,7 +673,7 @@ int Gia_ManHashMux( Gia_Man_t * p, int iCtrl, int iData1, int iData0 )
...
@@ -586,7 +673,7 @@ int Gia_ManHashMux( Gia_Man_t * p, int iCtrl, int iData1, int iData0 )
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Rehashes AIG
with mapping
.]
Synopsis [Rehashes AIG.]
Description []
Description []
...
...
src/aig/gia/giaMan.c
View file @
2afef15a
...
@@ -120,6 +120,7 @@ void Gia_ManStop( Gia_Man_t * p )
...
@@ -120,6 +120,7 @@ void Gia_ManStop( Gia_Man_t * p )
ABC_FREE
(
p
->
pRefs
);
ABC_FREE
(
p
->
pRefs
);
// ABC_FREE( p->pNodeRefs );
// ABC_FREE( p->pNodeRefs );
ABC_FREE
(
p
->
pHTable
);
ABC_FREE
(
p
->
pHTable
);
ABC_FREE
(
p
->
pMuxes
);
ABC_FREE
(
p
->
pObjs
);
ABC_FREE
(
p
->
pObjs
);
ABC_FREE
(
p
->
pSpec
);
ABC_FREE
(
p
->
pSpec
);
ABC_FREE
(
p
->
pName
);
ABC_FREE
(
p
->
pName
);
...
...
src/aig/gia/giaScl.c
View file @
2afef15a
...
@@ -52,7 +52,8 @@ int Gia_ManCombMarkUsed_rec( Gia_Man_t * p, Gia_Obj_t * pObj )
...
@@ -52,7 +52,8 @@ int Gia_ManCombMarkUsed_rec( Gia_Man_t * p, Gia_Obj_t * pObj )
assert
(
Gia_ObjIsAnd
(
pObj
)
);
assert
(
Gia_ObjIsAnd
(
pObj
)
);
return
1
+
Gia_ManCombMarkUsed_rec
(
p
,
Gia_ObjFanin0
(
pObj
)
)
return
1
+
Gia_ManCombMarkUsed_rec
(
p
,
Gia_ObjFanin0
(
pObj
)
)
+
Gia_ManCombMarkUsed_rec
(
p
,
Gia_ObjFanin1
(
pObj
)
)
+
Gia_ManCombMarkUsed_rec
(
p
,
Gia_ObjFanin1
(
pObj
)
)
+
(
p
->
pNexts
?
Gia_ManCombMarkUsed_rec
(
p
,
Gia_ObjNextObj
(
p
,
Gia_ObjId
(
p
,
pObj
))
)
:
0
);
+
(
p
->
pNexts
?
Gia_ManCombMarkUsed_rec
(
p
,
Gia_ObjNextObj
(
p
,
Gia_ObjId
(
p
,
pObj
))
)
:
0
)
+
(
p
->
pMuxes
?
Gia_ManCombMarkUsed_rec
(
p
,
Gia_ObjFanin2
(
p
,
pObj
)
)
:
0
);
}
}
/**Function*************************************************************
/**Function*************************************************************
...
...
src/aig/gia/giaUtil.c
View file @
2afef15a
...
@@ -1120,6 +1120,15 @@ void Gia_ObjPrint( Gia_Man_t * p, Gia_Obj_t * pObj )
...
@@ -1120,6 +1120,15 @@ void Gia_ObjPrint( Gia_Man_t * p, Gia_Obj_t * pObj )
printf
(
"RI( %4d%s )"
,
Gia_ObjFaninId0p
(
p
,
pObj
),
(
Gia_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
)
);
printf
(
"RI( %4d%s )"
,
Gia_ObjFaninId0p
(
p
,
pObj
),
(
Gia_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
)
);
// else if ( Gia_ObjIsBuf(pObj) )
// else if ( Gia_ObjIsBuf(pObj) )
// printf( "BUF( %d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
// printf( "BUF( %d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
else
if
(
Gia_ObjIsXor
(
pObj
)
)
printf
(
"XOR( %4d%s, %4d%s )"
,
Gia_ObjFaninId0p
(
p
,
pObj
),
(
Gia_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
),
Gia_ObjFaninId1p
(
p
,
pObj
),
(
Gia_ObjFaninC1
(
pObj
)
?
"
\'
"
:
" "
)
);
else
if
(
Gia_ObjIsMux
(
p
,
pObj
)
)
printf
(
"MUX( %4d%s, %4d%s, %4d%s )"
,
Gia_ObjFaninId2p
(
p
,
pObj
),
(
Gia_ObjFaninC2
(
p
,
pObj
)
?
"
\'
"
:
" "
),
Gia_ObjFaninId1p
(
p
,
pObj
),
(
Gia_ObjFaninC1
(
pObj
)
?
"
\'
"
:
" "
),
Gia_ObjFaninId0p
(
p
,
pObj
),
(
Gia_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
)
);
else
else
printf
(
"AND( %4d%s, %4d%s )"
,
printf
(
"AND( %4d%s, %4d%s )"
,
Gia_ObjFaninId0p
(
p
,
pObj
),
(
Gia_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
),
Gia_ObjFaninId0p
(
p
,
pObj
),
(
Gia_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
),
...
@@ -1156,6 +1165,8 @@ void Gia_ManPrint( Gia_Man_t * p )
...
@@ -1156,6 +1165,8 @@ void Gia_ManPrint( Gia_Man_t * p )
{
{
Gia_Obj_t
*
pObj
;
Gia_Obj_t
*
pObj
;
int
i
;
int
i
;
printf
(
"GIA manage has %d ANDs, %d XORs, %d MUXes.
\n
"
,
Gia_ManAndNum
(
p
)
-
Gia_ManXorNum
(
p
)
-
Gia_ManMuxNum
(
p
),
Gia_ManXorNum
(
p
),
Gia_ManMuxNum
(
p
)
);
Gia_ManForEachObj
(
p
,
pObj
,
i
)
Gia_ManForEachObj
(
p
,
pObj
,
i
)
Gia_ObjPrint
(
p
,
pObj
);
Gia_ObjPrint
(
p
,
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