Skip to content

Add a new API set_node_direction() to RRGraphBuilder #1854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions vpr/src/device/rr_graph_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ void RRGraphBuilder::clear() {
node_lookup_.clear();
}

void RRGraphBuilder::set_node_direction(RRNodeId id, Direction new_direction) {
node_storage_.set_node_direction(id, new_direction);
}
void RRGraphBuilder::set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2) {
node_storage_.set_node_coordinates(id, x1, y1, x2, y2);
}
5 changes: 4 additions & 1 deletion vpr/src/device/rr_graph_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ class RRGraphBuilder {
/** @brief Clear all the underlying data storage */
void clear();

/** @brief Set the node coordinate */
/** @brief Set the node direction */
void set_node_direction(RRNodeId, Direction new_direction);

/** @brief Set the node coordinate */
void set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2);

/* -- Internal data storage -- */
Expand Down
7 changes: 4 additions & 3 deletions vpr/src/route/clock_network_builders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ int ClockRib::create_chanx_wire(int x_start,
node.set_track_num(ptc_num);
node.set_rc_index(find_create_rr_rc_data(
x_chan_wire.layer.r_metal, x_chan_wire.layer.c_metal));
node.set_direction(direction);
rr_graph_builder.set_node_direction(chanx_node, direction);

short seg_index = 0;
switch (direction) {
Expand Down Expand Up @@ -624,15 +624,16 @@ int ClockSpine::create_chany_wire(int y_start,
rr_nodes->emplace_back();
auto node_index = rr_nodes->size() - 1;
auto node = rr_nodes->back();
RRNodeId chany_node = RRNodeId(node_index);

RRNodeId chanx_node = RRNodeId(node_index);

rr_graph_builder.set_node_coordinates(chany_node, x, y_start, x, y_end);
node.set_type(CHANY);
node.set_capacity(1);
node.set_track_num(ptc_num);
node.set_rc_index(find_create_rr_rc_data(
y_chan_wire.layer.r_metal, y_chan_wire.layer.c_metal));
node.set_direction(direction);
rr_graph_builder.set_node_direction(chanx_node, direction);

short seg_index = 0;
switch (direction) {
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/route/rr_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,

L_rr_node.set_node_ptc_num(node, track);
L_rr_node.set_node_type(node, chan_type);
L_rr_node.set_node_direction(node, seg_details[track].direction());
rr_graph_builder.set_node_direction(node, seg_details[track].direction());
}
}

Expand Down
4 changes: 3 additions & 1 deletion vpr/src/route/rr_graph_uxsdcxx_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -817,14 +817,16 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
inline void set_node_direction(uxsd::enum_node_direction direction, int& inode) final {
const auto& rr_graph = (*rr_graph_);
auto node = (*rr_nodes_)[inode];
RRNodeId node_id = node.id();

if (direction == uxsd::enum_node_direction::UXSD_INVALID) {
if (rr_graph.node_type(node.id()) == CHANX || rr_graph.node_type(node.id()) == CHANY) {
report_error(
"inode %d is type %d, which requires a direction, but no direction was supplied.",
inode, rr_graph.node_type(node.id()));
}
} else {
node.set_direction(from_uxsd_node_direction(direction));
rr_graph_builder_->set_node_direction(node_id, from_uxsd_node_direction(direction));
}
}
inline uxsd::enum_node_direction get_node_direction(const t_rr_node& node) final {
Expand Down
4 changes: 0 additions & 4 deletions vpr/src/route/rr_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ void t_rr_node::set_capacity(short new_capacity) {
storage_->set_node_capacity(id_, new_capacity);
}

void t_rr_node::set_direction(Direction new_direction) {
storage_->set_node_direction(id_, new_direction);
}

void t_rr_node::add_side(e_side new_side) {
storage_->add_node_side(id_, new_side);
}
1 change: 0 additions & 1 deletion vpr/src/route/rr_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class t_rr_node {
void set_cost_index(size_t);
void set_rc_index(short);

void set_direction(Direction);
void set_side(e_side);
void add_side(e_side);

Expand Down