Skip to content

Commit 77799b6

Browse files
committed
[vpr][analysis] use std::min/max instead of if condition
1 parent 526e953 commit 77799b6

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

doc/src/vpr/command_line_usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ VPR uses a negotiated congestion algorithm (based on Pathfinder) to perform rout
15201520

15211521
.. option:: --generate_net_timing_report {on | off}
15221522

1523-
Generates a report that lists the bounding box, slack, and delay of every routed connection in a design in csv format. Fields in the report are:
1523+
Generates a report that lists the bounding box, slack, and delay of every routed connection in a design in csv format (``report_net_timing.csv``). Fields in the report are:
15241524

15251525
.. code-block:: none
15261526
netname: The name assigned to the net in atom netlist

vpr/src/analysis/timing_reports.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
#include "VprTimingGraphResolver.h"
1919

2020
/**
21-
* @brief Get the bounding box of a net.
21+
* @brief Get the bounding box of a routed net.
2222
* If the net is completely absorbed into a cluster block, return the bounding box of the cluster block.
2323
* Otherwise, return the bounding box of the net's route tree.
24-
* If a net is not routed, bounding box is returned with default values (OPEN).
2524
*
2625
* @param atom_net_id The id of the atom net to get the bounding box of.
26+
*
27+
* @return The bounding box of the net. If the net is not routed, a bounding box
28+
* is returned with default values (OPEN).
2729
*/
2830
static t_bb get_net_bounding_box(const AtomNetId atom_net_id) {
2931
const auto& route_trees = g_vpr_ctx.routing().route_trees;
@@ -46,20 +48,14 @@ static t_bb get_net_bounding_box(const AtomNetId atom_net_id) {
4648
for (auto& rt_node : route_tree.all_nodes()) {
4749
RRNodeId inode = rt_node.inode;
4850

49-
if (rr_graph.node_xlow(inode) < bb.xmin)
50-
bb.xmin = rr_graph.node_xlow(inode);
51-
if (rr_graph.node_xhigh(inode) > bb.xmax)
52-
bb.xmax = rr_graph.node_xhigh(inode);
51+
bb.xmin = std::min(static_cast<int>(rr_graph.node_xlow(inode)), bb.xmin);
52+
bb.xmax = std::max(static_cast<int>(rr_graph.node_xhigh(inode)), bb.xmax);
5353

54-
if (rr_graph.node_ylow(inode) < bb.ymin)
55-
bb.ymin = rr_graph.node_ylow(inode);
56-
if (rr_graph.node_yhigh(inode) > bb.ymax)
57-
bb.ymax = rr_graph.node_yhigh(inode);
54+
bb.ymin = std::min(static_cast<int>(rr_graph.node_ylow(inode)), bb.ymin);
55+
bb.ymax = std::max(static_cast<int>(rr_graph.node_yhigh(inode)), bb.ymax);
5856

59-
if (rr_graph.node_layer(inode) < bb.layer_min)
60-
bb.layer_min = rr_graph.node_layer(inode);
61-
if (rr_graph.node_layer(inode) > bb.layer_max)
62-
bb.layer_max = rr_graph.node_layer(inode);
57+
bb.layer_min = std::min(static_cast<int>(rr_graph.node_layer(inode)), bb.layer_min);
58+
bb.layer_max = std::max(static_cast<int>(rr_graph.node_layer(inode)), bb.layer_max);
6359
}
6460
return bb;
6561
};

0 commit comments

Comments
 (0)