Skip to content

Commit e73a845

Browse files
author
Umar Iqbal
committed
strong Ids has been added
1 parent 89885eb commit e73a845

9 files changed

+18
-15
lines changed

vpr/src/base/vpr_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ struct DeviceContext : public Context {
174174
std::vector<t_rr_switch_inf> rr_switch_inf;
175175

176176
///@brief Wire segment types in RR graph
177-
std::vector<t_segment_inf> rr_segments;
177+
vtr::vector<RRSegmentId, t_segment_inf> rr_segments;
178178

179179
int num_arch_switches;
180180
t_arch_switch_inf* arch_switch_inf; // [0..(num_arch_switches-1)]

vpr/src/device/rr_graph_view.cpp

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

5-
RRGraphView::RRGraphView(const t_rr_graph_storage& node_storage, const RRSpatialLookup& node_lookup, const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data, const std::vector<t_segment_inf>& rr_segments)
5+
RRGraphView::RRGraphView(const t_rr_graph_storage& node_storage, const RRSpatialLookup& node_lookup, const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data, const vtr::vector<RRSegmentId, t_segment_inf>& rr_segments)
66
: node_storage_(node_storage)
77
, node_lookup_(node_lookup)
88
, rr_indexed_data_(rr_indexed_data)

vpr/src/device/rr_graph_view.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class RRGraphView {
3838
RRGraphView(const t_rr_graph_storage& node_storage,
3939
const RRSpatialLookup& node_lookup,
4040
const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data,
41-
const std::vector<t_segment_inf>& rr_segments);
41+
const vtr::vector<RRSegmentId, t_segment_inf>& rr_segments);
4242

4343
/* Disable copy constructors and copy assignment operator
4444
* This is to avoid accidental copy because it could be an expensive operation considering that the
@@ -209,7 +209,7 @@ class RRGraphView {
209209
if (node_type(node) == CHANX || node_type(node) == CHANY) { //for channels, we would like to describe the component with segment specific information
210210
RRIndexedDataId cost_index = node_cost_index(node);
211211
int seg_index = rr_indexed_data_[cost_index].seg_index;
212-
coordinate_string += rr_segments_[seg_index].name; //Write the segment name
212+
coordinate_string += rr_segments(RRSegmentId(seg_index)).name; //Write the segment name
213213
coordinate_string += " length:" + std::to_string(node_length(node)); //add the length of the segment
214214
//Figure out the starting and ending coordinate of the segment depending on the direction
215215

@@ -259,7 +259,7 @@ class RRGraphView {
259259
return node_lookup_;
260260
}
261261

262-
inline const t_segment_inf& rr_segments(int seg_id) const {
262+
inline const t_segment_inf& rr_segments(RRSegmentId seg_id) const {
263263
return rr_segments_[seg_id];
264264
}
265265

@@ -275,7 +275,7 @@ class RRGraphView {
275275
const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data_;
276276

277277
/* Segment info for rr nodes */
278-
const std::vector<t_segment_inf>& rr_segments_;
278+
const vtr::vector<RRSegmentId, t_segment_inf>& rr_segments_;
279279
};
280280

281281
#endif

vpr/src/power/power.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ static void power_usage_routing(t_power_usage* power_usage,
912912
wire_length = rr_graph.node_yhigh(rr_node) - rr_graph.node_ylow(rr_node) + 1;
913913
}
914914
int seg_index = device_ctx.rr_indexed_data[rr_graph.node_cost_index(rr_node)].seg_index;
915-
C_wire = wire_length * rr_graph.rr_segments(seg_index).Cmetal;
915+
C_wire = wire_length * rr_graph.rr_segments(RRSegmentId(seg_index)).Cmetal;
916916
//(double)power_ctx.commonly_used->tile_length);
917917
VTR_ASSERT(node_power->selected_input < node_fan_in);
918918

vpr/src/power/power_sizing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,12 @@ static double power_count_transistors_switchbox() {
386386
* The (x2) factor accounts for vertical and horizontal tracks.
387387
* Of the wires of each segment type only (1/seglength) will have a mux&buffer.
388388
*/
389-
float freq_frac = (float)rr_graph.rr_segments(seg_idx).frequency
389+
float freq_frac = (float)rr_graph.rr_segments(RRSegmentId(seg_idx)).frequency
390390
/ (float)MAX_CHANNEL_WIDTH;
391391

392392
transistor_cnt += transistors_per_buf_mux * 2 * freq_frac
393393
* power_ctx.solution_inf.channel_width
394-
* (1 / (float)rr_graph.rr_segments(seg_idx).length);
394+
* (1 / (float)rr_graph.rr_segments(RRSegmentId(seg_idx)).length);
395395
}
396396

397397
return transistor_cnt;

vpr/src/route/router_lookahead_extended_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ std::pair<float, float> ExtendedMapLookahead::get_expected_delay_and_cong(RRNode
229229
float expected_cost = expected_delay_cost + expected_cong_cost;
230230

231231
VTR_LOGV_DEBUG(f_router_debug, "Requested lookahead from node %d to %d\n", size_t(from_node), size_t(to_node));
232-
const std::string& segment_name = rr_graph.rr_segments(from_seg_index).name;
232+
const std::string& segment_name = rr_graph.rr_segments(RRSegmentId(from_seg_index)).name;
233233
VTR_LOGV_DEBUG(f_router_debug, "Lookahead returned %s (%d) with distance (%d, %d)\n",
234234
segment_name.c_str(), from_seg_index,
235235
dx, dy);

vpr/src/route/rr_graph.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,9 @@ static void build_rr_graph(const t_graph_type graph_type,
446446
}
447447

448448
/* START SEG_DETAILS */
449-
device_ctx.rr_segments = segment_inf;
449+
//device_ctx.rr_segments = segment_inf;
450+
size_t num_segments = segment_inf.size();
451+
device_ctx.rr_segments.reserve(num_segments);
450452
int num_seg_details = 0;
451453
t_seg_details* seg_details = nullptr;
452454

@@ -2444,7 +2446,7 @@ std::string describe_rr_node(int inode) {
24442446
if (seg_index < (int)device_ctx.rr_segments.size()) {
24452447
msg += vtr::string_fmt(" track: %d longline: %d",
24462448
rr_node.track_num(),
2447-
rr_graph.rr_segments(seg_index).longline);
2449+
rr_graph.rr_segments(RRSegmentId(seg_index)).longline);
24482450
} else {
24492451
msg += vtr::string_fmt(" track: %d seg_type: ILLEGAL_SEG_INDEX %d",
24502452
rr_node.track_num(),

vpr/src/route/rr_graph_reader.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ void load_rr_file(const t_graph_type graph_type,
4747

4848
auto& device_ctx = g_vpr_ctx.mutable_device();
4949

50-
device_ctx.rr_segments = segment_inf;
51-
50+
//device_ctx.rr_segments = segment_inf;
51+
size_t num_segments = segment_inf.size();
52+
device_ctx.rr_segments.reserve(num_segments);
5253
RrGraphSerializer reader(
5354
graph_type,
5455
base_cost_type,

vpr/src/util/vpr_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ std::string rr_node_arch_name(int inode) {
219219
auto cost_index = rr_graph.node_cost_index(RRNodeId(inode));
220220
int seg_index = device_ctx.rr_indexed_data[cost_index].seg_index;
221221

222-
rr_node_arch_name += rr_graph.rr_segments(seg_index).name;
222+
rr_node_arch_name += rr_graph.rr_segments(RRSegmentId(seg_index)).name;
223223
}
224224

225225
return rr_node_arch_name;

0 commit comments

Comments
 (0)