Go to the documentation of this file.
40 #include "debug/Drain.hh"
41 #include "debug/QOS.hh"
43 #include "params/QoSMemSinkInterface.hh"
49 :
MemCtrl(
p), requestLatency(
p->request_latency),
50 responseLatency(
p->response_latency),
51 memoryPacketSize(
p->memory_packet_size),
52 readBufferSize(
p->read_buffer_size),
53 writeBufferSize(
p->write_buffer_size), port(
name() +
".port", *this),
54 interface(
p->interface),
55 retryRdReq(false), retryWrReq(false), nextRequest(0), nextReqEvent(this)
96 "%s Should not see packets where cache is responding\n",
127 bool req_accepted =
true;
130 "%s. Should only see "
131 "read and writes at memory controller\n",
135 "%s. Should not see packets where cache is responding\n",
139 "%s: REQUESTOR %s request %s addr %lld size %d\n",
146 assert(required_entries);
155 "%s Read queue full, not accepting\n", __func__);
159 req_accepted =
false;
163 readQueue.at(pkt_priority).push_back(pkt);
169 "%s Write queue full, not accepting\n", __func__);
173 req_accepted =
false;
185 pkt->
req->requestorId(),
194 "%s scheduling next request at "
195 "time %d (next is %d)\n", __func__,
221 "%s DUMPING %s queues status\n", __func__,
226 std::string plist =
"";
231 "%s priority Queue [%i] contains %i elements, "
232 "packets are: [%s]\n", __func__,
i,
241 for (
auto queue = (*queue_ptr).rbegin();
242 queue != (*queue_ptr).rend(); ++queue) {
247 "%s checking %s queue [%d] priority [%d packets]\n",
249 curr_prio, queue->size());
251 if (!queue->empty()) {
258 "%s scheduling packet address %d for requestor %s from "
259 "priority queue %d\n", __func__, pkt->
getAddr(),
275 "%s scheduled packet address %d for requestor %s size is %d, "
276 "corresponds to %d memory packets\n", __func__, pkt->
getAddr(),
278 pkt->
getSize(), removed_entries);
282 "%s response not required\n", __func__);
290 pkt->
req->requestorId(),
298 "%s response scheduled at time %d\n",
317 "%s scheduling next request event at tick %d\n",
327 "%s queues have requests, waiting to drain\n",
341 using namespace Stats;
344 .
desc(
"Number of read retries");
346 .
desc(
"Number of write retries");
359 ranges.push_back(
memory.interface->getAddrRange());
366 return memory.recvAtomic(pkt);
374 if (!queue.trySatisfyFunctional(pkt)) {
378 memory.recvFunctional(pkt);
387 return memory.recvTimingReq(pkt);
393 QoSMemSinkCtrlParams::create()
404 QoSMemSinkInterfaceParams::create()
AddrRangeList getAddrRanges() const
Gets the configured address ranges for this port.
virtual void regStats()
Callback to set stat parameters.
void setMemCtrl(QoS::MemSinkCtrl *_ctrl)
Setting a pointer to the interface.
The QoS::MemCtrl is a base class for Memory objects which support QoS - it provides access to a set o...
void setCurrentBusState()
Set current bus direction (READ or WRITE) from next selected one.
bool cacheResponding() const
QoSMemSinkInterface(const QoSMemSinkInterfaceParams *_p)
QoSMemSinkInterface *const interface
Create pointer to interface of actual media.
uint8_t schedule(RequestorID id, uint64_t data)
void recordTurnaroundStats()
Record statistics on turnarounds based on busStateNext and busState values.
EventWrapper< MemSinkCtrl, &MemSinkCtrl::processNextReqEvent > nextReqEvent
Event wrapper to schedule next request handler function.
void processNextReqEvent()
Processes the next Request event according to configured request latency.
std::vector< PacketQueue > readQueue
QoS-aware (per priority) incoming read requests packets queue.
uint8_t numPriorities() const
Gets the total number of priority levels in the QoS memory controller.
MemoryPort(const std::string &, MemSinkCtrl &)
Constructor.
const std::string to_string(sc_enc enc)
bool writeQueueFull(const uint64_t packets) const
Check if the write queue has room for more entries.
uint64_t Tick
Tick count type.
const uint64_t readBufferSize
Read request packets queue buffer size in #packets.
bool recvTimingReq(PacketPtr pkt)
Receive a Packet in Timing mode.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
RequestPtr req
A pointer to the original request.
void recvFunctional(PacketPtr pkt)
Receive a Packet in Functional mode.
void schedTimingResp(PacketPtr pkt, Tick when)
Schedule the sending of a timing response.
void recvFunctional(PacketPtr pkt)
Receive a Packet in Functional mode.
void functionalAccess(PacketPtr pkt)
Perform an untimed memory read or write without changing anything but the memory itself.
@ Drained
Buffers drained, ready for serialization/handover.
uint8_t qosSchedule(std::initializer_list< Queues * > queues_ptr, uint64_t queue_entry_size, const PacketPtr pkt)
Assign priority to a packet by executing the configured QoS policy.
DrainState
Object drain/handover states.
An abstract memory represents a contiguous block of physical memory, with an associated address range...
void logResponse(BusState dir, RequestorID id, uint8_t qos, Addr addr, uint64_t entries, double delay)
Called upon receiving a response, updates statistics and updates queues status.
bool recvTimingReq(PacketPtr pkt)
Receive a Packet in Timing mode.
uint64_t totalWriteQueueSize
Total write request packets queue length in #packets.
uint8_t qosValue() const
QoS Value getter Returns 0 if QoS value was never set (constructor default).
T divCeil(const T &a, const U &b)
void access(PacketPtr pkt)
Perform an untimed memory access and update all the state (e.g.
Tick recvAtomic(PacketPtr pkt)
Receive a Packet in Atomic mode.
void logRequest(BusState dir, RequestorID id, uint8_t qos, Addr addr, uint64_t entries)
Called upon receiving a request or updates statistics and updates queues status.
BusState busStateNext
bus state for next request event triggered
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
System * _system
Pointer to the System object.
Ports are used to interface objects to each other.
bool needsResponse() const
uint64_t totalReadQueueSize
Total read request packets queue length in #packets.
Stats::Scalar numReadRetries
Count the number of read retries.
MemSinkCtrl(const QoSMemSinkCtrlParams *)
QoS Memory Sink Constructor.
void init() override
Initializes this object.
Port & getPort(const std::string &if_name, PortID=InvalidPortID) override
Getter method to access this memory's response port.
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
DrainState drain() override
Checks and return the Drain state of this SimObject.
const uint64_t writeBufferSize
Write request packets queue buffer size in #packets.
bool readQueueFull(const uint64_t packets) const
Check if the read queue has room for more entries.
std::vector< PacketQueue > writeQueue
QoS-aware (per priority) incoming read requests packets queue.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
const std::string & name()
std::vector< uint64_t > readQueueSizes
Read request packets queue length in #packets, per QoS priority.
const uint64_t memoryPacketSize
Memory packet size in bytes.
virtual const std::string name() const
bool retryRdReq
Read request pending.
void regStats() override
Registers statistics.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
MemoryPort port
Memory response port.
Tick recvAtomic(PacketPtr pkt)
Receive a Packet in Atomic mode.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
bool isConnected() const
Is this port currently connected to a peer?
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Tick nextRequest
Next request service time.
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
void sendRetryReq()
Send a retry to the request port that previously attempted a sendTimingReq to this response port and ...
bool retryWrReq
Write request pending.
void sendRangeChange() const
Called by the owner to send a range change.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
const Tick requestLatency
Memory between requests latency (ticks)
const std::unique_ptr< QueuePolicy > queuePolicy
QoS Queue Policy: selects packet among same-priority queue.
const Tick responseLatency
Memory response latency (ticks)
BusState busState
Bus state used to control the read/write switching and drive the scheduling of the next request.
BusState selectNextBusState()
Returns next bus direction (READ or WRITE) based on configured policy.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
@ Draining
Draining buffers pending serialization/handover.
Stats::Scalar numWriteRetries
Count the number of write retries.
Tick curTick()
The current simulated tick.
std::vector< uint64_t > writeQueueSizes
Write request packets queue length in #packets, per QoS priority.
Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17