Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions libs/librrgraph/src/base/check_rr_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ void check_rr_node(const RRGraphView& rr_graph,

e_pin_type class_type = e_pin_type::OPEN;
int class_num_pins = -1;
std::vector<e_side> rr_graph_sides;
std::vector<e_side> arch_side_vec;
switch (rr_type) {
case e_rr_type::SOURCE:
case e_rr_type::SINK:
Expand Down Expand Up @@ -511,6 +513,19 @@ void check_rr_node(const RRGraphView& rr_graph,
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
"in check_rr_node: inode %d (type %d) has a capacity of %d.\n", inode, rr_type, capacity);
}
rr_graph_sides = rr_graph.node_sides(rr_node);
std::tie(std::ignore, std::ignore, arch_side_vec) = get_pin_coordinates(type, ptc_num, std::vector<e_side>(TOTAL_2D_SIDES.begin(), TOTAL_2D_SIDES.end()));
// Number of sides in arch_side_vec may be higher than rr_graph sides since there may be duplicates (a pin may have different x/y offset on the same side)
// Because of that, we itearte over arch_side_vec and check if the side is in rr_graph_sides
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

itearate -> iterate

for (size_t i = 0; i < arch_side_vec.size(); i++) {
if (std::find(rr_graph_sides.begin(), rr_graph_sides.end(), arch_side_vec[i]) == rr_graph_sides.end()) {
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
"in check_rr_node: inode %d (type %d) has a different side '%s' in the RR graph and the architecture.\n",
inode,
rr_type,
TOTAL_2D_SIDE_STRINGS[rr_graph_sides[i]]);
}
}
break;

case e_rr_type::CHANX:
Expand Down
13 changes: 12 additions & 1 deletion libs/librrgraph/src/base/rr_graph_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,17 @@ const std::string& t_rr_graph_storage::node_direction_string(RRNodeId id) const
return CONST_DIRECTION_STRING[int_direction];
}


const std::vector<e_side> t_rr_graph_storage::node_sides(RRNodeId id) const {
std::vector<e_side> sides;
for (const e_side& side : TOTAL_2D_SIDES) {
if (is_node_on_specific_side(id, side)) {
sides.push_back(side);
}
}
return sides;
}

const char* t_rr_graph_storage::node_side_string(RRNodeId id) const {
for (const e_side& side : TOTAL_2D_SIDES) {
if (is_node_on_specific_side(id, side)) {
Expand Down Expand Up @@ -807,7 +818,7 @@ void t_rr_graph_storage::set_node_direction(RRNodeId id, Direction new_direction

void t_rr_graph_storage::add_node_side(RRNodeId id, e_side new_side) {
if (node_type(id) != e_rr_type::IPIN && node_type(id) != e_rr_type::OPIN) {
VTR_LOG_ERROR("Attempted to set RR node 'side' for non-channel type '%s'", node_type_string(id));
VTR_LOG_ERROR("Attempted to set RR node 'side' for non-pin type '%s'", node_type_string(id));
}
std::bitset<NUM_2D_SIDES> side_bits = node_storage_[id].dir_side_.sides;
side_bits[size_t(new_side)] = true;
Expand Down
3 changes: 3 additions & 0 deletions libs/librrgraph/src/base/rr_graph_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ class t_rr_graph_storage {
id, side);
}

/** @brief Get the sides where the node locates on. */
const std::vector<e_side> node_sides(RRNodeId id) const;

/* FIXME: This function should be DEPRECATED!
* Developers can easily use the following codes with more flexibility
*
Expand Down
5 changes: 5 additions & 0 deletions libs/librrgraph/src/base/rr_graph_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,11 @@ class RRGraphView {
return node_storage_.is_node_on_specific_side(node, side);
}

/** @brief Get the sides where the node locates on. */
inline const std::vector<e_side> node_sides(RRNodeId node) const {
return node_storage_.node_sides(node);
}

/** @brief Return a string representing the side of a routing resource node.
*/
inline const char* node_side_string(RRNodeId node) const {
Expand Down
Loading