Skip to content

Commit 84ec20c

Browse files
authored
Merge pull request #3283 from verilog-to-routing/debug_router_iter
[Draw][Breakpoint] Fix debug breakpoints to work in placement and routing
2 parents c2cce9a + f23388f commit 84ec20c

File tree

3 files changed

+23
-28
lines changed

3 files changed

+23
-28
lines changed

vpr/src/draw/breakpoint.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ bool check_for_breakpoints(bool in_placer) {
6161
//goes through the breakpoints vector
6262
t_draw_state* draw_state = get_draw_state_vars();
6363
for (size_t i = 0; i < draw_state->list_of_breakpoints.size(); i++) {
64-
if (draw_state->list_of_breakpoints[i].type == BT_MOVE_NUM && draw_state->list_of_breakpoints[i].active)
64+
if (draw_state->list_of_breakpoints[i].type == BT_MOVE_NUM && draw_state->list_of_breakpoints[i].active && in_placer)
6565
return check_for_moves_breakpoints(draw_state->list_of_breakpoints[i].bt_moves);
66-
else if (draw_state->list_of_breakpoints[i].type == BT_FROM_BLOCK && draw_state->list_of_breakpoints[i].active)
66+
else if (draw_state->list_of_breakpoints[i].type == BT_FROM_BLOCK && draw_state->list_of_breakpoints[i].active && in_placer)
6767
return check_for_block_breakpoints(draw_state->list_of_breakpoints[i].bt_from_block);
68-
else if (draw_state->list_of_breakpoints[i].type == BT_TEMP_NUM && draw_state->list_of_breakpoints[i].active)
68+
else if (draw_state->list_of_breakpoints[i].type == BT_TEMP_NUM && draw_state->list_of_breakpoints[i].active && in_placer)
6969
return check_for_temperature_breakpoints(draw_state->list_of_breakpoints[i].bt_temps);
70-
else if (draw_state->list_of_breakpoints[i].type == BT_ROUTER_ITER && draw_state->list_of_breakpoints[i].active)
70+
else if (draw_state->list_of_breakpoints[i].type == BT_ROUTER_ITER && draw_state->list_of_breakpoints[i].active && !in_placer)
7171
return check_for_router_iter_breakpoints(draw_state->list_of_breakpoints[i].bt_router_iter);
72-
else if (draw_state->list_of_breakpoints[i].type == BT_ROUTE_NET_ID && draw_state->list_of_breakpoints[i].active)
72+
else if (draw_state->list_of_breakpoints[i].type == BT_ROUTE_NET_ID && draw_state->list_of_breakpoints[i].active && !in_placer)
7373
return check_for_route_net_id_iter_breakpoints(draw_state->list_of_breakpoints[i].bt_route_net_id);
7474
else if (draw_state->list_of_breakpoints[i].type == BT_EXPRESSION && draw_state->list_of_breakpoints[i].active)
7575
return check_for_expression_breakpoints(draw_state->list_of_breakpoints[i].bt_expression, in_placer);

vpr/src/route/route.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "rr_graph.h"
1313
#include "router_lookahead_report.h"
1414
#include "vtr_time.h"
15+
#include "vtr_expr_eval.h"
1516

1617
bool route(const Netlist<>& net_list,
1718
int width_fac,
@@ -251,6 +252,10 @@ bool route(const Netlist<>& net_list,
251252
int rcv_finished_count = RCV_FINISH_EARLY_COUNTDOWN;
252253

253254
print_route_status_header();
255+
#ifndef NO_GRAPHICS
256+
// Reset router iteration in the current route attempt.
257+
get_bp_state_globals()->get_glob_breakpoint_state()->router_iter = 0;
258+
#endif
254259
for (itry = 1; itry <= router_opts.max_router_iterations; ++itry) {
255260
/* Reset "is_routed" and "is_fixed" flags to indicate nets not pre-routed (yet) */
256261
for (auto net_id : net_list.nets()) {
@@ -268,6 +273,11 @@ bool route(const Netlist<>& net_list,
268273
worst_negative_slack = timing_info->hold_total_negative_slack();
269274
}
270275

276+
#ifndef NO_GRAPHICS
277+
// Update router information and check breakpoint.
278+
update_router_info_and_check_bp(BP_ROUTE_ITER, -1);
279+
#endif
280+
271281
/* Initial criticalities: set to 1 on the first iter if the user asked for it */
272282
if (router_opts.initial_timing == e_router_initial_timing::ALL_CRITICAL && itry == 1)
273283
netlist_router->set_timing_info(make_constant_timing_info(1));
@@ -400,19 +410,13 @@ bool route(const Netlist<>& net_list,
400410
if (legal_convergence_count >= router_opts.max_convergence_count
401411
|| iter_results.stats.connections_routed == 0
402412
|| early_reconvergence_exit_heuristic(router_opts, itry_since_last_convergence, timing_info, best_routing_metrics)) {
403-
#ifndef NO_GRAPHICS
404-
update_router_info_and_check_bp(BP_ROUTE_ITER, -1);
405-
#endif
406413
break; //Done routing
407414
}
408415

409416
/*
410417
* Abort checks: Should we give-up because this routing problem is unlikely to converge to a legal routing?
411418
*/
412419
if (itry == 1 && early_exit_heuristic(router_opts, wirelength_info)) {
413-
#ifndef NO_GRAPHICS
414-
update_router_info_and_check_bp(BP_ROUTE_ITER, -1);
415-
#endif
416420
//Abort
417421
break;
418422
}
@@ -423,18 +427,12 @@ bool route(const Netlist<>& net_list,
423427

424428
if (!std::isnan(est_success_iteration) && est_success_iteration > abort_iteration_threshold && router_opts.routing_budgets_algorithm != YOYO) {
425429
VTR_LOG("Routing aborted, the predicted iteration for a successful route (%.1f) is too high.\n", est_success_iteration);
426-
#ifndef NO_GRAPHICS
427-
update_router_info_and_check_bp(BP_ROUTE_ITER, -1);
428-
#endif
429430
break; //Abort
430431
}
431432
}
432433

433434
if (itry == 1 && router_opts.exit_after_first_routing_iteration) {
434435
VTR_LOG("Exiting after first routing iteration as requested\n");
435-
#ifndef NO_GRAPHICS
436-
update_router_info_and_check_bp(BP_ROUTE_ITER, -1);
437-
#endif
438436
break;
439437
}
440438

vpr/src/route/route_utils.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -672,17 +672,14 @@ void update_draw_pres_fac(const float /*new_pres_fac*/) {
672672

673673
#ifndef NO_GRAPHICS
674674
void update_router_info_and_check_bp(bp_router_type type, int net_id) {
675-
t_draw_state* draw_state = get_draw_state_vars();
676-
if (!draw_state->list_of_breakpoints.empty()) {
677-
if (type == BP_ROUTE_ITER)
678-
get_bp_state_globals()->get_glob_breakpoint_state()->router_iter++;
679-
else if (type == BP_NET_ID)
680-
get_bp_state_globals()->get_glob_breakpoint_state()->route_net_id = net_id;
681-
f_router_debug = check_for_breakpoints(false);
682-
if (f_router_debug) {
683-
breakpoint_info_window(get_bp_state_globals()->get_glob_breakpoint_state()->bp_description, *get_bp_state_globals()->get_glob_breakpoint_state(), false);
684-
update_screen(ScreenUpdatePriority::MAJOR, "Breakpoint Encountered", ROUTING, nullptr);
685-
}
675+
if (type == BP_ROUTE_ITER)
676+
get_bp_state_globals()->get_glob_breakpoint_state()->router_iter++;
677+
else if (type == BP_NET_ID)
678+
get_bp_state_globals()->get_glob_breakpoint_state()->route_net_id = net_id;
679+
f_router_debug = check_for_breakpoints(false);
680+
if (f_router_debug) {
681+
breakpoint_info_window(get_bp_state_globals()->get_glob_breakpoint_state()->bp_description, *get_bp_state_globals()->get_glob_breakpoint_state(), false);
682+
update_screen(ScreenUpdatePriority::MAJOR, "Breakpoint Encountered", ROUTING, nullptr);
686683
}
687684
}
688685
#endif

0 commit comments

Comments
 (0)