Skip to content

Commit 9a12593

Browse files
doxygen comments for some function in rr_graph_opin_chan_edges
1 parent d7b67ea commit 9a12593

File tree

1 file changed

+37
-33
lines changed

1 file changed

+37
-33
lines changed

vpr/src/route/rr_graph_generation/rr_graph_opin_chan_edges.cpp

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ static void build_unidir_rr_opins(RRGraphBuilder& rr_graph_builder,
5050
const std::vector<t_clb_to_clb_directs>& clb_to_clb_directs,
5151
int num_seg_types,
5252
int& edge_count);
53-
53+
/**
54+
* @brief Builds bidirectional OPIN-->CHAN edges for a given CLB output pin.
55+
*
56+
* Finds all routing tracks that the OPIN at (i, j, layer, ipin) connects to
57+
* based on the pin-to-track mapping and channel details, and appends the
58+
* corresponding RR edges to @p rr_edges_to_create.
59+
*/
5460
static int get_bidir_opin_connections(RRGraphBuilder& rr_graph_builder,
5561
int layer,
5662
int i,
@@ -62,6 +68,12 @@ static int get_bidir_opin_connections(RRGraphBuilder& rr_graph_builder,
6268
const t_chan_details& chan_details_x,
6369
const t_chan_details& chan_details_y);
6470

71+
/**
72+
* @brief Creates unidirectional OPIN-->CHAN edges for a given segment type.
73+
*
74+
* Connects an OPIN node to nearby routing tracks (INC/DEC muxes) based on Fc.
75+
* Uses @p Fc_ofs to stagger connections and may clip Fc if not enough muxes exist
76+
*/
6577
static int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
6678
int layer,
6779
int chan,
@@ -77,6 +89,13 @@ static int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
7789
const t_chan_width& nodes_per_chan,
7890
bool* Fc_clipped);
7991

92+
/**
93+
* @brief Adds direct CLB-to-CLB OPIN-->IPIN connections for a given OPIN.
94+
*
95+
* Finds and creates all direct pin-to-pin edges (bypassing routing channels)
96+
* from the OPIN at (layer, x, y, side) to corresponding IPINs defined by
97+
* architecture-specified direct connections.
98+
*/
8099
static int get_opin_direct_connections(RRGraphBuilder& rr_graph_builder,
81100
const RRGraphView& rr_graph,
82101
int layer,
@@ -270,8 +289,6 @@ static void build_unidir_rr_opins(RRGraphBuilder& rr_graph_builder,
270289
}
271290
}
272291

273-
/* Returns the number of tracks to which clb opin #ipin at (i,j) connects. *
274-
* Also stores the nodes to which this pin connects in rr_edges_to_create */
275292
int get_bidir_opin_connections(RRGraphBuilder& rr_graph_builder,
276293
int layer,
277294
int i,
@@ -352,12 +369,6 @@ int get_bidir_opin_connections(RRGraphBuilder& rr_graph_builder,
352369
return num_conn;
353370
}
354371

355-
/* Actually builds the edges from the OPIN nodes already allocated to their correct tracks for segment seg_Inf[seg_type_index].
356-
* Note that this seg_inf vector is NOT the segment_info vectored as stored in the device variable. This index is w.r.t to seg_inf_x
357-
* or seg_inf_y for x-adjacent and y-adjacent segments respectively. This index is assigned in get_seg_details earlier
358-
* in the rr_graph_builder routine. This t_seg_detail is then used to build t_chan_seg_details which is passed in to label_wire mux
359-
* routine used in this function.
360-
*/
361372
int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
362373
int layer,
363374
int chan,
@@ -372,9 +383,6 @@ int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
372383
int max_len,
373384
const t_chan_width& nodes_per_chan,
374385
bool* Fc_clipped) {
375-
/* Gets a linked list of Fc nodes of specified seg_type_index to connect
376-
* to in given chan seg. Fc_ofs is used for the opin staggering pattern. */
377-
378386
*Fc_clipped = false;
379387

380388
// Fc is assigned in pairs so check it is even.
@@ -398,7 +406,7 @@ int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
398406
Direction::DEC, max_chan_width, true, dec_muxes, &num_dec_muxes, &dummy);
399407

400408
// Clip Fc to the number of muxes.
401-
if (((Fc / 2) > num_inc_muxes) || ((Fc / 2) > num_dec_muxes)) {
409+
if ((Fc / 2 > num_inc_muxes) || (Fc / 2 > num_dec_muxes)) {
402410
*Fc_clipped = true;
403411
Fc = 2 * std::min(num_inc_muxes, num_dec_muxes);
404412
}
@@ -436,10 +444,6 @@ int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
436444
return num_edges;
437445
}
438446

439-
/* Add all direct clb-pin-to-clb-pin edges to given opin
440-
*
441-
* The current opin is located at (layer,x,y) along the specified side
442-
*/
443447
static int get_opin_direct_connections(RRGraphBuilder& rr_graph_builder,
444448
const RRGraphView& rr_graph,
445449
int layer,
@@ -451,7 +455,7 @@ static int get_opin_direct_connections(RRGraphBuilder& rr_graph_builder,
451455
t_rr_edge_info_set& rr_edges_to_create,
452456
const std::vector<t_direct_inf>& directs,
453457
const std::vector<t_clb_to_clb_directs>& clb_to_clb_directs) {
454-
auto& device_ctx = g_vpr_ctx.device();
458+
const DeviceContext& device_ctx = g_vpr_ctx.device();
455459

456460
t_physical_tile_type_ptr curr_type = device_ctx.grid.get_physical_type({x, y, layer});
457461

@@ -463,7 +467,7 @@ static int get_opin_direct_connections(RRGraphBuilder& rr_graph_builder,
463467
return num_pins; //No source pin on this side
464468
}
465469

466-
//Capacity location determined by pin number relative to pins per capacity instance
470+
// Capacity location determined by pin number relative to pins per capacity instance
467471
auto [z, relative_opin] = get_capacity_location_from_physical_pin(curr_type, opin);
468472
VTR_ASSERT(z >= 0 && z < curr_type->capacity);
469473
const int num_directs = directs.size();
@@ -546,14 +550,14 @@ static int get_opin_direct_connections(RRGraphBuilder& rr_graph_builder,
546550
int final_ipin_y = y + directs[i].y_offset - target_height_offset + target_type->pin_height_offset[ipin];
547551

548552
if (directs[i].to_side != NUM_2D_SIDES) {
549-
//Explicit side specified, only create if pin exists on that side
553+
// Explicit side specified, only create if pin exists on that side
550554
RRNodeId inode = rr_graph_builder.node_lookup().find_node(layer, final_ipin_x, final_ipin_y,
551555
e_rr_type::IPIN, ipin, directs[i].to_side);
552556
if (inode) {
553557
inodes.push_back(inode);
554558
}
555559
} else {
556-
//No side specified, get all candidates
560+
// No side specified, get all candidates
557561
inodes = rr_graph_builder.node_lookup().find_nodes_at_all_sides(layer, final_ipin_x, final_ipin_y, e_rr_type::IPIN, ipin);
558562
}
559563

@@ -578,14 +582,14 @@ static int get_opin_direct_connections(RRGraphBuilder& rr_graph_builder,
578582
static RRNodeId pick_best_direct_connect_target_rr_node(const RRGraphView& rr_graph,
579583
RRNodeId from_rr,
580584
const std::vector<RRNodeId>& candidate_rr_nodes) {
581-
//With physically equivalent pins there may be multiple candidate rr nodes (which are equivalent)
582-
//to connect the direct edge to.
583-
//As a result it does not matter (from a correctness standpoint) which is picked.
585+
// With physically equivalent pins there may be multiple candidate rr nodes (which are equivalent)
586+
// to connect the direct edge to.
587+
// As a result it does not matter (from a correctness standpoint) which is picked.
584588
//
585-
//However intuitively we would expect (e.g. when visualizing the drawn RR graph) that the 'closest'
586-
//candidate would be picked (i.e. to minimize the drawn edge length).
589+
// However intuitively we would expect (e.g. when visualizing the drawn RR graph) that the 'closest'
590+
// candidate would be picked (i.e. to minimize the drawn edge length).
587591
//
588-
//This function attempts to pick the 'best/closest' of the candidates.
592+
// This function attempts to pick the 'best/closest' of the candidates.
589593
VTR_ASSERT(rr_graph.node_type(from_rr) == e_rr_type::OPIN);
590594

591595
float best_dist = std::numeric_limits<float>::infinity();
@@ -603,26 +607,26 @@ static RRNodeId pick_best_direct_connect_target_rr_node(const RRGraphView& rr_gr
603607
+ std::abs(rr_graph.node_ylow(from_rr) - rr_graph.node_ylow(to_rr));
604608

605609
for (const e_side& to_side : TOTAL_2D_SIDES) {
606-
/* Bypass those side where the node does not appear */
610+
// Bypass those side where the node does not appear
607611
if (!rr_graph.is_node_on_specific_side(to_rr, to_side)) {
608612
continue;
609613
}
610614

611-
//Include a partial unit of distance based on side alignment to ensure
612-
//we prefer facing sides
615+
// Include a partial unit of distance based on side alignment to ensure
616+
// we prefer facing sides
613617
if ((from_side == RIGHT && to_side == LEFT)
614618
|| (from_side == LEFT && to_side == RIGHT)
615619
|| (from_side == TOP && to_side == BOTTOM)
616620
|| (from_side == BOTTOM && to_side == TOP)) {
617-
//Facing sides
621+
// Facing sides
618622
to_dist += 0.25;
619623
} else if (((from_side == RIGHT || from_side == LEFT) && (to_side == TOP || to_side == BOTTOM))
620624
|| ((from_side == TOP || from_side == BOTTOM) && (to_side == RIGHT || to_side == LEFT))) {
621-
//Perpendicular sides
625+
// Perpendicular sides
622626
to_dist += 0.5;
623627

624628
} else {
625-
//Opposite sides
629+
// Opposite sides
626630
to_dist += 0.75;
627631
}
628632

0 commit comments

Comments
 (0)