Skip to content

Commit 0010a73

Browse files
authored
Merge pull request verilog-to-routing#1847 from verilog-to-routing/rr_graph_builder_api
Add a new API ``set_node_type()`` to ``RRGraphBuilder``
2 parents e79234b + c437601 commit 0010a73

File tree

7 files changed

+13
-15
lines changed

7 files changed

+13
-15
lines changed

vpr/src/device/rr_graph_builder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class RRGraphBuilder {
3737
t_rr_graph_storage& node_storage();
3838
/** @brief Return a writable object for update the fast look-up of rr_node */
3939
RRSpatialLookup& node_lookup();
40+
/** @brief Set the type of a node with a given valid id */
41+
inline void set_node_type(RRNodeId id, t_rr_type type) {
42+
node_storage_.set_node_type(id, type);
43+
}
4044
/**
4145
* @brief Add an existing rr_node in the node storage to the node look-up
4246
*

vpr/src/route/clock_connection_builders.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x,
110110
rr_graph_builder.set_node_coordinates(node_index, x, y, x, y);
111111
rr_graph_builder.set_node_capacity(node_index, 1);
112112
rr_graph.set_node_cost_index(node_index, RRIndexedDataId(SINK_COST_INDEX));
113-
rr_graph.set_node_type(node_index, SINK);
113+
rr_graph_builder.set_node_type(node_index, SINK);
114114

115115
float R = 0.;
116116
float C = 0.;

vpr/src/route/clock_network_builders.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ int ClockRib::create_chanx_wire(int x_start,
319319
auto node = rr_nodes->back();
320320
RRNodeId chanx_node = RRNodeId(node_index);
321321

322+
rr_graph_builder.set_node_type(chanx_node, CHANX);
322323
rr_graph_builder.set_node_coordinates(chanx_node, x_start, y, x_end, y);
323-
node.set_type(CHANX);
324324
rr_graph_builder.set_node_capacity(chanx_node, 1);
325325
node.set_track_num(ptc_num);
326326
node.set_rc_index(find_create_rr_rc_data(
@@ -625,8 +625,8 @@ int ClockSpine::create_chany_wire(int y_start,
625625
auto node = rr_nodes->back();
626626
RRNodeId chany_node = RRNodeId(node_index);
627627

628+
rr_graph_builder.set_node_type(chany_node, CHANY);
628629
rr_graph_builder.set_node_coordinates(chany_node, x, y_start, x, y_end);
629-
node.set_type(CHANY);
630630
rr_graph_builder.set_node_capacity(chany_node, 1);
631631
node.set_track_num(ptc_num);
632632
node.set_rc_index(find_create_rr_rc_data(

vpr/src/route/rr_graph.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
14061406
}
14071407

14081408
L_rr_node.set_node_cost_index(inode, RRIndexedDataId(SOURCE_COST_INDEX));
1409-
L_rr_node.set_node_type(inode, SOURCE);
1409+
rr_graph_builder.set_node_type(inode, SOURCE);
14101410
} else { /* SINK */
14111411
VTR_ASSERT(class_inf[iclass].type == RECEIVER);
14121412
inode = rr_graph_builder.node_lookup().find_node(i, j, SINK, iclass);
@@ -1424,7 +1424,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
14241424
* - set_node_type(RRNodeId, t_rr_type);
14251425
*/
14261426
L_rr_node.set_node_cost_index(inode, RRIndexedDataId(SINK_COST_INDEX));
1427-
L_rr_node.set_node_type(inode, SINK);
1427+
rr_graph_builder.set_node_type(inode, SINK);
14281428
}
14291429

14301430
/* Things common to both SOURCEs and SINKs. */
@@ -1459,7 +1459,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
14591459
rr_edges_to_create.emplace_back(inode, to_node, delayless_switch);
14601460

14611461
L_rr_node.set_node_cost_index(inode, RRIndexedDataId(IPIN_COST_INDEX));
1462-
L_rr_node.set_node_type(inode, IPIN);
1462+
rr_graph_builder.set_node_type(inode, IPIN);
14631463
}
14641464
} else {
14651465
VTR_ASSERT(class_inf[iclass].type == DRIVER);
@@ -1471,7 +1471,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
14711471
if (inode) {
14721472
//Initially left unconnected
14731473
L_rr_node.set_node_cost_index(inode, RRIndexedDataId(OPIN_COST_INDEX));
1474-
L_rr_node.set_node_type(inode, OPIN);
1474+
rr_graph_builder.set_node_type(inode, OPIN);
14751475
}
14761476
}
14771477

@@ -1672,7 +1672,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
16721672
L_rr_node.set_node_rc_index(node, find_create_rr_rc_data(R, C));
16731673

16741674
L_rr_node.set_node_ptc_num(node, track);
1675-
L_rr_node.set_node_type(node, chan_type);
1675+
rr_graph_builder.set_node_type(node, chan_type);
16761676
L_rr_node.set_node_direction(node, seg_details[track].direction());
16771677
}
16781678
}

vpr/src/route/rr_graph_uxsdcxx_serializer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,8 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
763763
auto node = (*rr_nodes_)[id];
764764
RRNodeId node_id = node.id();
765765

766+
rr_graph_builder_->set_node_type(node_id, from_uxsd_node_type(type));
766767
rr_graph_builder_->set_node_capacity(node_id, capacity);
767-
node.set_type(from_uxsd_node_type(type));
768768

769769
switch (rr_graph.node_type(node.id())) {
770770
case CHANX:

vpr/src/route/rr_node.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ bool t_rr_node::validate() const {
5151
return true;
5252
}
5353

54-
void t_rr_node::set_type(t_rr_type new_type) {
55-
storage_->set_node_type(id_, new_type);
56-
}
57-
5854
void t_rr_node::set_ptc_num(short new_ptc_num) {
5955
storage_->set_node_ptc_num(id_, new_ptc_num);
6056
}

vpr/src/route/rr_node.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ class t_rr_node {
108108
bool validate() const;
109109

110110
public: //Mutators
111-
void set_type(t_rr_type new_type);
112-
113111
void set_ptc_num(short);
114112
void set_pin_num(short); //Same as set_ptc_num() by checks type() is consistent
115113
void set_track_num(short); //Same as set_ptc_num() by checks type() is consistent

0 commit comments

Comments
 (0)