36#include "debug/TokenPort.hh"
93 auto *request_port =
dynamic_cast<RequestPort*
>(&peer);
94 if (!token_request_port && !request_port) {
95 fatal(
"Attempt to bind port %s to unsupported response port %s.",
97 }
else if (token_request_port) {
103 }
else if (request_port) {
120 "Attempted to retry a response when no retry was queued!\n");
159 DPRINTF(TokenPort,
"Received %d tokens, have %d\n",
163 "More tokens available than the maximum after recvTokens!\n");
176 "Attempted to acquire more tokens than are available!\n");
180 DPRINTF(TokenPort,
"Acquired %d tokens, have %d\n",
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Ports are used to interface objects to each other.
const std::string name() const
Return port name (for DPRINTF).
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
void bind(Port &peer) override
Bind this request port to a response port.
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the request port by calling its corresponding receive function.
void responderUnbind()
Called by the request port to unbind.
int getMaxTokenCount() const
Return the maximum possible tokens.
void acquireTokens(int num_tokens)
Decrement the number of available tokens by num_tokens.
TokenManager(int init_tokens)
bool haveTokens(int num_tokens)
Query is num_tokens tokens are available.
void recvTokens(int num_tokens)
Increment the number of available tokens by num_tokens.
void recvTokens(int num_tokens)
Receive tokens returned by the response port.
void acquireTokens(int num_tokens)
Acquire tokens by decrementing the number of available tokens across the port.
void bind(Port &peer) override
Bind this request port to response port.
TokenManager * tokenManager
bool haveTokens(int num_tokens)
Query if there are at least num_tokens tokens available to acquire.
void setTokenManager(TokenManager *_tokenManager)
Specify a token manger, which will handle tracking of tokens for a TokenRequestPort/ResponseRequestPo...
void unbind() override
Unbind this response port and associated request port.
bool sendTimingResp(PacketPtr pkt)
void sendTokens(int num_tokens)
Return num_tokens tokens back to the request port.
TokenRequestPort * tokenRequestPort
void bind(Port &peer) override
Bind this response port to a request port.
std::deque< PacketPtr > respQueue
void recvRespRetry() override
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
#define fatal(...)
This implements a cprintf based fatal() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.