diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2015-09-14 10:14:50 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2015-09-14 10:14:50 -0500 |
commit | 6bee1d912482ee57ed79bb557afdad25563e9955 (patch) | |
tree | 9cc2afe33fabc498c8d2058cffd2c5ee5dd30519 /src/mem/ruby/network/Topology.hh | |
parent | 4e898be76299f72605fd1624f04917edb2bba3c4 (diff) | |
download | gem5-6bee1d912482ee57ed79bb557afdad25563e9955.tar.xz |
ruby: topology: refactor code.
Diffstat (limited to 'src/mem/ruby/network/Topology.hh')
-rw-r--r-- | src/mem/ruby/network/Topology.hh | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/mem/ruby/network/Topology.hh b/src/mem/ruby/network/Topology.hh index 1a11156e7..7fa0914a1 100644 --- a/src/mem/ruby/network/Topology.hh +++ b/src/mem/ruby/network/Topology.hh @@ -64,28 +64,38 @@ typedef std::map<std::pair<SwitchID, SwitchID>, LinkEntry> LinkMap; class Topology { public: - Topology(uint32_t num_routers, std::vector<BasicExtLink *> ext_links, - std::vector<BasicIntLink *> int_links); + Topology(uint32_t num_routers, const std::vector<BasicExtLink *> &ext_links, + const std::vector<BasicIntLink *> &int_links); uint32_t numSwitches() const { return m_number_of_switches; } void createLinks(Network *net); void print(std::ostream& out) const { out << "[Topology]"; } - protected: + private: void addLink(SwitchID src, SwitchID dest, BasicLink* link, LinkDirection dir); void makeLink(Network *net, SwitchID src, SwitchID dest, const NetDest& routing_table_entry); - NodeID m_nodes; - uint32_t m_number_of_switches; + // Helper functions based on chapter 29 of Cormen et al. + void extend_shortest_path(Matrix ¤t_dist, Matrix &latencies, + Matrix &inter_switches); + + std::vector<std::vector<int>> shortest_path(const Matrix &weights, + Matrix &latencies, Matrix &inter_switches); + + bool link_is_shortest_path_to_node(SwitchID src, SwitchID next, + SwitchID final, const Matrix &weights, const Matrix &dist); + + NetDest shortest_path_to_node(SwitchID src, SwitchID next, + const Matrix &weights, const Matrix &dist); + + const uint32_t m_nodes; + const uint32_t m_number_of_switches; std::vector<BasicExtLink*> m_ext_link_vector; std::vector<BasicIntLink*> m_int_link_vector; - Matrix m_component_latencies; - Matrix m_component_inter_switches; - LinkMap m_link_map; }; |