Skip to content

Commit d63860f

Browse files
apply PR comments
1 parent 0d4aba4 commit d63860f

File tree

6 files changed

+19
-27
lines changed

6 files changed

+19
-27
lines changed

libs/libarchfpga/src/physical_types_util.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -682,12 +682,10 @@ std::vector<std::string> block_type_class_index_to_pin_names(t_physical_tile_typ
682682
pin_info.push_back(block_type_pin_index_to_pin_inst(type, pin_physical_num, is_flat));
683683
}
684684

685-
auto cmp = [](const t_pin_inst_port& lhs, const t_pin_inst_port& rhs) noexcept {
686-
return lhs.pin_physical_num < rhs.pin_physical_num;
687-
};
688-
689685
// Ensure all the pins are in order
690-
std::ranges::sort(pin_info, cmp);
686+
std::ranges::sort(pin_info, [](const t_pin_inst_port& lhs, const t_pin_inst_port& rhs) noexcept {
687+
return lhs.pin_physical_num < rhs.pin_physical_num;
688+
});
691689

692690
// Determine ranges for each capacity instance and port pair
693691
std::map<std::tuple<int, int, int, int, int>, std::array<int, 4>> pin_ranges;

vpr/src/route/route_budgets.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,15 @@ void route_budgets::allocate_slack_using_weights(NetPinsMatrix<float>& net_delay
165165
std::shared_ptr<SetupHoldTimingInfo> timing_info_min = nullptr;
166166
std::shared_ptr<SetupHoldTimingInfo> original_timing_info = nullptr;
167167

168-
unsigned iteration;
169-
float max_budget_change;
170-
171168
/*Preprocessing algorithm in order to consider short paths when setting initial maximum budgets.
172169
* Not necessary unless budgets are really hard to meet*/
173170
// process_negative_slack_using_minimax();
174171
if (negative_hold_slack) {
175172
process_negative_slack_using_minimax(net_delay, netlist_pin_lookup);
176173
}
177174

178-
iteration = 0;
179-
max_budget_change = 900e-12;
175+
unsigned iteration = 0;
176+
float max_budget_change = 900e-12;
180177

181178
// Cutoff threshold so slack allocator can detect if budgets aren't changing, and stop loop early
182179
// An experimentally derived constant that allows for a balance between budget calculation time, and quality
@@ -249,13 +246,11 @@ void route_budgets::process_negative_slack_using_minimax(NetPinsMatrix<float>& n
249246
* This ensures that the short path slacks are also taken into account for the maximum budgets.
250247
* Ensures that maximum budgets will always be above minimum budgets.
251248
* Can be unnecessary for not so strict budgets*/
252-
unsigned iteration;
253-
float max_budget_change;
254249
std::shared_ptr<SetupHoldTimingInfo> timing_info = nullptr;
255250
std::shared_ptr<SetupHoldTimingInfo> original_timing_info = nullptr;
256251

257-
iteration = 0;
258-
max_budget_change = 900e-12;
252+
unsigned iteration = 0;
253+
float max_budget_change = 900e-12;
259254
float second_max_budget_change = 900e-12;
260255
original_timing_info = perform_sta(net_delay);
261256

@@ -576,10 +571,9 @@ void route_budgets::allocate_slack_using_delays_and_criticalities(NetPinsMatrix<
576571
* the maximum delay budget = delay through this connection / pin criticality.
577572
* The minimum delay budget is set to 0 to promote finding the fastest path*/
578573

579-
float pin_criticality;
580574
for (auto net_id : net_list_.nets()) {
581575
for (auto pin_id : net_list_.net_sinks(net_id)) {
582-
pin_criticality = calculate_clb_net_pin_criticality(*timing_info, netlist_pin_lookup, pin_id, is_flat_);
576+
float pin_criticality = calculate_clb_net_pin_criticality(*timing_info, netlist_pin_lookup, pin_id, is_flat_);
583577

584578
/* Pin criticality is between 0 and 1.
585579
* Shift it downwards by 1 - max_criticality (max_criticality is 0.99 by default,
@@ -894,7 +888,7 @@ void route_budgets::print_route_budget(std::string filename, NetPinsMatrix<float
894888
fp.close();
895889
}
896890

897-
void route_budgets::print_temporary_budgets_to_file(NetPinsMatrix<float>& temp_budgets) {
891+
void route_budgets::print_temporary_budgets_to_file(NetPinsMatrix<float>& temp_budgets) const {
898892
/*Used for debugging. Print one specific budget to an external file called
899893
* temporary_budgets.txt. This can be used to see how the budgets change between
900894
* each minimax PERT iteration*/

vpr/src/route/route_budgets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class route_budgets {
112112
tatum::EdgeId get_edge_from_nets(ParentNetId net_id, int ipin);
113113

114114
/*debugging tools*/
115-
void print_temporary_budgets_to_file(NetPinsMatrix<float>& temp_budgets);
115+
void print_temporary_budgets_to_file(NetPinsMatrix<float>& temp_budgets) const;
116116

117117
/*Budget variables*/
118118
NetPinsMatrix<float> delay_min_budget; //[0..num_nets][0..clb_net[inet].pins]

vpr/src/route/route_utils.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ vtr::vector<ParentNetId, std::vector<std::unordered_map<RRNodeId, int>>> set_net
457457
continue;
458458
} else {
459459
// get the ptc_number of the sinks in the group
460-
std::for_each(sink_grp.begin(), sink_grp.end(), [&rr_graph](int& sink_rr_num) {
460+
std::ranges::for_each(sink_grp, [&rr_graph](int& sink_rr_num) {
461461
sink_rr_num = rr_graph.node_ptc_num(RRNodeId(sink_rr_num));
462462
});
463463

@@ -494,7 +494,7 @@ vtr::vector<ParentNetId, std::vector<std::unordered_map<RRNodeId, int>>> set_net
494494
void try_graph(int width_fac,
495495
const t_router_opts& router_opts,
496496
t_det_routing_arch& det_routing_arch,
497-
std::vector<t_segment_inf>& segment_inf,
497+
const std::vector<t_segment_inf>& segment_inf,
498498
t_chan_width_dist chan_width_dist,
499499
const std::vector<t_direct_inf>& directs,
500500
bool is_flat) {
@@ -680,12 +680,12 @@ void update_router_info_and_check_bp(bp_router_type type, int net_id) {
680680
// Between net id iters, check only net id and expression breakpoints
681681
get_bp_state_globals()->get_glob_breakpoint_state()->route_net_id = net_id;
682682
t_draw_state* draw_state = get_draw_state_vars();
683-
for (size_t i = 0; i < draw_state->list_of_breakpoints.size(); i++) {
684-
if (draw_state->list_of_breakpoints[i].type == BT_ROUTE_NET_ID && draw_state->list_of_breakpoints[i].active) {
685-
hit_bp = check_for_route_net_id_iter_breakpoints(draw_state->list_of_breakpoints[i].bt_route_net_id);
683+
for (const Breakpoint& breakpoint : draw_state->list_of_breakpoints) {
684+
if (breakpoint.type == BT_ROUTE_NET_ID && breakpoint.active) {
685+
hit_bp = check_for_route_net_id_iter_breakpoints(breakpoint.bt_route_net_id);
686686
break;
687-
} else if (draw_state->list_of_breakpoints[i].type == BT_EXPRESSION && draw_state->list_of_breakpoints[i].active) {
688-
hit_bp = check_for_expression_breakpoints(draw_state->list_of_breakpoints[i].bt_expression, false);
687+
} else if (breakpoint.type == BT_EXPRESSION && breakpoint.active) {
688+
hit_bp = check_for_expression_breakpoints(breakpoint.bt_expression, false);
689689
break;
690690
}
691691
}

vpr/src/route/route_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ vtr::vector<ParentNetId, std::vector<std::unordered_map<RRNodeId, int>>> set_net
150150
void try_graph(int width_fac,
151151
const t_router_opts& router_opts,
152152
t_det_routing_arch& det_routing_arch,
153-
std::vector<t_segment_inf>& segment_inf,
153+
const std::vector<t_segment_inf>& segment_inf,
154154
t_chan_width_dist chan_width_dist,
155155
const std::vector<t_direct_inf>& directs,
156156
bool is_flat);

vpr/src/util/vpr_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ std::tuple<int, int, std::string, std::string> parse_direct_pin_name(std::string
13731373

13741374
// Replace '.' and '[' characters with ' '
13751375
std::ranges::replace_if(source_string,
1376-
[](char c) { return c == '.' || c == '[' || c == ':' || c == ']'; },
1376+
[](char c) noexcept { return c == '.' || c == '[' || c == ':' || c == ']'; },
13771377
' ');
13781378

13791379
std::istringstream source_iss(source_string);

0 commit comments

Comments
 (0)