Skip to content

Commit b2e1530

Browse files
committed
[vpr][analysis] fix net timing report bugs + including layer min/max of bb
1 parent 7558005 commit b2e1530

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

vpr/src/analysis/timing_reports.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
static t_bb get_net_bounding_box(const AtomNetId atom_net_id) {
2929
const auto& route_trees = g_vpr_ctx.routing().route_trees;
3030
const auto& rr_graph = g_vpr_ctx.device().rr_graph;
31-
const bool flat_router = g_vpr_ctx.routing().is_flat;
3231

3332
// Lambda to get the bounding box of a route tree
3433
auto route_tree_bb = [](const RRGraphView& rr_graph, const RouteTree& route_tree) {
@@ -46,21 +45,26 @@ static t_bb get_net_bounding_box(const AtomNetId atom_net_id) {
4645
// Iterate over all nodes in the route tree and update the bounding box
4746
for (auto& rt_node : route_tree.all_nodes()) {
4847
RRNodeId inode = rt_node.inode;
48+
4949
if (rr_graph.node_xlow(inode) < bb.xmin)
5050
bb.xmin = rr_graph.node_xlow(inode);
5151
if (rr_graph.node_xhigh(inode) > bb.xmax)
5252
bb.xmax = rr_graph.node_xhigh(inode);
53+
5354
if (rr_graph.node_ylow(inode) < bb.ymin)
5455
bb.ymin = rr_graph.node_ylow(inode);
55-
if (rr_graph.node_layer(inode) > bb.layer_min)
56+
if (rr_graph.node_yhigh(inode) > bb.ymax)
57+
bb.ymax = rr_graph.node_yhigh(inode);
58+
59+
if (rr_graph.node_layer(inode) < bb.layer_min)
5660
bb.layer_min = rr_graph.node_layer(inode);
5761
if (rr_graph.node_layer(inode) > bb.layer_max)
5862
bb.layer_max = rr_graph.node_layer(inode);
5963
}
6064
return bb;
6165
};
6266

63-
if (flat_router) {
67+
if (g_vpr_ctx.routing().is_flat) {
6468
// If flat router is used, route tree data structure can be used
6569
// directly to get the bounding box of the net
6670
const auto& route_tree = route_trees[atom_net_id];
@@ -85,6 +89,9 @@ static t_bb get_net_bounding_box(const AtomNetId atom_net_id) {
8589
continue;
8690
bbs.push_back(route_tree_bb(rr_graph, *route_tree));
8791
}
92+
if (bbs.empty()) {
93+
return t_bb();
94+
}
8895
// Assign the first cluster net's bounding box to the final bounding box
8996
// and then iteratively update it with the union of bounding boxes of
9097
// all cluster nets
@@ -97,6 +104,7 @@ static t_bb get_net_bounding_box(const AtomNetId atom_net_id) {
97104
max_bb.layer_min = std::min(bbs[i].layer_min, max_bb.layer_min);
98105
max_bb.layer_max = std::max(bbs[i].layer_max, max_bb.layer_max);
99106
}
107+
return max_bb;
100108
} else {
101109
// If there is no cluster net corresponding to the atom net,
102110
// it means the net is completely absorbed into a cluster block.
@@ -192,7 +200,7 @@ void generate_net_timing_report(const std::string& prefix,
192200
os << "# Revision: " << vtr::VCS_REVISION << std::endl;
193201
os << "# For each net, the timing information is reported in the following format:" << std::endl;
194202
os << "# netname : Fanout : "
195-
<< "bounding_box_xmin,bounding_box_ymin,bounding_box_xmax,bounding_box_ymax : "
203+
<< "(bounding_box_xmin,bounding_box_ymin,bounding_box_layermin),(bounding_box_xmax,bounding_box_ymax,bounding_box_layermax) : "
196204
<< "source_instance <slack_on source pin> : "
197205
<< "<load pin name1> <slack on load pin name1> <net delay for this net> : "
198206
<< "<load pin name2> <slack on load pin name2> <net delay for this net> : ..."
@@ -219,7 +227,8 @@ void generate_net_timing_report(const std::string& prefix,
219227
const auto& net_bb = get_net_bounding_box(net);
220228
os << net_name << " : "
221229
<< fanout << " : "
222-
<< net_bb.xmin << "," << net_bb.ymin << "," << net_bb.xmax << "," << net_bb.ymax << " : "
230+
<< "(" << net_bb.xmin << "," << net_bb.ymin << "," << net_bb.layer_min << "),("
231+
<< net_bb.xmax << "," << net_bb.ymax << "," << net_bb.layer_max << ") : "
223232
<< atom_netlist.pin_name(source_pin).c_str() << " " << source_pin_slack << " : ";
224233

225234
/* Iterate over all fanout pins and print their timing information */

vpr/src/analysis/timing_reports.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ void generate_hold_timing_stats(const std::string& prefix,
2424
/**
2525
* @brief Generates timing information for each net in atom netlist. For each net, the timing information
2626
* is reported in the following format:
27-
* netname : Fanout : bounding_box_xmin,bounding_box_ymin,bounding_box_xmax,bounding_box_ymax :
27+
* netname : Fanout :
28+
* (bounding_box_xmin,bounding_box_ymin,bounding_box_layermin),(bounding_box_xmax,bounding_box_ymax,bounding_box_layermax) :
2829
* source_instance <slack_on source pin> :
2930
* <load pin name1> <slack on load pin name1> <net delay for this net> :
3031
* <load pin name2> <slack on load pin name2> <net delay for this net> : ...

0 commit comments

Comments
 (0)