SST/macro
fat_tree_global_adaptive_router.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SSTMAC_HARDWARE_NETWORK_SWTICHES_ROUTING_FATTREEGLOBALADAPTIVEROUTER_H_INCLUDED
13 #define SSTMAC_HARDWARE_NETWORK_SWTICHES_ROUTING_FATTREEGLOBALADAPTIVEROUTER_H_INCLUDED
14 
16 #include <set>
17 
18 namespace sstmac {
19 namespace hw {
20 
21 /**
22  * @brief The fat_tree_global_adaptive_router class
23  * Router encapsulating the special routing computations that must occur on
24  * a fat tree topology.
25  */
27  public fat_tree_router
28 {
29  public:
31 
34  {
35  }
36 
37  virtual std::string
38  to_string() const {
39  return "fattreegarouter";
40  }
41 
42  // fields used to distinguish between packets
43  struct Match_Fields {
44  // app id
45  // flow id
48  bool operator==(const Match_Fields & mf) const {
49  return ((src == mf.src) &&
50  (dst == mf.dst));
51  }
52 
53  bool operator<(const Match_Fields & mf) const {
54  return ((src < mf.src)?true:
55  (dst < mf.dst));
56  }
57 
58  };
59 
60  // (src, dst) -> outport
61  struct Entry {
63  int vc;
64  int outport;
65 
66  bool operator==(const Entry & entry) const {
67  return ((match_fields == entry.match_fields) && (vc == entry.vc) && (outport == entry.outport));
68  }
69 
70  bool operator<(const Entry & entry) const {
71  return ((match_fields < entry.match_fields)?true:((vc < entry.vc)?true:(outport < entry.outport)));
72  }
73  };
74 
75  typedef std::set <Entry> Table;
76 
77  void
78  add_entry(const Entry & entry);
79 
80  // no delete entry
81 
82  Match_Fields *
83  get_packet_metadata(packet * pkt) const;
84 
85  virtual void
86  route(packet* pkt);
87 
88  private:
89  Table table;
90 };
91 
92 }
93 }
94 #endif
Match_Fields * get_packet_metadata(packet *pkt) const
The fat_tree_global_adaptive_router class Router encapsulating the special routing computations that ...
topology_id switch_id
Definition: node_address.h:23
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
The fat_tree_router class Router encapsulating the special routing computations that must occur on a ...