24
24
#include < X11/keysym.h>
25
25
#endif
26
26
27
- void draw_chany_to_chany_edge (RRNodeId from_node, RRNodeId to_node, short switch_type , ezgl::renderer* g) {
27
+ void draw_chany_to_chany_edge (RRNodeId from_node, RRNodeId to_node, RRSwitchId rr_switch_id , ezgl::renderer* g) {
28
28
t_draw_coords* draw_coords = get_draw_coords_vars ();
29
29
const DeviceContext& device_ctx = g_vpr_ctx.device ();
30
30
const RRGraphView& rr_graph = device_ctx.rr_graph ;
31
31
32
- /* Draws a connection between two y-channel segments. Passing in the track *
33
- * numbers allows this routine to be used for both rr_graph and routing *
34
- * drawing-> */
35
-
36
- float x1, x2, y1, y2;
37
- ezgl::rectangle from_chan;
38
- ezgl::rectangle to_chan;
39
- int from_ylow, to_ylow, from_yhigh, to_yhigh; // , from_x, to_x;
40
-
41
32
// Get the coordinates of the channel wires.
42
- from_chan = draw_get_rr_chan_bbox (from_node);
43
- to_chan = draw_get_rr_chan_bbox (to_node);
44
-
45
- // from_x = rr_graph.node_xlow(RRNodeId(from_node));
46
- // to_x = rr_graph.node_xlow(RRNodeId(to_node));
47
- from_ylow = rr_graph.node_ylow (from_node);
48
- from_yhigh = rr_graph.node_yhigh (from_node);
49
- to_ylow = rr_graph.node_ylow (to_node);
50
- to_yhigh = rr_graph.node_yhigh (to_node);
33
+ ezgl::rectangle from_chan = draw_get_rr_chan_bbox (from_node);
34
+ ezgl::rectangle to_chan = draw_get_rr_chan_bbox (to_node);
51
35
52
- /* (x1, y1) point on from_node, (x2, y2) point on to_node. */
36
+ int from_ylow = rr_graph.node_ylow (from_node);
37
+ int from_yhigh = rr_graph.node_yhigh (from_node);
38
+ int to_ylow = rr_graph.node_ylow (to_node);
39
+ int to_yhigh = rr_graph.node_yhigh (to_node);
53
40
54
- x1 = from_chan.left ();
55
- x2 = to_chan.left ();
41
+ // (x1, y1) point on from_node, (x2, y2) point on to_node.
42
+ float x1 = from_chan.left ();
43
+ float x2 = to_chan.left ();
56
44
57
- if (to_yhigh < from_ylow) { /* From upper to lower */
45
+ float y1, y2;
46
+ if (to_yhigh < from_ylow) { // From upper to lower
58
47
y1 = from_chan.bottom ();
59
48
y2 = to_chan.top ();
60
- } else if (to_ylow > from_yhigh) { /* From lower to upper */
49
+ } else if (to_ylow > from_yhigh) { // From lower to upper
61
50
y1 = from_chan.top ();
62
51
y2 = to_chan.bottom ();
63
52
}
64
-
65
- /* Segments overlap in the channel. Figure out best way to draw. Have to *
66
- * make sure the drawing is symmetric in the from rr and to rr so the edges *
67
- * will be drawn on top of each other for bidirectional connections. */
68
-
69
- /* UDSD Modification by WMF Begin */
53
+ // Segments overlap in the channel. Figure out the best way to draw. Have to
54
+ // make sure the drawing is symmetric in the from rr and to rr so the edges
55
+ // will be drawn on top of each other for bidirectional connections.
70
56
else {
71
57
if (rr_graph.node_direction (to_node) != Direction::BIDIR) {
72
- if (rr_graph.node_direction (to_node) == Direction::INC) { /* INC wire starts at bottom edge */
58
+ if (rr_graph.node_direction (to_node) == Direction::INC) { // INC wire starts at bottom edge
73
59
74
60
y2 = to_chan.bottom ();
75
- /* since no U-turns from_tracks must be INC as well */
61
+ // since no U-turns from_tracks must be INC as well
76
62
y1 = draw_coords->tile_y [to_ylow - 1 ]
77
63
+ draw_coords->get_tile_width ();
78
- } else { /* DEC wire starts at top edge */
64
+ } else { // DEC wire starts at top edge
79
65
80
66
y2 = to_chan.top ();
81
67
y1 = draw_coords->tile_y [to_yhigh + 1 ];
82
68
}
83
69
} else {
84
- if (to_ylow < from_ylow) { /* Draw from bottom edge of one to other. */
70
+ if (to_ylow < from_ylow) { // Draw from bottom edge of one to other.
85
71
y1 = from_chan.bottom ();
86
72
y2 = draw_coords->tile_y [from_ylow - 1 ]
87
73
+ draw_coords->get_tile_width ();
88
74
} else if (from_ylow < to_ylow) {
89
75
y1 = draw_coords->tile_y [to_ylow - 1 ]
90
76
+ draw_coords->get_tile_width ();
91
77
y2 = to_chan.bottom ();
92
- } else if (to_yhigh > from_yhigh) { /* Draw from top edge of one to other. */
78
+ } else if (to_yhigh > from_yhigh) { // Draw from top edge of one to other.
93
79
y1 = from_chan.top ();
94
80
y2 = draw_coords->tile_y [from_yhigh + 1 ];
95
81
} else if (from_yhigh > to_yhigh) {
96
82
y1 = draw_coords->tile_y [to_yhigh + 1 ];
97
83
y2 = to_chan.top ();
98
- } else { /* Complete overlap: start and end both align. Draw outside the sbox */
84
+ } else { // Complete overlap: start and end both align. Draw outside the sbox
99
85
y1 = from_chan.bottom ();
100
86
y2 = from_chan.bottom () + draw_coords->get_tile_width ();
101
87
}
102
88
}
103
89
}
104
90
105
- /* UDSD Modification by WMF End */
106
91
g->draw_line ({x1, y1}, {x2, y2});
107
92
108
93
draw_rr_switch (x1, y1, x2, y2,
109
- rr_graph.rr_switch_inf (RRSwitchId (switch_type) ).buffered (),
110
- rr_graph.rr_switch_inf (RRSwitchId (switch_type) ).configurable (), g);
94
+ rr_graph.rr_switch_inf (rr_switch_id ).buffered (),
95
+ rr_graph.rr_switch_inf (rr_switch_id ).configurable (), g);
111
96
}
112
97
113
- void draw_chanx_to_chanx_edge (RRNodeId from_node, RRNodeId to_node, short switch_type, ezgl::renderer* g) {
114
- /* Draws a connection between two x-channel segments. Passing in the track *
115
- * numbers allows this routine to be used for both rr_graph and routing *
116
- * drawing-> */
117
-
98
+ void draw_chanx_to_chanx_edge (RRNodeId from_node, RRNodeId to_node, RRSwitchId rr_switch_id, ezgl::renderer* g) {
118
99
t_draw_coords* draw_coords = get_draw_coords_vars ();
119
100
const DeviceContext& device_ctx = g_vpr_ctx.device ();
120
101
const RRGraphView& rr_graph = device_ctx.rr_graph ;
121
102
122
- float x1, x2, y1, y2;
123
- ezgl::rectangle from_chan;
124
- ezgl::rectangle to_chan;
125
- int from_xlow, to_xlow, from_xhigh, to_xhigh;
126
-
127
103
// Get the coordinates of the channel wires.
128
- from_chan = draw_get_rr_chan_bbox (from_node);
129
- to_chan = draw_get_rr_chan_bbox (to_node);
130
-
131
- /* (x1, y1) point on from_node, (x2, y2) point on to_node. */
132
-
133
- y1 = from_chan.bottom ();
134
- y2 = to_chan.bottom ();
135
-
136
- from_xlow = rr_graph.node_xlow (from_node);
137
- from_xhigh = rr_graph.node_xhigh (from_node);
138
- to_xlow = rr_graph.node_xlow (to_node);
139
- to_xhigh = rr_graph.node_xhigh (to_node);
104
+ ezgl::rectangle from_chan = draw_get_rr_chan_bbox (from_node);
105
+ ezgl::rectangle to_chan = draw_get_rr_chan_bbox (to_node);
106
+
107
+ // (x1, y1) point on from_node, (x2, y2) point on to_node.
108
+ float x1, x2;
109
+ float y1 = from_chan.bottom ();
110
+ float y2 = to_chan.bottom ();
111
+
112
+ int from_xlow = rr_graph.node_xlow (from_node);
113
+ int from_xhigh = rr_graph.node_xhigh (from_node);
114
+ int to_xlow = rr_graph.node_xlow (to_node);
115
+ int to_xhigh = rr_graph.node_xhigh (to_node);
140
116
if (to_xhigh < from_xlow) { /* From right to left */
141
- /* UDSD Note by WMF: could never happen for INC wires, unless U-turn. For DEC
142
- * wires this handles well */
117
+ // Could never happen for INC wires, unless U-turn. For DEC wires this handles well
143
118
x1 = from_chan.left ();
144
119
x2 = to_chan.right ();
145
120
} else if (to_xlow > from_xhigh) { /* From left to right */
146
- /* UDSD Note by WMF: could never happen for DEC wires, unless U-turn. For INC
147
- * wires this handles well */
121
+ // Could never happen for DEC wires, unless U-turn. For INC wires this handles well
148
122
x1 = from_chan.right ();
149
123
x2 = to_chan.left ();
150
124
}
151
-
152
125
/* Segments overlap in the channel. Figure out best way to draw. Have to *
153
126
* make sure the drawing is symmetric in the from rr and to rr so the edges *
154
127
* will be drawn on top of each other for bidirectional connections. */
155
-
156
128
else {
157
129
if (rr_graph.node_direction (to_node) != Direction::BIDIR) {
158
- /* must connect to to_node's wire beginning at x2 */
159
- if (rr_graph.node_direction (to_node) == Direction::INC) { /* INC wire starts at leftmost edge */
130
+ // must connect to to_node's wire beginning at x2
131
+ if (rr_graph.node_direction (to_node) == Direction::INC) { // INC wire starts at leftmost edge
160
132
VTR_ASSERT (from_xlow < to_xlow);
161
133
x2 = to_chan.left ();
162
- /* since no U-turns from_tracks must be INC as well */
134
+ // since no U-turns from_tracks must be INC as well
163
135
x1 = draw_coords->tile_x [to_xlow - 1 ]
164
136
+ draw_coords->get_tile_width ();
165
- } else { /* DEC wire starts at rightmost edge */
137
+ } else { // DEC wire starts at rightmost edge
166
138
VTR_ASSERT (from_xhigh > to_xhigh);
167
139
x2 = to_chan.right ();
168
140
x1 = draw_coords->tile_x [to_xhigh + 1 ];
169
141
}
170
142
} else {
171
- if (to_xlow < from_xlow) { /* Draw from left edge of one to other */
143
+ if (to_xlow < from_xlow) { // Draw from left edge of one to other
172
144
x1 = from_chan.left ();
173
145
x2 = draw_coords->tile_x [from_xlow - 1 ]
174
146
+ draw_coords->get_tile_width ();
@@ -177,14 +149,14 @@ void draw_chanx_to_chanx_edge(RRNodeId from_node, RRNodeId to_node, short switch
177
149
+ draw_coords->get_tile_width ();
178
150
x2 = to_chan.left ();
179
151
180
- } /* The following then is executed when from_xlow == to_xlow */
181
- else if (to_xhigh > from_xhigh) { /* Draw from right edge of one to other */
152
+ } // The following then is executed when from_xlow == to_xlow
153
+ else if (to_xhigh > from_xhigh) { // Draw from right edge of one to other
182
154
x1 = from_chan.right ();
183
155
x2 = draw_coords->tile_x [from_xhigh + 1 ];
184
156
} else if (from_xhigh > to_xhigh) {
185
157
x1 = draw_coords->tile_x [to_xhigh + 1 ];
186
158
x2 = to_chan.right ();
187
- } else { /* Complete overlap: start and end both align. Draw outside the sbox */
159
+ } else { // Complete overlap: start and end both align. Draw outside the sbox
188
160
x1 = from_chan.left ();
189
161
x2 = from_chan.left () + draw_coords->get_tile_width ();
190
162
}
@@ -194,77 +166,75 @@ void draw_chanx_to_chanx_edge(RRNodeId from_node, RRNodeId to_node, short switch
194
166
g->draw_line ({x1, y1}, {x2, y2});
195
167
196
168
draw_rr_switch (x1, y1, x2, y2,
197
- rr_graph.rr_switch_inf (RRSwitchId (switch_type) ).buffered (),
198
- rr_graph.rr_switch_inf (RRSwitchId (switch_type) ).configurable (), g);
169
+ rr_graph.rr_switch_inf (rr_switch_id ).buffered (),
170
+ rr_graph.rr_switch_inf (rr_switch_id ).configurable (), g);
199
171
}
200
172
201
- void draw_chanx_to_chany_edge (RRNodeId chanx_node, RRNodeId chany_node, enum e_chan_edge_dir edge_dir, short switch_type, ezgl::renderer* g) {
173
+ void draw_chanx_to_chany_edge (RRNodeId chanx_node,
174
+ RRNodeId chany_node,
175
+ e_chan_edge_dir edge_dir,
176
+ RRSwitchId rr_switch_id,
177
+ ezgl::renderer* g) {
202
178
t_draw_coords* draw_coords = get_draw_coords_vars ();
203
179
const DeviceContext& device_ctx = g_vpr_ctx.device ();
204
180
const RRGraphView& rr_graph = device_ctx.rr_graph ;
205
181
206
- /* Draws an edge (SBOX connection) between an x-directed channel and a *
207
- * y-directed channel. */
208
-
209
- float x1, y1, x2, y2;
210
- ezgl::rectangle chanx_bbox;
211
- ezgl::rectangle chany_bbox;
212
- int chanx_xlow, chany_x, chany_ylow, chanx_y;
213
-
214
- /* Get the coordinates of the CHANX and CHANY segments. */
215
- chanx_bbox = draw_get_rr_chan_bbox (chanx_node);
216
- chany_bbox = draw_get_rr_chan_bbox (chany_node);
182
+ const t_rr_switch_inf& rr_switch_inf = rr_graph.rr_switch_inf (rr_switch_id);
217
183
218
- /* (x1,y1): point on CHANX segment, (x2,y2): point on CHANY segment. */
184
+ // Get the coordinates of the CHANX and CHANY segments.
185
+ ezgl::rectangle chanx_bbox = draw_get_rr_chan_bbox (chanx_node);
186
+ ezgl::rectangle chany_bbox = draw_get_rr_chan_bbox (chany_node);
219
187
220
- y1 = chanx_bbox.bottom ();
221
- x2 = chany_bbox.left ();
188
+ // (x1,y1): point on CHANX segment, (x2,y2): point on CHANY segment.
189
+ float y1 = chanx_bbox.bottom ();
190
+ float x2 = chany_bbox.left ();
191
+ float x1, y2;
222
192
223
- // these values xhigh/low yhigh/low mark the cordinates for the begining and ends of the wire.
224
- chanx_xlow = rr_graph.node_xlow (chanx_node);
225
- chanx_y = rr_graph.node_ylow (chanx_node);
226
- chany_x = rr_graph.node_xlow (chany_node);
227
- chany_ylow = rr_graph.node_ylow (chany_node);
193
+ // these values xhigh/low yhigh/low mark the coordinates for the beginning and ends of the wire.
194
+ int chanx_xlow = rr_graph.node_xlow (chanx_node);
195
+ int chanx_y = rr_graph.node_ylow (chanx_node);
196
+ int chany_x = rr_graph.node_xlow (chany_node);
197
+ int chany_ylow = rr_graph.node_ylow (chany_node);
228
198
229
- if (chanx_xlow <= chany_x) { /* Can draw connection going right */
230
- /* Connection not at end of the CHANX segment. */
199
+ if (chanx_xlow <= chany_x) { // Can draw connection going right
200
+ // Connection not at end of the CHANX segment.
231
201
x1 = draw_coords->tile_x [chany_x] + draw_coords->get_tile_width ();
232
- if (rr_graph.node_direction (chanx_node) != Direction::BIDIR && (e_switch_type)switch_type != e_switch_type::SHORT) {
233
- if (edge_dir == FROM_X_TO_Y) {
234
- if (rr_graph.node_direction (chanx_node) == Direction::DEC) { /* If dec wire, then going left */
202
+ if (rr_graph.node_direction (chanx_node) != Direction::BIDIR && rr_switch_inf. type () != e_switch_type::SHORT) {
203
+ if (edge_dir == e_chan_edge_dir:: FROM_X_TO_Y) {
204
+ if (rr_graph.node_direction (chanx_node) == Direction::DEC) { // If dec wire, then going left
235
205
x1 = draw_coords->tile_x [chany_x + 1 ];
236
206
}
237
207
}
238
208
}
239
- } else { /* Must draw connection going left. */
209
+ } else { // Must draw connection going left.
240
210
x1 = chanx_bbox.left ();
241
211
}
242
- if (chany_ylow <= chanx_y) { /* Can draw connection going up. */
243
- /* Connection not at end of the CHANY segment. */
212
+ if (chany_ylow <= chanx_y) { // Can draw connection going up.
213
+ // Connection not at end of the CHANY segment.
244
214
y2 = draw_coords->tile_y [chanx_y] + draw_coords->get_tile_width ();
245
215
246
- if (rr_graph.node_direction (chany_node) != Direction::BIDIR && (e_switch_type)switch_type != e_switch_type::SHORT) {
247
- if (edge_dir == FROM_Y_TO_X) {
248
- if (rr_graph.node_direction (chany_node) == Direction::DEC) { /* If dec wire, then going down */
216
+ if (rr_graph.node_direction (chany_node) != Direction::BIDIR && rr_switch_inf. type () != e_switch_type::SHORT) {
217
+ if (edge_dir == e_chan_edge_dir:: FROM_Y_TO_X) {
218
+ if (rr_graph.node_direction (chany_node) == Direction::DEC) { // If dec wire, then going down
249
219
y2 = draw_coords->tile_y [chanx_y + 1 ];
250
220
}
251
221
}
252
222
}
253
223
254
- } else { /* Must draw connection going down. */
224
+ } else { // Must draw connection going down.
255
225
y2 = chany_bbox.bottom ();
256
226
}
257
227
258
228
g->draw_line ({x1, y1}, {x2, y2});
259
229
260
- if (edge_dir == FROM_X_TO_Y) {
230
+ if (edge_dir == e_chan_edge_dir:: FROM_X_TO_Y) {
261
231
draw_rr_switch (x1, y1, x2, y2,
262
- rr_graph. rr_switch_inf ( RRSwitchId (switch_type)) .buffered (),
263
- rr_graph. rr_switch_inf ( RRSwitchId (switch_type)) .configurable (), g);
232
+ rr_switch_inf.buffered (),
233
+ rr_switch_inf.configurable (), g);
264
234
} else {
265
235
draw_rr_switch (x2, y2, x1, y1,
266
- rr_graph. rr_switch_inf ( RRSwitchId (switch_type)) .buffered (),
267
- rr_graph. rr_switch_inf ( RRSwitchId (switch_type)) .configurable (), g);
236
+ rr_switch_inf.buffered (),
237
+ rr_switch_inf.configurable (), g);
268
238
}
269
239
}
270
240
@@ -646,7 +616,7 @@ void draw_rr_edge(RRNodeId inode, RRNodeId prev_node, ezgl::color color, ezgl::r
646
616
void draw_inter_cluster_rr_edge (RRNodeId inode, RRNodeId prev_node, e_rr_type rr_type, e_rr_type prev_type, ezgl::renderer* g) {
647
617
const RRGraphView& rr_graph = g_vpr_ctx.device ().rr_graph ;
648
618
t_edge_size iedge = find_edge (prev_node, inode);
649
- short switch_type = rr_graph.edge_switch (prev_node, iedge);
619
+ RRSwitchId rr_switch_id = (RRSwitchId) rr_graph.edge_switch (prev_node, iedge);
650
620
651
621
switch (rr_type) {
652
622
case e_rr_type::IPIN:
@@ -660,11 +630,11 @@ void draw_inter_cluster_rr_edge(RRNodeId inode, RRNodeId prev_node, e_rr_type rr
660
630
case e_rr_type::CHANX:
661
631
switch (prev_type) {
662
632
case e_rr_type::CHANX:
663
- draw_chanx_to_chanx_edge (prev_node, inode, switch_type , g);
633
+ draw_chanx_to_chanx_edge (prev_node, inode, rr_switch_id , g);
664
634
break ;
665
635
666
636
case e_rr_type::CHANY:
667
- draw_chanx_to_chany_edge (inode, prev_node, FROM_Y_TO_X, switch_type , g);
637
+ draw_chanx_to_chany_edge (inode, prev_node, e_chan_edge_dir:: FROM_Y_TO_X, rr_switch_id , g);
668
638
break ;
669
639
670
640
case e_rr_type::OPIN:
@@ -682,13 +652,11 @@ void draw_inter_cluster_rr_edge(RRNodeId inode, RRNodeId prev_node, e_rr_type rr
682
652
case e_rr_type::CHANY:
683
653
switch (prev_type) {
684
654
case e_rr_type::CHANX:
685
- draw_chanx_to_chany_edge (prev_node, inode,
686
- FROM_X_TO_Y, switch_type, g);
655
+ draw_chanx_to_chany_edge (prev_node, inode, e_chan_edge_dir::FROM_X_TO_Y, rr_switch_id, g);
687
656
break ;
688
657
689
658
case e_rr_type::CHANY:
690
- draw_chany_to_chany_edge (prev_node, inode,
691
- switch_type, g);
659
+ draw_chany_to_chany_edge (prev_node, inode, rr_switch_id, g);
692
660
break ;
693
661
694
662
case e_rr_type::OPIN:
0 commit comments