Skip to content

Commit 616b31f

Browse files
authored
Merge pull request #1853 from RapidSilicon/set_node_coordinates_api
Add a new API set_node_coordinates() to RRGraphBuilder
2 parents 069d5b8 + 37547b3 commit 616b31f

8 files changed

+21
-20
lines changed

vpr/src/device/rr_graph_builder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ void RRGraphBuilder::add_node_to_all_locs(RRNodeId node) {
5050
void RRGraphBuilder::clear() {
5151
node_lookup_.clear();
5252
}
53+
54+
void RRGraphBuilder::set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2) {
55+
node_storage_.set_node_coordinates(id, x1, y1, x2, y2);
56+
}

vpr/src/device/rr_graph_builder.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class RRGraphBuilder {
5555
/** @brief Clear all the underlying data storage */
5656
void clear();
5757

58+
/** @brief Set the node coordinate */
59+
void set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2);
60+
5861
/* -- Internal data storage -- */
5962
private:
6063
/* TODO: When the refactoring effort finishes,

vpr/src/route/clock_connection_builders.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void RoutingToClockConnection::create_switches(const ClockRRGraphBuilder& clock_
9292
RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x, int y) {
9393
auto& device_ctx = g_vpr_ctx.mutable_device();
9494
auto& rr_graph = device_ctx.rr_nodes;
95+
auto& rr_graph_builder = device_ctx.rr_graph_builder;
9596
auto& node_lookup = device_ctx.rr_graph_builder.node_lookup();
9697
rr_graph.emplace_back();
9798
RRNodeId node_index = RRNodeId(rr_graph.size() - 1);
@@ -106,7 +107,7 @@ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x,
106107
int ptc = max_ptc + 1;
107108

108109
rr_graph.set_node_ptc_num(node_index, ptc);
109-
rr_graph.set_node_coordinates(node_index, x, y, x, y);
110+
rr_graph_builder.set_node_coordinates(node_index, x, y, x, y);
110111
rr_graph.set_node_capacity(node_index, 1);
111112
rr_graph.set_node_cost_index(node_index, SINK_COST_INDEX);
112113
rr_graph.set_node_type(node_index, SINK);

vpr/src/route/clock_network_builders.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,9 @@ int ClockRib::create_chanx_wire(int x_start,
317317
rr_nodes->emplace_back();
318318
auto node_index = rr_nodes->size() - 1;
319319
auto node = rr_nodes->back();
320+
RRNodeId chanx_node = RRNodeId(node_index);
320321

321-
node.set_coordinates(x_start, y, x_end, y);
322+
rr_graph_builder.set_node_coordinates(chanx_node, x_start, y, x_end, y);
322323
node.set_type(CHANX);
323324
node.set_capacity(1);
324325
node.set_track_num(ptc_num);
@@ -345,7 +346,7 @@ int ClockRib::create_chanx_wire(int x_start,
345346

346347
/* Add the node to spatial lookup */
347348
auto& rr_graph = (*rr_nodes);
348-
RRNodeId chanx_node = RRNodeId(node_index);
349+
349350
/* TODO: Will replace these codes with an API add_node_to_all_locs() of RRGraphBuilder */
350351
for (int ix = rr_graph.node_xlow(chanx_node); ix <= rr_graph.node_xhigh(chanx_node); ++ix) {
351352
for (int iy = rr_graph.node_ylow(chanx_node); iy <= rr_graph.node_yhigh(chanx_node); ++iy) {
@@ -623,8 +624,9 @@ int ClockSpine::create_chany_wire(int y_start,
623624
rr_nodes->emplace_back();
624625
auto node_index = rr_nodes->size() - 1;
625626
auto node = rr_nodes->back();
627+
RRNodeId chany_node = RRNodeId(node_index);
626628

627-
node.set_coordinates(x, y_start, x, y_end);
629+
rr_graph_builder.set_node_coordinates(chany_node, x, y_start, x, y_end);
628630
node.set_type(CHANY);
629631
node.set_capacity(1);
630632
node.set_track_num(ptc_num);
@@ -651,7 +653,7 @@ int ClockSpine::create_chany_wire(int y_start,
651653

652654
/* Add the node to spatial lookup */
653655
auto& rr_graph = (*rr_nodes);
654-
RRNodeId chany_node = RRNodeId(node_index);
656+
655657
/* TODO: Will replace these codes with an API add_node_to_all_locs() of RRGraphBuilder */
656658
for (int ix = rr_graph.node_xlow(chany_node); ix <= rr_graph.node_xhigh(chany_node); ++ix) {
657659
for (int iy = rr_graph.node_ylow(chany_node); iy <= rr_graph.node_yhigh(chany_node); ++iy) {

vpr/src/route/rr_graph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
14291429

14301430
/* Things common to both SOURCEs and SINKs. */
14311431
L_rr_node.set_node_capacity(inode, class_inf[iclass].num_pins);
1432-
L_rr_node.set_node_coordinates(inode, i, j, i + type->width - 1, j + type->height - 1);
1432+
rr_graph_builder.set_node_coordinates(inode, i, j, i + type->width - 1, j + type->height - 1);
14331433
float R = 0.;
14341434
float C = 0.;
14351435
L_rr_node.set_node_rc_index(inode, find_create_rr_rc_data(R, C));
@@ -1488,7 +1488,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
14881488
//For those pins located on multiple sides, we save the rr node index
14891489
//for the pin on all sides at which it exists
14901490
//As such, multipler driver problem can be avoided.
1491-
L_rr_node.set_node_coordinates(inode, i + width_offset, j + height_offset, i + width_offset, j + height_offset);
1491+
rr_graph_builder.set_node_coordinates(inode, i + width_offset, j + height_offset, i + width_offset, j + height_offset);
14921492
L_rr_node.add_node_side(inode, side);
14931493

14941494
// Sanity check
@@ -1660,10 +1660,10 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
16601660
L_rr_node.set_node_capacity(node, 1); /* GLOBAL routing handled elsewhere */
16611661

16621662
if (chan_type == CHANX) {
1663-
L_rr_node.set_node_coordinates(node, start, y_coord, end, y_coord);
1663+
rr_graph_builder.set_node_coordinates(node, start, y_coord, end, y_coord);
16641664
} else {
16651665
VTR_ASSERT(chan_type == CHANY);
1666-
L_rr_node.set_node_coordinates(node, x_coord, start, x_coord, end);
1666+
rr_graph_builder.set_node_coordinates(node, x_coord, start, x_coord, end);
16671667
}
16681668

16691669
int length = end - start + 1;

vpr/src/route/rr_graph_uxsdcxx_serializer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,9 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
601601

602602
inline int init_node_loc(int& inode, int ptc, int xhigh, int xlow, int yhigh, int ylow) final {
603603
auto node = (*rr_nodes_)[inode];
604+
RRNodeId node_id = node.id();
604605

605-
node.set_coordinates(xlow, ylow, xhigh, yhigh);
606+
rr_graph_builder_->set_node_coordinates(node_id, xlow, ylow, xhigh, yhigh);
606607
node.set_ptc_num(ptc);
607608
return inode;
608609
}

vpr/src/route/rr_node.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ void t_rr_node::set_type(t_rr_type new_type) {
5555
storage_->set_node_type(id_, new_type);
5656
}
5757

58-
/*
59-
* Pass in two coordinate variables describing location of node.
60-
* They do not have to be in any particular order.
61-
*/
62-
void t_rr_node::set_coordinates(short x1, short y1, short x2, short y2) {
63-
storage_->set_node_coordinates(id_, x1, y1, x2, y2);
64-
}
65-
6658
void t_rr_node::set_ptc_num(short new_ptc_num) {
6759
storage_->set_node_ptc_num(id_, new_ptc_num);
6860
}

vpr/src/route/rr_node.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ class t_rr_node {
110110
public: //Mutators
111111
void set_type(t_rr_type new_type);
112112

113-
void set_coordinates(short x1, short y1, short x2, short y2);
114-
115113
void set_capacity(short);
116114

117115
void set_ptc_num(short);

0 commit comments

Comments
 (0)