49 #include "debug/Drain.hh" 53 port(
name() +
".port", *this), latency(p->latency),
54 latency_var(p->latency_var), bandwidth(p->bandwidth), isBusy(false),
55 retryReq(false), retryResp(false),
118 "Should only see read and writes at memory controller, " 177 !
i->pkt->matchAddr(pkt))
223 DPRINTF(Drain,
"Draining of SimpleMemory complete\n");
247 if (if_name !=
"port") {
258 DPRINTF(Drain,
"SimpleMemory Queue has requests, waiting to drain\n");
274 ranges.push_back(
memory.getAddrRange());
281 return memory.recvAtomic(pkt);
288 return memory.recvAtomicBackdoor(pkt, _backdoor);
294 memory.recvFunctional(pkt);
300 return memory.recvTimingReq(pkt);
310 SimpleMemoryParams::create()
void functionalAccess(PacketPtr pkt)
Perform an untimed memory read or write without changing anything but the memory itself.
Ports are used to interface objects to each other.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
void sendRangeChange() const
Called by the owner to send a range change.
bool isBusy
Track the state of the memory as either idle or busy, no need for an enum with only two states...
const std::string & name()
DrainState
Object drain/handover states.
EventFunctionWrapper dequeueEvent
bool cacheResponding() const
DrainState drainState() const
Return the current drain state of an object.
std::unique_ptr< Packet > pendingDelete
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent c...
void signalDrainDone() const
Signal that an object is drained.
bool isConnected() const
Is this port currently connected to a peer?
A SlavePort is a specialisation of a port.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
SimpleMemory declaration.
std::enable_if< std::is_integral< T >::value, T >::type random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
A deferred packet stores a packet along with its scheduled transmission time.
void recvFunctional(PacketPtr pkt) override
Receive a functional request packet from the peer.
const Tick latency_var
Fudge factor added to the latency.
bool recvTimingReq(PacketPtr pkt)
bool retryResp
Remember if we failed to send a response and are awaiting a retry.
bool retryReq
Remember if we have to retry an outstanding request that arrived while we were busy.
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the master port by calling its corresponding receive function...
Tick curTick()
The current simulated tick.
void init() override
Initialise this memory.
bool needsResponse() const
bool scheduled() const
Determine if the current event is scheduled.
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
The simple memory is a basic single-ported memory controller with a configurable throughput and laten...
Tick recvAtomic(PacketPtr pkt) override
Receive an atomic request packet from the peer.
uint64_t Tick
Tick count type.
bool recvTimingReq(PacketPtr pkt) override
Receive a timing request from the peer.
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
void access(PacketPtr pkt)
Perform an untimed memory access and update all the state (e.g.
const double bandwidth
Bandwidth in ticks per byte.
void release()
Release the memory after being busy and send a retry if a request was rejected in the meanwhile...
SimpleMemory(const SimpleMemoryParams *p)
std::list< DeferredPacket > packetQueue
Internal (unbounded) storage to mimic the delay caused by the actual memory access.
Draining buffers pending serialization/handover.
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
virtual const std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
void recvFunctional(PacketPtr pkt)
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
void recvRespRetry() override
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
Tick recvAtomic(PacketPtr pkt)
MemoryPort(const std::string &_name, SimpleMemory &_memory)
void reschedule(Event &event, Tick when, bool always=false)
void init() override
Initialise this memory.
void sendRetryReq()
Send a retry to the master port that previously attempted a sendTimingReq to this slave port and fail...
void schedule(Event &event, Tick when)
DrainState drain() override
Notify an object that it needs to drain its state.
An abstract memory represents a contiguous block of physical memory, with an associated address range...
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
const Tick latency
Latency from that a request is accepted until the response is ready to be sent.
AddrRangeList getAddrRanges() const override
Get a list of the non-overlapping address ranges the owner is responsible for.
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
EventFunctionWrapper releaseEvent
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &_backdoor)
void dequeue()
Dequeue a packet from our internal packet queue and move it to the port where it will be sent as soon...
Tick getLatency() const
Detemine the latency.
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &_backdoor) override
Default implementations.