summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/Topology.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby/network/Topology.hh')
-rw-r--r--src/mem/ruby/network/Topology.hh26
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 &current_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;
};