Skip to content

Commit b4f3e75

Browse files
address remaining PR comments on auto and commenting
1 parent 61c8885 commit b4f3e75

File tree

7 files changed

+21
-20
lines changed

7 files changed

+21
-20
lines changed

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static void process_clock_routing(pugi::xml_node parent,
345345
const std::vector<t_arch_switch_inf>& switches,
346346
pugiutil::loc_data& loc_data);
347347

348-
static std::vector<t_segment_inf> process_segments(pugi::xml_node Parent,
348+
static std::vector<t_segment_inf> process_segments(pugi::xml_node parent,
349349
const std::vector<t_arch_switch_inf>& switches,
350350
int num_layers,
351351
const bool timing_enabled,
@@ -3804,7 +3804,7 @@ static void process_complex_blocks(pugi::xml_node Node,
38043804
}
38053805
}
38063806

3807-
static std::vector<t_segment_inf> process_segments(pugi::xml_node Parent,
3807+
static std::vector<t_segment_inf> process_segments(pugi::xml_node parent,
38083808
const std::vector<t_arch_switch_inf>& switches,
38093809
int num_layers,
38103810
const bool timing_enabled,
@@ -3817,16 +3817,16 @@ static std::vector<t_segment_inf> process_segments(pugi::xml_node Parent,
38173817
pugi::xml_node SubElem;
38183818
pugi::xml_node Node;
38193819

3820-
// Count the number of segs and check they are in fact of segment elements.
3821-
int num_segs = count_children(Parent, "segment", loc_data);
3820+
// Count the number of segs specified in the architecture file.
3821+
int num_segs = count_children(parent, "segment", loc_data);
38223822

38233823
// Alloc segment list
38243824
if (num_segs > 0) {
38253825
Segs.resize(num_segs);
38263826
}
38273827

38283828
// Load the segments.
3829-
Node = get_first_child(Parent, "segment", loc_data);
3829+
Node = get_first_child(parent, "segment", loc_data);
38303830

38313831
bool x_axis_seg_found = false; // Flags to see if we have any x-directed segment type specified
38323832
bool y_axis_seg_found = false; // Flags to see if we have any y-directed segment type specified

libs/librrgraph/src/base/check_rr_graph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ void check_rr_node(const RRGraphView& rr_graph,
348348
int ylow = rr_graph.node_ylow(rr_node);
349349
int yhigh = rr_graph.node_yhigh(rr_node);
350350
int layer_low = rr_graph.node_layer_low(rr_node);
351-
int layer_high = rr_graph.node_layer_low(rr_node);
351+
int layer_high = rr_graph.node_layer_high(rr_node);
352352
int ptc_num = rr_graph.node_ptc_num(rr_node);
353353
int capacity = rr_graph.node_capacity(rr_node);
354354
RRIndexedDataId cost_index = rr_graph.node_cost_index(rr_node);

libs/librrgraph/src/base/get_parallel_segs.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ std::vector<t_segment_inf> get_parallel_segs(const std::vector<t_segment_inf>& s
77
std::vector<t_segment_inf> result;
88
for (size_t i = 0; i < segment_inf.size(); ++i) {
99
e_parallel_axis seg_axis = segment_inf[i].parallel_axis;
10+
11+
// Keep this segment if:
12+
// 1. Its axis exactly matches the requested parallel_axis, OR
13+
// 2. The requested axis is X or Y (not Z), and the segment is marked BOTH_AXIS.
1014
if (seg_axis == parallel_axis
1115
|| (parallel_axis != e_parallel_axis::Z_AXIS && seg_axis == e_parallel_axis::BOTH_AXIS)) {
1216
result.push_back(segment_inf[i]);

libs/librrgraph/src/base/get_parallel_segs.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#include "physical_types.h"
55

66
/**
7-
* @brief Returns segments aligned with a given axis, including BOTH_AXIS segments.
7+
* @brief Filters segments aligned with a given axis and records index mappings.
88
*
9-
* Filters the unified segment list (`segment_inf`) to include only segments matching
10-
* the specified `parallel_axis` or marked as `BOTH_AXIS`. Also populates `seg_index_map`
11-
* to map unified indices to axis-specific ones.
9+
* Iterates through the unified segment list (`segment_inf`) and selects segments
10+
* whose `parallel_axis` matches the requested `parallel_axis`. If the requested
11+
* axis is not `Z_AXIS`, segments marked as `BOTH_AXIS` are also included.
1212
*
1313
* @param segment_inf Unified list of all segments.
1414
* @param seg_index_map Map from unified to axis-specific segment indices.

libs/librrgraph/src/base/rr_graph_utils.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void rr_set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_buil
154154
for (size_t node = 0; node < rr_graph.num_nodes(); ++node) {
155155
auto node_id = RRNodeId(node);
156156

157-
if (rr_graph.node_type((RRNodeId)node_id) != e_rr_type::SINK) {
157+
if (rr_graph.node_type(node_id) != e_rr_type::SINK) {
158158
continue;
159159
}
160160

@@ -170,10 +170,7 @@ void rr_set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_buil
170170
}
171171

172172
const int node_layer = rr_graph.node_layer_low(node_id);
173-
// Only CHANZ nodes spand across multiple layers. We're processing SINK nodes
174-
if (node_layer != rr_graph.node_layer_high(node_id)) {
175-
continue;
176-
}
173+
VTR_ASSERT(node_layer == rr_graph.node_layer_high(node_id));
177174

178175
int node_ptc = rr_graph.node_ptc_num(node_id);
179176

libs/librrgraph/src/base/rr_graph_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ class RRGraphView {
416416
else { // signal travels in increasing direction, stays at same point, or can travel both directions
417417
start_x = " (" + std::to_string(node_xlow(node)) + ","; //start coordinates have smaller value
418418
start_y = std::to_string(node_ylow(node)) + ",";
419-
start_layer_str = std::to_string(node_layer_high(node)) + ")";
419+
start_layer_str = std::to_string(node_layer_low(node)) + ")";
420420
end_x = " (" + std::to_string(node_xhigh(node)) + ","; //end coordinates have larger value
421421
end_y = std::to_string(node_yhigh(node)) + ",";
422422
end_layer_str = std::to_string(node_layer_high(node)) + ")"; //layer number

libs/librrgraph/src/io/rr_graph_uxsdcxx_serializer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
431431
segment_inf_vec_ptr = &segment_inf_z_;
432432
}
433433

434-
for(std::vector<t_segment_inf>::size_type i=0; i < segment_inf_vec_ptr->size(); i++){
435-
if((*segment_inf_vec_ptr)[i].seg_index == segment_id)
434+
for (size_t i = 0; i < segment_inf_vec_ptr->size(); i++){
435+
if ((*segment_inf_vec_ptr)[i].seg_index == segment_id)
436436
return static_cast<int>(i);
437437
}
438438

@@ -741,7 +741,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
741741
}
742742

743743
inline void set_node_loc_layer_low(int layer_num, int& inode) final {
744-
auto node = (*rr_nodes_)[inode];
744+
const t_rr_node& node = (*rr_nodes_)[inode];
745745
RRNodeId node_id = node.id();
746746

747747
// Currently, we only support two layers
@@ -750,7 +750,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
750750
}
751751

752752
inline void set_node_loc_layer_high(int layer_num, int& inode) final {
753-
auto node = (*rr_nodes_)[inode];
753+
const t_rr_node& node = (*rr_nodes_)[inode];
754754
RRNodeId node_id = node.id();
755755

756756
// Currently, we only support two layers

0 commit comments

Comments
 (0)