@@ -1159,7 +1159,7 @@ struct Router2
1159
1159
return success;
1160
1160
}
1161
1161
1162
- void write_wiretype_heatmap (std::ostream &out)
1162
+ void write_congestion_by_wiretype_heatmap (std::ostream &out)
1163
1163
{
1164
1164
dict<IdString, std::vector<int >> cong_by_type;
1165
1165
size_t max_cong = 0 ;
@@ -1185,6 +1185,33 @@ struct Router2
1185
1185
}
1186
1186
}
1187
1187
1188
+ void write_utilisation_by_wiretype_heatmap (std::ostream &out)
1189
+ {
1190
+ dict<IdString, int > util_by_type;
1191
+ for (auto &wd : flat_wires) {
1192
+ IdString type = ctx->getWireType (wd.w );
1193
+ if (wd.curr_cong > 0 )
1194
+ util_by_type[type] += wd.curr_cong ;
1195
+ }
1196
+ // Write csv
1197
+ for (auto &u : util_by_type)
1198
+ out << u.first .c_str (ctx) << " ," << u.second << std::endl;
1199
+ }
1200
+
1201
+ void write_congestion_by_coordinate_heatmap (std::ostream &out)
1202
+ {
1203
+ auto util_by_coord = std::vector<std::vector<int >>(ctx->getGridDimX () + 1 , std::vector<int >(ctx->getGridDimY () + 1 , 0 ));
1204
+ for (auto &wd : flat_wires)
1205
+ if (wd.curr_cong > 1 )
1206
+ util_by_coord[wd.x ][wd.y ] += wd.curr_cong ;
1207
+ // Write csv
1208
+ for (auto &x : util_by_coord) {
1209
+ for (auto y : x)
1210
+ out << y << " ," ;
1211
+ out << std::endl;
1212
+ }
1213
+ }
1214
+
1188
1215
int mid_x = 0 , mid_y = 0 ;
1189
1216
1190
1217
void partition_nets ()
@@ -1444,12 +1471,30 @@ struct Router2
1444
1471
update_congestion ();
1445
1472
1446
1473
if (!cfg.heatmap .empty ()) {
1447
- std::string filename (cfg.heatmap + " _" + std::to_string (iter) + " .csv" );
1448
- std::ofstream cong_map (filename);
1449
- if (!cong_map)
1450
- log_error (" Failed to open wiretype heatmap %s for writing.\n " , filename.c_str ());
1451
- write_wiretype_heatmap (cong_map);
1452
- log_info (" wrote wiretype heatmap to %s.\n " , filename.c_str ());
1474
+ {
1475
+ std::string filename (cfg.heatmap + " _congestion_by_wiretype_" + std::to_string (iter) + " .csv" );
1476
+ std::ofstream cong_map (filename);
1477
+ if (!cong_map)
1478
+ log_error (" Failed to open congestion-by-wiretype heatmap %s for writing.\n " , filename.c_str ());
1479
+ write_congestion_by_wiretype_heatmap (cong_map);
1480
+ log_info (" wrote congestion-by-wiretype heatmap to %s.\n " , filename.c_str ());
1481
+ }
1482
+ {
1483
+ std::string filename (cfg.heatmap + " _utilisation_by_wiretype_" + std::to_string (iter) + " .csv" );
1484
+ std::ofstream cong_map (filename);
1485
+ if (!cong_map)
1486
+ log_error (" Failed to open utilisation-by-wiretype heatmap %s for writing.\n " , filename.c_str ());
1487
+ write_utilisation_by_wiretype_heatmap (cong_map);
1488
+ log_info (" wrote utilisation-by-wiretype heatmap to %s.\n " , filename.c_str ());
1489
+ }
1490
+ {
1491
+ std::string filename (cfg.heatmap + " _congestion_by_coordinate_" + std::to_string (iter) + " .csv" );
1492
+ std::ofstream cong_map (filename);
1493
+ if (!cong_map)
1494
+ log_error (" Failed to open congestion-by-coordinate heatmap %s for writing.\n " , filename.c_str ());
1495
+ write_congestion_by_coordinate_heatmap (cong_map);
1496
+ log_info (" wrote congestion-by-coordinate heatmap to %s.\n " , filename.c_str ());
1497
+ }
1453
1498
}
1454
1499
int tmgfail = 0 ;
1455
1500
if (timing_driven)
0 commit comments