From 0310dafe423edf0bb363da6a8b96a9a17bd0ca2a Mon Sep 17 00:00:00 2001 From: tangxifan Date: Tue, 18 Feb 2020 18:35:00 -0700 Subject: [PATCH] add accessors to LBRouter --- openfpga/src/repack/lb_router.cpp | 26 ++++++++++++++++++++++++++ openfpga/src/repack/lb_router.h | 15 +++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 openfpga/src/repack/lb_router.cpp diff --git a/openfpga/src/repack/lb_router.cpp b/openfpga/src/repack/lb_router.cpp new file mode 100644 index 000000000..be2cbe37f --- /dev/null +++ b/openfpga/src/repack/lb_router.cpp @@ -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 LbRouter::find_congested_rr_nodes(const LbRRGraph& lb_rr_graph) const { + std::vector 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 */ diff --git a/openfpga/src/repack/lb_router.h b/openfpga/src/repack/lb_router.h index c0e575324..ae45afba5 100644 --- a/openfpga/src/repack/lb_router.h +++ b/openfpga/src/repack/lb_router.h @@ -46,7 +46,7 @@ class LbRouter { int historical_usage; /* Historical usage of using this node */ - t_lb_rr_graph_stats() { + t_routing_status() { occ = 0; mode = nullptr; historical_usage = 0; @@ -61,7 +61,7 @@ class LbRouter { ***************************************************************************/ struct t_trace { LbRRNodeId current_node; /* current t_lb_type_rr_node used by net */ - std::vector next_nodes; /* index of previous edge that drives current node */ + std::vector next_nodes; /* index of previous edge that drives current node */ }; /************************************************************************** @@ -73,9 +73,9 @@ class LbRouter { std::vector terminals; /* endpoints of the intra_lb_net, 0th position is the source, all others are sinks */ std::vector atom_pins; /* AtomPin's associated with each terminal */ std::vector 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(); rt_tree = nullptr; } @@ -148,6 +148,13 @@ class LbRouter { 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 find_congested_rr_nodes(const LbRRGraph& lb_rr_graph) const; private : /* Stores all data needed by intra-logic cluster_ctx.blocks router */ /* Logical Netlist Info */