Skip to content

Commit fc5e3d6

Browse files
author
Umar Iqbal
committed
Data type conversion from std to vtr has been done in alloc_and_load_rr_indexed_data() and RRSegmentId has been added in API's where needed
1 parent c828072 commit fc5e3d6

6 files changed

+17
-6
lines changed

vpr/src/device/rr_graph_view.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ class RRGraphView {
259259
return node_lookup_;
260260
}
261261

262+
/** @brief Return detailed routing segment information with a given id
263+
* @note The routing segments here may not be exactly same as those defined in architecture file. They have been adapted to fit the context of routing resource graphs.
264+
*/
265+
262266
inline const t_segment_inf& rr_segments(RRSegmentId seg_id) const {
263267
return rr_segments_[seg_id];
264268
}

vpr/src/route/rr_graph.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,10 @@ static void build_rr_graph(const t_graph_type graph_type,
449449
//device_ctx.rr_segments = segment_inf;
450450
size_t num_segments = segment_inf.size();
451451
device_ctx.rr_segments.reserve(num_segments);
452+
for (int iseg = 0; iseg <num_segments; ++iseg) {
453+
device_ctx.rr_segments.push_back(segment_inf[iseg]);
454+
}
455+
452456
int num_seg_details = 0;
453457
t_seg_details* seg_details = nullptr;
454458

vpr/src/route/rr_graph_indexed_data.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static void print_rr_index_info(const char* fname, const std::vector<t_segment_i
5353
* etc. more expensive than others. I give each segment type in an *
5454
* x-channel its own cost_index, and each segment type in a y-channel its *
5555
* own cost_index. */
56-
void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_inf,
56+
void alloc_and_load_rr_indexed_data(const vtr::vector<RRSegmentId, t_segment_inf>& segment_inf,
5757
int wire_to_ipin_switch,
5858
enum e_base_cost_type base_cost_type) {
5959
int iseg, length, i, index;

vpr/src/route/rr_graph_indexed_data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define RR_GRAPH_INDEXED_DATA_H
33
#include "physical_types.h"
44

5-
void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_inf,
5+
void alloc_and_load_rr_indexed_data(const vtr::vector<RRSegmentId, t_segment_inf>& segment_inf,
66
int wire_to_ipin_switch,
77
enum e_base_cost_type base_cost_type);
88

vpr/src/route/rr_graph_reader.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ void load_rr_file(const t_graph_type graph_type,
5050
//device_ctx.rr_segments = segment_inf;
5151
size_t num_segments = segment_inf.size();
5252
device_ctx.rr_segments.reserve(num_segments);
53+
for (int iseg = 0; iseg < num_segments; ++iseg) {
54+
device_ctx.rr_segments.push_back(segment_inf[iseg]);
55+
}
5356
RrGraphSerializer reader(
5457
graph_type,
5558
base_cost_type,

vpr/src/route/rr_graph_uxsdcxx_serializer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
11501150
* </xs:complexType>
11511151
*/
11521152
inline int get_segment_id(const t_segment_inf*& segment) final {
1153-
return segment - &segment_inf_.at(0);
1153+
return segment - &segment_inf_.at(RRSegmentId(0));
11541154
}
11551155
inline const char* get_segment_name(const t_segment_inf*& segment) final {
11561156
return segment->name.c_str();
@@ -1178,14 +1178,14 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
11781178
}
11791179
}
11801180
inline const t_segment_inf* add_segments_segment(void*& /*ctx*/, int id) final {
1181-
return &segment_inf_.at(id);
1181+
return &segment_inf_.at(RRSegmentId(id));
11821182
}
11831183
inline void finish_segments_segment(const t_segment_inf*& /*iter*/) final {}
11841184
inline size_t num_segments_segment(void*& /*iter*/) final {
11851185
return segment_inf_.size();
11861186
}
11871187
inline const t_segment_inf* get_segments_segment(int n, void*& /*ctx*/) final {
1188-
return &segment_inf_.at(n);
1188+
return &segment_inf_.at(RRSegmentId(n));
11891189
}
11901190

11911191
inline void* init_rr_graph_segments(void*& /*ctx*/) final {
@@ -1871,7 +1871,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
18711871

18721872
const size_t num_arch_switches_;
18731873
const t_arch_switch_inf* arch_switch_inf_;
1874-
const std::vector<t_segment_inf>& segment_inf_;
1874+
const vtr::vector<RRSegmentId,t_segment_inf>& segment_inf_;
18751875
const std::vector<t_physical_tile_type>& physical_tile_types_;
18761876
const DeviceGrid& grid_;
18771877
MetadataStorage<int>* rr_node_metadata_;

0 commit comments

Comments
 (0)