SST/macro
connection.h
Go to the documentation of this file.
1 #ifndef CONNECTION_H
2 #define CONNECTION_H
3 
5 
6 #define connectable_type_invalid(ty) \
7  spkt_throw_printf(sprockit::value_error, "invalid connectable type %s", connectable::str(ty))
8 
9 #define connect_str_case(x) case x: return #x
10 
11 namespace sstmac {
12 namespace hw {
13 
14 
16 {
17  public:
18  virtual std::string
19  to_string() const = 0;
20 
21  static const int any_port = -1;
22 
23  typedef enum {
24  RedundantConnection=0, /*!< The connection has extra redundant links */
25  WeightedConnection=1, /*!< The connection is weighted. Weighting applies
26  to bandwidths and buffer sizes */
27  FixedBandwidthConnection=2, /*!< The connection has a fixed bandwidth */
28  FixedConnection=3, /*!< The connection has a fixex bandwidth and latency */
29  BasicConnection=4 /*!< The connection has no special properties
30  Use only the defauly properties */
31  } config_type_t;
32 
33  struct config {
37  double xbar_weight;
38  double link_weight;
39  int red;
40  double bw;
42  config() : xbar_weight(1.0){}
43  };
44 
45  typedef enum {
49 
50 
51  static const char*
52  str(connection_type_t ty) {
53  switch (ty) {
56  }
57  }
58 
59  /**
60  * @brief connect
61  * @param src_outport The outgoing port at the source
62  * @param dst_inport The incoming port at the destination
63  * @param ty Whether we are configuring the input or output direction
64  * @param mod The device currently being connected
65  * @param cfg A struct with various special configuration options
66  */
67  virtual void
68  connect(
69  int src_outport,
70  int dst_inport,
71  connection_type_t ty,
72  connectable* mod,
73  config* cfg) = 0;
74 
75 };
76 
78  public event_scheduler,
79  public connectable
80 {
81  protected:
82 #if SSTMAC_INTEGRATED_SST_CORE
83  connectable_component(SST::ComponentId_t id,
84  SST::Params& params) : event_scheduler(id, params)
85  {
86  }
87 #endif
88 };
89 
91  public event_subscheduler,
92  public connectable
93 {
94 #if SSTMAC_INTEGRATED_SST_CORE
95  public:
96  virtual void
97  init_sst_params(SST::Params& params, SST::Component* parent){}
98 #endif
99 };
100 
101 }
102 
103 }
104 
105 #endif // CONNECTION_H
106 
#define connect_str_case(x)
Definition: connection.h:9
static const int any_port
Definition: connection.h:21
virtual std::string to_string() const =0
static const char * str(connection_type_t ty)
Definition: connection.h:52
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...
virtual void connect(int src_outport, int dst_inport, connection_type_t ty, connectable *mod, config *cfg)=0
connect
The interface for something that can schedule messages.