add accessors to LBRouter

This commit is contained in:
tangxifan 2020-02-18 18:35:00 -07:00
parent 1799db810d
commit 0310dafe42
2 changed files with 37 additions and 4 deletions

View File

@ -0,0 +1,26 @@
/******************************************************************************
* Memember functions for data structure LbRouter
******************************************************************************/
#include "vtr_assert.h"
#include "lb_router.h"
/* begin namespace openfpga */
namespace openfpga {
/**************************************************
* Public Accessors
*************************************************/
std::vector<LbRRNodeId> LbRouter::find_congested_rr_nodes(const LbRRGraph& lb_rr_graph) const {
std::vector<LbRRNodeId> congested_rr_nodes;
for (const LbRRNodeId& inode : lb_rr_graph.nodes()) {
if (routing_status_[inode].occ > lb_rr_graph.node_capacity(inode)) {
congested_rr_nodes.push_back(inode);
}
}
return congested_rr_nodes;
}
} /* end namespace openfpga */

View File

@ -46,7 +46,7 @@ class LbRouter {
int historical_usage; /* Historical usage of using this node */ int historical_usage; /* Historical usage of using this node */
t_lb_rr_graph_stats() { t_routing_status() {
occ = 0; occ = 0;
mode = nullptr; mode = nullptr;
historical_usage = 0; historical_usage = 0;
@ -61,7 +61,7 @@ class LbRouter {
***************************************************************************/ ***************************************************************************/
struct t_trace { struct t_trace {
LbRRNodeId current_node; /* current t_lb_type_rr_node used by net */ LbRRNodeId current_node; /* current t_lb_type_rr_node used by net */
std::vector<t_lb_trace> next_nodes; /* index of previous edge that drives current node */ std::vector<t_trace> next_nodes; /* index of previous edge that drives current node */
}; };
/************************************************************************** /**************************************************************************
@ -73,9 +73,9 @@ class LbRouter {
std::vector<LbRRNodeId> terminals; /* endpoints of the intra_lb_net, 0th position is the source, all others are sinks */ std::vector<LbRRNodeId> terminals; /* endpoints of the intra_lb_net, 0th position is the source, all others are sinks */
std::vector<AtomPinId> atom_pins; /* AtomPin's associated with each terminal */ std::vector<AtomPinId> atom_pins; /* AtomPin's associated with each terminal */
std::vector<bool> fixed_terminals; /* Marks a terminal as having a fixed target (i.e. a pin not a sink) */ std::vector<bool> fixed_terminals; /* Marks a terminal as having a fixed target (i.e. a pin not a sink) */
t_lb_trace* rt_tree; /* Route tree head */ t_trace* rt_tree; /* Route tree head */
t_lb_rr_net() { t_net() {
atom_net_id = AtomNetId::INVALID(); atom_net_id = AtomNetId::INVALID();
rt_tree = nullptr; rt_tree = nullptr;
} }
@ -148,6 +148,13 @@ class LbRouter {
return is_mode_conflict || try_expand_all_modes; return is_mode_conflict || try_expand_all_modes;
} }
}; };
public : /* Public accessors */
/**
* Find all the routing resource nodes that is congested, which they are used more than their capacity
* This function is call to collect the nodes and router can reroute these net
*/
std::vector<LbRRNodeId> find_congested_rr_nodes(const LbRRGraph& lb_rr_graph) const;
private : /* Stores all data needed by intra-logic cluster_ctx.blocks router */ private : /* Stores all data needed by intra-logic cluster_ctx.blocks router */
/* Logical Netlist Info */ /* Logical Netlist Info */