SST/macro
packet_flow_switch.h
Go to the documentation of this file.
1 #ifndef PACKETFLOW_SWITCH_H
2 #define PACKETFLOW_SWITCH_H
3 
9 
10 namespace sstmac {
11 namespace hw {
12 
14  public network_switch,
16 {
17  public:
18  virtual void
19  init_factory_params(sprockit::sim_parameters* params);
20 
21  virtual void
22  initialize() = 0;
23 
24  timestamp
25  hop_latency() const {
26  return hop_lat;
27  }
28 
29  timestamp
30  lookahead() const {
31  return hop_lat;
32  }
33 
34  virtual int
35  initial_credits() const = 0;
36 
37  double
38  hop_bandwidth() const {
39  return link_bw;
40  }
41 
43  xbar_stats() const {
44  return xbar_stats_;
45  }
46 
48  buf_stats() const {
49  return buf_stats_;
50  }
51 
52  protected:
53 #if SSTMAC_INTEGRATED_SST_CORE
55  SST::ComponentId_t id,
56  SST::Params& params
57  ) : network_switch(id, params),
58  buf_stats_(nullptr),
59  xbar_stats_(nullptr),
61  { }
62 #else
64 #endif
65 
67 
69 
70  double link_bw;
71 
72  double ej_bw;
73 
75 
77 
78  double xbar_bw;
79 
81 
83 
85 
88 };
89 
90 /**
91  @class packet_flow_switch
92  A switch in the network that arbitrates/routes packet_trains
93  to the next link in the network
94  */
97 {
98 
99  public:
100 #if !SSTMAC_INTEGRATED_SST_CORE
102 #endif
103 
104 #if SSTMAC_INTEGRATED_SST_CORE
106  SST::ComponentId_t id,
107  SST::Params& params
108  );
109 #endif
110 
111  virtual ~packet_flow_switch();
112 
113  virtual void
114  initialize();
115 
117  crossbar(config* cfg);
118 
119  virtual void
120  init_factory_params(sprockit::sim_parameters* params);
121 
122  int
123  queue_length(int port) const;
124 
125  int
126  initial_credits() const {
128  }
129 
130  virtual void
131  connect(
132  int src_outport,
133  int dst_inport,
134  connection_type_t ty,
135  connectable* mod,
136  config* cfg);
137 
138  std::vector<switch_id>
139  connected_switches() const;
140 
141  /**
142  Cast message and pass to #send
143  @param msg Incoming message (should cast to packet_train)
144  */
145  void
146  handle(event* ev);
147 
148  void deadlock_check();
149 
150  void deadlock_check(event* ev);
151 
152  /**
153  Set the link to use when ejecting packets at their endpoint. A packet_flow_switch
154  can have any number of ejectors, corresponding to the number of nodes
155  per switch.
156  @param addr The compute node address of the endpoint to eject to
157  @param link The link to the compute node for ejection
158  */
159  void
160  add_ejector(node_id addr, event_handler* link);
161 
162  virtual void
163  set_event_manager(event_manager* m);
164 
165  void
166  set_topology(topology *top);
167 
168  virtual std::string
169  to_string() const;
170 
171  protected:
172  virtual void
173  connect_injector(int src_outport, int dst_inport, event_handler* nic);
174 
175  virtual void
176  connect_ejector(int src_outport, int dst_inport, event_handler* nic);
177 
178  protected:
179  sprockit::sim_parameters* params_;
180 
181  std::vector<packet_flow_sender*> out_buffers_;
182 
184 
185  private:
186  void
187  connect_output(
188  int src_outport,
189  int dst_inport,
190  connectable* mod,
191  config* cfg);
192 
193  void
194  connect_input(
195  int src_outport,
196  int dst_inport,
197  connectable* mod,
198  config* cfg);
199 
200  void resize_buffers();
201 
203  output_buffer(int port, config* cfg);
204 
205 };
206 
208 
209 }
210 }
211 
212 #endif // PACKETFLOW_SWITCH_H
packet_sent_stats * buf_stats() const
Base type for implementations of an engine that is able to schedule events and advance simulation tim...
Definition: event_manager.h:47
The main interface for something that can respond to an event (sst_message).
Definition: event_handler.h:24
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
A networkinterface is a delegate between a node and a server module.
Definition: nic.h:45
sprockit::sim_parameters * params_
The crossbar network generates a network which connects all nodes with only two hops: those to and fr...
Definition: crossbar.h:24
virtual void init_factory_params(sprockit::sim_parameters *params)
A switch in the network that arbitrates/routes packet_trains to the next link in the network...
virtual int initial_credits() const =0
std::vector< packet_flow_sender * > out_buffers_
packet_sent_stats * xbar_stats() const
endpoint_id node_id
Definition: node_address.h:20
DeclareIntegratedComponent(simple_node)
packet_flow_bandwidth_arbitrator * link_arbitrator_template