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"
19namespace SST::CoreTestPortModule {
28 bool modified =
false;
33 Event::serialize_order(ser);
55 SST_ELI_REGISTER_PORTMODULE(
59 SST_ELI_ELEMENT_VERSION(0, 1, 0),
60 "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 explicit TestPortModule(
Params& params);
74 TestPortModule() =
default;
84 bool install_on_send_ =
false;
87 bool replace_ =
false;
91 SST::PortModule::serialize_order(ser);
92 SST_SER(install_on_send_);
104 SST_ELI_REGISTER_COMPONENT(
105 coreTestPortModuleComponent,
107 "coreTestPortModuleComponent",
108 SST_ELI_ELEMENT_VERSION(1,0,0),
109 "Component to test PortModule functionality",
110 COMPONENT_CATEGORY_UNCATEGORIZED
113 SST_ELI_DOCUMENT_PORTS(
114 {
"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.", {
"" } },
115 {
"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.", {
"" } }
118 SST_ELI_DOCUMENT_PARAMS(
119 {
"sendcount",
"Events to send if send is set to true",
"20"},
120 {
"use_subcomponent",
"Set to true to use a subcomponent to hook up the ports",
"false"},
121 {
"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" },
125 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
126 {
"port_slot",
"SLot for loading subcomponent to test shared ports",
"" }
129 coreTestPortModuleComponent(SST::ComponentId_t
id,
SST::Params& params);
133 SST::Component::serialize_order(ser);
136 SST_SER(repeat_last_);
144 bool repeat_last_ =
false;
151 coreTestPortModuleComponent() =
default;
152 coreTestPortModuleComponent(
const coreTestPortModuleComponent&) =
delete;
153 coreTestPortModuleComponent& operator=(
const coreTestPortModuleComponent&) =
delete;
155 bool tick(SST::Cycle_t);
165 SST_ELI_REGISTER_SUBCOMPONENT(
169 SST_ELI_ELEMENT_VERSION(1,0,0),
170 "Subcomponent used to test putting PortModules on shared ports",
174 PortSubComponent(ComponentId_t
id,
Params& params);
175 PortSubComponent() =
default;
176 ~PortSubComponent() {}
178 Link* getLeft() {
return left_; }
179 Link* getRight() {
return right_; }
189 SST::SubComponent::serialize_order(ser);
Main component object for the simulation.
Definition component.h:31
Definition coreTest_PortModule.h:44
Definition coreTest_PortModule.h:26
Definition coreTest_PortModule.h:161
Definition coreTest_PortModule.h:53
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:43
bool installOnSend() override
Called to determine if the PortModule should be installed on sends.
Definition coreTest_PortModule.h:81
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:75
bool installOnReceive() override
Called to determine if the PortModule should be installed on receives.
Definition coreTest_PortModule.h:80
Definition coreTest_PortModule.h:101
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:45
Base class for Events - Items sent across links to communicate between components.
Definition event.h:35
Link between two components.
Definition link.h:55
Parameter store.
Definition params.h:58
PortModules are modules that can be attached to the send and/or receive side of ports.
Definition portModule.h:46
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition subcomponent.h:29