Go to the documentation of this file.
42 #include "debug/Drain.hh"
43 #include "debug/QOS.hh"
45 #include "params/QoSMemSinkInterface.hh"
57 :
MemCtrl(
p), requestLatency(
p.request_latency),
58 responseLatency(
p.response_latency),
59 memoryPacketSize(
p.memory_packet_size),
60 readBufferSize(
p.read_buffer_size),
61 writeBufferSize(
p.write_buffer_size), port(
name() +
".port", *this),
62 interface(
p.interface),
63 retryRdReq(false), retryWrReq(false), nextRequest(0), nextReqEvent(*this),
105 "%s Should not see packets where cache is responding\n",
136 bool req_accepted =
true;
139 "%s. Should only see "
140 "read and writes at memory controller\n",
144 "%s. Should not see packets where cache is responding\n",
148 "%s: REQUESTOR %s request %s addr %lld size %d\n",
155 assert(required_entries);
164 "%s Read queue full, not accepting\n", __func__);
168 req_accepted =
false;
172 readQueue.at(pkt_priority).push_back(pkt);
178 "%s Write queue full, not accepting\n", __func__);
182 req_accepted =
false;
194 pkt->
req->requestorId(),
203 "%s scheduling next request at "
204 "time %d (next is %d)\n", __func__,
230 "%s DUMPING %s queues status\n", __func__,
235 std::string plist =
"";
240 "%s priority Queue [%i] contains %i elements, "
241 "packets are: [%s]\n", __func__,
i,
250 for (
auto queue = (*queue_ptr).rbegin();
251 queue != (*queue_ptr).rend(); ++queue) {
256 "%s checking %s queue [%d] priority [%d packets]\n",
258 curr_prio, queue->size());
260 if (!queue->empty()) {
267 "%s scheduling packet address %d for requestor %s from "
268 "priority queue %d\n", __func__, pkt->
getAddr(),
284 "%s scheduled packet address %d for requestor %s size is %d, "
285 "corresponds to %d memory packets\n", __func__, pkt->
getAddr(),
287 pkt->
getSize(), removed_entries);
291 "%s response not required\n", __func__);
299 pkt->
req->requestorId(),
307 "%s response scheduled at time %d\n",
326 "%s scheduling next request event at tick %d\n",
336 "%s queues have requests, waiting to drain\n",
345 : statistics::
Group(parent),
347 "Number of read retries"),
349 "Number of write retries")
356 mem(
m), queue(
mem, *this, true)
363 ranges.push_back(
mem.interface->getAddrRange());
370 return mem.recvAtomic(pkt);
378 if (!queue.trySatisfyFunctional(pkt)) {
382 mem.recvFunctional(pkt);
391 return mem.recvTimingReq(pkt);
Tick curTick()
The universal simulation clock.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
MemSinkCtrl(const QoSMemSinkCtrlParams &)
QoS Memory Sink Constructor.
uint64_t totalReadQueueSize
Total read request packets queue length in #packets.
statistics::Scalar numReadRetries
Count the number of read retries.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
const std::unique_ptr< QueuePolicy > queuePolicy
QoS Queue Policy: selects packet among same-priority queue.
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.
void setMemCtrl(MemSinkCtrl *_ctrl)
Setting a pointer to the interface.
void sendRetryReq()
Send a retry to the request port that previously attempted a sendTimingReq to this response port and ...
Port & getPort(const std::string &if_name, PortID=InvalidPortID) override
Getter method to access this memory's response port.
RequestPtr req
A pointer to the original request.
MemoryPort port
Memory response port.
MemSinkInterface *const interface
Create pointer to interface of actual media.
System * _system
Pointer to the System object.
std::vector< PacketQueue > writeQueue
QoS-aware (per priority) incoming read requests packets queue.
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
const std::string to_string(sc_enc enc)
uint8_t qosValue() const
QoS Value getter Returns 0 if QoS value was never set (constructor default).
statistics::Scalar numWriteRetries
Count the number of write retries.
std::vector< uint64_t > readQueueSizes
Read request packets queue length in #packets, per QoS priority.
bool cacheResponding() const
Tick recvAtomic(PacketPtr pkt)
Receive a Packet in Atomic mode.
std::vector< PacketQueue > readQueue
QoS-aware (per priority) incoming read requests packets queue.
std::vector< uint64_t > writeQueueSizes
Write request packets queue length in #packets, per QoS priority.
BusState busStateNext
bus state for next request event triggered
BusState busState
Bus state used to control the read/write switching and drive the scheduling of the next request.
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.
const uint64_t readBufferSize
Read request packets queue buffer size in #packets.
bool retryWrReq
Write request pending.
void init() override
Initializes this object.
const Tick requestLatency
Memory between requests latency (ticks)
const Tick responseLatency
Memory response latency (ticks)
void recvFunctional(PacketPtr pkt)
Receive a Packet in Functional mode.
DrainState
Object drain/handover states.
uint8_t schedule(RequestorID id, uint64_t data)
const uint64_t writeBufferSize
Write request packets queue buffer size in #packets.
void functionalAccess(PacketPtr pkt)
Perform an untimed memory read or write without changing anything but the memory itself.
virtual std::string name() const
const uint64_t memoryPacketSize
Memory packet size in bytes.
BusState selectNextBusState()
Returns next bus direction (READ or WRITE) based on configured policy.
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
An abstract memory represents a contiguous block of physical memory, with an associated address range...
uint64_t Tick
Tick count type.
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
uint64_t totalWriteQueueSize
Total write request packets queue length in #packets.
bool isConnected() const
Is this port currently connected to a peer?
@ Drained
Buffers drained, ready for serialization/handover.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
DrainState drain() override
Checks and return the Drain state of this SimObject.
void recordTurnaroundStats(BusState busState, BusState busStateNext)
Record statistics on turnarounds based on busStateNext and busState values.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
bool needsResponse() const
MemSinkInterface(const QoSMemSinkInterfaceParams &_p)
const std::string & name()
Tick nextRequest
Next request service time.
void sendRangeChange() const
Called by the owner to send a range change.
static constexpr T divCeil(const T &a, const U &b)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Ports are used to interface objects to each other.
bool recvTimingReq(PacketPtr pkt)
Receive a Packet in Timing mode.
Tick recvAtomic(PacketPtr pkt)
Receive a Packet in Atomic mode.
bool writeQueueFull(const uint64_t packets) const
Check if the write queue has room for more entries.
MemberEventWrapper<&MemSinkCtrl::processNextReqEvent > nextReqEvent
Event wrapper to schedule next request handler function.
bool recvTimingReq(PacketPtr pkt)
Receive a Packet in Timing mode.
uint8_t numPriorities() const
Gets the total number of priority levels in the QoS memory controller.
MemSinkCtrlStats(statistics::Group *parent)
void recvFunctional(PacketPtr pkt)
Receive a Packet in Functional mode.
void setCurrentBusState()
Set current bus direction (READ or WRITE) from next selected one.
The qos::MemCtrl is a base class for Memory objects which support QoS - it provides access to a set o...
AddrRangeList getAddrRanges() const
Gets the configured address ranges for this port.
void schedTimingResp(PacketPtr pkt, Tick when)
Schedule the sending of a timing response.
bool readQueueFull(const uint64_t packets) const
Check if the read queue has room for more entries.
void access(PacketPtr pkt)
Perform an untimed memory access and update all the state (e.g.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
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.
bool retryRdReq
Read request pending.
@ Draining
Draining buffers pending serialization/handover.
void processNextReqEvent()
Processes the next Request event according to configured request latency.
bool scheduled() const
Determine if the current event is scheduled.
MemoryPort(const std::string &, MemSinkCtrl &)
Constructor.
Generated on Sun Jul 30 2023 01:56:58 for gem5 by doxygen 1.8.17