Skip to content

Commit 2845c07

Browse files
committed
fix old traceback conversion
1 parent 1cdc7cf commit 2845c07

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

vpr/src/base/old_traceback.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
std::pair<t_trace*, t_trace*> traceback_from_route_tree_recurr(t_trace* head, t_trace* tail, const RouteTreeNode& node);
1010
static void traceback_to_route_tree_x(
11-
std::unordered_map<RRNodeId, vtr::optional<RouteTreeNode&>> rr_node_to_rt_node,
11+
std::unordered_map<RRNodeId, vtr::optional<RouteTreeNode&>>& rr_node_to_rt_node,
1212
t_trace* trace,
1313
RouteTreeNode& parent,
1414
RRSwitchId parent_switch);
@@ -23,7 +23,7 @@ vtr::optional<RouteTree> traceback_to_route_tree(t_trace* head) {
2323
if (head == nullptr)
2424
return vtr::nullopt;
2525

26-
RouteTreeNode root(RRNodeId(head->index), RRSwitchId(OPEN), vtr::nullopt);
26+
RouteTreeNode root(RRNodeId(head->index), RRSwitchId::INVALID(), vtr::nullopt);
2727
std::unordered_map<RRNodeId, vtr::optional<RouteTreeNode&>> rr_node_to_rt_node;
2828

2929
rr_node_to_rt_node[RRNodeId(head->index)] = root;
@@ -34,18 +34,18 @@ vtr::optional<RouteTree> traceback_to_route_tree(t_trace* head) {
3434
RouteTree tree(std::move(root));
3535
tree.reload_timing();
3636

37-
/* We built the tree using an external lookup, but returning by value should either copy
37+
/* We built the tree using a (hacky) external lookup, but returning by value should either copy
3838
* or move, which will make the tree update its own lookup */
3939
return tree;
4040
}
4141

4242
/* Add the path indicated by the trace to parent */
43-
static void traceback_to_route_tree_x(std::unordered_map<RRNodeId, vtr::optional<RouteTreeNode&>> rr_node_to_rt_node, t_trace* trace, RouteTreeNode& parent, RRSwitchId parent_switch) {
43+
static void traceback_to_route_tree_x(std::unordered_map<RRNodeId, vtr::optional<RouteTreeNode&>>& rr_node_to_rt_node, t_trace* trace, RouteTreeNode& parent, RRSwitchId parent_switch) {
4444
auto& device_ctx = g_vpr_ctx.device();
4545
const auto& rr_graph = device_ctx.rr_graph;
4646
RRNodeId inode = RRNodeId(trace->index);
4747

48-
RouteTreeNode new_node = parent.emplace_child(inode, parent_switch, parent);
48+
RouteTreeNode& new_node = parent.emplace_child(inode, parent_switch, parent);
4949
new_node.net_pin_index = trace->net_pin_index;
5050
new_node.R_upstream = std::numeric_limits<float>::quiet_NaN();
5151
new_node.C_downstream = std::numeric_limits<float>::quiet_NaN();
@@ -59,7 +59,7 @@ static void traceback_to_route_tree_x(std::unordered_map<RRNodeId, vtr::optional
5959
rr_node_to_rt_node[new_node.inode] = new_node;
6060

6161
if (rr_graph.node_type(inode) == SINK) {
62-
/* The traceback returns to the previous branch point if there is more than one SINK, else we are at the base case */
62+
/* The traceback returns to the previous branch point if there is more than one SINK, otherwise we are at the last SINK */
6363
if (trace->next) {
6464
RRNodeId next_rr_node = RRNodeId(trace->next->index);
6565
RouteTreeNode& branch = rr_node_to_rt_node.at(next_rr_node).value();

0 commit comments

Comments
 (0)