Skip to content

Commit 7ec9f74

Browse files
authored
Merge pull request #1872 from RapidSilicon/api_set_node_x_num
Add a new API set_node_x_num() to RRGraphBuilder
2 parents 41e0879 + bbbb3a6 commit 7ec9f74

7 files changed

+37
-29
lines changed

vpr/src/device/rr_graph_builder.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,39 @@ class RRGraphBuilder {
6969
node_storage_.set_node_coordinates(id, x1, y1, x2, y2);
7070
}
7171

72+
/** @brief Set the node_ptc_num; The ptc (pin, track, or class) number is an integer
73+
* that allows you to differentiate between wires, pins or sources/sinks with overlapping x,y coordinates or extent.
74+
* This is useful for drawing rr-graphs nicely.
75+
*
76+
* The ptc_num carries different meanings for different node types
77+
* (true in VPR RRG that is currently supported, may not be true in customized RRG)
78+
* CHANX or CHANY: the track id in routing channels
79+
* OPIN or IPIN: the index of pins in the logic block data structure
80+
* SOURCE and SINK: the class id of a pin (indicating logic equivalence of pins) in the logic block data structure */
81+
inline void set_node_ptc_num(RRNodeId id, short new_ptc_num) {
82+
node_storage_.set_node_ptc_num(id, new_ptc_num);
83+
}
84+
85+
/** @brief set_node_pin_num() is designed for logic blocks, which are IPIN and OPIN nodes */
86+
inline void set_node_pin_num(RRNodeId id, short new_pin_num) {
87+
node_storage_.set_node_pin_num(id, new_pin_num);
88+
}
89+
90+
/** @brief set_node_track_num() is designed for routing tracks, which are CHANX and CHANY nodes */
91+
inline void set_node_track_num(RRNodeId id, short new_track_num) {
92+
node_storage_.set_node_track_num(id, new_track_num);
93+
}
94+
95+
/** @brief set_ node_class_num() is designed for routing source and sinks, which are SOURCE and SINK nodes */
96+
inline void set_node_class_num(RRNodeId id, short new_class_num) {
97+
node_storage_.set_node_class_num(id, new_class_num);
98+
}
99+
72100
/** @brief Set the node direction; The node direction is only available of routing channel nodes, such as x-direction routing tracks (CHANX) and y-direction routing tracks (CHANY). For other nodes types, this value is not meaningful and should be set to NONE. */
73101
inline void set_node_direction(RRNodeId id, Direction new_direction) {
74102
node_storage_.set_node_direction(id, new_direction);
75103
}
104+
76105
/* -- Internal data storage -- */
77106
private:
78107
/* TODO: When the refactoring effort finishes,

vpr/src/route/clock_connection_builders.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x,
106106
}
107107
int ptc = max_ptc + 1;
108108

109-
rr_graph.set_node_ptc_num(node_index, ptc);
109+
rr_graph_builder.set_node_type(node_index, SINK);
110+
rr_graph_builder.set_node_class_num(node_index, ptc);
110111
rr_graph_builder.set_node_coordinates(node_index, x, y, x, y);
111112
rr_graph_builder.set_node_capacity(node_index, 1);
112113
rr_graph.set_node_cost_index(node_index, RRIndexedDataId(SINK_COST_INDEX));
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
@@ -322,7 +322,7 @@ int ClockRib::create_chanx_wire(int x_start,
322322
rr_graph_builder.set_node_type(chanx_node, CHANX);
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);
325-
node.set_track_num(ptc_num);
325+
rr_graph_builder.set_node_track_num(chanx_node, ptc_num);
326326
node.set_rc_index(find_create_rr_rc_data(
327327
x_chan_wire.layer.r_metal, x_chan_wire.layer.c_metal));
328328
rr_graph_builder.set_node_direction(chanx_node, direction);
@@ -628,7 +628,7 @@ int ClockSpine::create_chany_wire(int y_start,
628628
rr_graph_builder.set_node_type(chany_node, CHANY);
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);
631-
node.set_track_num(ptc_num);
631+
rr_graph_builder.set_node_track_num(chany_node, ptc_num);
632632
node.set_rc_index(find_create_rr_rc_data(
633633
y_chan_wire.layer.r_metal, y_chan_wire.layer.c_metal));
634634
rr_graph_builder.set_node_direction(chany_node, direction);

vpr/src/route/rr_graph.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
14381438
float R = 0.;
14391439
float C = 0.;
14401440
L_rr_node.set_node_rc_index(inode, find_create_rr_rc_data(R, C));
1441-
L_rr_node.set_node_ptc_num(inode, iclass);
1441+
rr_graph_builder.set_node_class_num(inode, iclass);
14421442
}
14431443

14441444
/* Connect IPINS to SINKS and initialize OPINS */
@@ -1486,7 +1486,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
14861486
float R = 0.;
14871487
float C = 0.;
14881488
L_rr_node.set_node_rc_index(inode, find_create_rr_rc_data(R, C));
1489-
L_rr_node.set_node_ptc_num(inode, ipin);
1489+
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,
14921492
//which greatly simplifies the drawing code
@@ -1676,8 +1676,8 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
16761676
float C = length * seg_details[track].Cmetal();
16771677
L_rr_node.set_node_rc_index(node, find_create_rr_rc_data(R, C));
16781678

1679-
L_rr_node.set_node_ptc_num(node, track);
16801679
rr_graph_builder.set_node_type(node, chan_type);
1680+
rr_graph_builder.set_node_track_num(node, track);
16811681
rr_graph_builder.set_node_direction(node, seg_details[track].direction());
16821682
}
16831683
}

vpr/src/route/rr_graph_uxsdcxx_serializer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
604604
RRNodeId node_id = node.id();
605605

606606
rr_graph_builder_->set_node_coordinates(node_id, xlow, ylow, xhigh, yhigh);
607-
node.set_ptc_num(ptc);
607+
rr_graph_builder_->set_node_ptc_num(node_id, ptc);
608608
return inode;
609609
}
610610
inline void finish_node_loc(int& /*inode*/) final {}

vpr/src/route/rr_node.cpp

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

54-
void t_rr_node::set_ptc_num(short new_ptc_num) {
55-
storage_->set_node_ptc_num(id_, new_ptc_num);
56-
}
57-
58-
void t_rr_node::set_pin_num(short new_pin_num) {
59-
storage_->set_node_pin_num(id_, new_pin_num);
60-
}
61-
62-
void t_rr_node::set_track_num(short new_track_num) {
63-
storage_->set_node_track_num(id_, new_track_num);
64-
}
65-
66-
void t_rr_node::set_class_num(short new_class_num) {
67-
storage_->set_node_class_num(id_, new_class_num);
68-
}
69-
7054
void t_rr_node::set_cost_index(RRIndexedDataId new_cost_index) {
7155
storage_->set_node_cost_index(id_, new_cost_index);
7256
}

vpr/src/route/rr_node.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,6 @@ class t_rr_node {
106106
bool validate() const;
107107

108108
public: //Mutators
109-
void set_ptc_num(short);
110-
void set_pin_num(short); //Same as set_ptc_num() by checks type() is consistent
111-
void set_track_num(short); //Same as set_ptc_num() by checks type() is consistent
112-
void set_class_num(short); //Same as set_ptc_num() by checks type() is consistent
113-
114109
void set_cost_index(RRIndexedDataId);
115110
void set_rc_index(short);
116111

0 commit comments

Comments
 (0)