Skip to content

Add a new API set_node_type() to RRGraphBuilder #1847

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

Merged
merged 6 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions vpr/src/device/rr_graph_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ RRSpatialLookup& RRGraphBuilder::node_lookup() {
return node_lookup_;
}

void RRGraphBuilder::set_node_type(RRNodeId id, t_rr_type type) {
node_storage_.set_node_type(id, type);
}

void RRGraphBuilder::add_node_to_all_locs(RRNodeId node) {
t_rr_type node_type = node_storage_.node_type(node);
short node_ptc_num = node_storage_.node_ptc_num(node);
Expand Down
2 changes: 2 additions & 0 deletions vpr/src/device/rr_graph_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class RRGraphBuilder {
t_rr_graph_storage& node_storage();
/** @brief Return a writable object for update the fast look-up of rr_node */
RRSpatialLookup& node_lookup();
/** @brief Set the type of a node with a given valid id */
void set_node_type(RRNodeId id, t_rr_type type);
/**
* @brief Add an existing rr_node in the node storage to the node look-up
*
Expand Down
3 changes: 2 additions & 1 deletion vpr/src/route/clock_connection_builders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void RoutingToClockConnection::create_switches(const ClockRRGraphBuilder& clock_
RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x, int y) {
auto& device_ctx = g_vpr_ctx.mutable_device();
auto& rr_graph = device_ctx.rr_nodes;
auto& rr_graph_builder = device_ctx.rr_graph_builder;
auto& node_lookup = device_ctx.rr_graph_builder.node_lookup();
rr_graph.emplace_back();
RRNodeId node_index = RRNodeId(rr_graph.size() - 1);
Expand All @@ -109,7 +110,7 @@ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x,
rr_graph.set_node_coordinates(node_index, x, y, x, y);
rr_graph.set_node_capacity(node_index, 1);
rr_graph.set_node_cost_index(node_index, SINK_COST_INDEX);
rr_graph.set_node_type(node_index, SINK);
rr_graph_builder.set_node_type(node_index, SINK);
float R = 0.;
float C = 0.;
rr_graph.set_node_rc_index(node_index, find_create_rr_rc_data(R, C));
Expand Down
8 changes: 4 additions & 4 deletions vpr/src/route/clock_network_builders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,10 @@ int ClockRib::create_chanx_wire(int x_start,
rr_nodes->emplace_back();
auto node_index = rr_nodes->size() - 1;
auto node = rr_nodes->back();
RRNodeId chanx_node = RRNodeId(node_index);

node.set_coordinates(x_start, y, x_end, y);
node.set_type(CHANX);
rr_graph_builder.set_node_type(chanx_node, CHANX);
node.set_capacity(1);
node.set_track_num(ptc_num);
node.set_rc_index(find_create_rr_rc_data(
Expand All @@ -345,7 +346,6 @@ int ClockRib::create_chanx_wire(int x_start,

/* Add the node to spatial lookup */
auto& rr_graph = (*rr_nodes);
RRNodeId chanx_node = RRNodeId(node_index);
/* TODO: Will replace these codes with an API add_node_to_all_locs() of RRGraphBuilder */
for (int ix = rr_graph.node_xlow(chanx_node); ix <= rr_graph.node_xhigh(chanx_node); ++ix) {
for (int iy = rr_graph.node_ylow(chanx_node); iy <= rr_graph.node_yhigh(chanx_node); ++iy) {
Expand Down Expand Up @@ -623,9 +623,10 @@ 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);

node.set_coordinates(x, y_start, x, y_end);
node.set_type(CHANY);
rr_graph_builder.set_node_type(chany_node, CHANY);
node.set_capacity(1);
node.set_track_num(ptc_num);
node.set_rc_index(find_create_rr_rc_data(
Expand All @@ -651,7 +652,6 @@ int ClockSpine::create_chany_wire(int y_start,

/* Add the node to spatial lookup */
auto& rr_graph = (*rr_nodes);
RRNodeId chany_node = RRNodeId(node_index);
/* TODO: Will replace these codes with an API add_node_to_all_locs() of RRGraphBuilder */
for (int ix = rr_graph.node_xlow(chany_node); ix <= rr_graph.node_xhigh(chany_node); ++ix) {
for (int iy = rr_graph.node_ylow(chany_node); iy <= rr_graph.node_yhigh(chany_node); ++iy) {
Expand Down
10 changes: 5 additions & 5 deletions vpr/src/route/rr_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
}

L_rr_node.set_node_cost_index(inode, SOURCE_COST_INDEX);
L_rr_node.set_node_type(inode, SOURCE);
rr_graph_builder.set_node_type(inode, SOURCE);
} else { /* SINK */
VTR_ASSERT(class_inf[iclass].type == RECEIVER);
inode = rr_graph_builder.node_lookup().find_node(i, j, SINK, iclass);
Expand All @@ -1424,7 +1424,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
* - set_node_type(RRNodeId, t_rr_type);
*/
L_rr_node.set_node_cost_index(inode, SINK_COST_INDEX);
L_rr_node.set_node_type(inode, SINK);
rr_graph_builder.set_node_type(inode, SINK);
}

/* Things common to both SOURCEs and SINKs. */
Expand Down Expand Up @@ -1459,7 +1459,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
rr_edges_to_create.emplace_back(inode, to_node, delayless_switch);

L_rr_node.set_node_cost_index(inode, IPIN_COST_INDEX);
L_rr_node.set_node_type(inode, IPIN);
rr_graph_builder.set_node_type(inode, IPIN);
}
} else {
VTR_ASSERT(class_inf[iclass].type == DRIVER);
Expand All @@ -1471,7 +1471,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
if (inode) {
//Initially left unconnected
L_rr_node.set_node_cost_index(inode, OPIN_COST_INDEX);
L_rr_node.set_node_type(inode, OPIN);
rr_graph_builder.set_node_type(inode, OPIN);
}
}

Expand Down Expand Up @@ -1672,7 +1672,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
L_rr_node.set_node_rc_index(node, find_create_rr_rc_data(R, C));

L_rr_node.set_node_ptc_num(node, track);
L_rr_node.set_node_type(node, chan_type);
rr_graph_builder.set_node_type(node, chan_type);
L_rr_node.set_node_direction(node, seg_details[track].direction());
}
}
Expand Down
3 changes: 2 additions & 1 deletion vpr/src/route/rr_graph_uxsdcxx_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,10 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
const auto& rr_graph = (*rr_graph_);
rr_nodes_->make_room_for_node(RRNodeId(id));
auto node = (*rr_nodes_)[id];
RRNodeId node_id = node.id();

node.set_capacity(capacity);
node.set_type(from_uxsd_node_type(type));
rr_graph_builder_->set_node_type(node_id, from_uxsd_node_type(type));

switch (rr_graph.node_type(node.id())) {
case CHANX:
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 @@ -51,10 +51,6 @@ bool t_rr_node::validate() const {
return true;
}

void t_rr_node::set_type(t_rr_type new_type) {
storage_->set_node_type(id_, new_type);
}

/*
* Pass in two coordinate variables describing location of node.
* They do not have to be in any particular order.
Expand Down
2 changes: 0 additions & 2 deletions vpr/src/route/rr_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ class t_rr_node {
bool validate() const;

public: //Mutators
void set_type(t_rr_type new_type);

void set_coordinates(short x1, short y1, short x2, short y2);

void set_capacity(short);
Expand Down