summaryrefslogtreecommitdiffstats
path: root/src/opt/ret/retDelay.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2006-11-22 08:01:00 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2006-11-22 08:01:00 -0800
commit6ad22b4d3b0446652919d95b15fefb374bddfac0 (patch)
treeeb525005c9827e844464c4e787c5907c7edc1d5c /src/opt/ret/retDelay.c
parentda5e0785dfb98335bd49a13bf9e86e736fb931be (diff)
downloadabc-6ad22b4d3b0446652919d95b15fefb374bddfac0.tar.gz
abc-6ad22b4d3b0446652919d95b15fefb374bddfac0.tar.bz2
abc-6ad22b4d3b0446652919d95b15fefb374bddfac0.zip
Version abc61122
Diffstat (limited to 'src/opt/ret/retDelay.c')
-rw-r--r--src/opt/ret/retDelay.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/opt/ret/retDelay.c b/src/opt/ret/retDelay.c
index d2d87447..80c75729 100644
--- a/src/opt/ret/retDelay.c
+++ b/src/opt/ret/retDelay.c
@@ -76,7 +76,7 @@ int Abc_NtkRetimeMinDelayTry( Abc_Ntk_t * pNtk, int fForward, int fInitial, int
Vec_Ptr_t * vCritical;
Vec_Int_t * vValues;
Abc_Obj_t * pObj;
- int i, k, IterBest, DelayCur, DelayBest, DelayStart;
+ int i, k, IterBest, DelayCur, DelayBest, DelayStart, LatchesBest;
// transfer intitial values
if ( fInitial )
{
@@ -90,8 +90,15 @@ int Abc_NtkRetimeMinDelayTry( Abc_Ntk_t * pNtk, int fForward, int fInitial, int
pNtkNew = Abc_NtkRetimeBackwardInitialStart( pNtk );
}
}
+if ( fVerbose )
+{
+ if ( !fInitial )
+ printf( "Performing analysis:\n" );
+ else
+ printf( "Moving latches to the best position:\n" );
+}
// find the best iteration
- DelayBest = ABC_INFINITY; IterBest = 0;
+ DelayBest = ABC_INFINITY; IterBest = 0; LatchesBest = Abc_NtkLatchNum(pNtk);
vCritical = Vec_PtrAlloc( 100 );
for ( i = 0; ; i++ )
{
@@ -102,16 +109,29 @@ int Abc_NtkRetimeMinDelayTry( Abc_Ntk_t * pNtk, int fForward, int fInitial, int
// record this position if it has the best delay
if ( DelayBest > DelayCur )
{
+if ( fVerbose )
+ printf( "%s Iter = %3d. Delay = %3d. Latches = %5d. Delta = %6.2f. Ratio = %4.2f %%\n",
+ fForward ? "Fwd": "Bwd", i, DelayCur, Abc_NtkLatchNum(pNtk),
+ 1.0*(Abc_NtkLatchNum(pNtk)-LatchesBest)/(DelayBest-DelayCur),
+ 100.0*(Abc_NtkLatchNum(pNtk)-LatchesBest)/Abc_NtkLatchNum(pNtk)/(DelayBest-DelayCur) );
+
DelayBest = DelayCur;
IterBest = i;
+ LatchesBest = Abc_NtkLatchNum(pNtk);
}
// quit after timing analysis
if ( i == nIterLimit )
break;
+ // skip if 10 interations did not give improvement
+ if ( i - IterBest > 20 )
+ break;
// try retiming to improve the delay
Vec_PtrForEachEntry( vCritical, pObj, k )
if ( Abc_NtkRetimeNodeIsEnabled(pObj, fForward) )
Abc_NtkRetimeNode( pObj, fForward, fInitial );
+ // share latches
+ if ( !fForward )
+ Abc_NtkRetimeShareLatches( pNtk, fInitial );
}
Vec_PtrFree( vCritical );
// transfer the initial state back to the latches