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
26f3427a
Commit
26f3427a
authored
Sep 22, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added GIA normalization using timing manager.
parent
fdd043ca
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
8 deletions
+96
-8
src/aig/gia/gia.h
+2
-1
src/aig/gia/giaAiger.c
+7
-2
src/aig/gia/giaDup.c
+87
-5
No files found.
src/aig/gia/gia.h
View file @
26f3427a
...
@@ -732,7 +732,8 @@ extern Gia_Man_t * Gia_ManDupDfs( Gia_Man_t * p );
...
@@ -732,7 +732,8 @@ extern Gia_Man_t * Gia_ManDupDfs( Gia_Man_t * p );
extern
Gia_Man_t
*
Gia_ManDupDfsSkip
(
Gia_Man_t
*
p
);
extern
Gia_Man_t
*
Gia_ManDupDfsSkip
(
Gia_Man_t
*
p
);
extern
Gia_Man_t
*
Gia_ManDupDfsCone
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
);
extern
Gia_Man_t
*
Gia_ManDupDfsCone
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
);
extern
Gia_Man_t
*
Gia_ManDupDfsLitArray
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vLits
);
extern
Gia_Man_t
*
Gia_ManDupDfsLitArray
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vLits
);
extern
Gia_Man_t
*
Gia_ManDupNormalized
(
Gia_Man_t
*
p
);
extern
Gia_Man_t
*
Gia_ManDupNormalize
(
Gia_Man_t
*
p
);
extern
Gia_Man_t
*
Gia_ManDupUnnomalize
(
Gia_Man_t
*
p
);
extern
Gia_Man_t
*
Gia_ManDupTrimmed
(
Gia_Man_t
*
p
,
int
fTrimCis
,
int
fTrimCos
,
int
fDualOut
);
extern
Gia_Man_t
*
Gia_ManDupTrimmed
(
Gia_Man_t
*
p
,
int
fTrimCis
,
int
fTrimCos
,
int
fDualOut
);
extern
Gia_Man_t
*
Gia_ManDupOntop
(
Gia_Man_t
*
p
,
Gia_Man_t
*
p2
);
extern
Gia_Man_t
*
Gia_ManDupOntop
(
Gia_Man_t
*
p
,
Gia_Man_t
*
p2
);
extern
Gia_Man_t
*
Gia_ManDupDfsCiMap
(
Gia_Man_t
*
p
,
int
*
pCi2Lit
,
Vec_Int_t
*
vLits
);
extern
Gia_Man_t
*
Gia_ManDupDfsCiMap
(
Gia_Man_t
*
p
,
int
*
pCi2Lit
,
Vec_Int_t
*
vLits
);
...
...
src/aig/gia/giaAiger.c
View file @
26f3427a
...
@@ -1056,7 +1056,7 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fSkipS
...
@@ -1056,7 +1056,7 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fSkipS
Vec_IntFreeP
(
&
vPoTypes
);
Vec_IntFreeP
(
&
vPoTypes
);
}
}
if
(
Gia_ManHasDangling
(
pNew
)
)
if
(
!
fSkipStrash
&&
Gia_ManHasDangling
(
pNew
)
)
{
{
Tim_Man_t
*
pManTime
;
Tim_Man_t
*
pManTime
;
Vec_Int_t
*
vFlopMap
,
*
vGateMap
,
*
vObjMap
;
Vec_Int_t
*
vFlopMap
,
*
vGateMap
,
*
vObjMap
;
...
@@ -1073,6 +1073,11 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fSkipS
...
@@ -1073,6 +1073,11 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fSkipS
pNew
->
vObjClasses
=
vObjMap
;
pNew
->
vObjClasses
=
vObjMap
;
pNew
->
pManTime
=
pManTime
;
pNew
->
pManTime
=
pManTime
;
}
}
if
(
pNew
->
pManTime
)
{
pNew
=
Gia_ManDupUnnomalize
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
}
return
pNew
;
return
pNew
;
}
}
...
@@ -1395,7 +1400,7 @@ void Gia_WriteAiger( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
...
@@ -1395,7 +1400,7 @@ void Gia_WriteAiger( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
Tim_Man_t
*
pManTime
;
Tim_Man_t
*
pManTime
;
pManTime
=
pInit
->
pManTime
;
pInit
->
pManTime
=
NULL
;
pManTime
=
pInit
->
pManTime
;
pInit
->
pManTime
=
NULL
;
// printf( "Gia_WriteAiger(): Normalizing AIG for writing.\n" );
// printf( "Gia_WriteAiger(): Normalizing AIG for writing.\n" );
p
=
Gia_ManDupNormalize
d
(
pInit
);
p
=
Gia_ManDupNormalize
(
pInit
);
p
->
pManTime
=
pManTime
;
p
->
pManTime
=
pManTime
;
}
}
else
else
...
...
src/aig/gia/giaDup.c
View file @
26f3427a
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
***********************************************************************/
***********************************************************************/
#include "gia.h"
#include "gia.h"
#include "misc/tim/tim.h"
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
...
@@ -887,11 +888,12 @@ Gia_Man_t * Gia_ManDupDfsLitArray( Gia_Man_t * p, Vec_Int_t * vLits )
...
@@ -887,11 +888,12 @@ Gia_Man_t * Gia_ManDupDfsLitArray( Gia_Man_t * p, Vec_Int_t * vLits )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Gia_Man_t
*
Gia_ManDupNormalize
d
(
Gia_Man_t
*
p
)
Gia_Man_t
*
Gia_ManDupNormalize
(
Gia_Man_t
*
p
)
{
{
Gia_Man_t
*
pNew
;
Gia_Man_t
*
pNew
;
Gia_Obj_t
*
pObj
;
Gia_Obj_t
*
pObj
;
int
i
;
int
i
;
Gia_ManFillValue
(
p
);
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
...
@@ -904,6 +906,86 @@ Gia_Man_t * Gia_ManDupNormalized( Gia_Man_t * p )
...
@@ -904,6 +906,86 @@ Gia_Man_t * Gia_ManDupNormalized( Gia_Man_t * p )
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
assert
(
Gia_ManIsNormalized
(
pNew
)
);
assert
(
Gia_ManIsNormalized
(
pNew
)
);
Gia_ManDupRemapEquiv
(
pNew
,
p
);
return
pNew
;
}
/**Function*************************************************************
Synopsis [Duplicates AIG according to the timing manager.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManDupUnnomalize
(
Gia_Man_t
*
p
)
{
Tim_Man_t
*
pTime
=
p
->
pManTime
;
Gia_Man_t
*
pNew
;
Gia_Obj_t
*
pObj
;
int
i
,
k
,
curCi
,
curCo
,
curNo
,
nodeId
;
assert
(
pTime
!=
NULL
);
assert
(
Gia_ManIsNormalized
(
p
)
);
Gia_ManFillValue
(
p
);
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
Gia_ManConst0
(
p
)
->
Value
=
0
;
// copy primary inputs
for
(
k
=
0
;
k
<
Tim_ManPiNum
(
pTime
);
k
++
)
Gia_ManPi
(
p
,
k
)
->
Value
=
Gia_ManAppendCi
(
pNew
);
curCi
=
Tim_ManPiNum
(
pTime
);
curCo
=
0
;
curNo
=
Gia_ManPiNum
(
p
);
for
(
i
=
0
;
i
<
Tim_ManBoxNum
(
pTime
);
i
++
)
{
// find the latest node feeding into inputs of this box
nodeId
=
-
1
;
for
(
k
=
0
;
k
<
Tim_ManBoxInputNum
(
pTime
,
i
);
k
++
)
{
pObj
=
Gia_ManPo
(
p
,
curCo
+
k
);
nodeId
=
Abc_MaxInt
(
nodeId
,
Gia_ObjFaninId0p
(
p
,
pObj
)
);
}
// copy nodes up to the given node
for
(
k
=
curNo
;
k
<=
nodeId
;
k
++
)
{
pObj
=
Gia_ManObj
(
p
,
k
);
assert
(
Gia_ObjIsAnd
(
pObj
)
);
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
}
curNo
=
Abc_MaxInt
(
curNo
,
nodeId
+
1
);
// copy COs
for
(
k
=
0
;
k
<
Tim_ManBoxInputNum
(
pTime
,
i
);
k
++
)
{
pObj
=
Gia_ManPo
(
p
,
curCo
+
k
);
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
}
curCo
+=
Tim_ManBoxInputNum
(
pTime
,
i
);
// copy CIs
for
(
k
=
0
;
k
<
Tim_ManBoxOutputNum
(
pTime
,
i
);
k
++
)
{
pObj
=
Gia_ManPi
(
p
,
curCi
+
k
);
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
}
curCi
+=
Tim_ManBoxOutputNum
(
pTime
,
i
);
}
// copy primary outputs
for
(
k
=
0
;
k
<
Tim_ManPoNum
(
pTime
);
k
++
)
{
pObj
=
Gia_ManPo
(
p
,
curCo
+
k
);
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
}
curCo
+=
Tim_ManPoNum
(
pTime
);
assert
(
curCi
==
Gia_ManPiNum
(
p
)
);
assert
(
curCo
==
Gia_ManPoNum
(
p
)
);
assert
(
curNo
==
Gia_ManAndNum
(
p
)
);
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
Gia_ManDupRemapEquiv
(
pNew
,
p
);
// pass the timing manager
pNew
->
pManTime
=
pTime
;
p
->
pManTime
=
NULL
;
return
pNew
;
return
pNew
;
}
}
...
@@ -1259,7 +1341,7 @@ Gia_Man_t * Gia_ManDupTopAnd_iter( Gia_Man_t * p, int fVerbose )
...
@@ -1259,7 +1341,7 @@ Gia_Man_t * Gia_ManDupTopAnd_iter( Gia_Man_t * p, int fVerbose )
printf
(
"The AIG cannot be decomposed using AND-decomposition.
\n
"
);
printf
(
"The AIG cannot be decomposed using AND-decomposition.
\n
"
);
Vec_IntFree
(
vFront
);
Vec_IntFree
(
vFront
);
Vec_IntFree
(
vLeaves
);
Vec_IntFree
(
vLeaves
);
return
Gia_ManDupNormalize
d
(
p
);
return
Gia_ManDupNormalize
(
p
);
}
}
// expand the frontier
// expand the frontier
Gia_ManForEachObjVec
(
vFront
,
p
,
pObj
,
i
)
Gia_ManForEachObjVec
(
vFront
,
p
,
pObj
,
i
)
...
@@ -1304,7 +1386,7 @@ Gia_Man_t * Gia_ManDupTopAnd_iter( Gia_Man_t * p, int fVerbose )
...
@@ -1304,7 +1386,7 @@ Gia_Man_t * Gia_ManDupTopAnd_iter( Gia_Man_t * p, int fVerbose )
ABC_FREE
(
pCi2Lit
);
ABC_FREE
(
pCi2Lit
);
ABC_FREE
(
pVar2Val
);
ABC_FREE
(
pVar2Val
);
Vec_IntFree
(
vLeaves
);
Vec_IntFree
(
vLeaves
);
return
Gia_ManDupNormalize
d
(
p
);
return
Gia_ManDupNormalize
(
p
);
}
}
// create array of input literals
// create array of input literals
Vec_IntClear
(
vLeaves
);
Vec_IntClear
(
vLeaves
);
...
@@ -1339,7 +1421,7 @@ Gia_Man_t * Gia_ManDupTopAnd( Gia_Man_t * p, int fVerbose )
...
@@ -1339,7 +1421,7 @@ Gia_Man_t * Gia_ManDupTopAnd( Gia_Man_t * p, int fVerbose )
{
{
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Man_t
*
pNew
,
*
pTemp
;
int
fContinue
,
iIter
=
0
;
int
fContinue
,
iIter
=
0
;
pNew
=
Gia_ManDupNormalize
d
(
p
);
pNew
=
Gia_ManDupNormalize
(
p
);
for
(
fContinue
=
1
;
fContinue
;
)
for
(
fContinue
=
1
;
fContinue
;
)
{
{
pNew
=
Gia_ManDupTopAnd_iter
(
pTemp
=
pNew
,
fVerbose
);
pNew
=
Gia_ManDupTopAnd_iter
(
pTemp
=
pNew
,
fVerbose
);
...
@@ -1503,7 +1585,7 @@ Gia_Man_t * Gia_ManMiter( Gia_Man_t * p0, Gia_Man_t * p1, int fDualOut, int fSeq
...
@@ -1503,7 +1585,7 @@ Gia_Man_t * Gia_ManMiter( Gia_Man_t * p0, Gia_Man_t * p1, int fDualOut, int fSeq
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
Gia_ManStop
(
pTemp
);
pNew
=
Gia_ManDupNormalize
d
(
pTemp
=
pNew
);
pNew
=
Gia_ManDupNormalize
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
Gia_ManStop
(
pTemp
);
return
pNew
;
return
pNew
;
}
}
...
...
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