14 #ifndef CORE_INTERFACES_SIMPLENETWORK_H_
15 #define CORE_INTERFACES_SIMPLENETWORK_H_
18 #include <unordered_map>
20 #include <sst/core/sst_types.h>
21 #include <sst/core/subcomponent.h>
22 #include <sst/core/params.h>
24 #include <sst/core/serialization/serializable.h>
32 namespace Interfaces {
44 static const nid_t INIT_BROADCAST_ADDR;
107 dest(0), src(0), size_in_bits(0), head(false), tail(false), payload(NULL),
108 trace(
NONE), traceID(0)
111 Request(nid_t dest, nid_t src,
size_t size_in_bits,
112 bool head,
bool tail,
Event* payload = NULL) :
113 dest(dest), src(src), size_in_bits(size_in_bits), head(head), tail(tail), payload(payload),
114 trace(
NONE), traceID(0)
120 if ( payload != NULL )
delete payload;
127 if ( payload != NULL ) req->payload = payload->
clone();
131 void setTraceID(
int id) {traceID = id;}
132 void setTraceType(
TraceType type) {trace = type;}
133 int getTraceID() {
return traceID;}
168 virtual void inspectNetworkData(
Request* req) = 0;
184 virtual bool operator()(
int) = 0;
193 template <
typename classT,
typename argT =
void>
196 typedef bool (classT::*PtrMember)(int, argT);
198 const PtrMember member;
207 Handler( classT*
const object, PtrMember member, argT data ) :
213 bool operator()(
int vn) {
214 return (object->*member)(vn,data);
221 template <
typename classT>
224 typedef bool (classT::*PtrMember)(int);
226 const PtrMember member;
233 Handler( classT*
const object, PtrMember member ) :
238 bool operator()(
int vn) {
239 return (object->*member)(vn);
282 virtual bool send(Request *req,
int vn) = 0;
294 virtual Request*
recv(
int vn) = 0;
297 virtual void init(
unsigned int phase) {}
308 virtual bool spaceToSend(
int vn,
int num_bits) = 0;
Definition: simpleNetwork.h:100
nid_t src
Definition: simpleNetwork.h:53
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
Event * inspectPayload()
Returns the payload for the request for inspection.
Definition: simpleNetwork.h:91
Definition: simpleNetwork.h:101
void givePayload(Event *event)
Sets the payload field for this request.
Definition: simpleNetwork.h:68
virtual Request * recv(int vn)=0
Receive a Request from the network.
virtual bool initialize(const std::string &portName, const UnitAlgebra &link_bw, int vns, const UnitAlgebra &in_buf_size, const UnitAlgebra &out_buf_size)=0
Second half of building the interface.
virtual void sendInitData(Request *req)=0
Sends a network request during the init() phase.
Main component object for the simulation.
Definition: component.h:56
Handler(classT *const object, PtrMember member, argT data)
Constructor.
Definition: simpleNetwork.h:207
bool tail
Definition: simpleNetwork.h:57
virtual void setup()
Called after all components have been constructed and inialization has completed, but before simulati...
Definition: simpleNetwork.h:296
virtual void setNotifyOnReceive(HandlerBase *functor)=0
Registers a functor which will fire when a new request is received from the network.
Request()
Constructor.
Definition: simpleNetwork.h:106
nid_t dest
Definition: simpleNetwork.h:52
Functor classes for handling of callbacks.
Definition: simpleNetwork.h:182
Definition: serializable.h:108
virtual Request * recvInitData()=0
Receive any data during the init() phase.
SimpleNetwork(SST::Component *comp)
Constructor, designed to be used via 'loadSubComponent'.
Definition: simpleNetwork.h:246
Handler(classT *const object, PtrMember member)
Constructor.
Definition: simpleNetwork.h:233
virtual void finish()
Called after simulation completes, but before objects are destroyed.
Definition: simpleNetwork.h:298
Definition: simpleNetwork.h:99
Represents both network sends and receives.
Definition: simpleNetwork.h:49
virtual bool send(Request *req, int vn)=0
Returns a handle to the underlying SST::Link.
virtual bool isNetworkInitialized() const =0
Check to see if network is initialized.
TraceType
Trace types.
Definition: simpleNetwork.h:98
Event Handler class with user-data argument.
Definition: simpleNetwork.h:194
bool head
Definition: simpleNetwork.h:56
virtual bool requestToReceive(int vn)=0
Checks if there is a waiting network request request pending in the specified virtual network...
virtual const UnitAlgebra & getLinkBW() const =0
Returns the final BW of the link managed by the simpleNetwork instance.
virtual bool spaceToSend(int vn, int num_bits)=0
Checks if there is sufficient space to send on the specified virtual netork.
size_t size_in_bits
Definition: simpleNetwork.h:55
virtual nid_t getEndpointID() const =0
Returns the endpoint ID.
Event * takePayload()
Returns the payload for the request.
Definition: simpleNetwork.h:78
int64_t nid_t
All Addresses can be 64-bit.
Definition: simpleNetwork.h:42
virtual void initialize(std::string id)=0
The ID uniquely identifies the component in which this subcomponent is instantiated.
Generic network interface.
Definition: simpleNetwork.h:38
virtual void init(unsigned int phase)
Used during the init phase.
Definition: simpleNetwork.h:297
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:31
Performs Unit math in full precision.
Definition: unitAlgebra.h:112
virtual void setNotifyOnSend(HandlerBase *functor)=0
Registers a functor which will fire when a request is sent to the network.
Class used to inspect network requests going through the network.
Definition: simpleNetwork.h:159
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition: subcomponent.h:27
virtual Event * clone()
Clones the event in for the case of a broadcast.
Definition: event.cc:33
int vn
Definition: simpleNetwork.h:54
Definition: serializable.h:128