diff --git a/vpr/src/device/rr_graph_builder.cpp b/vpr/src/device/rr_graph_builder.cpp index c658b91df23..790bdd1baff 100644 --- a/vpr/src/device/rr_graph_builder.cpp +++ b/vpr/src/device/rr_graph_builder.cpp @@ -51,6 +51,9 @@ void RRGraphBuilder::clear() { node_lookup_.clear(); } +void RRGraphBuilder::set_node_direction(RRNodeId id, Direction new_direction) { + node_storage_.set_node_direction(id, new_direction); +} void RRGraphBuilder::set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2) { node_storage_.set_node_coordinates(id, x1, y1, x2, y2); } diff --git a/vpr/src/device/rr_graph_builder.h b/vpr/src/device/rr_graph_builder.h index e135e538ae2..8c87cb00e57 100644 --- a/vpr/src/device/rr_graph_builder.h +++ b/vpr/src/device/rr_graph_builder.h @@ -55,7 +55,10 @@ class RRGraphBuilder { /** @brief Clear all the underlying data storage */ void clear(); - /** @brief Set the node coordinate */ + /** @brief Set the node direction */ + void set_node_direction(RRNodeId, Direction new_direction); + + /** @brief Set the node coordinate */ void set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2); /* -- Internal data storage -- */ diff --git a/vpr/src/route/clock_network_builders.cpp b/vpr/src/route/clock_network_builders.cpp index 2ea41e09370..ed928d99ac5 100644 --- a/vpr/src/route/clock_network_builders.cpp +++ b/vpr/src/route/clock_network_builders.cpp @@ -325,7 +325,7 @@ int ClockRib::create_chanx_wire(int x_start, node.set_track_num(ptc_num); node.set_rc_index(find_create_rr_rc_data( x_chan_wire.layer.r_metal, x_chan_wire.layer.c_metal)); - node.set_direction(direction); + rr_graph_builder.set_node_direction(chanx_node, direction); short seg_index = 0; switch (direction) { @@ -624,7 +624,8 @@ int ClockSpine::create_chany_wire(int y_start, rr_nodes->emplace_back(); auto node_index = rr_nodes->size() - 1; auto node = rr_nodes->back(); - RRNodeId chany_node = RRNodeId(node_index); + + RRNodeId chanx_node = RRNodeId(node_index); rr_graph_builder.set_node_coordinates(chany_node, x, y_start, x, y_end); node.set_type(CHANY); @@ -632,7 +633,7 @@ int ClockSpine::create_chany_wire(int y_start, node.set_track_num(ptc_num); node.set_rc_index(find_create_rr_rc_data( y_chan_wire.layer.r_metal, y_chan_wire.layer.c_metal)); - node.set_direction(direction); + rr_graph_builder.set_node_direction(chanx_node, direction); short seg_index = 0; switch (direction) { diff --git a/vpr/src/route/rr_graph.cpp b/vpr/src/route/rr_graph.cpp index 7936afbe134..134fd678f18 100644 --- a/vpr/src/route/rr_graph.cpp +++ b/vpr/src/route/rr_graph.cpp @@ -1673,7 +1673,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder, L_rr_node.set_node_ptc_num(node, track); L_rr_node.set_node_type(node, chan_type); - L_rr_node.set_node_direction(node, seg_details[track].direction()); + rr_graph_builder.set_node_direction(node, seg_details[track].direction()); } } diff --git a/vpr/src/route/rr_graph_uxsdcxx_serializer.h b/vpr/src/route/rr_graph_uxsdcxx_serializer.h index 0876b8b6074..cc8b4e1948c 100644 --- a/vpr/src/route/rr_graph_uxsdcxx_serializer.h +++ b/vpr/src/route/rr_graph_uxsdcxx_serializer.h @@ -817,6 +817,8 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { inline void set_node_direction(uxsd::enum_node_direction direction, int& inode) final { const auto& rr_graph = (*rr_graph_); auto node = (*rr_nodes_)[inode]; + RRNodeId node_id = node.id(); + if (direction == uxsd::enum_node_direction::UXSD_INVALID) { if (rr_graph.node_type(node.id()) == CHANX || rr_graph.node_type(node.id()) == CHANY) { report_error( @@ -824,7 +826,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { inode, rr_graph.node_type(node.id())); } } else { - node.set_direction(from_uxsd_node_direction(direction)); + rr_graph_builder_->set_node_direction(node_id, from_uxsd_node_direction(direction)); } } inline uxsd::enum_node_direction get_node_direction(const t_rr_node& node) final { diff --git a/vpr/src/route/rr_node.cpp b/vpr/src/route/rr_node.cpp index f31c8c701ac..ffbb14372b4 100644 --- a/vpr/src/route/rr_node.cpp +++ b/vpr/src/route/rr_node.cpp @@ -83,10 +83,6 @@ void t_rr_node::set_capacity(short new_capacity) { storage_->set_node_capacity(id_, new_capacity); } -void t_rr_node::set_direction(Direction new_direction) { - storage_->set_node_direction(id_, new_direction); -} - void t_rr_node::add_side(e_side new_side) { storage_->add_node_side(id_, new_side); } diff --git a/vpr/src/route/rr_node.h b/vpr/src/route/rr_node.h index 23fc2acd558..a7c61e4aee6 100644 --- a/vpr/src/route/rr_node.h +++ b/vpr/src/route/rr_node.h @@ -120,7 +120,6 @@ class t_rr_node { void set_cost_index(size_t); void set_rc_index(short); - void set_direction(Direction); void set_side(e_side); void add_side(e_side);