diff --git a/vpr/src/device/rr_graph_builder.h b/vpr/src/device/rr_graph_builder.h index c8baa9619c4..b47ef698d31 100644 --- a/vpr/src/device/rr_graph_builder.h +++ b/vpr/src/device/rr_graph_builder.h @@ -102,6 +102,11 @@ class RRGraphBuilder { node_storage_.set_node_direction(id, new_direction); } + /** @brief Set the rc_index of routing resource node. */ + inline void set_node_rc_index(RRNodeId id, NodeRCIndex new_rc_index) { + node_storage_.set_node_rc_index(id, new_rc_index); + } + /** @brief Add the side where the node physically locates on a logic block. * Mainly applicable to IPIN and OPIN nodes.*/ inline void add_node_side(RRNodeId id, e_side new_side) { diff --git a/vpr/src/device/rr_graph_fwd.h b/vpr/src/device/rr_graph_fwd.h index 29e07854596..fee69b34cd2 100644 --- a/vpr/src/device/rr_graph_fwd.h +++ b/vpr/src/device/rr_graph_fwd.h @@ -18,11 +18,13 @@ struct rr_edge_id_tag; struct rr_indexed_data_id_tag; struct rr_switch_id_tag; struct rr_segment_id_tag; +struct rc_index_tag; typedef vtr::StrongId RRNodeId; typedef vtr::StrongId RREdgeId; typedef vtr::StrongId RRIndexedDataId; typedef vtr::StrongId RRSwitchId; typedef vtr::StrongId RRSegmentId; +typedef vtr::StrongId NodeRCIndex; #endif diff --git a/vpr/src/route/clock_connection_builders.cpp b/vpr/src/route/clock_connection_builders.cpp index 33f8171d21c..b5a70dd8e41 100644 --- a/vpr/src/route/clock_connection_builders.cpp +++ b/vpr/src/route/clock_connection_builders.cpp @@ -114,7 +114,7 @@ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x, float R = 0.; float C = 0.; - rr_graph.set_node_rc_index(node_index, find_create_rr_rc_data(R, C)); + rr_graph_builder.set_node_rc_index(node_index, NodeRCIndex(find_create_rr_rc_data(R, C))); // Use a generic way when adding nodes to lookup. // However, since the SINK node has the same xhigh/xlow as well as yhigh/ylow, we can probably use a shortcut diff --git a/vpr/src/route/clock_network_builders.cpp b/vpr/src/route/clock_network_builders.cpp index d7d406bf49f..bdf727a6832 100644 --- a/vpr/src/route/clock_network_builders.cpp +++ b/vpr/src/route/clock_network_builders.cpp @@ -323,8 +323,8 @@ int ClockRib::create_chanx_wire(int x_start, rr_graph_builder.set_node_coordinates(chanx_node, x_start, y, x_end, y); rr_graph_builder.set_node_capacity(chanx_node, 1); rr_graph_builder.set_node_track_num(chanx_node, ptc_num); - node.set_rc_index(find_create_rr_rc_data( - x_chan_wire.layer.r_metal, x_chan_wire.layer.c_metal)); + rr_graph_builder.set_node_rc_index(chanx_node, NodeRCIndex(find_create_rr_rc_data( + x_chan_wire.layer.r_metal, x_chan_wire.layer.c_metal))); rr_graph_builder.set_node_direction(chanx_node, direction); short seg_index = 0; @@ -629,8 +629,8 @@ int ClockSpine::create_chany_wire(int y_start, rr_graph_builder.set_node_coordinates(chany_node, x, y_start, x, y_end); rr_graph_builder.set_node_capacity(chany_node, 1); rr_graph_builder.set_node_track_num(chany_node, ptc_num); - node.set_rc_index(find_create_rr_rc_data( - y_chan_wire.layer.r_metal, y_chan_wire.layer.c_metal)); + rr_graph_builder.set_node_rc_index(chany_node, NodeRCIndex(find_create_rr_rc_data( + y_chan_wire.layer.r_metal, y_chan_wire.layer.c_metal))); rr_graph_builder.set_node_direction(chany_node, direction); short seg_index = 0; diff --git a/vpr/src/route/rr_graph.cpp b/vpr/src/route/rr_graph.cpp index ad680ae714c..ec112a6345d 100644 --- a/vpr/src/route/rr_graph.cpp +++ b/vpr/src/route/rr_graph.cpp @@ -1437,7 +1437,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder, rr_graph_builder.set_node_coordinates(inode, i, j, i + type->width - 1, j + type->height - 1); float R = 0.; float C = 0.; - L_rr_node.set_node_rc_index(inode, find_create_rr_rc_data(R, C)); + rr_graph_builder.set_node_rc_index(inode, NodeRCIndex(find_create_rr_rc_data(R, C))); rr_graph_builder.set_node_class_num(inode, iclass); } @@ -1485,7 +1485,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder, rr_graph_builder.set_node_capacity(inode, 1); float R = 0.; float C = 0.; - L_rr_node.set_node_rc_index(inode, find_create_rr_rc_data(R, C)); + rr_graph_builder.set_node_rc_index(inode, NodeRCIndex(find_create_rr_rc_data(R, C))); rr_graph_builder.set_node_pin_num(inode, ipin); //Note that we store the grid tile location and side where the pin is located, @@ -1674,7 +1674,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder, int length = end - start + 1; float R = length * seg_details[track].Rmetal(); float C = length * seg_details[track].Cmetal(); - L_rr_node.set_node_rc_index(node, find_create_rr_rc_data(R, C)); + rr_graph_builder.set_node_rc_index(node, NodeRCIndex(find_create_rr_rc_data(R, C))); rr_graph_builder.set_node_type(node, chan_type); rr_graph_builder.set_node_track_num(node, track); diff --git a/vpr/src/route/rr_graph_storage.cpp b/vpr/src/route/rr_graph_storage.cpp index f350be8ed2f..01b54f6576d 100644 --- a/vpr/src/route/rr_graph_storage.cpp +++ b/vpr/src/route/rr_graph_storage.cpp @@ -690,8 +690,8 @@ void t_rr_graph_storage::set_node_cost_index(RRNodeId id, RRIndexedDataId new_co node.cost_index_ = (size_t)new_cost_index; } -void t_rr_graph_storage::set_node_rc_index(RRNodeId id, short new_rc_index) { - node_storage_[id].rc_index_ = new_rc_index; +void t_rr_graph_storage::set_node_rc_index(RRNodeId id, NodeRCIndex new_rc_index) { + node_storage_[id].rc_index_ = (size_t)new_rc_index; } void t_rr_graph_storage::set_node_capacity(RRNodeId id, short new_capacity) { diff --git a/vpr/src/route/rr_graph_storage.h b/vpr/src/route/rr_graph_storage.h index 80eed7d89d9..5b8164eb7dc 100644 --- a/vpr/src/route/rr_graph_storage.h +++ b/vpr/src/route/rr_graph_storage.h @@ -473,7 +473,7 @@ class t_rr_graph_storage { void set_node_type(RRNodeId id, t_rr_type new_type); void set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2); void set_node_cost_index(RRNodeId, RRIndexedDataId new_cost_index); - void set_node_rc_index(RRNodeId, short new_rc_index); + void set_node_rc_index(RRNodeId, NodeRCIndex new_rc_index); void set_node_capacity(RRNodeId, short new_capacity); void set_node_direction(RRNodeId, Direction new_direction); diff --git a/vpr/src/route/rr_graph_timing_params.cpp b/vpr/src/route/rr_graph_timing_params.cpp index c08d2780e61..9b383e32378 100644 --- a/vpr/src/route/rr_graph_timing_params.cpp +++ b/vpr/src/route/rr_graph_timing_params.cpp @@ -191,7 +191,7 @@ void add_rr_graph_C_from_switches(float C_ipin_cblock) { //Create the final flywieghted t_rr_rc_data for (size_t inode = 0; inode < device_ctx.rr_nodes.size(); inode++) { - mutable_device_ctx.rr_nodes[inode].set_rc_index(find_create_rr_rc_data(rr_graph.node_R(RRNodeId(inode)), rr_node_C[inode])); + mutable_device_ctx.rr_graph_builder.set_node_rc_index(RRNodeId(inode), NodeRCIndex(find_create_rr_rc_data(rr_graph.node_R(RRNodeId(inode)), rr_node_C[inode]))); } free(Couts_to_add); diff --git a/vpr/src/route/rr_graph_uxsdcxx_serializer.h b/vpr/src/route/rr_graph_uxsdcxx_serializer.h index 23f2e22abe5..b5792630be0 100644 --- a/vpr/src/route/rr_graph_uxsdcxx_serializer.h +++ b/vpr/src/route/rr_graph_uxsdcxx_serializer.h @@ -672,7 +672,8 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { */ inline int init_node_timing(int& inode, float C, float R) final { auto node = (*rr_nodes_)[inode]; - node.set_rc_index(find_create_rr_rc_data(R, C)); + RRNodeId node_id = node.id(); + rr_graph_builder_->set_node_rc_index(node_id, NodeRCIndex(find_create_rr_rc_data(R, C))); return inode; } inline void finish_node_timing(int& /*inode*/) final {} @@ -790,7 +791,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { type); } - node.set_rc_index(find_create_rr_rc_data(0, 0)); + rr_graph_builder_->set_node_rc_index(node_id, NodeRCIndex(find_create_rr_rc_data(0, 0))); return id; } diff --git a/vpr/src/route/rr_node.cpp b/vpr/src/route/rr_node.cpp index 7d54f038b2f..bc0f1ce6bf6 100644 --- a/vpr/src/route/rr_node.cpp +++ b/vpr/src/route/rr_node.cpp @@ -54,7 +54,3 @@ bool t_rr_node::validate() const { void t_rr_node::set_cost_index(RRIndexedDataId new_cost_index) { storage_->set_node_cost_index(id_, new_cost_index); } - -void t_rr_node::set_rc_index(short new_rc_index) { - storage_->set_node_rc_index(id_, new_rc_index); -} diff --git a/vpr/src/route/rr_node.h b/vpr/src/route/rr_node.h index 9d4b85441b2..58dc6ac2450 100644 --- a/vpr/src/route/rr_node.h +++ b/vpr/src/route/rr_node.h @@ -107,7 +107,6 @@ class t_rr_node { public: //Mutators void set_cost_index(RRIndexedDataId); - void set_rc_index(short); void set_side(e_side);