@@ -795,7 +795,19 @@ class StaticPlacer
795
795
wl_coeff.at (axis) * pd.max_exp .at (axis) * x_max_sum) /
796
796
(max_sum * max_sum);
797
797
}
798
- gradient += (d_min - d_max);
798
+ float crit = 0.0 ;
799
+ if (cfg.timing_driven ) {
800
+ if (port.second .type == PORT_IN) {
801
+ crit = tmg.get_criticality (CellPortKey (cell->name , port.first ));
802
+ } else if (port.second .type == PORT_OUT) {
803
+ if (ni && ni->users .entries () < 5 ) {
804
+ for (auto usr : ni->users )
805
+ crit = std::max (crit, tmg.get_criticality (CellPortKey (usr)));
806
+ }
807
+ }
808
+ }
809
+ float weight = 1.0 + 5 * std::pow (crit, 2 );
810
+ gradient += weight * (d_min - d_max);
799
811
}
800
812
801
813
return gradient;
@@ -975,6 +987,7 @@ class StaticPlacer
975
987
initial_steplength *= 10 ;
976
988
}
977
989
}
990
+ update_timing ();
978
991
}
979
992
980
993
RealPair clamp_loc (RealPair loc)
@@ -1034,6 +1047,26 @@ class StaticPlacer
1034
1047
update_gradients (true );
1035
1048
log_info (" system potential: %f hpwl: %f\n " , system_potential (), system_hpwl ());
1036
1049
compute_overlap ();
1050
+ if ((iter % 5 ) == 0 )
1051
+ update_timing ();
1052
+ }
1053
+
1054
+ void update_timing ()
1055
+ {
1056
+ if (!cfg.timing_driven )
1057
+ return ;
1058
+ for (auto &net : nets) {
1059
+ NetInfo *ni = net.ni ;
1060
+ if (ni->driver .cell == nullptr )
1061
+ continue ;
1062
+ RealPair drv_loc = cell_loc (ni->driver .cell , false );
1063
+ for (auto usr : ni->users .enumerate()) {
1064
+ RealPair usr_loc = cell_loc (usr.value .cell , false );
1065
+ delay_t est_delay = cfg.timing_c + cfg.timing_mx * std::abs (drv_loc.x - usr_loc.x ) + cfg.timing_my * std::abs (drv_loc.y - usr_loc.y );
1066
+ tmg.set_route_delay (CellPortKey (usr.value ), DelayPair (est_delay));
1067
+ }
1068
+ }
1069
+ tmg.run (false );
1037
1070
}
1038
1071
1039
1072
void legalise_step (bool dsp_bram)
@@ -1342,6 +1375,8 @@ class StaticPlacer
1342
1375
: ctx(ctx), cfg(cfg), fast_bels(ctx, true , 8 ), tmg(ctx), pool(ctx->setting<int >(" threads" , 8 ))
1343
1376
{
1344
1377
groups.resize (cfg.cell_groups .size ());
1378
+ tmg.setup_only = true ;
1379
+ tmg.setup ();
1345
1380
};
1346
1381
void place ()
1347
1382
{
0 commit comments