40#include "params/MemDelay.hh"
41#include "params/SimpleMemDelay.hh"
48 requestPort(
name() +
"-mem_side_port", *this),
49 responsePort(
name() +
"-cpu_side_port", *this),
50 reqQueue(*this, requestPort),
51 respQueue(*this, responsePort),
52 snoopRespQueue(*this, requestPort)
60 fatal(
"Memory delay is not connected on both sides.\n");
67 if (if_name ==
"mem_side_port") {
69 }
else if (if_name ==
"cpu_side_port") {
97 const Tick when =
curTick() + parent.delayResp(pkt) + receive_delay;
99 parent.responsePort.schedTimingResp(pkt, when);
107 if (parent.trySatisfyFunctional(pkt)) {
110 parent.responsePort.sendFunctionalSnoop(pkt);
117 const Tick delay = parent.delaySnoopResp(pkt);
119 return delay + parent.responsePort.sendAtomicSnoop(pkt);
125 parent.responsePort.sendTimingSnoopReq(pkt);
139 const Tick delay = parent.delayReq(pkt) + parent.delayResp(pkt);
141 return delay + parent.requestPort.sendAtomic(pkt);
153 const Tick when =
curTick() + parent.delayReq(pkt) + receive_delay;
155 parent.requestPort.schedTimingReq(pkt, when);
163 if (parent.trySatisfyFunctional(pkt)) {
166 parent.requestPort.sendFunctional(pkt);
173 const Tick when =
curTick() + parent.delaySnoopResp(pkt);
175 parent.requestPort.schedTimingSnoopResp(pkt, when);
184 readReqDelay(
p.read_req),
185 readRespDelay(
p.read_resp),
186 writeReqDelay(
p.write_req),
187 writeRespDelay(
p.write_resp)
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Tick recvAtomicSnoop(PacketPtr pkt) override
Receive an atomic snoop request packet from our peer.
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the peer.
void recvTimingSnoopReq(PacketPtr pkt) override
Receive a timing snoop request from the peer.
void recvFunctionalSnoop(PacketPtr pkt) override
Receive a functional snoop request packet from the peer.
RequestPort(const std::string &_name, MemDelay &_parent)
bool recvTimingReq(PacketPtr pkt) override
Receive a timing request from the peer.
ResponsePort(const std::string &_name, MemDelay &_parent)
void recvFunctional(PacketPtr pkt) override
Receive a functional request packet from the peer.
bool recvTimingSnoopResp(PacketPtr pkt) override
Receive a timing snoop response from the peer.
Tick recvAtomic(PacketPtr pkt) override
Receive an atomic request packet from the peer.
This abstract component provides a mechanism to delay packets.
bool trySatisfyFunctional(PacketPtr pkt)
MemDelay(const MemDelayParams ¶ms)
RespPacketQueue respQueue
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
ResponsePort responsePort
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
Ports are used to interface objects to each other.
bool isConnected() const
Is this port currently connected to a peer?
The QueuedRequestPort combines two queues, a request queue and a snoop response queue,...
bool trySatisfyFunctional(PacketPtr pkt)
Check the list of buffered packets against the supplied functional request.
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
bool trySatisfyFunctional(PacketPtr pkt)
Check the list of buffered packets against the supplied functional request.
const Tick writeRespDelay
Tick delayReq(PacketPtr pkt) override
Delay a request by some number of ticks.
SimpleMemDelay(const SimpleMemDelayParams ¶ms)
Tick delayResp(PacketPtr pkt) override
Delay a response by some number of ticks.
#define fatal(...)
This implements a cprintf based fatal() function.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Tick curTick()
The universal simulation clock.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
uint64_t Tick
Tick count type.
const std::string & name()