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
f070d350
Commit
f070d350
authored
Apr 18, 2019
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to the retiming algorithm.
parent
a3620fe6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
21 deletions
+62
-21
src/base/wln/wlnRetime.c
+62
-21
No files found.
src/base/wln/wlnRetime.c
View file @
f070d350
...
...
@@ -89,9 +89,27 @@ void Wln_RetPrintObj( Wln_Ret_t * p, int iObj )
}
printf
(
"
\n
"
);
}
void
Wln_RetPrint
(
Wln_Ret_t
*
p
)
void
Wln_RetPrint
(
Wln_Ret_t
*
p
,
int
fVerbose
)
{
int
iObj
;
int
iObj
,
nCount
=
0
;
Wln_NtkForEachObj
(
p
->
pNtk
,
iObj
)
if
(
Wln_ObjInstId
(
p
->
pNtk
,
iObj
)
>
1
)
nCount
++
;
printf
(
"Total number of objects = %d. Objects with non-trivial delay = %d.
\n
"
,
Wln_NtkObjNum
(
p
->
pNtk
),
nCount
);
if
(
!
fVerbose
)
{
int
nCount
=
0
,
nPrints
=
0
,
nLimit
=
5
;
printf
(
"The following %d objects have non-trivial delays:
\n
"
,
nLimit
);
Wln_NtkForEachObj
(
p
->
pNtk
,
iObj
)
{
if
(
Wln_ObjInstId
(
p
->
pNtk
,
iObj
)
<=
1
)
continue
;
Wln_RetPrintObj
(
p
,
iObj
);
if
(
++
nPrints
==
nLimit
)
break
;
}
return
;
}
printf
(
"Printing %d objects of network
\"
%s
\"
:
\n
"
,
Wln_NtkObjNum
(
p
->
pNtk
),
p
->
pNtk
->
pName
);
Wln_NtkForEachObj
(
p
->
pNtk
,
iObj
)
Wln_RetPrintObj
(
p
,
iObj
);
...
...
@@ -125,7 +143,7 @@ int Wln_RetComputeFfClasses( Wln_Ntk_t * pNtk, Vec_Int_t * vClasses )
nClasses
=
Hsh_VecSize
(
p
);
Hsh_VecManStop
(
p
);
Vec_IntFree
(
vFlop
);
printf
(
"Detected %d flop
classes.
\n
"
,
nClasses
);
printf
(
"Detected %d flop
s and %d flop classes.
\n
"
,
Wln_NtkFfNum
(
pNtk
)
,
nClasses
);
return
nClasses
;
}
Wln_Ret_t
*
Wln_RetAlloc
(
Wln_Ntk_t
*
pNtk
)
...
...
@@ -467,24 +485,27 @@ void Wln_RetRetimeBackward( Wln_Ret_t * p, Vec_Int_t * vSet )
Wln_RetInsertOneFanin
(
p
,
iObj
,
iFlop
);
}
}
void
Wln_RetAddToMoves
(
Wln_Ret_t
*
p
,
Vec_Int_t
*
vSet
,
int
Delay
,
int
fForward
)
void
Wln_RetAddToMoves
(
Wln_Ret_t
*
p
,
Vec_Int_t
*
vSet
,
int
Delay
,
int
fForward
,
int
nMoves
,
int
fVerbose
)
{
int
i
,
iObj
;
if
(
vSet
==
NULL
)
{
printf
(
"
*** Recording initial state (delay = %d)
\n
"
,
Delay
);
printf
(
"
Move %4d : Recording initial state (delay = %6d)
\n
"
,
nMoves
,
Delay
);
Vec_IntPushTwo
(
&
p
->
vMoves
,
Delay
,
0
);
return
;
}
printf
(
"
*** Recording %s retiming (delay = %d):"
,
fForward
?
"forward
"
:
"backward"
,
Delay
);
printf
(
"
Move %4d : Recording %s retiming (delay = %6d) :"
,
nMoves
,
fForward
?
"forward
"
:
"backward"
,
Delay
);
Vec_IntPush
(
&
p
->
vMoves
,
Delay
);
Vec_IntForEachEntry
(
vSet
,
iObj
,
i
)
{
int
NameId
=
Vec_IntEntry
(
&
p
->
pNtk
->
vNameIds
,
iObj
);
Vec_IntPush
(
&
p
->
vMoves
,
fForward
?
-
NameId
:
NameId
);
if
(
fVerbose
)
printf
(
" %d (NameID = %d) "
,
fForward
?
-
iObj
:
iObj
,
fForward
?
-
NameId
:
NameId
);
}
Vec_IntPush
(
&
p
->
vMoves
,
0
);
if
(
!
fVerbose
)
printf
(
" %3d retimed objects"
,
Vec_IntSize
(
vSet
)
);
printf
(
"
\n
"
);
}
...
...
@@ -501,9 +522,11 @@ void Wln_RetAddToMoves( Wln_Ret_t * p, Vec_Int_t * vSet, int Delay, int fForward
***********************************************************************/
void
Wln_NtkRetimeCreateDelayInfo
(
Wln_Ntk_t
*
pNtk
)
{
// if ( Wln_NtkHasInstId(pNtk) )
// Vec_IntErase( &pNtk->vInstIds );
if
(
Wln_NtkHasInstId
(
pNtk
)
)
Vec_IntErase
(
&
pNtk
->
vInstIds
);
if
(
!
Wln_NtkHasInstId
(
pNtk
)
)
printf
(
"Using delays given by the user in the input file.
\n
"
);
else
{
int
i
,
iObj
;
printf
(
"The design has no delay information.
\n
"
);
...
...
@@ -520,7 +543,7 @@ void Wln_NtkRetimeCreateDelayInfo( Wln_Ntk_t * pNtk )
if
(
Wln_ObjType
(
pNtk
,
Wln_ObjFanin0
(
pNtk
,
iObj
))
!=
ABC_OPER_LUT
)
Wln_ObjSetInstId
(
pNtk
,
Wln_ObjFanin0
(
pNtk
,
iObj
),
1
);
}
printf
(
"Assuming
user-specified delays for internal node
s.
\n
"
);
printf
(
"Assuming
default delays: 10 units for most nodes and 1 unit for bit-slice, concat, and buffers driving CO
s.
\n
"
);
}
}
Vec_Int_t
*
Wln_NtkRetime
(
Wln_Ntk_t
*
pNtk
,
int
fVerbose
)
...
...
@@ -530,12 +553,13 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk, int fVerbose )
Vec_Int_t
*
vSinks
=
&
p
->
vSinks
;
Vec_Int_t
*
vFront
=
&
p
->
vFront
;
Vec_Int_t
*
vMoves
=
Vec_IntAlloc
(
0
);
if
(
fVerbose
)
Wln_RetPrint
(
p
);
int
nMoves
=
0
,
fPrevFwd
=
0
,
fPrevBwd
=
0
,
nCountIncrease
=
0
;
int
DelayInit
=
0
,
DelayBest
=
0
;
Wln_RetPrint
(
p
,
fVerbose
);
Wln_RetMarkChanges
(
p
,
NULL
);
p
->
DelayMax
=
Wln_RetPropDelay
(
p
);
p
->
DelayMax
=
DelayInit
=
DelayBest
=
Wln_RetPropDelay
(
p
);
Wln_RetFindSources
(
p
);
Wln_RetAddToMoves
(
p
,
NULL
,
p
->
DelayMax
,
0
);
Wln_RetAddToMoves
(
p
,
NULL
,
p
->
DelayMax
,
0
,
nMoves
,
fVerbose
);
while
(
Vec_IntSize
(
vSources
)
||
Vec_IntSize
(
vSinks
)
)
{
int
DelayMaxPrev
=
p
->
DelayMax
;
...
...
@@ -544,12 +568,6 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk, int fVerbose )
Vec_IntSort
(
vSources
,
0
);
Vec_IntSort
(
vSinks
,
0
);
printf
(
"
\n
Sinks: "
);
Vec_IntPrint
(
&
p
->
vSinks
);
printf
(
"Sources: "
);
Vec_IntPrint
(
&
p
->
vSources
);
if
(
!
fForward
&&
!
fBackward
)
{
printf
(
"Cannot retime forward and backward.
\n
"
);
...
...
@@ -560,14 +578,16 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk, int fVerbose )
printf
(
"Cannot reduce delay by retiming.
\n
"
);
break
;
}
nMoves
++
;
Vec_IntClear
(
vFront
);
if
(
(
f
Forward
&&
!
fBackward
)
||
(
fForward
&&
fBackward
&&
Vec_IntSize
(
vSources
)
<
Vec_IntSize
(
vSinks
))
)
if
(
(
f
PrevFwd
&&
fForward
)
||
(
!
(
fPrevBwd
&&
fBackward
)
&&
((
fForward
&&
!
fBackward
)
||
(
fForward
&&
fBackward
&&
Vec_IntSize
(
vSources
)
<
Vec_IntSize
(
vSinks
))
))
)
{
Vec_IntAppend
(
vFront
,
vSources
);
Wln_RetMarkChanges
(
p
,
vFront
);
Wln_RetRetimeForward
(
p
,
vFront
);
p
->
DelayMax
=
Wln_RetPropDelay
(
p
);
fForward
=
1
,
fBackward
=
0
;
fPrevFwd
=
1
;
}
else
{
...
...
@@ -576,10 +596,25 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk, int fVerbose )
Wln_RetMarkChanges
(
p
,
vFront
);
p
->
DelayMax
=
Wln_RetPropDelay
(
p
);
fForward
=
0
,
fBackward
=
1
;
fPrevBwd
=
1
;
}
DelayBest
=
Abc_MinInt
(
DelayBest
,
p
->
DelayMax
);
//Wln_RetPrint( p );
Wln_RetAddToMoves
(
p
,
vFront
,
p
->
DelayMax
,
fForward
);
if
(
fVerbose
)
printf
(
"
\n
"
);
Wln_RetAddToMoves
(
p
,
vFront
,
p
->
DelayMax
,
fForward
,
nMoves
,
fVerbose
);
if
(
fVerbose
)
{
printf
(
"Sinks: "
);
Vec_IntPrint
(
&
p
->
vSinks
);
printf
(
"Sources: "
);
Vec_IntPrint
(
&
p
->
vSources
);
}
if
(
p
->
DelayMax
>=
DelayMaxPrev
)
nCountIncrease
++
;
else
nCountIncrease
=
0
;
if
(
nCountIncrease
>
3
)
break
;
Wln_RetFindSources
(
p
);
if
(
2
*
Vec_IntSize
(
&
p
->
vEdgeLinks
)
>
Vec_IntCap
(
&
p
->
vEdgeLinks
)
)
...
...
@@ -592,6 +627,12 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk, int fVerbose )
printf
(
"
\n
The resulting moves recorded in terms of name IDs of the NDR nodes:
\n
"
);
Vec_IntPrint
(
vMoves
);
}
else
{
printf
(
"Retiming instruction contains %d moves and %d total retimed objects.
\n
"
,
nMoves
,
Vec_IntSize
(
vMoves
)
-
2
*
nMoves
-
2
);
printf
(
"Initial delay = %d. The best delay achieved = %d. Improvement = %d. (%6.2f %%)
\n
"
,
DelayInit
,
DelayBest
,
DelayInit
-
DelayBest
,
100
.
0
*
(
DelayInit
-
DelayBest
)
/
DelayInit
);
}
return
vMoves
;
}
...
...
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