Go to the documentation of this file.
43 #include "debug/RubyQueue.hh"
45 #include "mem/ruby/protocol/MemoryMsg.hh"
58 m_clusterID(
p.cluster_id),
59 m_id(
p.
system->getRequestorId(this)), m_is_blocking(false),
60 m_number_of_TBEs(
p.number_of_TBEs),
61 m_transitions_per_cycle(
p.transitions_per_cycle),
62 m_buffer_size(
p.buffer_size), m_recycle_latency(
p.recycle_latency),
63 m_mandatory_queue_latency(
p.mandatory_queue_latency),
64 m_waiting_mem_retry(false),
65 m_mem_ctrl_waiting_retry(false),
67 addrRanges(
p.addr_ranges.begin(),
p.addr_ranges.end()),
68 mRetryRespEvent{*
this,
false},
83 for (uint32_t
i = 0;
i < size;
i++) {
97 for (
auto abs_cntrl :
params().downstream_destinations) {
98 MachineID mid = abs_cntrl->getMachineID();
100 for (
const auto &addr_range : ranges) {
103 (
i->second.intersects(addr_range) !=
i->second.end())) {
104 fatal(
"%s: %s mapped to multiple machines of the same type\n",
105 name(), addr_range.to_string());
115 for (
auto abs_cntrl :
params().upstream_destinations) {
125 for (uint32_t
i = 0;
i < size;
i++) {
163 bool has_other_msgs =
false;
165 for (
unsigned int port = 0; port < msgVec->size(); ++port) {
166 if ((*msgVec)[port] == buf) {
168 (*msgVec)[port] = NULL;
169 }
else if ((*msgVec)[port] != NULL) {
170 has_other_msgs =
true;
173 if (!has_other_msgs) {
235 for (MsgVecType::iterator vec_iter = buf_iter->second->begin();
236 vec_iter != buf_iter->second->end();
241 if (*vec_iter != NULL &&
242 (wokeUpMsgBufs.count(*vec_iter) == 0)) {
243 (*vec_iter)->reanalyzeAllMessages(
clockEdge());
244 wokeUpMsgBufs.insert(*vec_iter);
247 wokeUpMsgVecs.push_back(buf_iter->second);
251 wb_iter != wokeUpMsgVecs.end();
269 const MemoryMsg *mem_msg = (
const MemoryMsg*)mem_queue->peek();
271 if (mem_msg->m_Len > 0) {
272 req_size = mem_msg->m_Len;
276 = std::make_shared<Request>(mem_msg->m_addr, req_size, 0,
m_id);
278 if (mem_msg->getType() == MemoryRequestType_MEMORY_WB) {
283 }
else if (mem_msg->getType() == MemoryRequestType_MEMORY_READ) {
285 uint8_t *newData =
new uint8_t[req_size];
288 panic(
"Unknown memory request type (%s) for addr %p",
289 MemoryRequestType_to_string(mem_msg->getType()),
365 int num_functional_writes = 0;
369 return num_functional_writes + 1;
379 if (!memRspQueue->areNSlotsAvailable(1,
curTick())) {
384 std::shared_ptr<MemoryMsg> msg = std::make_shared<MemoryMsg>(
clockEdge());
385 (*msg).m_addr = pkt->
getAddr();
389 (*msg).m_OriginalRequestorMachId =
s->id;
393 (*msg).m_Type = MemoryRequestType_MEMORY_READ;
394 (*msg).m_MessageSize = MessageSizeType_Response_Data;
397 (*msg).m_DataBlk.setData(pkt->
getPtr<uint8_t>(), 0,
400 (*msg).m_Type = MemoryRequestType_MEMORY_WB;
401 (*msg).m_MessageSize = MessageSizeType_Writeback_Control;
403 panic(
"Incorrect packet type received from memory controller!");
429 if (mtype == MachineType_NUM) {
432 const auto mapping =
i.second.contains(
addr);
433 if (mapping !=
i.second.end())
434 return mapping->second;
440 const auto mapping =
i->second.contains(
addr);
441 if (mapping !=
i->second.end())
442 return mapping->second;
445 fatal(
"%s: couldn't find mapping for address %x mtype=%s\n",
482 controller->m_waiting_mem_retry =
false;
483 controller->serviceMemoryQueue();
495 : statistics::
Group(parent),
497 "cycles for which number of transistions == max transitions"),
498 ADD_STAT(delayHistogram,
"delay_histogram")
Tick curTick()
The universal simulation clock.
#define fatal(...)
This implements a cprintf based fatal() function.
MachineType getType() const
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
static uint32_t getNumberOfVirtualNetworks()
std::set< MessageBuffer * > MsgBufType
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
statistics::Scalar fullyBusyCycles
Counter for the number of cycles when the transitions carried out were equal to the maximum allowed.
virtual MessageBuffer * getMemReqQueue() const =0
void profileMsgDelay(uint32_t virtualNetwork, Cycles delay)
Profiles the delay associated with messages.
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
void pushSenderState(SenderState *sender_state)
Push a new sender state to the packet and make the current sender state the predecessor of the new on...
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time,...
bool serviceMemoryQueue()
const FlagsType nozero
Don't print if this is zero.
void wakeUpBuffers(Addr addr)
virtual void resetStats()=0
Callback to reset stats.
static uint32_t getBlockSizeBytes()
static PacketPtr createWrite(const RequestPtr &req)
MachineID mapAddressToDownstreamMachine(Addr addr, MachineType mtype=MachineType_NUM) const
Maps an address to the correct dowstream MachineID (i.e.
void dequeueMemRespQueue()
void schedule(Event &event, Tick when)
std::map< Addr, MessageBuffer * > m_block_map
bool isBlocked(Addr) const
std::string csprintf(const char *format, const Args &...args)
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
A function used to return the port associated with this bus object.
std::vector< MessageBuffer * > MsgVecType
void memRespQueueDequeued()
void reanalyzeMessages(Addr addr, Tick current_time)
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
statistics::Histogram delayHistogram
Histogram for profiling delay for the messages this controller cares for.
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
void registerDumpCallback(const std::function< void()> &callback)
Register a callback that should be called whenever statistics are about to be dumped.
Cycles is a wrapper class for representing cycle counts, i.e.
std::vector< statistics::Histogram * > delayVCHistogram
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
int functionalMemoryWrite(PacketPtr)
virtual std::string name() const
Tick cyclesToTicks(Cycles c) const
const Params & params() const
void scheduleEvent(Cycles timeDelta)
#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....
bool functionalRead(Packet *pkt)
MachineID mapAddressToMachine(Addr addr, MachineType mtype) const
Map an address to the correct MachineID.
uint64_t Tick
Tick count type.
virtual void sendRetryResp()
Send a retry to the response port that previously attempted a sendTimingResp to this request port and...
std::shared_ptr< Request > RequestPtr
Tick recvAtomic(PacketPtr pkt)
ControllerStats(statistics::Group *parent)
unsigned int m_cur_in_port
NetDest downstreamDestinations
Addr getOffset(Addr addr)
MemoryPort(const std::string &_name, AbstractController *_controller, PortID id=InvalidPortID)
AbstractController(const Params &p)
MemberEventWrapper<&AbstractController::sendRetryRespToMem > mRetryRespEvent
std::unordered_map< MachineType, AddrRangeMap< MachineID, 3 > > downstreamAddrMap
bool m_mem_ctrl_waiting_retry
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Histogram & init(size_type size)
Set the parameters of this histogram.
SenderState * senderState
This packet's sender state.
const std::string & name()
WaitingBufType m_waiting_buffers
virtual void regStats()
Callback to set stat parameters.
bool recvTimingResp(PacketPtr pkt)
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
gem5::ruby::AbstractController::ControllerStats stats
void setConsumer(Consumer *consumer)
void allocate()
Allocate memory for the packet.
Ports are used to interface objects to each other.
NodeID addressToNodeID(Addr addr, MachineType mtype)
Map an address to the correct NodeID.
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
static bool getWarmupEnabled()
void functionalMemoryRead(PacketPtr)
NetDest upstreamDestinations
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
void sendRetryRespToMem()
void add(MachineID newElement)
virtual void regStats()
Callback to set stat parameters.
AbstractController * controller
void reset()
Reset stat value to default.
ClockedObjectParams Params
Parameters of ClockedObject.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Cycles ticksToCycles(Tick t) const
#define gem5_assert(cond,...)
The assert macro will function like a normal assert, but will use panic instead of straight abort().
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
static PacketPtr createRead(const RequestPtr &req)
Constructor-like methods that return Packets based on Request objects.
virtual MessageBuffer * getMemRespQueue() const =0
void blockOnQueue(Addr, MessageBuffer *)
bool scheduled() const
Determine if the current event is scheduled.
void wakeUpBuffer(MessageBuffer *buf, Addr addr)
#define panic(...)
This implements a cprintf based panic() function.
void stallBuffer(MessageBuffer *buf, Addr addr)
RubyTester::SenderState SenderState
T * getPtr()
get a pointer to the data ptr.
Generated on Sun Jul 30 2023 01:56:59 for gem5 by doxygen 1.8.17