SST/macro
multipath_routing.h
Go to the documentation of this file.
1 #ifndef MULTIPATH_ROUTER_H
2 #define MULTIPATH_ROUTER_H
3 
6 #include <sprockit/util.h>
7 
8 namespace sstmac {
9 namespace hw {
10 
11 template <class ParentRouter>
13  public ParentRouter
14 {
15  public:
16  virtual void
17  route(packet* pkt){
19  ParentRouter::route(pkt, paths);
20  int path_id = paths[0].geometric_id;
21  int next_index = geom_paths_[path_id].next_index();
22  debug_printf(sprockit::dbg::router,
23  "multipath routing: using index %d", next_index);
24  pkt->interface<structured_routable>()->assign_path(paths[next_index]);
25  }
26 
27  virtual void
29  std::vector<int> reds;
30  ParentRouter::set_topology(top);
33  int npaths = reds.size();
34  geom_paths_.resize(npaths);
35  for (int i=0; i < npaths; ++i){
36  geom_paths_[i].redundancy = reds[i];
37  }
38  }
39 
40  virtual void
41  init_factory_params(sprockit::sim_parameters* params){
42  ParentRouter::init_factory_params(params);
43  }
44 
45 
46 
47  private:
48  std::vector<router::structured_path> geom_paths_;
50 
51 };
52 
53 }
54 }
55 
56 #endif // MULTIPATH_ROUTER_H
#define debug_printf(slot_bitmask,...)
Definition: debug.h:275
std::vector< router::structured_path > geom_paths_
virtual void configure_geometric_paths(std::vector< int > &redundancies)=0
configure_geometric_paths For all possible geometric or structure paths, compute their redundances in...
#define safe_cast(type,...)
First entry in VA_ARGS is the obj Second entry is optional being an error msg.
Definition: util.h:46
The cartesian_topology class Encapsulates a topology like torus that can be naturally mapped onto an ...
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
virtual void init_factory_params(sprockit::sim_parameters *params)
virtual void set_topology(topology *top)
T * interface()
Definition: sst_event.h:60
virtual void route(packet *pkt)