@@ -382,7 +382,12 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
382
382
side_map_[(1 << TOP) | (1 << RIGHT) | (1 << BOTTOM) | (1 << LEFT)] = uxsd::enum_loc_side::TOP_RIGHT_BOTTOM_LEFT;
383
383
}
384
384
385
+ /* *
386
+ * @brief This function separates the segments in segment_inf_ based on whether their parallel axis
387
+ * is X or Y, and it stores them in segment_inf_x_ and segment_inf_y_.
388
+ */
385
389
void init_segment_inf_x_y (){
390
+
386
391
/* Create a temp copy to convert from vtr::vector to std::vector
387
392
* This is required because the ``alloc_and_load_rr_indexed_data()`` function supports only std::vector data
388
393
* type for ``rr_segments``
@@ -401,7 +406,14 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
401
406
402
407
}
403
408
404
- int find_segment_index_along_axis (int seg_index, e_parallel_axis axis) const {
409
+ /* *
410
+ * @brief Search for a segment with a matching segment ID and return its position index
411
+ * in the list of segments along the corresponding axis (X or Y).
412
+ * @param segment_id The ID of the segment to search for.
413
+ * @param axis The axis along which to search for the segment (X or Y).
414
+ * @return int The position index of the matching segment.
415
+ */
416
+ int find_segment_index_along_axis (int segment_id, e_parallel_axis axis) const {
405
417
const std::vector<t_segment_inf>* segment_inf_vec_ptr;
406
418
407
419
if (axis == X_AXIS)
@@ -410,10 +422,16 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
410
422
segment_inf_vec_ptr = &segment_inf_y_;
411
423
412
424
for (std::vector<t_segment_inf>::size_type i=0 ; i < (*segment_inf_vec_ptr).size (); i++){
413
- if ((*segment_inf_vec_ptr)[i].seg_index == seg_index )
425
+ if ((*segment_inf_vec_ptr)[i].seg_index == segment_id )
414
426
return static_cast <int >(i);
415
427
}
416
- return 0 ;
428
+
429
+ if (axis == X_AXIS)
430
+ VTR_LOG_ERROR (" Segment ID %d not found in the list of segments along X axis.\n " , segment_id);
431
+ else
432
+ VTR_LOG_ERROR (" Segment ID %d not found in the list of segments along Y axis.\n " , segment_id);
433
+
434
+ return -1 ;
417
435
}
418
436
419
437
public:
@@ -2000,8 +2018,8 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
2000
2018
* the methods following routines:rr_graph_rr_nodes and init_node_segment according to the changes in
2001
2019
* rr_graph_indexed_data.cpp */
2002
2020
const vtr::vector<RRSegmentId, t_segment_inf>& segment_inf_;
2003
- std::vector<t_segment_inf> segment_inf_x_;
2004
- std::vector<t_segment_inf> segment_inf_y_;
2021
+ std::vector<t_segment_inf> segment_inf_x_; // [num_segs_along_x_axis-1:0] - vector of segment information for segments along the x-axis.
2022
+ std::vector<t_segment_inf> segment_inf_y_; // [num_segs_along_y_axis-1:0] - vector of segment information for segments along the y-axis.
2005
2023
const std::vector<t_physical_tile_type>& physical_tile_types_;
2006
2024
const DeviceGrid& grid_;
2007
2025
MetadataStorage<int >* rr_node_metadata_;
0 commit comments