Skip to content

Commit 190fc90

Browse files
authored
Merge pull request #2381 from verilog-to-routing/3D-Routing-Util
Routing Util 3d
2 parents fbc635a + 17a38ce commit 190fc90

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

vpr/src/draw/draw_basic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,8 @@ void draw_routing_util(ezgl::renderer* g) {
844844
t_draw_coords* draw_coords = get_draw_coords_vars();
845845
auto& device_ctx = g_vpr_ctx.device();
846846

847-
auto chanx_usage = calculate_routing_usage(CHANX, draw_state->is_flat);
848-
auto chany_usage = calculate_routing_usage(CHANY, draw_state->is_flat);
847+
auto chanx_usage = calculate_routing_usage(CHANX, draw_state->is_flat, false);
848+
auto chany_usage = calculate_routing_usage(CHANY, draw_state->is_flat, false);
849849

850850
auto chanx_avail = calculate_routing_avail(CHANX);
851851
auto chany_avail = calculate_routing_avail(CHANY);

vpr/src/route/channel_stats.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ void print_channel_stats(bool is_flat) {
2020
histogram.emplace_back(0.9, 1.0);
2121
histogram.emplace_back(1.0, std::numeric_limits<float>::infinity());
2222

23-
auto chanx_usage = calculate_routing_usage(CHANX, is_flat);
24-
auto chany_usage = calculate_routing_usage(CHANY, is_flat);
23+
auto chanx_usage = calculate_routing_usage(CHANX, is_flat, true);
24+
auto chany_usage = calculate_routing_usage(CHANY, is_flat, true);
2525

2626
auto chanx_avail = calculate_routing_avail(CHANX);
2727
auto chany_avail = calculate_routing_avail(CHANY);

vpr/src/route/route_util.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "route_util.h"
22
#include "globals.h"
3+
#include "draw_types.h"
4+
#include "draw_global.h"
35

4-
vtr::Matrix<float> calculate_routing_usage(t_rr_type rr_type, bool is_flat) {
6+
vtr::Matrix<float> calculate_routing_usage(t_rr_type rr_type, bool is_flat, bool is_print) {
57
VTR_ASSERT(rr_type == CHANX || rr_type == CHANY);
68

79
auto& device_ctx = g_vpr_ctx.device();
@@ -27,6 +29,15 @@ vtr::Matrix<float> calculate_routing_usage(t_rr_type rr_type, bool is_flat) {
2729

2830
//Record number of used resources in each x/y channel
2931
for (RRNodeId rr_node : rr_nodes) {
32+
#ifndef NO_GRAPHICS
33+
if (!is_print) {
34+
t_draw_state* draw_state = get_draw_state_vars();
35+
int layer_num = rr_graph.node_layer(rr_node);
36+
if (!draw_state->draw_layer_display[layer_num].visible)
37+
continue; // don't count usage if layer is not visible
38+
}
39+
#endif
40+
3041
if (rr_type == CHANX) {
3142
VTR_ASSERT(rr_graph.node_type(rr_node) == CHANX);
3243
VTR_ASSERT(rr_graph.node_ylow(rr_node) == rr_graph.node_yhigh(rr_node));

vpr/src/route/route_util.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
#ifndef VPR_ROUTE_UTIL_H
22
#define VPR_ROUTE_UTIL_H
33
#include "vpr_types.h"
4+
#include "draw_types.h"
5+
#include "draw_global.h"
46

57
vtr::Matrix<float> calculate_routing_avail(t_rr_type rr_type);
6-
vtr::Matrix<float> calculate_routing_usage(t_rr_type rr_type, bool is_flat);
8+
9+
/**
10+
* @brief: Calculates and returns the usage over the entire grid for the specified
11+
* type of rr_node to the usage array. The usage is recorded at each (x,y) location.
12+
*
13+
* @param rr_type: Type of rr_node that we are calculating the usage of; can be CHANX or CHANY
14+
* @param is_flat: Is the flat router being used or not?
15+
* @param only_visible: If true, only record the usage of rr_nodes on layers that are visible according to the current
16+
* drawing settings.
17+
*/
18+
vtr::Matrix<float> calculate_routing_usage(t_rr_type rr_type, bool is_flat, bool is_print);
719
float routing_util(float used, float avail);
820

921
#endif

0 commit comments

Comments
 (0)