SST/macro
routable.h
Go to the documentation of this file.
1 #ifndef sstmac_hardware_network_interconnect_INTERCONNECT_MESSAGE_H
2 #define sstmac_hardware_network_interconnect_INTERCONNECT_MESSAGE_H
3 
6 #include <vector>
7 
8 namespace sstmac {
9 namespace hw {
10 
12 {
13  public:
14  typedef enum {
18  } metadata_slot;
19 
20  struct path {
21  int outport;
22  int vc;
23  /** An identifier indicating what geometric path on the topology this is following */
26 
27  path() :
28  outport(routing::uninitialized),
30  vc(uninitialized)
31  #else
32  vc(0)
33  #endif
34  {
35  }
36 
37  bool
38  metadata_bit(metadata_slot slot) const {
39  return metadata.bit(slot);
40  }
41 
42  void
43  set_metadata_bit(metadata_slot slot) {
44  metadata.set_bit(slot);
45  }
46 
47  void
48  unset_metadata_bit(metadata_slot slot) {
49  metadata.unset_bit(slot);
50  }
51 
52  void
54  metadata.clear();
55  }
56  };
57 
58  #define MAX_PATHS 32
59  class path_set
60  {
61  public:
62  path_set() : size_(0) {}
63  int size() const { return size_; }
64  void resize(int s){
65  if (s > MAX_PATHS){
67  "routable::path_set size exceeds max %d", MAX_PATHS);
68  }
69  size_ = s;
70  }
71 
72  path& operator[](int idx){
73  return paths_[idx];
74  }
75 
76  private:
77  int size_;
78  path paths_[MAX_PATHS];
79  };
80 
81  public:
82  node_id
83  toaddr() const {
84  return toaddr_;
85  }
86 
87  node_id
88  fromaddr() const {
89  return fromaddr_;
90  }
91 
92  void
94  toaddr_ = to;
95  }
96 
97  void
99  fromaddr_ = from;
100  }
101 
102  path&
104  return path_;
105  }
106 
107  void
108  assign_path(const path& pth) {
109  path_ = pth;
110  }
111 
112  void
115  path_.vc = 0;
116  }
117 
118  virtual int
119  vc() const {
120  return path_.vc;
121  }
122 
123  int
124  port() const {
125  return path_.outport;
126  }
127  void
129 
130 
131  void
133  dest_switch_ = sid;
134  }
135 
136  switch_id
137  dest_switch() const {
138  return dest_switch_;
139  }
140 
141  protected:
143 
145 
146  private:
148 
150 
152 
154 
155 };
156 
157 }
158 }
159 
161 template <>
162 class serialize<sstmac::hw::structured_routable::path>
163 {
164  public:
165  void
167  ser.primitive(info);
168  }
169 };
171 
172 #endif // INTERCONNECT_MESSAGE_H
void set_bit(int bitnum)
Definition: metadata_bits.h:23
void operator()(sstmac::hw::structured_routable::path &info, serializer &ser)
Definition: routable.h:166
bool metadata_bit(metadata_slot slot) const
Definition: routable.h:38
sprockit::metadata_bits< uint32_t > metadata
Definition: routable.h:25
void set_fromaddr(node_id from)
Definition: routable.h:98
#define MAX_PATHS
Definition: routable.h:58
void assign_path(const path &pth)
Definition: routable.h:108
void unset_metadata_bit(metadata_slot slot)
Definition: routable.h:48
int geometric_id
An identifier indicating what geometric path on the topology this is following.
Definition: routable.h:24
node_id toaddr() const
Definition: routable.h:83
node_id fromaddr() const
Definition: routable.h:88
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:33
topology_id switch_id
Definition: node_address.h:23
void serialize_order(serializer &ser)
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
virtual int vc() const
Definition: routable.h:119
void set_dest_switch(switch_id sid)
Definition: routable.h:132
#define SSTMAC_SANITY_CHECK
#define START_SERIALIZATION_NAMESPACE
Definition: serializable.h:36
#define spkt_throw_printf(exc, template_str,...)
Definition: errors.h:37
void set_toaddr(node_id to)
Definition: routable.h:93
switch_id dest_switch() const
Definition: routable.h:137
static const int uninitialized
Definition: routing_enum.h:8
#define END_SERIALIZATION_NAMESPACE
Definition: serializable.h:37
bool bit(int bitnum) const
Definition: metadata_bits.h:13
endpoint_id node_id
Definition: node_address.h:20
void unset_bit(int bitnum)
Definition: metadata_bits.h:28
void set_metadata_bit(metadata_slot slot)
Definition: routable.h:43
Error indicating some internal value was unexpected.
Definition: errors.h:83