4
4
#include " globals.h"
5
5
#include " vtr_log.h"
6
6
7
+ static void report_overused_ipin_opin (std::ostream& os, RRNodeId node_id);
8
+ static void report_overused_chanx_chany (std::ostream& os, RRNodeId node_id);
9
+ static void report_overused_source_sink (std::ostream& os, RRNodeId node_id);
10
+ static void report_congested_nets (std::ostream& os, const std::set<ClusterNetId>& congested_nets);
11
+
7
12
static void log_overused_nodes_header ();
8
13
static void log_single_overused_node_status (int overuse_index, RRNodeId inode);
9
14
@@ -34,9 +39,8 @@ void log_overused_nodes_status(int max_logged_overused_rr_nodes) {
34
39
void report_overused_nodes () {
35
40
const auto & device_ctx = g_vpr_ctx.device ();
36
41
const auto & route_ctx = g_vpr_ctx.routing ();
37
- const auto & clb_nlist = g_vpr_ctx.clustering ().clb_nlist ;
38
42
39
- // Generate overuse infor lookup table
43
+ // Generate overuse info lookup table
40
44
std::map<RRNodeId, std::set<ClusterNetId>> nodes_to_nets_lookup;
41
45
generate_overused_nodes_to_congested_net_lookup (nodes_to_nets_lookup);
42
46
@@ -45,8 +49,7 @@ void report_overused_nodes() {
45
49
os << " Overused nodes information report on the final failed routing attempt" << ' \n ' ;
46
50
os << " Total number of overused nodes = " << nodes_to_nets_lookup.size () << ' \n ' ;
47
51
48
- int inode = 0 ;
49
-
52
+ size_t inode = 0 ;
50
53
for (const auto & lookup_pair : nodes_to_nets_lookup) {
51
54
const RRNodeId node_id = lookup_pair.first ;
52
55
const auto & congested_nets = lookup_pair.second ;
@@ -57,45 +60,33 @@ void report_overused_nodes() {
57
60
os << " Overused RR node #" << inode << ' \n ' ;
58
61
os << " Node id = " << size_t (node_id) << ' \n ' ;
59
62
os << " Occupancy = " << route_ctx.rr_node_route_inf [size_t (node_id)].occ () << ' \n ' ;
60
- os << " Capacity = " << device_ctx.rr_nodes .node_capacity (node_id) << ' \n ' ;
61
- os << " Node type = " << device_ctx.rr_nodes .node_type_string (node_id) << ' \n ' ;
62
- os << " PTC number = " << device_ctx.rr_nodes .node_ptc_num (node_id) << ' \n ' ;
63
- os << " Xlow = " << device_ctx.rr_nodes .node_xlow (node_id) << " , " ;
64
- os << " Ylow = " << device_ctx.rr_nodes .node_ylow (node_id) << ' \n ' ;
65
- os << " Xhigh = " << device_ctx.rr_nodes .node_xhigh (node_id) << " , " ;
66
- os << " Yhigh = " << device_ctx.rr_nodes .node_yhigh (node_id) << ' \n ' ;
63
+ os << " Capacity = " << device_ctx.rr_nodes .node_capacity (node_id) << " \n\n " ;
67
64
68
65
// Report Selective info
69
- auto node_type = device_ctx.rr_nodes .node_type (node_id);
70
-
71
- if (node_type == e_rr_type::CHANX || node_type == e_rr_type::CHANY) {
72
- os << " Direction = " << device_ctx.rr_nodes .node_direction_string (node_id) << ' \n ' ;
66
+ os << " Node type = " << device_ctx.rr_nodes .node_type_string (node_id) << ' \n ' ;
73
67
74
- os << " Resistance = " << device_ctx.rr_nodes .node_R (node_id) << ' \n ' ;
75
- os << " Capacitance = " << device_ctx.rr_nodes .node_C (node_id) << ' \n ' ;
76
- } else if (node_type == e_rr_type::IPIN || node_type == e_rr_type::OPIN) {
77
- os << " Side = " << device_ctx.rr_nodes .node_side_string (node_id) << ' \n ' ;
68
+ auto node_type = device_ctx.rr_nodes .node_type (node_id);
69
+ switch (node_type) {
70
+ case IPIN:
71
+ case OPIN:
72
+ report_overused_ipin_opin (os, node_id);
73
+ break ;
74
+ case CHANX:
75
+ case CHANY:
76
+ report_overused_chanx_chany (os, node_id);
77
+ break ;
78
+ case SOURCE:
79
+ case SINK:
80
+ report_overused_source_sink (os, node_id);
81
+ break ;
82
+
83
+ default :
84
+ break ;
78
85
}
79
86
80
87
os << " -----------------------------\n " ; // Node/net info separation line
88
+ report_congested_nets (os, congested_nets);
81
89
82
- // Reported corresponding congested nets
83
- int inet = 0 ;
84
-
85
- os << " Number of nets passing through this RR node = " << congested_nets.size () << ' \n ' ;
86
- for (ClusterNetId net_id : congested_nets) {
87
- ClusterBlockId block_id = clb_nlist.net_driver_block (net_id);
88
-
89
- os << " Net #" << inet << " : " ;
90
- os << " Net ID = " << size_t (net_id) << " , " ;
91
- os << " Net name = " << clb_nlist.net_name (net_id) << " , " ;
92
- os << " Driving block name = " << clb_nlist.block_pb (block_id)->name << " , " ;
93
- os << " Driving block type = " << clb_nlist.block_type (block_id)->name << ' \n ' ;
94
-
95
- ++inet;
96
- }
97
-
98
- os << ' \n ' ;
99
90
++inode;
100
91
}
101
92
@@ -121,6 +112,80 @@ void generate_overused_nodes_to_congested_net_lookup(std::map<RRNodeId, std::set
121
112
}
122
113
}
123
114
115
+ static void report_overused_ipin_opin (std::ostream& os, RRNodeId node_id) {
116
+ const auto & device_ctx = g_vpr_ctx.device ();
117
+ const auto & place_ctx = g_vpr_ctx.placement ();
118
+
119
+ auto grid_x = device_ctx.rr_nodes .node_xlow (node_id);
120
+ auto grid_y = device_ctx.rr_nodes .node_ylow (node_id);
121
+ VTR_ASSERT_MSG (
122
+ grid_x == device_ctx.rr_nodes .node_xhigh (node_id) && grid_y == device_ctx.rr_nodes .node_yhigh (node_id),
123
+ " Non-track RR node should not span across multiple grid blocks." );
124
+
125
+ os << " Pin number = " << device_ctx.rr_nodes .node_pin_num (node_id) << ' \n ' ;
126
+ os << " Side = " << device_ctx.rr_nodes .node_side_string (node_id) << " \n\n " ;
127
+
128
+ // Add block type for IPINs/OPINs in overused rr-node report
129
+ const auto & clb_nlist = g_vpr_ctx.clustering ().clb_nlist ;
130
+ auto & grid_info = place_ctx.grid_blocks [grid_x][grid_y];
131
+ auto & grid_blocks = grid_info.blocks ;
132
+
133
+ os << " Grid location: X = " << grid_x << " , Y = " << grid_y << ' \n ' ;
134
+ os << " Number of blocks currently at this grid location = " << grid_info.usage << ' \n ' ;
135
+ for (size_t iblock = 0 ; iblock < grid_blocks.size (); ++iblock) {
136
+ ClusterBlockId block_id = grid_blocks[iblock];
137
+ os << " Block #" << iblock << " : " ;
138
+ os << " Block name = " << clb_nlist.block_pb (block_id)->name << " , " ;
139
+ os << " Block type = " << clb_nlist.block_type (block_id)->name << ' \n ' ;
140
+ }
141
+ }
142
+
143
+ static void report_overused_chanx_chany (std::ostream& os, RRNodeId node_id) {
144
+ const auto & device_ctx = g_vpr_ctx.device ();
145
+
146
+ os << " Track number = " << device_ctx.rr_nodes .node_track_num (node_id) << ' \n ' ;
147
+ os << " Direction = " << device_ctx.rr_nodes .node_direction_string (node_id) << " \n\n " ;
148
+
149
+ os << " Grid location: " << ' \n ' ;
150
+ os << " Xlow = " << device_ctx.rr_nodes .node_xlow (node_id) << " , " ;
151
+ os << " Ylow = " << device_ctx.rr_nodes .node_ylow (node_id) << ' \n ' ;
152
+ os << " Xhigh = " << device_ctx.rr_nodes .node_xhigh (node_id) << " , " ;
153
+ os << " Yhigh = " << device_ctx.rr_nodes .node_yhigh (node_id) << ' \n ' ;
154
+ os << " Resistance = " << device_ctx.rr_nodes .node_R (node_id) << ' \n ' ;
155
+ os << " Capacitance = " << device_ctx.rr_nodes .node_C (node_id) << ' \n ' ;
156
+ }
157
+
158
+ static void report_overused_source_sink (std::ostream& os, RRNodeId node_id) {
159
+ const auto & device_ctx = g_vpr_ctx.device ();
160
+
161
+ auto grid_x = device_ctx.rr_nodes .node_xlow (node_id);
162
+ auto grid_y = device_ctx.rr_nodes .node_ylow (node_id);
163
+ VTR_ASSERT_MSG (
164
+ grid_x == device_ctx.rr_nodes .node_xhigh (node_id) && grid_y == device_ctx.rr_nodes .node_yhigh (node_id),
165
+ " Non-track RR node should not span across multiple grid blocks." );
166
+
167
+ os << " Class number = " << device_ctx.rr_nodes .node_class_num (node_id) << ' \n ' ;
168
+ os << " Grid location: X = " << grid_x << " , Y = " << grid_y << ' \n ' ;
169
+ }
170
+
171
+ // Reported congested nets at a specific rr node
172
+ static void report_congested_nets (std::ostream& os, const std::set<ClusterNetId>& congested_nets) {
173
+ const auto & clb_nlist = g_vpr_ctx.clustering ().clb_nlist ;
174
+ os << " Number of nets passing through this RR node = " << congested_nets.size () << ' \n ' ;
175
+
176
+ size_t inet = 0 ;
177
+ for (ClusterNetId net_id : congested_nets) {
178
+ ClusterBlockId block_id = clb_nlist.net_driver_block (net_id);
179
+ os << " Net #" << inet << " : " ;
180
+ os << " Net ID = " << size_t (net_id) << " , " ;
181
+ os << " Net name = " << clb_nlist.net_name (net_id) << " , " ;
182
+ os << " Driving block name = " << clb_nlist.block_pb (block_id)->name << " , " ;
183
+ os << " Driving block type = " << clb_nlist.block_type (block_id)->name << ' \n ' ;
184
+ ++inet;
185
+ }
186
+ os << ' \n ' ;
187
+ }
188
+
124
189
static void log_overused_nodes_header () {
125
190
VTR_LOG (" Routing Failure Diagnostics: Printing Overused Nodes Information\n " );
126
191
VTR_LOG (" ------ ------- ---------- --------- -------- ------------ ------- ------- ------- ------- ------- -------\n " );
0 commit comments