refactored skip nets in LbRouter

This commit is contained in:
tangxifan 2020-02-18 22:08:51 -07:00
parent 289c869caf
commit 80fa6f8a0a
2 changed files with 51 additions and 8 deletions

View File

@ -80,14 +80,32 @@ LbRouter::t_trace* LbRouter::find_node_in_rt(t_trace* rt, const LbRRNodeId& rt_i
/**************************************************
* Private mutators
*************************************************/
void LbRouter::reset_explored_node_tb() {
for (t_explored_node_stats& explored_node : explored_node_tb_) {
explored_node.prev_index = LbRRNodeId::INVALID();
explored_node.explored_id = OPEN;
explored_node.inet = OPEN;
explored_node.enqueue_id = OPEN;
explored_node.enqueue_cost = 0;
bool LbRouter::is_skip_route_net(const LbRRGraph& lb_rr_graph,
t_trace* rt) {
/* Validate if the rr_graph is the one we used to initialize the router */
VTR_ASSERT(true == matched_lb_rr_graph(lb_rr_graph));
if (rt == nullptr) {
return false; /* Net is not routed, therefore must route net */
}
LbRRNodeId inode = rt->current_node;
/* Determine if node is overused */
if (routing_status_[inode].occ > lb_rr_graph.node_capacity(inode)) {
/* Conflict between this net and another net at this node, reroute net */
return false;
}
/* Recursively check that rest of route tree does not have a conflict */
for (unsigned int i = 0; i < rt->next_nodes.size(); i++) {
if (!is_skip_route_net(lb_rr_graph, &rt->next_nodes[i])) {
return false;
}
}
/* No conflict, this net's current route is legal, skip routing this net */
return true;
}
bool LbRouter::add_to_rt(t_trace* rt, const LbRRNodeId& node_index, const int& irt_net) {
@ -123,6 +141,13 @@ bool LbRouter::add_to_rt(t_trace* rt, const LbRRNodeId& node_index, const int& i
return false;
}
void LbRouter::add_source_to_rt(const int& inet) {
/* TODO: Validate net id */
VTR_ASSERT(nullptr == lb_nets_[inet].rt_tree);
lb_nets_[inet].rt_tree = new t_trace;
lb_nets_[inet].rt_tree->current_node = lb_nets_[inet].terminals[0];
}
void LbRouter::expand_rt_rec(t_trace* rt,
const LbRRNodeId& prev_index,
reservable_pq<t_expansion_node, std::vector<t_expansion_node>, compare_expansion_node>& pq,
@ -276,4 +301,18 @@ bool LbRouter::matched_lb_rr_graph(const LbRRGraph& lb_rr_graph) const {
&& (explored_node_tb_.size() == lb_rr_graph.nodes().size()) );
}
/**************************************************
* Private Initializer and cleaner
*************************************************/
void LbRouter::reset_explored_node_tb() {
for (t_explored_node_stats& explored_node : explored_node_tb_) {
explored_node.prev_index = LbRRNodeId::INVALID();
explored_node.explored_id = OPEN;
explored_node.inet = OPEN;
explored_node.enqueue_id = OPEN;
explored_node.enqueue_cost = 0;
}
}
} /* end namespace openfpga */

View File

@ -200,8 +200,9 @@ class LbRouter {
t_trace* find_node_in_rt(t_trace* rt, const LbRRNodeId& rt_index);
private : /* Private mutators */
void reset_explored_node_tb();
bool is_skip_route_net(const LbRRGraph& lb_rr_graph, t_trace* rt);
bool add_to_rt(t_trace* rt, const LbRRNodeId& node_index, const int& irt_net);
void add_source_to_rt(const int& inet);
void expand_rt_rec(t_trace* rt,
const LbRRNodeId& prev_index,
reservable_pq<t_expansion_node, std::vector<t_expansion_node>, compare_expansion_node>& pq,
@ -231,6 +232,9 @@ class LbRouter {
*/
bool matched_lb_rr_graph(const LbRRGraph& lb_rr_graph) const;
private : /* Private initializer and cleaner */
void reset_explored_node_tb();
private : /* Stores all data needed by intra-logic cluster_ctx.blocks router */
/* Logical Netlist Info */
std::vector<t_net> lb_nets_; /* Pointer to vector of intra logic cluster_ctx.blocks nets and their connections */