Skip to content

Commit 36dacfa

Browse files
typos and references
1 parent c9fcf98 commit 36dacfa

File tree

10 files changed

+57
-55
lines changed

10 files changed

+57
-55
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,8 +1558,8 @@ enum e_Fc_type {
15581558
* seg_index: The index of the segment as stored in the appropriate Segs list*
15591559
* Upon loading the architecture, we use this field to keep track *
15601560
* the segment's index in the unified segment_inf vector. This is *
1561-
* usefull when building the rr_graph for different Y & X channels*
1562-
* interms of track distribution and segment type. *
1561+
* useful when building the rr_graph for different Y & X channels *
1562+
* in terms of track distribution and segment type. *
15631563
* meta: Table storing extra arbitrary metadata attributes. */
15641564
struct t_segment_inf {
15651565
std::string name;

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ class t_chan_seg_details {
16821682

16831683
private:
16841684
//The only unique information about a channel segment is it's start/end
1685-
//and length. All other information is shared accross segment types,
1685+
//and length. All other information is shared across segment types,
16861686
//so we use a flyweight to the t_seg_details which defines that info.
16871687
//
16881688
//To preserve the illusion of uniqueness we wrap all t_seg_details members

vpr/src/place/timing_place_lookup.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ std::unique_ptr<PlaceDelayModel> compute_place_delay_model(const t_placer_opts&
195195
router_opts.read_router_lookahead,
196196
segment_inf,
197197
is_flat);
198+
198199
RouterDelayProfiler route_profiler(net_list, router_lookahead, is_flat);
199200

200201
int longest_length = get_longest_segment_length(segment_inf);

vpr/src/route/router_delay_profiling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ vtr::vector<RRNodeId, float> calculate_all_path_delays_from_rr_node(RRNodeId src
243243
return path_delays_to;
244244
}
245245

246-
void alloc_routing_structs(t_chan_width chan_width,
246+
void alloc_routing_structs(const t_chan_width& chan_width,
247247
const t_router_opts& router_opts,
248248
t_det_routing_arch* det_routing_arch,
249249
std::vector<t_segment_inf>& segment_inf,

vpr/src/route/router_delay_profiling.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ vtr::vector<RRNodeId, float> calculate_all_path_delays_from_rr_node(RRNodeId src
5454
const t_router_opts& router_opts,
5555
bool is_flat);
5656

57-
void alloc_routing_structs(t_chan_width chan_width,
57+
void alloc_routing_structs(const t_chan_width& chan_width,
5858
const t_router_opts& router_opts,
5959
t_det_routing_arch* det_routing_arch,
6060
std::vector<t_segment_inf>& segment_inf,

vpr/src/route/router_lookahead.cpp

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@
77
#include "vpr_error.h"
88
#include "globals.h"
99

10-
static int get_expected_segs_to_target(RRNodeId inode, RRNodeId target_node, int* num_segs_ortho_dir_ptr);
10+
/**
11+
* Assuming inode is CHANX or CHANY, this function calculates the number of required wires of the same type as inode
12+
* to arrive at target_noe.
13+
* @param inode The source node from which the cost to the target node is obtained.
14+
* @param target_node The target node to which the cost is obtained.
15+
* @return std::pait<int, int> The first element is the number of required wires in the same direction as inode,
16+
* while the second element determines the number of wires in the direction orthogonal to inode.
17+
*/
18+
static std::pair<int, int> get_expected_segs_to_target(RRNodeId inode, RRNodeId target_node);
19+
1120
static int round_up(float x);
1221

1322
static std::unique_ptr<RouterLookahead> make_router_lookahead_object(const t_det_routing_arch& det_routing_arch,
@@ -31,8 +40,8 @@ static std::unique_ptr<RouterLookahead> make_router_lookahead_object(const t_det
3140

3241
std::unique_ptr<RouterLookahead> make_router_lookahead(const t_det_routing_arch& det_routing_arch,
3342
e_router_lookahead router_lookahead_type,
34-
std::string write_lookahead,
35-
std::string read_lookahead,
43+
const std::string& write_lookahead,
44+
const std::string& read_lookahead,
3645
const std::vector<t_segment_inf>& segment_inf,
3746
bool is_flat) {
3847
std::unique_ptr<RouterLookahead> router_lookahead = make_router_lookahead_object(det_routing_arch,
@@ -53,8 +62,7 @@ std::unique_ptr<RouterLookahead> make_router_lookahead(const t_det_routing_arch&
5362
}
5463

5564
float ClassicLookahead::get_expected_cost(RRNodeId current_node, RRNodeId target_node, const t_conn_cost_params& params, float R_upstream) const {
56-
float delay_cost, cong_cost;
57-
std::tie(delay_cost, cong_cost) = get_expected_delay_and_cong(current_node, target_node, params, R_upstream);
65+
auto [delay_cost, cong_cost] = get_expected_delay_and_cong(current_node, target_node, params, R_upstream);
5866

5967
return delay_cost + cong_cost;
6068
}
@@ -66,8 +74,7 @@ std::pair<float, float> ClassicLookahead::get_expected_delay_and_cong(RRNodeId n
6674
t_rr_type rr_type = rr_graph.node_type(node);
6775

6876
if (rr_type == CHANX || rr_type == CHANY) {
69-
int num_segs_ortho_dir = 0;
70-
int num_segs_same_dir = get_expected_segs_to_target(node, target_node, &num_segs_ortho_dir);
77+
auto [num_segs_same_dir, num_segs_ortho_dir] = get_expected_segs_to_target(node, target_node);
7178

7279
auto cost_index = rr_graph.node_cost_index(node);
7380
int ortho_cost_index = device_ctx.rr_indexed_data[cost_index].ortho_cost_index;
@@ -112,28 +119,27 @@ static int round_up(float x) {
112119
return std::ceil(x - 0.001);
113120
}
114121

115-
static int get_expected_segs_to_target(RRNodeId inode, RRNodeId target_node, int* num_segs_ortho_dir_ptr) {
122+
static std::pair<int, int> get_expected_segs_to_target(RRNodeId inode, RRNodeId target_node) {
116123
/* Returns the number of segments the same type as inode that will be needed *
117124
* to reach target_node (not including inode) in each direction (the same *
118125
* direction (horizontal or vertical) as inode and the orthogonal direction).*/
119-
120126
auto& device_ctx = g_vpr_ctx.device();
121127
const auto& rr_graph = device_ctx.rr_graph;
122128

123-
t_rr_type rr_type;
124-
int target_x, target_y, num_segs_same_dir, ortho_cost_index;
125-
RRIndexedDataId cost_index;
129+
int num_segs_ortho_dir;
130+
int num_segs_same_dir;
131+
126132
int no_need_to_pass_by_clb;
127-
float inv_length, ortho_inv_length, ylow, yhigh, xlow, xhigh;
133+
float ylow, yhigh, xlow, xhigh;
128134

129-
target_x = rr_graph.node_xlow(target_node);
130-
target_y = rr_graph.node_ylow(target_node);
135+
int target_x = rr_graph.node_xlow(target_node);
136+
int target_y = rr_graph.node_ylow(target_node);
131137

132-
cost_index = rr_graph.node_cost_index(inode);
133-
inv_length = device_ctx.rr_indexed_data[cost_index].inv_length;
134-
ortho_cost_index = device_ctx.rr_indexed_data[cost_index].ortho_cost_index;
135-
ortho_inv_length = device_ctx.rr_indexed_data[RRIndexedDataId(ortho_cost_index)].inv_length;
136-
rr_type = rr_graph.node_type(inode);
138+
RRIndexedDataId cost_index = rr_graph.node_cost_index(inode);
139+
float inv_length = device_ctx.rr_indexed_data[cost_index].inv_length;
140+
int ortho_cost_index = device_ctx.rr_indexed_data[cost_index].ortho_cost_index;
141+
float ortho_inv_length = device_ctx.rr_indexed_data[RRIndexedDataId(ortho_cost_index)].inv_length;
142+
t_rr_type rr_type = rr_graph.node_type(inode);
137143

138144
if (rr_type == CHANX) {
139145
ylow = rr_graph.node_ylow(inode);
@@ -143,13 +149,13 @@ static int get_expected_segs_to_target(RRNodeId inode, RRNodeId target_node, int
143149
/* Count vertical (orthogonal to inode) segs first. */
144150

145151
if (ylow > target_y) { /* Coming from a row above target? */
146-
*num_segs_ortho_dir_ptr = round_up((ylow - target_y + 1.) * ortho_inv_length);
152+
num_segs_ortho_dir = round_up((ylow - target_y + 1.) * ortho_inv_length);
147153
no_need_to_pass_by_clb = 1;
148154
} else if (ylow < target_y - 1) { /* Below the CLB bottom? */
149-
*num_segs_ortho_dir_ptr = round_up((target_y - ylow) * ortho_inv_length);
155+
num_segs_ortho_dir = round_up((target_y - ylow) * ortho_inv_length);
150156
no_need_to_pass_by_clb = 1;
151157
} else { /* In a row that passes by target CLB */
152-
*num_segs_ortho_dir_ptr = 0;
158+
num_segs_ortho_dir = 0;
153159
no_need_to_pass_by_clb = 0;
154160
}
155161

@@ -170,13 +176,13 @@ static int get_expected_segs_to_target(RRNodeId inode, RRNodeId target_node, int
170176
/* Count horizontal (orthogonal to inode) segs first. */
171177

172178
if (xlow > target_x) { /* Coming from a column right of target? */
173-
*num_segs_ortho_dir_ptr = round_up((xlow - target_x + 1.) * ortho_inv_length);
179+
num_segs_ortho_dir = round_up((xlow - target_x + 1.) * ortho_inv_length);
174180
no_need_to_pass_by_clb = 1;
175181
} else if (xlow < target_x - 1) { /* Left of and not adjacent to the CLB? */
176-
*num_segs_ortho_dir_ptr = round_up((target_x - xlow) * ortho_inv_length);
182+
num_segs_ortho_dir = round_up((target_x - xlow) * ortho_inv_length);
177183
no_need_to_pass_by_clb = 1;
178184
} else { /* In a column that passes by target CLB */
179-
*num_segs_ortho_dir_ptr = 0;
185+
num_segs_ortho_dir = 0;
180186
no_need_to_pass_by_clb = 0;
181187
}
182188

@@ -191,7 +197,7 @@ static int get_expected_segs_to_target(RRNodeId inode, RRNodeId target_node, int
191197
}
192198
}
193199

194-
return (num_segs_same_dir);
200+
return {num_segs_same_dir, num_segs_ortho_dir};
195201
}
196202

197203
void invalidate_router_lookahead_cache() {
@@ -201,8 +207,8 @@ void invalidate_router_lookahead_cache() {
201207

202208
const RouterLookahead* get_cached_router_lookahead(const t_det_routing_arch& det_routing_arch,
203209
e_router_lookahead router_lookahead_type,
204-
std::string write_lookahead,
205-
std::string read_lookahead,
210+
const std::string& write_lookahead,
211+
const std::string& read_lookahead,
206212
const std::vector<t_segment_inf>& segment_inf,
207213
bool is_flat) {
208214
auto& router_ctx = g_vpr_ctx.routing();

vpr/src/route/router_lookahead.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ class RouterLookahead {
9292
*/
9393
std::unique_ptr<RouterLookahead> make_router_lookahead(const t_det_routing_arch& det_routing_arch,
9494
e_router_lookahead router_lookahead_type,
95-
std::string write_lookahead,
96-
std::string read_lookahead,
95+
const std::string& write_lookahead,
96+
const std::string& read_lookahead,
9797
const std::vector<t_segment_inf>& segment_inf,
9898
bool is_flat);
9999

@@ -115,8 +115,8 @@ void invalidate_router_lookahead_cache();
115115
*/
116116
const RouterLookahead* get_cached_router_lookahead(const t_det_routing_arch& det_routing_arch,
117117
e_router_lookahead router_lookahead_type,
118-
std::string write_lookahead,
119-
std::string read_lookahead,
118+
const std::string& write_lookahead,
119+
const std::string& read_lookahead,
120120
const std::vector<t_segment_inf>& segment_inf,
121121
bool is_flat);
122122

vpr/src/route/router_lookahead_map.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@
1717
* which are reachable from each physical tile type's SOURCEs/OPINs (f_src_opin_delays). This is used for
1818
* SRC/OPIN -> CHANX/CHANY estimates.
1919
*
20-
* In the case of SRC/OPIN -> SINK estimates the resuls from the two look-ups are added together (and the minimum taken
21-
* if there are multiple possiblities).
20+
* In the case of SRC/OPIN -> SINK estimates the results from the two look-ups are added together (and the minimum taken
21+
* if there are multiple possibilities).
2222
*/
2323

2424
#include <cmath>
2525
#include <vector>
26-
#include <queue>
27-
#include <ctime>
2826
#include "connection_router_interface.h"
2927
#include "vpr_types.h"
3028
#include "vpr_error.h"
@@ -50,7 +48,7 @@
5048
# include "serdes_utils.h"
5149
#endif /* VTR_ENABLE_CAPNPROTO */
5250

53-
const int VALID_NEIGHBOR_NUMBER = 3;
51+
static constexpr int VALID_NEIGHBOR_NUMBER = 3;
5452

5553
/* when a list of delay/congestion entries at a coordinate in Cost_Entry is boiled down to a single
5654
* representative entry, this enum is passed-in to specify how that representative entry should be
@@ -176,15 +174,12 @@ float MapLookahead::get_expected_cost(RRNodeId current_node, RRNodeId target_nod
176174

177175
VTR_ASSERT_SAFE(rr_graph.node_type(target_node) == t_rr_type::SINK);
178176

179-
float delay_cost = 0.;
180-
float cong_cost = 0.;
181-
182177
if (is_flat_) {
183178
return get_expected_cost_flat_router(current_node, target_node, params, R_upstream);
184179
} else {
185180
if (from_rr_type == CHANX || from_rr_type == CHANY || from_rr_type == SOURCE || from_rr_type == OPIN) {
186181
// Get the total cost using the combined delay and congestion costs
187-
std::tie(delay_cost, cong_cost) = get_expected_delay_and_cong(current_node, target_node, params, R_upstream);
182+
auto [delay_cost, cong_cost] = get_expected_delay_and_cong(current_node, target_node, params, R_upstream);
188183
return delay_cost + cong_cost;
189184
} else if (from_rr_type == IPIN) { /* Change if you're allowing route-throughs */
190185
return (device_ctx.rr_indexed_data[RRIndexedDataId(SINK_COST_INDEX)].base_cost);

vpr/src/route/rr_graph.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ static void build_rr_graph(const t_graph_type graph_type,
628628
t_chan_width nodes_per_chan,
629629
const enum e_switch_block_type sb_type,
630630
const int Fs,
631-
const std::vector<t_switchblock_inf> switchblocks,
631+
const std::vector<t_switchblock_inf>& switchblocks,
632632
const std::vector<t_segment_inf>& segment_inf,
633633
const int global_route_switch,
634634
const int wire_to_arch_ipin_switch,
@@ -660,7 +660,7 @@ static void build_intra_cluster_rr_graph(const t_graph_type graph_type,
660660
void create_rr_graph(const t_graph_type graph_type,
661661
const std::vector<t_physical_tile_type>& block_types,
662662
const DeviceGrid& grid,
663-
const t_chan_width nodes_per_chan,
663+
const t_chan_width& nodes_per_chan,
664664
t_det_routing_arch* det_routing_arch,
665665
const std::vector<t_segment_inf>& segment_inf,
666666
const t_router_opts& router_opts,
@@ -944,7 +944,7 @@ static void build_rr_graph(const t_graph_type graph_type,
944944
t_chan_width nodes_per_chan,
945945
const enum e_switch_block_type sb_type,
946946
const int Fs,
947-
const std::vector<t_switchblock_inf> switchblocks,
947+
const std::vector<t_switchblock_inf>& switchblocks,
948948
const std::vector<t_segment_inf>& segment_inf,
949949
const int global_route_switch,
950950
const int wire_to_arch_ipin_switch,
@@ -1011,16 +1011,16 @@ static void build_rr_graph(const t_graph_type graph_type,
10111011
seg_details_y = alloc_and_load_global_route_seg_details(global_route_switch, &num_seg_details_y);
10121012

10131013
} else {
1014-
/* Setup segments including distrubuting tracks and staggering.
1014+
/* Setup segments including distributing tracks and staggering.
10151015
* If use_full_seg_groups is specified, max_chan_width may be
10161016
* changed. Warning should be singled to caller if this happens. */
10171017

1018-
/* Need to setup segments along x & y axis seperately, due to different
1018+
/* Need to setup segments along x & y axes separately, due to different
10191019
* max_channel_widths and segment specifications. */
10201020

10211021
size_t max_dim = std::max(grid.width(), grid.height()) - 2; //-2 for no perim channels
10221022

1023-
/*Get x & y segments seperately*/
1023+
/*Get x & y segments separately*/
10241024
seg_details_x = alloc_and_load_seg_details(&max_chan_width_x,
10251025
max_dim, segment_inf_x,
10261026
use_full_seg_groups, directionality,
@@ -1086,7 +1086,7 @@ static void build_rr_graph(const t_graph_type graph_type,
10861086
}
10871087
}
10881088

1089-
/* get the number of 'sets' for each segment type -- unidirectial architectures have two tracks in a set, bidirectional have one */
1089+
/* get the number of 'sets' for each segment type -- unidirectional architectures have two tracks in a set, bidirectional have one */
10901090
int total_sets = max_chan_width;
10911091
int total_sets_x = max_chan_width_x;
10921092
int total_sets_y = max_chan_width_y;

vpr/src/route/rr_graph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ enum {
2323
void create_rr_graph(const t_graph_type graph_type,
2424
const std::vector<t_physical_tile_type>& block_types,
2525
const DeviceGrid& grid,
26-
t_chan_width nodes_per_chan,
26+
const t_chan_width& nodes_per_chan,
2727
t_det_routing_arch* det_routing_arch,
2828
const std::vector<t_segment_inf>& segment_inf,
2929
const t_router_opts& router_opts,

0 commit comments

Comments
 (0)