SST  11.0.0
StructuralSimulationToolkit
coreTest_Component.h
1 // Copyright 2009-2021 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2021, NTESS
6 // All rights reserved.
7 //
8 // Portions are copyright of other developers:
9 // See the file CONTRIBUTORS.TXT in the top level directory
10 // the distribution for more information.
11 //
12 // This file is part of the SST software package. For license
13 // information, see the LICENSE file in the top level directory of the
14 // distribution.
15 
16 #ifndef _CORETESTCOMPONENT_H
17 #define _CORETESTCOMPONENT_H
18 
19 #include <sst/core/component.h>
20 #include <sst/core/link.h>
21 #include <sst/core/rng/marsaglia.h>
22 
23 namespace SST {
24 namespace CoreTestComponent {
25 
27 {
28 public:
29 
30  // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
31  SST_ELI_REGISTER_COMPONENT(
33  "coreTestElement",
34  "coreTestComponent",
35  SST_ELI_ELEMENT_VERSION(1,0,0),
36  "CoreTest Test Component",
37  COMPONENT_CATEGORY_PROCESSOR
38  )
39 
40  SST_ELI_DOCUMENT_PARAMS(
41  { "workPerCycle", "Count of busy work to do during a clock tick.", NULL},
42  { "commFreq", "Approximate frequency of sending an event during a clock tick.", NULL},
43  { "commSize", "Size of communication to send.", "16"}
44  )
45 
46  SST_ELI_DOCUMENT_STATISTICS({ "N", "events sent on N link", "counts", 1 },
47  { "S", "events sent on S link", "counts", 1 },
48  { "E", "events sent on E link", "counts", 1 },
49  { "W", "events sent on W link", "counts", 1 }, )
50 
51  SST_ELI_DOCUMENT_PORTS(
52  {"Nlink", "Link to the coreTestComponent to the North", { "coreTestComponent.coreTestComponentEvent", "" } },
53  {"Slink", "Link to the coreTestComponent to the South", { "coreTestComponent.coreTestComponentEvent", "" } },
54  {"Elink", "Link to the coreTestComponent to the East", { "coreTestComponent.coreTestComponentEvent", "" } },
55  {"Wlink", "Link to the coreTestComponent to the West", { "coreTestComponent.coreTestComponentEvent", "" } }
56  )
57 
58  // Optional since there is nothing to document
59  SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
60  )
61 
62  coreTestComponent(SST::ComponentId_t id, SST::Params& params);
64 
65  void setup() { }
66  void finish() {
67  printf("Component Finished.\n");
68  }
69 
70 private:
71  coreTestComponent(); // for serialization only
72  coreTestComponent(const coreTestComponent&); // do not implement
73  void operator=(const coreTestComponent&); // do not implement
74 
75  void handleEvent(SST::Event *ev);
76  virtual bool clockTic(SST::Cycle_t);
77 
78  int workPerCycle;
79  int commFreq;
80  int commSize;
81  int neighbor;
82 
84  SST::Link* N;
85  SST::Link* S;
86  SST::Link* E;
87  SST::Link* W;
92 };
93 
94 } // namespace CoreTestComponent
95 } // namespace SST
96 
97 #endif /* _CORETESTCOMPONENT_H */
void setup()
Called after all components have been constructed and initialization has completed, but before simulation time has begun.
Definition: coreTest_Component.h:65
Main component object for the simulation.
Definition: component.h:31
Definition: coreTest_Component.h:26
Implements a random number generator using the Marsaglia method.
Definition: marsaglia.h:39
Parameter store.
Definition: params.h:44
void finish()
Called after simulation completes, but before objects are destroyed.
Definition: coreTest_Component.h:66
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:31