Skip to content

Commit e4ca722

Browse files
author
Muhammad Haris Zafar
committed
Merge branch 'master' of github.com:RapidSilicon/vtr-verilog-to-routing into api_set_node_x_num
2 parents 14f735e + 37d5576 commit e4ca722

File tree

10 files changed

+53
-54
lines changed

10 files changed

+53
-54
lines changed

vpr/src/device/rr_graph_builder.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ class RRGraphBuilder {
8484
inline void set_node_ptc_num(RRNodeId id, short new_ptc_num) {
8585
node_storage_.set_node_ptc_num(id, new_ptc_num);
8686
}
87+
88+
/** @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. */
89+
inline void set_node_direction(RRNodeId id, Direction new_direction) {
90+
node_storage_.set_node_direction(id, new_direction);
91+
}
92+
8793
/* -- Internal data storage -- */
8894
private:
8995
/* TODO: When the refactoring effort finishes,

vpr/src/draw/draw.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,6 +2255,7 @@ static void draw_rr_pin(int inode, const ezgl::color& color, ezgl::renderer* g)
22552255
float xcen, ycen;
22562256
char str[vtr::bufsize];
22572257
auto& device_ctx = g_vpr_ctx.device();
2258+
const auto& rr_graph = device_ctx.rr_graph;
22582259

22592260
int ipin = device_ctx.rr_nodes[inode].ptc_num();
22602261

@@ -2265,7 +2266,7 @@ static void draw_rr_pin(int inode, const ezgl::color& color, ezgl::renderer* g)
22652266
* - draw the pin on each side that it appears
22662267
*/
22672268
for (const e_side& pin_side : SIDES) {
2268-
if (!device_ctx.rr_nodes[inode].is_node_on_specific_side(pin_side)) {
2269+
if (!rr_graph.is_node_on_specific_side(RRNodeId(inode), pin_side)) {
22692270
continue;
22702271
}
22712272
draw_get_rr_pin_coords(inode, &xcen, &ycen, pin_side);
@@ -3185,7 +3186,7 @@ static void draw_pin_to_chan_edge(int pin_node, int chan_node, ezgl::renderer* g
31853186
*/
31863187
std::vector<e_side> pin_candidate_sides;
31873188
for (const e_side& pin_candidate_side : SIDES) {
3188-
if ((pin_rr.is_node_on_specific_side(pin_candidate_side))
3189+
if ((rr_graph.is_node_on_specific_side(pin_rr.id(), pin_candidate_side))
31893190
&& (grid_type->pinloc[grid_tile.width_offset][grid_tile.height_offset][pin_candidate_side][pin_rr.pin_num()])) {
31903191
pin_candidate_sides.push_back(pin_candidate_side);
31913192
}
@@ -3312,7 +3313,7 @@ static void draw_pin_to_pin(int opin_node, int ipin_node, ezgl::renderer* g) {
33123313
float x1 = 0, y1 = 0;
33133314
std::vector<e_side> opin_candidate_sides;
33143315
for (const e_side& opin_candidate_side : SIDES) {
3315-
if (device_ctx.rr_nodes[opin_node].is_node_on_specific_side(opin_candidate_side)) {
3316+
if (rr_graph.is_node_on_specific_side(RRNodeId(opin_node), opin_candidate_side)) {
33163317
opin_candidate_sides.push_back(opin_candidate_side);
33173318
}
33183319
}
@@ -3322,7 +3323,7 @@ static void draw_pin_to_pin(int opin_node, int ipin_node, ezgl::renderer* g) {
33223323
float x2 = 0, y2 = 0;
33233324
std::vector<e_side> ipin_candidate_sides;
33243325
for (const e_side& ipin_candidate_side : SIDES) {
3325-
if (device_ctx.rr_nodes[ipin_node].is_node_on_specific_side(ipin_candidate_side)) {
3326+
if (rr_graph.is_node_on_specific_side(RRNodeId(ipin_node), ipin_candidate_side)) {
33263327
ipin_candidate_sides.push_back(ipin_candidate_side);
33273328
}
33283329
}
@@ -3338,12 +3339,12 @@ static void draw_pin_to_pin(int opin_node, int ipin_node, ezgl::renderer* g) {
33383339

33393340
static void draw_pin_to_sink(int ipin_node, int sink_node, ezgl::renderer* g) {
33403341
auto& device_ctx = g_vpr_ctx.device();
3342+
const auto& rr_graph = device_ctx.rr_graph;
33413343

33423344
float x1 = 0, y1 = 0;
33433345
/* Draw the line for each ipin on different sides */
33443346
for (const e_side& pin_side : SIDES) {
3345-
if (!device_ctx.rr_nodes[ipin_node].is_node_on_specific_side(
3346-
pin_side)) {
3347+
if (!rr_graph.is_node_on_specific_side(RRNodeId(ipin_node), pin_side)) {
33473348
continue;
33483349
}
33493350

@@ -3362,14 +3363,14 @@ static void draw_pin_to_sink(int ipin_node, int sink_node, ezgl::renderer* g) {
33623363

33633364
static void draw_source_to_pin(int source_node, int opin_node, ezgl::renderer* g) {
33643365
auto& device_ctx = g_vpr_ctx.device();
3366+
const auto& rr_graph = device_ctx.rr_graph;
33653367

33663368
float x1 = 0, y1 = 0;
33673369
draw_get_rr_src_sink_coords(device_ctx.rr_nodes[source_node], &x1, &y1);
33683370

33693371
/* Draw the line for each ipin on different sides */
33703372
for (const e_side& pin_side : SIDES) {
3371-
if (!device_ctx.rr_nodes[opin_node].is_node_on_specific_side(
3372-
pin_side)) {
3373+
if (!rr_graph.is_node_on_specific_side(RRNodeId(opin_node), pin_side)) {
33733374
continue;
33743375
}
33753376

vpr/src/route/check_rr_graph.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ void check_rr_graph(const t_graph_type graph_type,
240240
std::string pin_name = block_type_pin_index_to_name(block_type, node.pin_num());
241241
/* Print error messages for all the sides that a node may appear */
242242
for (const e_side& node_side : SIDES) {
243-
if (!node.is_node_on_specific_side(node_side)) {
243+
if (!rr_graph.is_node_on_specific_side(RRNodeId(rr_node), node_side)) {
244244
continue;
245245
}
246246
VTR_LOG_ERROR("in check_rr_graph: node %d (%s) at (%d,%d) block=%s side=%s pin=%s has no fanin.\n",
@@ -591,10 +591,10 @@ static bool has_adjacent_channel(const t_rr_node& node, const DeviceGrid& grid)
591591
const auto& rr_graph = g_vpr_ctx.device().rr_graph;
592592
VTR_ASSERT(rr_graph.node_type(node.id()) == IPIN || rr_graph.node_type(node.id()) == OPIN);
593593

594-
if ((rr_graph.node_xlow(node.id()) == 0 && !node.is_node_on_specific_side(RIGHT)) //left device edge connects only along block's right side
595-
|| (rr_graph.node_ylow(node.id()) == int(grid.height() - 1) && !node.is_node_on_specific_side(BOTTOM)) //top device edge connects only along block's bottom side
596-
|| (rr_graph.node_xlow(node.id()) == int(grid.width() - 1) && !node.is_node_on_specific_side(LEFT)) //right deivce edge connects only along block's left side
597-
|| (rr_graph.node_ylow(node.id()) == 0 && !node.is_node_on_specific_side(TOP)) //bottom deivce edge connects only along block's top side
594+
if ((rr_graph.node_xlow(node.id()) == 0 && !rr_graph.is_node_on_specific_side(node.id(), RIGHT)) //left device edge connects only along block's right side
595+
|| (rr_graph.node_ylow(node.id()) == int(grid.height() - 1) && !rr_graph.is_node_on_specific_side(node.id(), BOTTOM)) //top device edge connects only along block's bottom side
596+
|| (rr_graph.node_xlow(node.id()) == int(grid.width() - 1) && !rr_graph.is_node_on_specific_side(node.id(), LEFT)) //right deivce edge connects only along block's left side
597+
|| (rr_graph.node_ylow(node.id()) == 0 && !rr_graph.is_node_on_specific_side(node.id(), TOP)) //bottom deivce edge connects only along block's top side
598598
) {
599599
return false;
600600
}

vpr/src/route/clock_network_builders.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ int ClockRib::create_chanx_wire(int x_start,
325325
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));
328-
node.set_direction(direction);
328+
rr_graph_builder.set_node_direction(chanx_node, direction);
329329

330330
short seg_index = 0;
331331
switch (direction) {
@@ -631,7 +631,7 @@ int ClockSpine::create_chany_wire(int y_start,
631631
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));
634-
node.set_direction(direction);
634+
rr_graph_builder.set_node_direction(chany_node, direction);
635635

636636
short seg_index = 0;
637637
switch (direction) {

vpr/src/route/router_lookahead_map.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,10 +1005,9 @@ static void adjust_rr_pin_position(const RRNodeId rr, int& x, int& y) {
10051005
* Similarly for blocks at (*,0) we clip the minimum y to zero.
10061006
*/
10071007
auto& device_ctx = g_vpr_ctx.device();
1008-
const auto& temp_rr_graph = device_ctx.rr_graph; //TODO rename to rr_graph once the rr_graph below is unneeded
1009-
auto& rr_graph = device_ctx.rr_nodes;
1008+
auto& rr_graph = device_ctx.rr_graph;
10101009

1011-
VTR_ASSERT_SAFE(is_pin(temp_rr_graph.node_type(rr)));
1010+
VTR_ASSERT_SAFE(is_pin(rr_graph.node_type(rr)));
10121011
VTR_ASSERT_SAFE(rr_graph.node_xlow(rr) == rr_graph.node_xhigh(rr));
10131012
VTR_ASSERT_SAFE(rr_graph.node_ylow(rr) == rr_graph.node_yhigh(rr));
10141013

0 commit comments

Comments
 (0)