Skip to content

Commit 4213c3a

Browse files
is_chan --> is_chanxy && handle chanz in get_adjusted_rr_position()
1 parent fff2dc5 commit 4213c3a

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

libs/librrgraph/src/base/rr_node_types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ enum class e_rr_type : unsigned char {
3333
NUM_RR_TYPES
3434
};
3535

36+
constexpr bool is_pin(e_rr_type type) { return (type == e_rr_type::IPIN || type == e_rr_type::OPIN); }
37+
constexpr bool is_chanxy(e_rr_type type) { return (type == e_rr_type::CHANX || type == e_rr_type::CHANY); }
38+
constexpr bool is_chanz(e_rr_type type) { return (type == e_rr_type::CHANZ); }
39+
constexpr bool is_src_sink(e_rr_type type) { return (type == e_rr_type::SOURCE || type == e_rr_type::SINK); }
40+
3641
/// Used to iterate for different e_rr_type values in range-based for loops.
3742
constexpr std::array<e_rr_type, (size_t)e_rr_type::NUM_RR_TYPES> RR_TYPES = {{e_rr_type::SOURCE, e_rr_type::SINK,
3843
e_rr_type::IPIN, e_rr_type::OPIN,

vpr/src/base/vpr_types.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,10 +1447,6 @@ struct t_det_routing_arch {
14471447
std::string read_rr_edge_override_filename;
14481448
};
14491449

1450-
constexpr bool is_pin(e_rr_type type) { return (type == e_rr_type::IPIN || type == e_rr_type::OPIN); }
1451-
constexpr bool is_chan(e_rr_type type) { return (type == e_rr_type::CHANX || type == e_rr_type::CHANY); }
1452-
constexpr bool is_src_sink(e_rr_type type) { return (type == e_rr_type::SOURCE || type == e_rr_type::SINK); }
1453-
14541450
/**
14551451
* @brief Information about the current status of a particular
14561452
* net as pertains to routing

vpr/src/route/route_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ static float comp_initial_acc_cost(RRNodeId node_id,
450450
const double weight = route_opts.initial_acc_cost_chan_congestion_weight;
451451

452452
// TODO: We don't have an explicit CHANZ type. These wires are marked as CHANX. This should be fixed.
453-
if (is_chan(rr_type)) {
453+
if (is_chanxy(rr_type)) {
454454
double max_util = 0.;
455455

456456
if (rr_type == e_rr_type::CHANX) {

vpr/src/route/router_lookahead/router_lookahead_map_utils.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ std::pair<int, int> get_xy_deltas(RRNodeId from_node, RRNodeId to_node) {
594594

595595
int delta_x, delta_y;
596596

597-
if (!is_chan(from_type) && !is_chan(to_type)) {
597+
if (!is_chanxy(from_type) && !is_chanxy(to_type)) {
598598
//Alternate formulation for non-channel types
599599
auto [from_x, from_y] = get_adjusted_rr_position(from_node);
600600
auto [to_x, to_y] = get_adjusted_rr_position(to_node);
@@ -659,7 +659,7 @@ std::pair<int, int> get_xy_deltas(RRNodeId from_node, RRNodeId to_node) {
659659
/* account for wire direction. lookahead map was computed by looking up and to the right starting at INC wires. for targets
660660
* that are opposite of the wire direction, let's add 1 to delta_seg */
661661
Direction from_dir = rr_graph.node_direction(from_node);
662-
if (is_chan(from_type)
662+
if (is_chanxy(from_type)
663663
&& ((to_seg < from_seg_low && from_dir == Direction::INC) || (to_seg > from_seg_high && from_dir == Direction::DEC))) {
664664
delta_seg++;
665665
}
@@ -1412,13 +1412,15 @@ static std::pair<int, int> get_adjusted_rr_position(const RRNodeId rr) {
14121412

14131413
e_rr_type rr_type = rr_graph.node_type(rr);
14141414

1415-
if (is_chan(rr_type)) {
1415+
if (is_chanxy(rr_type)) {
14161416
return get_adjusted_rr_wire_position(rr);
14171417
} else if (is_pin(rr_type)) {
14181418
return get_adjusted_rr_pin_position(rr);
1419-
} else {
1420-
VTR_ASSERT_SAFE(is_src_sink(rr_type));
1419+
} else if (is_src_sink(rr_type)) {
14211420
return get_adjusted_rr_src_sink_position(rr);
1421+
} else {
1422+
VTR_ASSERT_SAFE(is_chanz(rr_type));
1423+
return {rr_graph.node_xlow(rr), rr_graph.node_ylow(rr)};
14221424
}
14231425
}
14241426

@@ -1492,7 +1494,7 @@ static std::pair<int, int> get_adjusted_rr_wire_position(const RRNodeId rr) {
14921494
auto& device_ctx = g_vpr_ctx.device();
14931495
const auto& rr_graph = device_ctx.rr_graph;
14941496

1495-
VTR_ASSERT_SAFE(is_chan(rr_graph.node_type(rr)));
1497+
VTR_ASSERT_SAFE(is_chanxy(rr_graph.node_type(rr)));
14961498

14971499
Direction rr_dir = rr_graph.node_direction(rr);
14981500

0 commit comments

Comments
 (0)