Skip to main content

CustomReq

// Constructor
SST::Interfaces::StandardMem::CustomReq(CustomData* data, flags_t flags = 0, Addr iPtr = 0,
uint32_t tid = 0);

Response Type StandardMem::CustomResp  
Needs Response true

The CustomReq class allows implementations (endpoints and/or memory systems) to add additional custom memory transactions to the set provided by StandardMem. The class wraps a generic data structure, CustomData which can be extended by endpoints and the memory system to dynamically add new request types to the StandardInterface. The CustomData class provides a minimal set of functions to enable a memory system to route requests by address, create responses, and generate debug/output for the CustomReq. CustomReq also provides functions to manage ownership (e.g., responsibility for delete) of the CustomData structure.

Member variables

Including those inherited from the StandardMem::Request base class, StandardMem::CustomReq includes the following member variables.

  • id (id_t) A request or response identifier. A request and its response contain the same identifier.
  • flags (flags_t) A 32-bit vector indicating any special flags added to the request
  • data (CustomData*) A custom data structure encapsulating any custom fields provided by the custom request
  • iPtr (Addr) An instruction pointer. This is optional metadata.
  • tid (uint32_t) An optional thread ID, can be used by memory systems if needed

Member functions

Defined in Request base class

  • getId
  • setNoncacheable
  • unsetNoncacheable
  • getNoncacheable
  • setSuccess
  • unsetSuccess
  • getSuccess
  • setFail
  • unsetFail
  • getFail
  • setTrace
  • unsetTrace
  • getTrace
  • setFlag
  • unsetFlag
  • getFlag
  • clearAllFlags
  • getAllFlags
  • getFlagString

Virtual functions inherited from the Request base class

makeResponse

Request* makeResponse();

Creates a CustomResp initialized as a response to this CustomReq request. The data field in the response is populated by calling makeResponse() on this request's custom data object.

needsResponse

bool needsResponse();

Returns the result of calling needsResponse() on the CustomData object data.

convert

SST::Event* convert(RequestConverter* converter);

Invokes convert() on the supplied converter visitor class to return an SST::Event in an implementation-specific format.

handle

virtual void handle(RequestHandler* handler) =0;

Invokes handle() on the supplied handler visitor class to handle the event according to type.

getString

virtual std::string getString() =0;

Returns a formatted string listing the fields of the CustomReq request as well as the result of calling getString() on the the CustomData object data.

Example Output:
# In this example, data->getString() returns "atomic increment at addr 0x7ffffcf0"
ID: 133, Type: CustomReq, Flags: [], atomic increment at addr 0x7ffffcf0, InstPtr: 0x0, ThreadID: 0

Member functions defined in the CustomReq class

getData

CustomData& getData();
const CustomData& getData() const;

Returns a reference to the CustomData object belonging to the request. Ownership of the CustomData is retained by the request.

setData

void setData(CustomData* dataNew);

Copies dataNew to the CustomRequest's data member. dataNew is deleted. The CustomRequest has ownership of the new data member.

resetData

CustomData* resetData(CustomData* dataNew = nullptr);

The CustomRequest updates its data member to dataNew and returns the old value of data. The CustomRequest takes ownership of dataNew. If dataNew is not provided, this function updates the data member to nullptr and returns the old value of data.

releaseData

CustomData* releaseData();

Returns the CustomRequest's data member and transfers ownership to the caller. data is updated to nullptr.

#include <sst/core/interfaces/stdMem.h>