12#ifndef SST_CORE_CORETEST_PORTMODULE_H
13#define SST_CORE_CORETEST_PORTMODULE_H
15#include "sst/core/component.h"
16#include "sst/core/event.h"
17#include "sst/core/subcomponent.h"
21namespace SST::CoreTestPortModule {
30 bool modified =
false;
35 Event::serialize_order(ser);
57 SST_ELI_REGISTER_PORTMODULE(
61 SST_ELI_ELEMENT_VERSION(0, 1, 0),
62 "PortModule used for testing port module functionality")
64 SST_ELI_DOCUMENT_PARAMS(
65 {
"modify",
"Set to true to have PortModule mark event as modfied. NOTE: only 1 of modify, drop or replace can be set to true.",
"false" },
66 {
"drop",
"Set to true to have PortModule drop events. NOTE: only 1 of modify, drop, or replace can be set to true.",
"false" },
67 {
"replace",
"Set to true to have PortModule drop events and deliver an Ack event instead. NOTE: only 1 of modify, drop or replace can be set to true.",
"false" },
68 {
"install_on_send",
"Controls whether the PortModule is installed on the send or receive side. Set to true to register on send and false to register on recieve.",
"false" },
71 SST_ELI_DOCUMENT_STATISTICS(
72 {
"events_intercepted",
"How many events were intercepted by the module",
"count", 4 },
73 {
"not_enabled",
"A statistic that isn't enabled in tests to ensure that stat level is respected",
"none", 7 }
76 SST_ELI_IS_CHECKPOINTABLE()
78 explicit TestPortModule(
Params& params);
81 TestPortModule() =
default;
91 bool install_on_send_ =
false;
94 bool replace_ =
false;
101 SST::PortModule::serialize_order(ser);
102 SST_SER(install_on_send_);
116 SST_ELI_REGISTER_COMPONENT(
117 coreTestPortModuleComponent,
119 "coreTestPortModuleComponent",
120 SST_ELI_ELEMENT_VERSION(1,0,0),
121 "Component to test PortModule functionality",
122 COMPONENT_CATEGORY_UNCATEGORIZED
125 SST_ELI_DOCUMENT_PORTS(
126 {
"left",
"Link to the left. Will only receive on left port. If nothing is attached to the left port, the component will send sendcount events.", {
"" } },
127 {
"right",
"Link to the right. Will only send on right port. If nothing is connect to the right port, the component will check the types of the events recieved.", {
"" } }
130 SST_ELI_DOCUMENT_PARAMS(
131 {
"sendcount",
"Events to send if send is set to true",
"20"},
132 {
"use_subcomponent",
"Set to true to use a subcomponent to hook up the ports",
"false"},
133 {
"repeat_last",
"When set to true, will keep sending \"last\" events until the simulation terminates. This is to support test of the RandomDropPortModule which doesn't check event types or values so will not automatically pass through the event marked last.",
"false" },
136 SST_ELI_DOCUMENT_STATISTICS(
137 {
"handle_modified_event",
"How many modified events were handled",
"events", 1 },
138 {
"handle_ack_event",
"How many ack events were handled",
"events", 1 },
139 {
"handle_unmodified_event",
"How many unmodified events were handled",
"events", 1 },
143 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
144 {
"port_slot",
"Slot for loading subcomponent to test shared ports",
"" }
147 SST_ELI_IS_CHECKPOINTABLE()
149 coreTestPortModuleComponent(SST::ComponentId_t
id,
SST::Params& params);
153 SST::Component::serialize_order(ser);
156 SST_SER(repeat_last_);
159 SST_SER(stat_mod_event_);
160 SST_SER(stat_unmod_event_);
161 SST_SER(stat_ack_event_);
167 bool repeat_last_ =
false;
178 coreTestPortModuleComponent() =
default;
179 coreTestPortModuleComponent(
const coreTestPortModuleComponent&) =
delete;
180 coreTestPortModuleComponent& operator=(
const coreTestPortModuleComponent&) =
delete;
182 bool tick(SST::Cycle_t);
192 SST_ELI_REGISTER_SUBCOMPONENT(
196 SST_ELI_ELEMENT_VERSION(1,0,0),
197 "Subcomponent used to test putting PortModules on shared ports",
201 SST_ELI_IS_CHECKPOINTABLE()
203 PortSubComponent(ComponentId_t
id,
Params& params);
204 PortSubComponent() =
default;
205 ~PortSubComponent() {}
207 Link* getLeft() {
return left_; }
208 Link* getRight() {
return right_; }
218 SST::SubComponent::serialize_order(ser);
Main component object for the simulation.
Definition component.h:32
Definition coreTest_PortModule.h:46
Definition coreTest_PortModule.h:28
Definition coreTest_PortModule.h:188
Definition coreTest_PortModule.h:55
void eventSent(uintptr_t key, Event *&ev) override
Function that will be called when an event is sent on a link with registered PortModules.
Definition coreTest_PortModule.cc:48
bool installOnSend() override
Called to determine if the PortModule should be installed on sends.
Definition coreTest_PortModule.h:88
void interceptHandler(uintptr_t key, Event *&data, bool &cancel) override
Function that will be called before the event handler to let the attach point intercept the data.
Definition coreTest_PortModule.cc:82
bool installOnReceive() override
Called to determine if the PortModule should be installed on receives.
Definition coreTest_PortModule.h:87
Definition coreTest_PortModule.h:113
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:43
Base class for Events - Items sent across links to communicate between components.
Definition event.h:41
Link between two components.
Definition link.h:57
Parameter store.
Definition params.h:65
PortModules are modules that can be attached to the send and/or receive side of ports.
Definition portModule.h:54
Forms the template defined base class for statistics gathering within SST.
Definition statbase.h:369
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition subcomponent.h:29