49 #include "debug/Drain.hh"
55 port(
name() +
".port", *this), latency(p->latency),
56 latency_var(p->latency_var), bandwidth(p->bandwidth), isBusy(false),
57 retryReq(false), retryResp(false),
58 releaseEvent(this), dequeueEvent(this)
109 "Should only see read and writes at memory controller, "
168 i->pkt->getAddr() != pkt->
getAddr())
214 DPRINTF(Drain,
"Draining of SimpleMemory complete\n");
238 if (if_name !=
"port") {
249 DPRINTF(Drain,
"SimpleMemory Queue has requests, waiting to drain\n");
258 :
SlavePort(_name, &_memory), memory(_memory)
265 ranges.push_back(memory.getAddrRange());
272 return memory.recvAtomic(pkt);
278 memory.recvFunctional(pkt);
284 return memory.recvTimingReq(pkt);
290 memory.recvRespRetry();
294 SimpleMemoryParams::create()
EventWrapper< SimpleMemory,&SimpleMemory::dequeue > dequeueEvent
void functionalAccess(PacketPtr pkt)
Perform an untimed memory read or write without changing anything but the memory itself.
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.
EventWrapper< SimpleMemory,&SimpleMemory::release > releaseEvent
BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a slave port with a given name and index.
panic_if(!root,"Invalid expression\n")
bool scheduled() const
Determine if the current event is scheduled.
std::unique_ptr< Packet > pendingDelete
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent c...
A SlavePort is a specialisation of a port.
virtual BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID)
Get a slave port with a given name and index.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
A BaseSlavePort is a protocol-agnostic slave port, responsible only for the structural connection to ...
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.
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.
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...
uint64_t Tick
Tick count type.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
Tick getLatency() const
Detemine the latency.
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...
bool needsResponse() const
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
SimpleMemory(const SimpleMemoryParams *p)
std::list< DeferredPacket > packetQueue
Internal (unbounded) storage to mimic the delay caused by the actual memory access.
bool cacheResponding() const
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...
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
void recvFunctional(PacketPtr pkt)
void sendRangeChange() const
Called by the owner to send a range change.
bool checkFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the master port.
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the master port.
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.
virtual const std::string name() const
void sendRetryReq()
Send a retry to the master port that previously attempted a sendTimingReq to this slave port and fail...
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
void recvRespRetry()
Called by the master port if sendTimingResp was called on this slave port (causing recvTimingResp to ...
void signalDrainDone() const
Signal that an object is drained.
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...
DrainState drainState() const
Return the current drain state of an object.
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.
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the master port.
void dequeue()
Dequeue a packet from our internal packet queue and move it to the port where it will be sent as soon...