@@ -113,6 +113,41 @@ void routing_stats(const Netlist<>& net_list,
113
113
}
114
114
}
115
115
116
+ std::pair<vtr::NdMatrix<int , 3 >, vtr::NdMatrix<int , 3 >> calculate_channel_width () {
117
+ const auto & device_ctx = g_vpr_ctx.device ();
118
+ const auto & rr_graph = device_ctx.rr_graph ;
119
+
120
+ auto chanx_width = vtr::NdMatrix<int , 3 >({{(size_t )device_ctx.grid .get_num_layers (),
121
+ device_ctx.grid .width (),
122
+ device_ctx.grid .height ()}},
123
+ 0 );
124
+
125
+ auto chany_width = vtr::NdMatrix<int , 3 >({{(size_t )device_ctx.grid .get_num_layers (),
126
+ device_ctx.grid .width (),
127
+ device_ctx.grid .height ()}},
128
+ 0 );
129
+
130
+ for (RRNodeId node_id : rr_graph.nodes ()) {
131
+ e_rr_type rr_type = rr_graph.node_type (node_id);
132
+
133
+ if (rr_type == e_rr_type::CHANX) {
134
+ int y = rr_graph.node_ylow (node_id);
135
+ int layer = rr_graph.node_layer (node_id);
136
+ for (int x = rr_graph.node_xlow (node_id); x <= rr_graph.node_xhigh (node_id); x++) {
137
+ chanx_width[layer][x][y]++;
138
+ }
139
+ } else if (rr_type == e_rr_type::CHANY) {
140
+ int x = rr_graph.node_xlow (node_id);
141
+ int layer = rr_graph.node_layer (node_id);
142
+ for (int y = rr_graph.node_ylow (node_id); y <= rr_graph.node_yhigh (node_id); y++) {
143
+ chany_width[layer][x][y]++;
144
+ }
145
+ }
146
+ }
147
+
148
+ return {chanx_width, chany_width};
149
+ }
150
+
116
151
void length_and_bends_stats (const Netlist<>& net_list, bool is_flat) {
117
152
int max_bends = 0 ;
118
153
int total_bends = 0 ;
0 commit comments