Topology.hh (11663:cf870cd20cfc) | Topology.hh (11664:2365e9e396f7) |
---|---|
1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 38 unchanged lines hidden (view full) --- 47#include "mem/protocol/LinkDirection.hh" 48#include "mem/ruby/common/TypeDefines.hh" 49#include "mem/ruby/network/BasicLink.hh" 50 51class NetDest; 52class Network; 53 54typedef std::vector<std::vector<int> > Matrix; | 1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 38 unchanged lines hidden (view full) --- 47#include "mem/protocol/LinkDirection.hh" 48#include "mem/ruby/common/TypeDefines.hh" 49#include "mem/ruby/network/BasicLink.hh" 50 51class NetDest; 52class Network; 53 54typedef std::vector<std::vector<int> > Matrix; |
55typedef std::string PortDirection; |
|
55 56struct LinkEntry 57{ 58 BasicLink *link; 59 LinkDirection direction; | 56 57struct LinkEntry 58{ 59 BasicLink *link; 60 LinkDirection direction; |
61 PortDirection src_outport_dirn; 62 PortDirection dst_inport_dirn; |
|
60}; 61 62typedef std::map<std::pair<SwitchID, SwitchID>, LinkEntry> LinkMap; 63 64class Topology 65{ 66 public: 67 Topology(uint32_t num_routers, const std::vector<BasicExtLink *> &ext_links, 68 const std::vector<BasicIntLink *> &int_links); 69 70 uint32_t numSwitches() const { return m_number_of_switches; } 71 void createLinks(Network *net); 72 void print(std::ostream& out) const { out << "[Topology]"; } 73 74 private: | 63}; 64 65typedef std::map<std::pair<SwitchID, SwitchID>, LinkEntry> LinkMap; 66 67class Topology 68{ 69 public: 70 Topology(uint32_t num_routers, const std::vector<BasicExtLink *> &ext_links, 71 const std::vector<BasicIntLink *> &int_links); 72 73 uint32_t numSwitches() const { return m_number_of_switches; } 74 void createLinks(Network *net); 75 void print(std::ostream& out) const { out << "[Topology]"; } 76 77 private: |
75 void addLink(SwitchID src, SwitchID dest, BasicLink* link); | 78 void addLink(SwitchID src, SwitchID dest, BasicLink* link, 79 PortDirection src_outport_dirn = "", 80 PortDirection dest_inport_dirn = ""); |
76 void makeLink(Network *net, SwitchID src, SwitchID dest, 77 const NetDest& routing_table_entry); 78 79 // Helper functions based on chapter 29 of Cormen et al. 80 void extend_shortest_path(Matrix ¤t_dist, Matrix &latencies, 81 Matrix &inter_switches); 82 83 std::vector<std::vector<int>> shortest_path(const Matrix &weights, --- 26 unchanged lines hidden --- | 81 void makeLink(Network *net, SwitchID src, SwitchID dest, 82 const NetDest& routing_table_entry); 83 84 // Helper functions based on chapter 29 of Cormen et al. 85 void extend_shortest_path(Matrix ¤t_dist, Matrix &latencies, 86 Matrix &inter_switches); 87 88 std::vector<std::vector<int>> shortest_path(const Matrix &weights, --- 26 unchanged lines hidden --- |