Skip to content

Commit 92556fe

Browse files
authored
Merge pull request #1887 from RapidSilicon/api_set_node_rc_index
Add a new API set_node_rc_index() to RRGraphBuilder
2 parents 82b7a2d + 82c5913 commit 92556fe

11 files changed

+22
-19
lines changed

vpr/src/device/rr_graph_builder.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ class RRGraphBuilder {
102102
node_storage_.set_node_direction(id, new_direction);
103103
}
104104

105+
/** @brief Set the rc_index of routing resource node. */
106+
inline void set_node_rc_index(RRNodeId id, NodeRCIndex new_rc_index) {
107+
node_storage_.set_node_rc_index(id, new_rc_index);
108+
}
109+
105110
/** @brief Add the side where the node physically locates on a logic block.
106111
* Mainly applicable to IPIN and OPIN nodes.*/
107112
inline void add_node_side(RRNodeId id, e_side new_side) {

vpr/src/device/rr_graph_fwd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ struct rr_edge_id_tag;
1818
struct rr_indexed_data_id_tag;
1919
struct rr_switch_id_tag;
2020
struct rr_segment_id_tag;
21+
struct rc_index_tag;
2122

2223
typedef vtr::StrongId<rr_node_id_tag, unsigned int> RRNodeId;
2324
typedef vtr::StrongId<rr_edge_id_tag, unsigned int> RREdgeId;
2425
typedef vtr::StrongId<rr_indexed_data_id_tag, unsigned int> RRIndexedDataId;
2526
typedef vtr::StrongId<rr_switch_id_tag, short> RRSwitchId;
2627
typedef vtr::StrongId<rr_segment_id_tag, short> RRSegmentId;
28+
typedef vtr::StrongId<rc_index_tag, short> NodeRCIndex;
2729

2830
#endif

vpr/src/route/clock_connection_builders.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x,
114114

115115
float R = 0.;
116116
float C = 0.;
117-
rr_graph.set_node_rc_index(node_index, find_create_rr_rc_data(R, C));
117+
rr_graph_builder.set_node_rc_index(node_index, NodeRCIndex(find_create_rr_rc_data(R, C)));
118118

119119
// Use a generic way when adding nodes to lookup.
120120
// However, since the SINK node has the same xhigh/xlow as well as yhigh/ylow, we can probably use a shortcut

vpr/src/route/clock_network_builders.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ int ClockRib::create_chanx_wire(int x_start,
323323
rr_graph_builder.set_node_coordinates(chanx_node, x_start, y, x_end, y);
324324
rr_graph_builder.set_node_capacity(chanx_node, 1);
325325
rr_graph_builder.set_node_track_num(chanx_node, ptc_num);
326-
node.set_rc_index(find_create_rr_rc_data(
327-
x_chan_wire.layer.r_metal, x_chan_wire.layer.c_metal));
326+
rr_graph_builder.set_node_rc_index(chanx_node, NodeRCIndex(find_create_rr_rc_data(
327+
x_chan_wire.layer.r_metal, x_chan_wire.layer.c_metal)));
328328
rr_graph_builder.set_node_direction(chanx_node, direction);
329329

330330
short seg_index = 0;
@@ -629,8 +629,8 @@ int ClockSpine::create_chany_wire(int y_start,
629629
rr_graph_builder.set_node_coordinates(chany_node, x, y_start, x, y_end);
630630
rr_graph_builder.set_node_capacity(chany_node, 1);
631631
rr_graph_builder.set_node_track_num(chany_node, ptc_num);
632-
node.set_rc_index(find_create_rr_rc_data(
633-
y_chan_wire.layer.r_metal, y_chan_wire.layer.c_metal));
632+
rr_graph_builder.set_node_rc_index(chany_node, NodeRCIndex(find_create_rr_rc_data(
633+
y_chan_wire.layer.r_metal, y_chan_wire.layer.c_metal)));
634634
rr_graph_builder.set_node_direction(chany_node, direction);
635635

636636
short seg_index = 0;

vpr/src/route/rr_graph.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
14371437
rr_graph_builder.set_node_coordinates(inode, i, j, i + type->width - 1, j + type->height - 1);
14381438
float R = 0.;
14391439
float C = 0.;
1440-
L_rr_node.set_node_rc_index(inode, find_create_rr_rc_data(R, C));
1440+
rr_graph_builder.set_node_rc_index(inode, NodeRCIndex(find_create_rr_rc_data(R, C)));
14411441
rr_graph_builder.set_node_class_num(inode, iclass);
14421442
}
14431443

@@ -1485,7 +1485,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
14851485
rr_graph_builder.set_node_capacity(inode, 1);
14861486
float R = 0.;
14871487
float C = 0.;
1488-
L_rr_node.set_node_rc_index(inode, find_create_rr_rc_data(R, C));
1488+
rr_graph_builder.set_node_rc_index(inode, NodeRCIndex(find_create_rr_rc_data(R, C)));
14891489
rr_graph_builder.set_node_pin_num(inode, ipin);
14901490

14911491
//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,
16741674
int length = end - start + 1;
16751675
float R = length * seg_details[track].Rmetal();
16761676
float C = length * seg_details[track].Cmetal();
1677-
L_rr_node.set_node_rc_index(node, find_create_rr_rc_data(R, C));
1677+
rr_graph_builder.set_node_rc_index(node, NodeRCIndex(find_create_rr_rc_data(R, C)));
16781678

16791679
rr_graph_builder.set_node_type(node, chan_type);
16801680
rr_graph_builder.set_node_track_num(node, track);

vpr/src/route/rr_graph_storage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,8 @@ void t_rr_graph_storage::set_node_cost_index(RRNodeId id, RRIndexedDataId new_co
690690
node.cost_index_ = (size_t)new_cost_index;
691691
}
692692

693-
void t_rr_graph_storage::set_node_rc_index(RRNodeId id, short new_rc_index) {
694-
node_storage_[id].rc_index_ = new_rc_index;
693+
void t_rr_graph_storage::set_node_rc_index(RRNodeId id, NodeRCIndex new_rc_index) {
694+
node_storage_[id].rc_index_ = (size_t)new_rc_index;
695695
}
696696

697697
void t_rr_graph_storage::set_node_capacity(RRNodeId id, short new_capacity) {

vpr/src/route/rr_graph_storage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ class t_rr_graph_storage {
473473
void set_node_type(RRNodeId id, t_rr_type new_type);
474474
void set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2);
475475
void set_node_cost_index(RRNodeId, RRIndexedDataId new_cost_index);
476-
void set_node_rc_index(RRNodeId, short new_rc_index);
476+
void set_node_rc_index(RRNodeId, NodeRCIndex new_rc_index);
477477
void set_node_capacity(RRNodeId, short new_capacity);
478478
void set_node_direction(RRNodeId, Direction new_direction);
479479

vpr/src/route/rr_graph_timing_params.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void add_rr_graph_C_from_switches(float C_ipin_cblock) {
191191

192192
//Create the final flywieghted t_rr_rc_data
193193
for (size_t inode = 0; inode < device_ctx.rr_nodes.size(); inode++) {
194-
mutable_device_ctx.rr_nodes[inode].set_rc_index(find_create_rr_rc_data(rr_graph.node_R(RRNodeId(inode)), rr_node_C[inode]));
194+
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])));
195195
}
196196

197197
free(Couts_to_add);

vpr/src/route/rr_graph_uxsdcxx_serializer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,8 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
672672
*/
673673
inline int init_node_timing(int& inode, float C, float R) final {
674674
auto node = (*rr_nodes_)[inode];
675-
node.set_rc_index(find_create_rr_rc_data(R, C));
675+
RRNodeId node_id = node.id();
676+
rr_graph_builder_->set_node_rc_index(node_id, NodeRCIndex(find_create_rr_rc_data(R, C)));
676677
return inode;
677678
}
678679
inline void finish_node_timing(int& /*inode*/) final {}
@@ -790,7 +791,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
790791
type);
791792
}
792793

793-
node.set_rc_index(find_create_rr_rc_data(0, 0));
794+
rr_graph_builder_->set_node_rc_index(node_id, NodeRCIndex(find_create_rr_rc_data(0, 0)));
794795

795796
return id;
796797
}

vpr/src/route/rr_node.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,3 @@ bool t_rr_node::validate() const {
5454
void t_rr_node::set_cost_index(RRIndexedDataId new_cost_index) {
5555
storage_->set_node_cost_index(id_, new_cost_index);
5656
}
57-
58-
void t_rr_node::set_rc_index(short new_rc_index) {
59-
storage_->set_node_rc_index(id_, new_rc_index);
60-
}

vpr/src/route/rr_node.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ class t_rr_node {
107107

108108
public: //Mutators
109109
void set_cost_index(RRIndexedDataId);
110-
void set_rc_index(short);
111110

112111
void set_side(e_side);
113112

0 commit comments

Comments
 (0)