1
0
mirror of https://github.com/YosysHQ/nextpnr.git synced 2026-05-14 02:28:10 +00:00

router2: Also write congestion-per-net in heatmap mode

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat
2026-04-20 10:04:41 +02:00
parent 33e1c9033b
commit 68978f076f

View File

@@ -1456,6 +1456,22 @@ struct Router2
}
}
void write_congestion_by_net_heatmap(std::ostream &out)
{
dict<IdString, int> congestion_by_net;
for (size_t i = 0; i < nets_by_udata.size(); i++) {
IdString name = nets_by_udata.at(i)->name;
for (const auto &wire : nets.at(i).wires) {
const auto &wd = flat_wires.at(wire_to_idx.at(wire.first));
if (wd.curr_cong > 1)
congestion_by_net[name] += (wd.curr_cong - 1);
}
}
// Write csv
for (auto &u : congestion_by_net)
out << u.first.c_str(ctx) << "," << u.second << std::endl;
}
int mid_x = 0, mid_y = 0;
void partition_nets()
@@ -1734,6 +1750,12 @@ struct Router2
write_congestion_by_coordinate_heatmap(cong_map);
log_info(" wrote congestion-by-coordinate heatmap to %s.\n", filename.c_str());
}
{
std::string filename(cfg.heatmap + "_congestion_by_net_" + std::to_string(iter) + ".csv");
auto cong_map = open_ofstream_and_log_error(filename, "congestion-by-net heatmap");
write_congestion_by_net_heatmap(cong_map);
log_info(" wrote congestion-by-net heatmap to %s.\n", filename.c_str());
}
}
int tmgfail = 0;
if (timing_driven)