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
a3253767
Commit
a3253767
authored
Dec 06, 2018
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with retiming.
parent
65b10c03
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
27 deletions
+65
-27
src/base/wlc/wlcNtk.c
+1
-1
src/base/wlc/wlcShow.c
+1
-1
src/base/wln/wlnNdr.c
+9
-0
src/base/wln/wlnRetime.c
+54
-25
No files found.
src/base/wlc/wlcNtk.c
View file @
a3253767
...
@@ -1129,7 +1129,7 @@ void Wlc_NtkMarkCone_rec( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vFlops )
...
@@ -1129,7 +1129,7 @@ void Wlc_NtkMarkCone_rec( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vFlops )
Vec_IntPush
(
vFlops
,
Wlc_ObjCiId
(
pObj
)
);
Vec_IntPush
(
vFlops
,
Wlc_ObjCiId
(
pObj
)
);
return
;
return
;
}
}
Wlc_ObjForEachFanin
(
pObj
,
iFanin
,
i
)
Wlc_ObjForEachFanin
(
pObj
,
iFanin
,
i
)
if
(
iFanin
)
Wlc_NtkMarkCone_rec
(
p
,
Wlc_NtkObj
(
p
,
iFanin
),
vFlops
);
Wlc_NtkMarkCone_rec
(
p
,
Wlc_NtkObj
(
p
,
iFanin
),
vFlops
);
}
}
void
Wlc_NtkMarkCone
(
Wlc_Ntk_t
*
p
,
int
iCoId
,
int
Range
,
int
fSeq
,
int
fAllPis
)
void
Wlc_NtkMarkCone
(
Wlc_Ntk_t
*
p
,
int
iCoId
,
int
Range
,
int
fSeq
,
int
fAllPis
)
...
...
src/base/wlc/wlcShow.c
View file @
a3253767
...
@@ -203,7 +203,7 @@ void Wlc_NtkDumpDot( Wlc_Ntk_t * p, char * pFileName, Vec_Int_t * vBold )
...
@@ -203,7 +203,7 @@ void Wlc_NtkDumpDot( Wlc_Ntk_t * p, char * pFileName, Vec_Int_t * vBold )
fprintf
(
pFile
,
"
\"
"
);
fprintf
(
pFile
,
"
\"
"
);
}
}
else
if
(
pNode
->
Type
==
WLC_OBJ_BUF
||
pNode
->
Type
==
WLC_OBJ_MUX
)
else
if
(
pNode
->
Type
==
WLC_OBJ_BUF
||
pNode
->
Type
==
WLC_OBJ_MUX
)
fprintf
(
pFile
,
" Node%d [label =
\"
%d
\"
"
,
i
,
Wlc_ObjRange
(
pNode
)
);
fprintf
(
pFile
,
" Node%d [label =
\"
%d
: %d
\"
"
,
i
,
i
,
Wlc_ObjRange
(
pNode
)
);
else
if
(
pNode
->
Type
>=
WLC_OBJ_LOGIC_NOT
&&
pNode
->
Type
<=
WLC_OBJ_COMP_MOREEQU
)
else
if
(
pNode
->
Type
>=
WLC_OBJ_LOGIC_NOT
&&
pNode
->
Type
<=
WLC_OBJ_COMP_MOREEQU
)
fprintf
(
pFile
,
" Node%d [label =
\"
%d:%s
\"
"
,
i
,
i
,
Wlc_ObjTypeName
(
pNode
)
);
fprintf
(
pFile
,
" Node%d [label =
\"
%d:%s
\"
"
,
i
,
i
,
Wlc_ObjTypeName
(
pNode
)
);
else
else
...
...
src/base/wln/wlnNdr.c
View file @
a3253767
...
@@ -313,6 +313,8 @@ void Wln_NtkRetimeTest( char * pFileName )
...
@@ -313,6 +313,8 @@ void Wln_NtkRetimeTest( char * pFileName )
void
*
pData
=
Ndr_Read
(
pFileName
);
void
*
pData
=
Ndr_Read
(
pFileName
);
Wln_Ntk_t
*
pNtk
=
Wln_NtkFromNdr
(
pData
);
Wln_Ntk_t
*
pNtk
=
Wln_NtkFromNdr
(
pData
);
Ndr_Delete
(
pData
);
Ndr_Delete
(
pData
);
if
(
Wln_NtkHasInstId
(
pNtk
)
)
Vec_IntErase
(
&
pNtk
->
vInstIds
);
if
(
!
Wln_NtkHasInstId
(
pNtk
)
)
if
(
!
Wln_NtkHasInstId
(
pNtk
)
)
{
{
int
iObj
;
int
iObj
;
...
@@ -325,6 +327,13 @@ void Wln_NtkRetimeTest( char * pFileName )
...
@@ -325,6 +327,13 @@ void Wln_NtkRetimeTest( char * pFileName )
Wln_ObjSetInstId
(
pNtk
,
iObj
,
10
);
Wln_ObjSetInstId
(
pNtk
,
iObj
,
10
);
printf
(
"Assuming user-specified delays for internal nodes.
\n
"
);
printf
(
"Assuming user-specified delays for internal nodes.
\n
"
);
}
}
else
{
int
iObj
;
Wln_NtkForEachObj
(
pNtk
,
iObj
)
if
(
!
Wln_ObjIsCio
(
pNtk
,
iObj
)
&&
Wln_ObjFaninNum
(
pNtk
,
iObj
)
>
0
&&
!
Wln_ObjIsFf
(
pNtk
,
iObj
)
)
printf
(
"Obj %5d : NameId = %6d InstId = %6d
\n
"
,
iObj
,
Wln_ObjNameId
(
pNtk
,
iObj
),
Wln_ObjInstId
(
pNtk
,
iObj
)
);
}
//else
//else
{
{
Vec_Int_t
*
vMoves
=
Wln_NtkRetime
(
pNtk
);
Vec_Int_t
*
vMoves
=
Wln_NtkRetime
(
pNtk
);
...
...
src/base/wln/wlnRetime.c
View file @
a3253767
...
@@ -51,7 +51,7 @@ static inline int * Wln_RetFanouts( Wln_Ret_t * p, int i ) { return Vec_IntEnt
...
@@ -51,7 +51,7 @@ static inline int * Wln_RetFanouts( Wln_Ret_t * p, int i ) { return Vec_IntEnt
#define Wln_RetForEachFanin( p, iObj, iFanin, pLink, i ) \
#define Wln_RetForEachFanin( p, iObj, iFanin, pLink, i ) \
for ( i = 0; (i < Wln_ObjFaninNum(p->pNtk, iObj)) && \
for ( i = 0; (i < Wln_ObjFaninNum(p->pNtk, iObj)) && \
(((iFanin) = Wln_RetFanins(p, iObj)[2*i]), 1) && \
(((iFanin) = Wln_RetFanins(p, iObj)[2*i]), 1) && \
((pLink) = (Wln_RetFanins(p, iObj)+2*i+1)); i++ ) if ( !iFanin ) {} else
((pLink) = (Wln_RetFanins(p, iObj)+2*i+1)); i++ ) if ( !iFanin
|| (!Wln_ObjFaninNum(p->pNtk, iFanin) && !Wln_ObjIsCi(p->pNtk, iFanin))
) {} else
#define Wln_RetForEachFanout( p, iObj, iFanout, pLink, i ) \
#define Wln_RetForEachFanout( p, iObj, iFanout, pLink, i ) \
for ( i = 0; (i < Wln_ObjRefs(p->pNtk, iObj)) && \
for ( i = 0; (i < Wln_ObjRefs(p->pNtk, iObj)) && \
...
@@ -217,6 +217,21 @@ void Wln_RetMarkChanges_rec( Wln_Ret_t * p, int iObj )
...
@@ -217,6 +217,21 @@ void Wln_RetMarkChanges_rec( Wln_Ret_t * p, int iObj )
if
(
!
pLink
[
0
]
)
if
(
!
pLink
[
0
]
)
Wln_RetMarkChanges_rec
(
p
,
iFanout
);
Wln_RetMarkChanges_rec
(
p
,
iFanout
);
}
}
void
Wln_RetMarkChanges
(
Wln_Ret_t
*
p
,
Vec_Int_t
*
vFront
)
{
int
i
,
iObj
;
if
(
vFront
)
{
Vec_IntForEachEntry
(
vFront
,
iObj
,
i
)
Wln_RetMarkChanges_rec
(
p
,
iObj
);
}
else
{
Vec_IntFill
(
&
p
->
vPathDelays
,
Wln_NtkObjNum
(
p
->
pNtk
),
-
1
);
Wln_NtkForEachCi
(
p
->
pNtk
,
iObj
,
i
)
Vec_IntWriteEntry
(
&
p
->
vPathDelays
,
iObj
,
0
);
}
}
int
Wln_RetPropDelay_rec
(
Wln_Ret_t
*
p
,
int
iObj
)
int
Wln_RetPropDelay_rec
(
Wln_Ret_t
*
p
,
int
iObj
)
{
{
int
k
,
iFanin
,
*
pLink
,
*
pDelay
=
Vec_IntEntryP
(
&
p
->
vPathDelays
,
iObj
);
int
k
,
iFanin
,
*
pLink
,
*
pDelay
=
Vec_IntEntryP
(
&
p
->
vPathDelays
,
iObj
);
...
@@ -224,27 +239,18 @@ int Wln_RetPropDelay_rec( Wln_Ret_t * p, int iObj )
...
@@ -224,27 +239,18 @@ int Wln_RetPropDelay_rec( Wln_Ret_t * p, int iObj )
return
*
pDelay
;
return
*
pDelay
;
*
pDelay
=
0
;
*
pDelay
=
0
;
Wln_RetForEachFanin
(
p
,
iObj
,
iFanin
,
pLink
,
k
)
Wln_RetForEachFanin
(
p
,
iObj
,
iFanin
,
pLink
,
k
)
{
if
(
pLink
[
0
]
)
if
(
pLink
[
0
]
)
*
pDelay
=
Abc_MaxInt
(
*
pDelay
,
0
);
*
pDelay
=
Abc_MaxInt
(
*
pDelay
,
0
);
else
else
*
pDelay
=
Abc_MaxInt
(
*
pDelay
,
Wln_RetPropDelay_rec
(
p
,
iFanin
));
*
pDelay
=
Abc_MaxInt
(
*
pDelay
,
Wln_RetPropDelay_rec
(
p
,
iFanin
));
}
*
pDelay
+=
Vec_IntEntry
(
&
p
->
vNodeDelays
,
iObj
);
*
pDelay
+=
Vec_IntEntry
(
&
p
->
vNodeDelays
,
iObj
);
return
*
pDelay
;
return
*
pDelay
;
}
}
int
Wln_RetPropDelay
(
Wln_Ret_t
*
p
,
Vec_Int_t
*
vFront
)
int
Wln_RetPropDelay
(
Wln_Ret_t
*
p
)
{
{
int
i
,
iObj
,
DelayMax
=
0
;
int
iObj
,
DelayMax
=
0
;
if
(
vFront
)
{
Vec_IntForEachEntry
(
vFront
,
iObj
,
i
)
Wln_RetMarkChanges_rec
(
p
,
iObj
);
}
else
{
Vec_IntFill
(
&
p
->
vPathDelays
,
Wln_NtkObjNum
(
p
->
pNtk
),
-
1
);
Wln_NtkForEachCi
(
p
->
pNtk
,
iObj
,
i
)
Vec_IntWriteEntry
(
&
p
->
vPathDelays
,
iObj
,
0
);
}
Vec_IntClear
(
&
p
->
vSinks
);
Vec_IntClear
(
&
p
->
vSinks
);
Wln_NtkForEachObj
(
p
->
pNtk
,
iObj
)
Wln_NtkForEachObj
(
p
->
pNtk
,
iObj
)
if
(
!
Wln_ObjIsCio
(
p
->
pNtk
,
iObj
)
)
if
(
!
Wln_ObjIsCio
(
p
->
pNtk
,
iObj
)
)
...
@@ -458,16 +464,20 @@ void Wln_RetAddToMoves( Wln_Ret_t * p, Vec_Int_t * vSet, int Delay, int fForward
...
@@ -458,16 +464,20 @@ void Wln_RetAddToMoves( Wln_Ret_t * p, Vec_Int_t * vSet, int Delay, int fForward
int
i
,
iObj
;
int
i
,
iObj
;
if
(
vSet
==
NULL
)
if
(
vSet
==
NULL
)
{
{
printf
(
"*** Recording initial
move (0,
%d)
\n
"
,
Delay
);
printf
(
"*** Recording initial
state (delay =
%d)
\n
"
,
Delay
);
Vec_IntPushTwo
(
&
p
->
vMoves
,
0
,
Delay
);
Vec_IntPushTwo
(
&
p
->
vMoves
,
Delay
,
0
);
return
;
return
;
}
}
printf
(
"*** Recording %s retiming (delay = %d):"
,
fForward
?
"forward"
:
"backward"
,
Delay
);
Vec_IntPush
(
&
p
->
vMoves
,
Delay
);
Vec_IntForEachEntry
(
vSet
,
iObj
,
i
)
Vec_IntForEachEntry
(
vSet
,
iObj
,
i
)
{
{
int
NameId
=
Vec_IntEntry
(
&
p
->
pNtk
->
vNameIds
,
iObj
);
int
NameId
=
Vec_IntEntry
(
&
p
->
pNtk
->
vNameIds
,
iObj
);
printf
(
"*** Recording new move (%d, %d)
\n
"
,
fForward
?
-
NameId
:
NameId
,
Delay
);
Vec_IntPush
(
&
p
->
vMoves
,
fForward
?
-
NameId
:
NameId
);
Vec_IntPushTwo
(
&
p
->
vMoves
,
fForward
?
-
NameId
:
NameId
,
Delay
);
printf
(
" %d"
,
fForward
?
-
iObj
:
iObj
);
}
}
Vec_IntPush
(
&
p
->
vMoves
,
0
);
printf
(
"
\n
"
);
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -489,7 +499,8 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk )
...
@@ -489,7 +499,8 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk )
Vec_Int_t
*
vFront
=
&
p
->
vFront
;
Vec_Int_t
*
vFront
=
&
p
->
vFront
;
Vec_Int_t
*
vMoves
=
Vec_IntAlloc
(
0
);
Vec_Int_t
*
vMoves
=
Vec_IntAlloc
(
0
);
//Wln_RetPrint( p );
//Wln_RetPrint( p );
p
->
DelayMax
=
Wln_RetPropDelay
(
p
,
NULL
);
Wln_RetMarkChanges
(
p
,
NULL
);
p
->
DelayMax
=
Wln_RetPropDelay
(
p
);
Wln_RetFindSources
(
p
);
Wln_RetFindSources
(
p
);
Wln_RetAddToMoves
(
p
,
NULL
,
p
->
DelayMax
,
0
);
Wln_RetAddToMoves
(
p
,
NULL
,
p
->
DelayMax
,
0
);
while
(
Vec_IntSize
(
vSources
)
||
Vec_IntSize
(
vSinks
)
)
while
(
Vec_IntSize
(
vSources
)
||
Vec_IntSize
(
vSinks
)
)
...
@@ -497,13 +508,20 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk )
...
@@ -497,13 +508,20 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk )
int
DelayMaxPrev
=
p
->
DelayMax
;
int
DelayMaxPrev
=
p
->
DelayMax
;
int
fForward
=
Vec_IntSize
(
vSources
)
&&
Wln_RetCheckForward
(
p
,
vSources
);
int
fForward
=
Vec_IntSize
(
vSources
)
&&
Wln_RetCheckForward
(
p
,
vSources
);
int
fBackward
=
Vec_IntSize
(
vSinks
)
&&
Wln_RetCheckBackward
(
p
,
vSinks
);
int
fBackward
=
Vec_IntSize
(
vSinks
)
&&
Wln_RetCheckBackward
(
p
,
vSinks
);
Vec_IntSort
(
vSources
,
0
);
Vec_IntSort
(
vSinks
,
0
);
printf
(
"
\n
Sinks: "
);
Vec_IntPrint
(
&
p
->
vSinks
);
printf
(
"Sources: "
);
Vec_IntPrint
(
&
p
->
vSources
);
if
(
!
fForward
&&
!
fBackward
)
if
(
!
fForward
&&
!
fBackward
)
{
{
printf
(
"Cannot retime forward and backward.
\n
"
);
printf
(
"Cannot retime forward and backward.
\n
"
);
break
;
break
;
}
}
Vec_IntSort
(
vSources
,
0
);
Vec_IntSort
(
vSinks
,
0
);
if
(
Vec_IntTwoCountCommon
(
vSources
,
vSinks
)
)
if
(
Vec_IntTwoCountCommon
(
vSources
,
vSinks
)
)
{
{
printf
(
"Cannot reduce delay by retiming.
\n
"
);
printf
(
"Cannot reduce delay by retiming.
\n
"
);
...
@@ -511,13 +529,24 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk )
...
@@ -511,13 +529,24 @@ Vec_Int_t * Wln_NtkRetime( Wln_Ntk_t * pNtk )
}
}
Vec_IntClear
(
vFront
);
Vec_IntClear
(
vFront
);
if
(
(
fForward
&&
!
fBackward
)
||
(
fForward
&&
fBackward
&&
Vec_IntSize
(
vSources
)
<
Vec_IntSize
(
vSinks
))
)
if
(
(
fForward
&&
!
fBackward
)
||
(
fForward
&&
fBackward
&&
Vec_IntSize
(
vSources
)
<
Vec_IntSize
(
vSinks
))
)
Wln_RetRetimeForward
(
p
,
vSources
),
Vec_IntAppend
(
vFront
,
vSources
),
fForward
=
1
,
fBackward
=
0
;
{
Vec_IntAppend
(
vFront
,
vSources
);
Wln_RetMarkChanges
(
p
,
vFront
);
Wln_RetRetimeForward
(
p
,
vFront
);
p
->
DelayMax
=
Wln_RetPropDelay
(
p
);
fForward
=
1
,
fBackward
=
0
;
}
else
else
Wln_RetRetimeBackward
(
p
,
vSinks
),
Vec_IntAppend
(
vFront
,
vSinks
),
fForward
=
0
,
fBackward
=
1
;
{
Vec_IntAppend
(
vFront
,
vSinks
);
Wln_RetRetimeBackward
(
p
,
vFront
);
Wln_RetMarkChanges
(
p
,
vFront
);
p
->
DelayMax
=
Wln_RetPropDelay
(
p
);
fForward
=
0
,
fBackward
=
1
;
}
//Wln_RetPrint( p );
//Wln_RetPrint( p );
p
->
DelayMax
=
Wln_RetPropDelay
(
p
,
vFront
);
Wln_RetAddToMoves
(
p
,
vFront
,
p
->
DelayMax
,
fForward
);
Wln_RetAddToMoves
(
p
,
vFront
,
p
->
DelayMax
,
fForward
);
if
(
p
->
DelayMax
>
DelayMaxPrev
)
if
(
p
->
DelayMax
>
=
DelayMaxPrev
)
break
;
break
;
Wln_RetFindSources
(
p
);
Wln_RetFindSources
(
p
);
if
(
2
*
Vec_IntSize
(
&
p
->
vEdgeLinks
)
>
Vec_IntCap
(
&
p
->
vEdgeLinks
)
)
if
(
2
*
Vec_IntSize
(
&
p
->
vEdgeLinks
)
>
Vec_IntCap
(
&
p
->
vEdgeLinks
)
)
...
...
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