SST/macro
packet_flow_memory_model.h
Go to the documentation of this file.
1 #ifndef PACKET_FLOW_MEMORY_MODEL_H
2 #define PACKET_FLOW_MEMORY_MODEL_H
3 
9 
10 namespace sstmac {
11 namespace hw {
12 
13 
14 
15 class memory_message : public message
16 {
18 
19  public:
20  memory_message(long bytes, uint64_t id, double max_bw) :
21  bytes_(bytes), id_(id), max_bw_(max_bw)
22  {
23  }
24 
25  long byte_length() const {
26  return bytes_;
27  }
28 
29  uint64_t unique_id() const {
30  return id_;
31  }
32 
33  std::string
34  to_string() const {
35  return "memory message";
36  }
37 
38  node_id
39  toaddr() const {
40  return node_id();
41  }
42 
43  node_id
44  fromaddr() const {
45  return node_id();
46  }
47 
48  double max_bw() const {
49  return max_bw_;
50  }
51 
52  private:
53  uint64_t id_;
54  long bytes_;
55  double max_bw_;
56 };
57 
59 {
60  public:
62 
64 
65  std::string
66  packet_flow_name() const {
67  return "packet flow memory model";
68  }
69 
70  void
71  recv_credit(packet_flow_credit* credit);
72 
73  void
74  recv_packet(packet_flow_payload* pkt){}
75 
76  virtual void
77  init_factory_params(sprockit::sim_parameters* params);
78 
79  void finalize_init();
80 
81  void inject(int vn, long bytes, long byte_offset, message *payload);
82 
83  bool spaceToSend(int vn, int num_bits) const {
84  return true;
85  }
86 
87  private:
88  void
89  handle_payload(int vn, packet_flow_payload* pkt);
90 
91  void
92  init_noise_model();
93 
94  private:
95  double max_bw_;
103 
104 };
105 
106 
108  public memory_model,
109  public packetizer_callback
110 {
111  public:
113  memory_model(nd)
114  {
115  }
116 
117  virtual ~packet_flow_memory_model();
118 
119  void
120  set_event_parent(event_scheduler* m);
121 
122  virtual void
123  finalize_init();
124 
125  virtual void
126  init_factory_params(sprockit::sim_parameters* params);
127 
128  void
130  memory_model::schedule(t, handler, msg);
131  }
132 
133  void notify(int vn, message* msg);
134 
135  virtual void
136  access(long bytes, double max_bw, callback* cb);
137 
138  double
139  max_single_bw() const {
140  return max_single_bw_;
141  }
142 
143  private:
144  int allocate_channel();
145 
146  private:
148  std::map<message*, callback*> pending_requests_;
150  std::list<int> channels_available_;
152 
153 };
154 
155 }
156 } /* namespace sstmac */
157 
158 
159 #endif // PACKET_FLOW_MEMORY_MODEL_H
A class describing an event.
Definition: sst_message.h:42
The packet_allocator class Factory for creating packets.
The main interface for something that can respond to an event (sst_message).
Definition: event_handler.h:24
bool spaceToSend(int vn, int num_bits) const
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...
The interface for something that can schedule messages.
void schedule(timestamp t, event_handler *handler, message *msg)
long byte_length() const
Virtual function to return size.
std::map< message *, callback * > pending_requests_
endpoint_id node_id
Definition: node_address.h:20
packet_flow_memory_packetizer * mem_packetizer_
NotSerializable(memory_message) public
packet_flow_bandwidth_arbitrator * arb_