Skip to content

Commit 17a816a

Browse files
authored
Merge pull request #2445 from verilog-to-routing/6d_router_lookahead
6D Router Lookahead
2 parents ad7057f + bb34dc8 commit 17a816a

9 files changed

+271
-203
lines changed

libs/librrgraph/src/base/rr_graph_view.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,13 @@ class RRGraphView {
242242
std::string start_y; //start y-coordinate
243243
std::string end_x; //end x-coordinate
244244
std::string end_y; //end y-coordinate
245-
std::string layer_num_str; //layer number
245+
std::string start_layer_str; //layer number
246+
std::string end_layer_str; //layer number
246247
std::string arrow; //direction arrow
247248
std::string coordinate_string = node_type_string(node); //write the component's type as a routing resource node
248249
coordinate_string += ":" + std::to_string(size_t(node)) + " "; //add the index of the routing resource node
250+
251+
int node_layer_num = node_layer(node);
249252
if (node_type(node) == OPIN || node_type(node) == IPIN) {
250253
coordinate_string += "side: ("; //add the side of the routing resource node
251254
for (const e_side& node_side : SIDES) {
@@ -259,12 +262,12 @@ class RRGraphView {
259262
// and the end to the lower coordinate
260263
start_x = " (" + std::to_string(node_xhigh(node)) + ","; //start and end coordinates are the same for OPINs and IPINs
261264
start_y = std::to_string(node_yhigh(node)) + ",";
262-
layer_num_str = std::to_string(node_layer(node)) + ")";
265+
start_layer_str = std::to_string(node_layer_num) + ")";
263266
} else if (node_type(node) == SOURCE || node_type(node) == SINK) {
264267
// For SOURCE and SINK the starting and ending coordinate are identical, so just use start
265268
start_x = " (" + std::to_string(node_xhigh(node)) + ",";
266269
start_y = std::to_string(node_yhigh(node)) + ",";
267-
layer_num_str = std::to_string(node_layer(node)) + ")";
270+
start_layer_str = std::to_string(node_layer_num) + ")";
268271
} else if (node_type(node) == CHANX || node_type(node) == CHANY) { //for channels, we would like to describe the component with segment specific information
269272
RRIndexedDataId cost_index = node_cost_index(node);
270273
int seg_index = rr_indexed_data_[cost_index].seg_index;
@@ -278,26 +281,28 @@ class RRGraphView {
278281

279282
start_x = " (" + std::to_string(node_xhigh(node)) + ","; //start coordinates have large value
280283
start_y = std::to_string(node_yhigh(node)) + ",";
284+
start_layer_str = std::to_string(node_layer_num);
281285
end_x = " (" + std::to_string(node_xlow(node)) + ","; //end coordinates have smaller value
282286
end_y = std::to_string(node_ylow(node)) + ",";
283-
layer_num_str = std::to_string(node_layer(node)) + ")";
287+
end_layer_str = std::to_string(node_layer_num) + ")";
284288
}
285289

286290
else { // signal travels in increasing direction, stays at same point, or can travel both directions
287291
start_x = " (" + std::to_string(node_xlow(node)) + ","; //start coordinates have smaller value
288292
start_y = std::to_string(node_ylow(node)) + ",";
293+
start_layer_str = std::to_string(node_layer_num);
289294
end_x = " (" + std::to_string(node_xhigh(node)) + ","; //end coordinates have larger value
290295
end_y = std::to_string(node_yhigh(node)) + ",";
291-
layer_num_str = std::to_string(node_layer(node)) + ")"; //layer number
296+
end_layer_str = std::to_string(node_layer_num) + ")"; //layer number
292297
if (node_direction(node) == Direction::BIDIR) {
293298
arrow = "<->"; //indicate that signal can travel both direction
294299
}
295300
}
296301
}
297302

298-
coordinate_string += start_x + start_y + layer_num_str; //Write the starting coordinates
303+
coordinate_string += start_x + start_y + start_layer_str; //Write the starting coordinates
299304
coordinate_string += arrow; //Indicate the direction
300-
coordinate_string += end_x + end_y + layer_num_str; //Write the end coordinates
305+
coordinate_string += end_x + end_y + end_layer_str; //Write the end coordinates
301306
return coordinate_string;
302307
}
303308

vpr/src/route/connection_router.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ t_heap* ConnectionRouter<Heap>::timing_driven_route_connection_from_heap(RRNodeI
203203
const t_conn_cost_params cost_params,
204204
t_bb bounding_box) {
205205
VTR_ASSERT_SAFE(heap_.is_valid());
206-
//std::cout << "using this: " << (void *)this << "\n";
207-
//std::cout << "using heap: " << heap_.get_ptr() << "\n";
208206

209207
if (heap_.is_empty_heap()) { //No source
210208
VTR_LOGV_DEBUG(router_debug_, " Initial heap empty (no source)\n");

vpr/src/route/router_lookahead_extended_map.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static std::pair<float, int> run_dijkstra(RRNodeId start_node,
6565
std::vector<util::Search_Path>* paths,
6666
util::RoutingCosts* routing_costs);
6767

68-
std::pair<float, float> ExtendedMapLookahead::get_src_opin_cost(RRNodeId from_node, int delta_x, int delta_y, const t_conn_cost_params& params) const {
68+
std::pair<float, float> ExtendedMapLookahead::get_src_opin_cost(RRNodeId from_node, int delta_x, int delta_y, int to_layer_num, const t_conn_cost_params& params) const {
6969
auto& device_ctx = g_vpr_ctx.device();
7070
auto& rr_graph = device_ctx.rr_graph;
7171

@@ -109,7 +109,7 @@ std::pair<float, float> ExtendedMapLookahead::get_src_opin_cost(RRNodeId from_no
109109
float expected_delay_cost = std::numeric_limits<float>::infinity();
110110
float expected_cong_cost = std::numeric_limits<float>::infinity();
111111

112-
for (const auto& kv : this->src_opin_delays[from_layer_num][tile_index][from_ptc]) {
112+
for (const auto& kv : this->src_opin_delays[from_layer_num][tile_index][from_ptc][to_layer_num]) {
113113
const util::t_reachable_wire_inf& reachable_wire_inf = kv.second;
114114

115115
util::Cost_Entry cost_entry;
@@ -195,13 +195,15 @@ std::pair<float, float> ExtendedMapLookahead::get_expected_delay_and_cong(RRNode
195195
int to_x = rr_graph.node_xlow(to_node);
196196
int to_y = rr_graph.node_ylow(to_node);
197197

198+
int to_layer_num = rr_graph.node_layer(to_node);
199+
198200
int dx, dy;
199201
dx = to_x - from_x;
200202
dy = to_y - from_y;
201203

202204
e_rr_type from_type = rr_graph.node_type(from_node);
203205
if (from_type == SOURCE || from_type == OPIN) {
204-
return this->get_src_opin_cost(from_node, dx, dy, params);
206+
return this->get_src_opin_cost(from_node, dx, dy, to_layer_num, params);
205207
} else if (from_type == IPIN) {
206208
return std::make_pair(0., 0.);
207209
}
@@ -420,7 +422,7 @@ std::pair<float, int> ExtendedMapLookahead::run_dijkstra(RRNodeId start_node,
420422

421423
// compute the cost maps for lookahead
422424
void ExtendedMapLookahead::compute(const std::vector<t_segment_inf>& segment_inf) {
423-
std::tie(this->src_opin_delays, this->src_opin_inter_layer_delays) = util::compute_router_src_opin_lookahead(is_flat_);
425+
this->src_opin_delays = util::compute_router_src_opin_lookahead(is_flat_);
424426

425427
this->chan_ipins_delays = util::compute_router_chan_ipin_lookahead();
426428

@@ -616,7 +618,7 @@ void ExtendedMapLookahead::write(const std::string& file) const {
616618
void ExtendedMapLookahead::read(const std::string& file) {
617619
cost_map_.read(file);
618620

619-
std::tie(this->src_opin_delays, this->src_opin_inter_layer_delays) = util::compute_router_src_opin_lookahead(is_flat_);
621+
this->src_opin_delays = util::compute_router_src_opin_lookahead(is_flat_);
620622

621623
this->chan_ipins_delays = util::compute_router_chan_ipin_lookahead();
622624
}

vpr/src/route/router_lookahead_extended_map.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ class ExtendedMapLookahead : public RouterLookahead {
1919
///<Look-up table from SOURCE/OPIN to CHANX/CHANY of various types
2020
util::t_src_opin_delays src_opin_delays;
2121

22-
///< Lookup table from SOURCE/OPIN to CHANX/CHANY of the another layer
23-
util::t_src_opin_inter_layer_delays src_opin_inter_layer_delays;
24-
2522
///<Look-up table from CHANX/CHANY to SINK/IPIN of various types
2623
util::t_chan_ipins_delays chan_ipins_delays;
2724

@@ -33,7 +30,7 @@ class ExtendedMapLookahead : public RouterLookahead {
3330
* @param criticality_fac criticality of the current connection between 0 (all congestion) and 1 (all timing)
3431
* @return expected cost to get to the destination
3532
*/
36-
std::pair<float, float> get_src_opin_cost(RRNodeId from_node, int delta_x, int delta_y, const t_conn_cost_params& params) const;
33+
std::pair<float, float> get_src_opin_cost(RRNodeId from_node, int delta_x, int delta_y, int to_layer_num, const t_conn_cost_params& params) const;
3734

3835
/**
3936
* @brief Returns the CHAN -> IPIN delay that gets added to the final expected delay

0 commit comments

Comments
 (0)