40#include <unordered_map>
45#include "debug/QOS.hh"
46#include "enums/QoSQPolicy.hh"
61 switch (
p.qos_q_policy) {
62 case enums::QoSQPolicy::fifo:
64 case enums::QoSQPolicy::lrg:
66 case enums::QoSQPolicy::lifo:
72QueuePolicy::PacketQueue::iterator
76 "Provided packet queue is not usable by queue policy");
77 return queue->begin();
80QueuePolicy::PacketQueue::iterator
84 "Provided packet queue is not usable by queue policy");
85 return std::prev(queue->end());
88QueuePolicy::PacketQueue::iterator
92 "Provided packet queue is not usable by queue policy");
93 QueuePolicy::PacketQueue::iterator ret =
q->end();
96 std::unordered_map<RequestorID, QueuePolicy::PacketQueue::iterator> track;
99 for (
auto pkt_it =
q->begin(); pkt_it !=
q->end(); ++pkt_it) {
101 const auto& pkt = *pkt_it;
104 "QoSQPolicy::lrg detected packet without request");
107 RequestorID requestor_id = pkt->req->requestorId();
108 DPRINTF(QOS,
"QoSQPolicy::lrg checking packet "
109 "from queue with id %d\n", requestor_id);
113 "%s: Unrecognized Requestor\n", __func__);
116 "%s: toServe list is empty\n", __func__);
118 if (
toServe.front() == requestor_id) {
119 DPRINTF(QOS,
"QoSQPolicy::lrg matched to served "
120 "requestor id %d\n", requestor_id);
123 toServe.push_back(requestor_id);
134 if (track.find(requestor_id) == track.end()) {
135 track[requestor_id] = pkt_it;
136 DPRINTF(QOS,
"QoSQPolicy::lrg tracking a packet for "
137 "requestor id %d\n", requestor_id);
143 for (
const auto& requestorId :
toServe) {
144 DPRINTF(QOS,
"QoSQPolicy::lrg evaluating alternative "
145 "requestor id %d\n", requestorId);
147 if (track.find(requestorId) != track.end()) {
148 ret = track[requestorId];
149 DPRINTF(QOS,
"QoSQPolicy::lrg requestor id "
150 "%d selected for service\n", requestorId);
156 DPRINTF(QOS,
"QoSQPolicy::lrg no packet was serviced\n");
167 toServe.push_back(requestor_id);
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
RequestorID requestorId() const
First In First Out Queue Policy.
PacketQueue::iterator selectPacket(PacketQueue *queue) override
Implements FCFS packet select policy.
Last In First Out Queue Policy.
PacketQueue::iterator selectPacket(PacketQueue *queue) override
Implements LIFO packet select policy.
Least Recently Granted Queue Policy It selects packets from the queue with a round robin-like policy:...
void enqueuePacket(PacketPtr pkt) override
This method is called by the memory controller after it enqueues a packet.
PacketQueue::iterator selectPacket(PacketQueue *queue) override
Implements LRG packet select policy.
std::list< RequestorID > toServe
Support structure for lrg algorithms: keeps track of serviced requestors, always serve the front elem...
bool hasRequestor(RequestorID id) const
hasRequestor returns true if the selected requestor(ID) has been registered in the memory controller,...
static QueuePolicy * create(const QoSMemCtrlParams &p)
This factory method is used for generating the queue policy.
MemCtrl * memCtrl
Pointer to parent memory controller implementing the policy.
#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.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...