From d163b1513238de1e999e9b63e46ffed01635453a Mon Sep 17 00:00:00 2001 From: Muhammad Haris Zafar Date: Tue, 21 Sep 2021 16:03:06 +0500 Subject: [PATCH 1/4] Adding apt set_node_direction to rr_graph_builder.h/.cpp --- vpr/src/device/rr_graph_builder.cpp | 4 ++++ vpr/src/device/rr_graph_builder.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/vpr/src/device/rr_graph_builder.cpp b/vpr/src/device/rr_graph_builder.cpp index 6cf28ca276c..3bc19c0e6ed 100644 --- a/vpr/src/device/rr_graph_builder.cpp +++ b/vpr/src/device/rr_graph_builder.cpp @@ -50,3 +50,7 @@ void RRGraphBuilder::add_node_to_all_locs(RRNodeId node) { void RRGraphBuilder::clear() { node_lookup_.clear(); } + +void RRGraphBuilder::set_node_direction(RRNodeId id, Direction new_direction) { + node_storage_.set_node_direction(id, new_direction); +} diff --git a/vpr/src/device/rr_graph_builder.h b/vpr/src/device/rr_graph_builder.h index fd722427521..033464b3279 100644 --- a/vpr/src/device/rr_graph_builder.h +++ b/vpr/src/device/rr_graph_builder.h @@ -55,6 +55,9 @@ class RRGraphBuilder { /** @brief Clear all the underlying data storage */ void clear(); + /** @brief Set the nod direction */ + void set_node_direction(RRNodeId, Direction new_direction); + /* -- Internal data storage -- */ private: /* TODO: When the refactoring effort finishes, From 35a0bc1e878d06edfdf6e8b6e4f3b101f459a414 Mon Sep 17 00:00:00 2001 From: Muhammad Haris Zafar Date: Tue, 21 Sep 2021 17:45:35 +0500 Subject: [PATCH 2/4] Replacing set_node_direction in the relative files --- vpr/src/route/clock_network_builders.cpp | 7 ++++--- vpr/src/route/rr_graph.cpp | 2 +- vpr/src/route/rr_graph_uxsdcxx_serializer.h | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/vpr/src/route/clock_network_builders.cpp b/vpr/src/route/clock_network_builders.cpp index 5d26591faca..061ae838384 100644 --- a/vpr/src/route/clock_network_builders.cpp +++ b/vpr/src/route/clock_network_builders.cpp @@ -317,6 +317,7 @@ int ClockRib::create_chanx_wire(int x_start, rr_nodes->emplace_back(); auto node_index = rr_nodes->size() - 1; auto node = rr_nodes->back(); + RRNodeId chanx_node = RRNodeId(node_index); node.set_coordinates(x_start, y, x_end, y); node.set_type(CHANX); @@ -324,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) { @@ -345,7 +346,7 @@ int ClockRib::create_chanx_wire(int x_start, /* Add the node to spatial lookup */ auto& rr_graph = (*rr_nodes); - RRNodeId chanx_node = RRNodeId(node_index); + /* TODO: Will replace these codes with an API add_node_to_all_locs() of RRGraphBuilder */ for (int ix = rr_graph.node_xlow(chanx_node); ix <= rr_graph.node_xhigh(chanx_node); ++ix) { for (int iy = rr_graph.node_ylow(chanx_node); iy <= rr_graph.node_yhigh(chanx_node); ++iy) { @@ -630,7 +631,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 35a0f23ebbb..8a4f94fe621 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 dcfdbbb5cd2..6b0a77d894b 100644 --- a/vpr/src/route/rr_graph_uxsdcxx_serializer.h +++ b/vpr/src/route/rr_graph_uxsdcxx_serializer.h @@ -816,6 +816,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( @@ -823,7 +825,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 { From 52705ab14719c36278e520dd80a725459550d0d9 Mon Sep 17 00:00:00 2001 From: Muhammad Haris Zafar Date: Tue, 21 Sep 2021 17:51:52 +0500 Subject: [PATCH 3/4] Removing old api set_direction from rr_node.cpp/.h --- vpr/src/route/rr_node.cpp | 4 ---- vpr/src/route/rr_node.h | 1 - 2 files changed, 5 deletions(-) diff --git a/vpr/src/route/rr_node.cpp b/vpr/src/route/rr_node.cpp index b13ad34e3fe..e23270a4ac4 100644 --- a/vpr/src/route/rr_node.cpp +++ b/vpr/src/route/rr_node.cpp @@ -91,10 +91,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 e4ed1fd4e15..84eecd372ed 100644 --- a/vpr/src/route/rr_node.h +++ b/vpr/src/route/rr_node.h @@ -122,7 +122,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); From bb023fc5065cc15a7afcc9b19cf58721c3beb95a Mon Sep 17 00:00:00 2001 From: Muhammad Haris Zafar Date: Wed, 22 Sep 2021 11:51:47 +0500 Subject: [PATCH 4/4] Replacing all api set_node_direction from the related .cpp/.h files --- vpr/src/route/clock_network_builders.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/vpr/src/route/clock_network_builders.cpp b/vpr/src/route/clock_network_builders.cpp index 061ae838384..8f9268224c3 100644 --- a/vpr/src/route/clock_network_builders.cpp +++ b/vpr/src/route/clock_network_builders.cpp @@ -624,6 +624,7 @@ 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 chanx_node = RRNodeId(node_index); node.set_coordinates(x, y_start, x, y_end); node.set_type(CHANY);