@@ -205,7 +205,7 @@ void draw_chanx_to_chanx_edge(RRNodeId from_node, RRNodeId to_node, short switch
205
205
}
206
206
}
207
207
208
- void draw_chanx_to_chany_edge (RRNodeId chanx_node, RRNodeId chany_node, enum e_edge_dir edge_dir, short switch_type, ezgl::renderer* g) {
208
+ 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) {
209
209
t_draw_state* draw_state = get_draw_state_vars ();
210
210
t_draw_coords* draw_coords = get_draw_coords_vars ();
211
211
auto & device_ctx = g_vpr_ctx.device ();
@@ -300,44 +300,33 @@ void draw_intra_cluster_edge(RRNodeId inode, RRNodeId prev_node, ezgl::renderer*
300
300
draw_triangle_along_line (g, triangle_coord_x, triangle_coord_y, prev_coord.x , icoord.x , prev_coord.y , icoord.y );
301
301
}
302
302
303
- void draw_intra_cluster_pin_to_pin (RRNodeId inode , RRNodeId prev_node , ezgl::renderer* g) {
303
+ void draw_intra_cluster_pin_to_pin (RRNodeId intra_cluster_node , RRNodeId inter_cluster_node, e_pin_edge_dir pin_edge_dir, e_side pin_side , ezgl::renderer* g) {
304
304
t_draw_state* draw_state = get_draw_state_vars ();
305
305
t_draw_coords* draw_coords = get_draw_coords_vars ();
306
306
307
307
if (!draw_state->is_flat ) {
308
308
return ;
309
309
}
310
310
311
- const auto & rr_graph = g_vpr_ctx.device ().rr_graph ;
311
+ // determine the location of the pins
312
+ float inter_cluster_x, inter_cluster_y;
313
+ ezgl::point2d intra_cluster_coord;
312
314
313
- ezgl::point2d prev_coord, icoord;
314
- float temp_x, temp_y; // temporary variables to hold coordinates to cast into ezgl::point2d
315
-
316
- // get the location of the nodes based on whether inode is an inter-cluster or intra-cluster pin.
317
- if (!is_inter_cluster_node (rr_graph, inode)) {
315
+ draw_get_rr_pin_coords (inter_cluster_node, &inter_cluster_x, &inter_cluster_y, pin_side);
318
316
319
- auto [blk_id, pin_id] = get_rr_node_cluster_blk_id_pb_graph_pin (inode );
320
- icoord = draw_coords->get_absolute_pin_location (blk_id, pin_id);
317
+ auto [blk_id, pin_id] = get_rr_node_cluster_blk_id_pb_graph_pin (intra_cluster_node );
318
+ intra_cluster_coord = draw_coords->get_absolute_pin_location (blk_id, pin_id);
321
319
322
- for (const e_side& pin_side : TOTAL_2D_SIDES) {
323
- if (!rr_graph.is_node_on_specific_side (RRNodeId (prev_node), pin_side)) {
324
- continue ;
325
- }
326
- draw_get_rr_pin_coords (prev_node, &temp_x, &temp_y, pin_side);
327
- prev_coord = {temp_x, temp_y};
328
- }
320
+ // determine which coord is first based on the pin edge direction
321
+ ezgl::point2d prev_coord, icoord;
322
+ if (pin_edge_dir == FROM_INTRA_CLUSTER_TO_INTER_CLUSTER) {
323
+ prev_coord = intra_cluster_coord;
324
+ icoord = {inter_cluster_x, inter_cluster_y};
325
+ } else if (pin_edge_dir == FROM_INTER_CLUSTER_TO_INTRA_CLUSTER) {
326
+ prev_coord = {inter_cluster_x, inter_cluster_y};
327
+ icoord = intra_cluster_coord;
329
328
} else {
330
-
331
- auto [prev_blk_id, prev_pin_id] = get_rr_node_cluster_blk_id_pb_graph_pin (prev_node);
332
- prev_coord = draw_coords->get_absolute_pin_location (prev_blk_id, prev_pin_id);
333
-
334
- for (const e_side& pin_side : TOTAL_2D_SIDES) {
335
- if (!rr_graph.is_node_on_specific_side (RRNodeId (inode), pin_side)) {
336
- continue ;
337
- }
338
- draw_get_rr_pin_coords (inode, &temp_x, &temp_y, pin_side);
339
- icoord = {temp_x, temp_y};
340
- }
329
+ VPR_ERROR (VPR_ERROR_DRAW, " Invalid pin edge direction: %d" , pin_edge_dir);
341
330
}
342
331
343
332
g->draw_line (prev_coord, icoord);
@@ -433,14 +422,8 @@ void draw_source_to_pin(RRNodeId source_node, RRNodeId opin_node, ezgl::renderer
433
422
}
434
423
}
435
424
436
- void draw_pin_to_chan_edge (RRNodeId pin_node, RRNodeId chan_node, ezgl::renderer* g) {
437
- /* This routine draws an edge from the pin_node to the chan_node (CHANX or *
438
- * CHANY). The connection is made to the nearest end of the track instead *
439
- * of perpendicular to the track to symbolize a single-drive connection. */
440
-
441
- /* TODO: Fix this for global routing, currently for detailed only */
425
+ e_side get_pin_side (RRNodeId pin_node, RRNodeId chan_node) {
442
426
443
- t_draw_coords* draw_coords = get_draw_coords_vars ();
444
427
auto & device_ctx = g_vpr_ctx.device ();
445
428
const auto & rr_graph = device_ctx.rr_graph ;
446
429
@@ -453,7 +436,6 @@ void draw_pin_to_chan_edge(RRNodeId pin_node, RRNodeId chan_node, ezgl::renderer
453
436
int width_offset = device_ctx.grid .get_width_offset (tile_loc);
454
437
int height_offset = device_ctx.grid .get_height_offset (tile_loc);
455
438
456
- float x1 = 0 , y1 = 0 ;
457
439
/* If there is only one side, no need for the following inference!!!
458
440
* When a node may have multiple sides,
459
441
* we lack direct information about which side of the node drives the channel node
@@ -521,6 +503,30 @@ void draw_pin_to_chan_edge(RRNodeId pin_node, RRNodeId chan_node, ezgl::renderer
521
503
/* Sanity check */
522
504
VTR_ASSERT (NUM_2D_SIDES != pin_side);
523
505
506
+ return pin_side;
507
+ }
508
+
509
+ void draw_pin_to_chan_edge (RRNodeId pin_node, RRNodeId chan_node, ezgl::renderer* g) {
510
+ /* This routine draws an edge from the pin_node to the chan_node (CHANX or *
511
+ * CHANY). The connection is made to the nearest end of the track instead *
512
+ * of perpendicular to the track to symbolize a single-drive connection. */
513
+
514
+ /* TODO: Fix this for global routing, currently for detailed only */
515
+
516
+ t_draw_coords* draw_coords = get_draw_coords_vars ();
517
+ auto & device_ctx = g_vpr_ctx.device ();
518
+ const auto & rr_graph = device_ctx.rr_graph ;
519
+
520
+ t_physical_tile_loc tile_loc = {
521
+ rr_graph.node_xlow (pin_node),
522
+ rr_graph.node_ylow (pin_node),
523
+ rr_graph.node_layer (pin_node)};
524
+
525
+ const auto & grid_type = device_ctx.grid .get_physical_type (tile_loc);
526
+ const e_rr_type channel_type = rr_graph.node_type (chan_node);
527
+ e_side pin_side = get_pin_side (pin_node, chan_node);
528
+
529
+ float x1 = 0 , y1 = 0 ;
524
530
/* Now we determine which side to be used, calculate the offset for the pin to be drawn
525
531
* - For the pin locates above/right to the grid (at the top/right side),
526
532
* a positive offset (+ve) is required
0 commit comments