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),
65 addrRanges(
p.addr_ranges.begin(),
p.addr_ranges.end()),
80 for (uint32_t
i = 0;
i < size;
i++) {
94 for (
auto abs_cntrl :
params().downstream_destinations) {
95 MachineID mid = abs_cntrl->getMachineID();
97 for (
const auto &addr_range : ranges) {
104 "%s: %s mapped to multiple machines of the same type\n",
105 name(), addr_range.to_string());
118 for (uint32_t
i = 0;
i < size;
i++) {
156 bool has_other_msgs =
false;
158 for (
unsigned int port = 0; port < msgVec->size(); ++port) {
159 if ((*msgVec)[port] == buf) {
161 (*msgVec)[port] = NULL;
162 }
else if ((*msgVec)[port] != NULL) {
163 has_other_msgs =
true;
166 if (!has_other_msgs) {
228 for (MsgVecType::iterator vec_iter = buf_iter->second->begin();
229 vec_iter != buf_iter->second->end();
234 if (*vec_iter != NULL &&
235 (wokeUpMsgBufs.count(*vec_iter) == 0)) {
236 (*vec_iter)->reanalyzeAllMessages(
clockEdge());
237 wokeUpMsgBufs.insert(*vec_iter);
240 wokeUpMsgVecs.push_back(buf_iter->second);
244 wb_iter != wokeUpMsgVecs.end();
262 const MemoryMsg *mem_msg = (
const MemoryMsg*)mem_queue->peek();
264 if (mem_msg->m_Len > 0) {
265 req_size = mem_msg->m_Len;
269 = std::make_shared<Request>(mem_msg->m_addr, req_size, 0,
m_id);
271 if (mem_msg->getType() == MemoryRequestType_MEMORY_WB) {
276 }
else if (mem_msg->getType() == MemoryRequestType_MEMORY_READ) {
278 uint8_t *newData =
new uint8_t[req_size];
281 panic(
"Unknown memory request type (%s) for addr %p",
282 MemoryRequestType_to_string(mem_msg->getType()),
357 int num_functional_writes = 0;
361 return num_functional_writes + 1;
370 std::shared_ptr<MemoryMsg> msg = std::make_shared<MemoryMsg>(
clockEdge());
371 (*msg).m_addr = pkt->
getAddr();
375 (*msg).m_OriginalRequestorMachId =
s->id;
379 (*msg).m_Type = MemoryRequestType_MEMORY_READ;
380 (*msg).m_MessageSize = MessageSizeType_Response_Data;
383 (*msg).m_DataBlk.setData(pkt->
getPtr<uint8_t>(), 0,
386 (*msg).m_Type = MemoryRequestType_MEMORY_WB;
387 (*msg).m_MessageSize = MessageSizeType_Writeback_Control;
389 panic(
"Incorrect packet type received from memory controller!");
416 "%s: couldn't find mapping for address %x\n",
name(),
addr);
419 assert(!entry.empty());
421 if (mtype == MachineType_NUM) {
423 "%s: address %x mapped to multiple machine types.\n",
name(),
addr);
424 return entry.begin()->second;
426 auto j = entry.find(mtype);
428 "%s: couldn't find mapping for address %x\n",
name(),
addr);
444 controller->serviceMemoryQueue();
456 : statistics::
Group(parent),
458 "cycles for which number of transistions == max transitions"),
459 ADD_STAT(delayHistogram,
"delay_histogram")
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.
void enqueue(MsgPtr message, Tick curTime, Tick delta)
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.
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 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...
const_iterator contains(const AddrRange &r) const
Find entry that contains the given address range.
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...
virtual void collateStats()
Function for collating statistics from all the controllers of this particular type.
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.
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)
const_iterator end() const
MemoryPort(const std::string &_name, AbstractController *_controller, PortID id=InvalidPortID)
AbstractController(const Params &p)
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.
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)
const_iterator intersects(const AddrRange &r) const
Find entry that intersects with the given address range.
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)
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
iterator insert(const AddrRange &r, const V &d)
void add(MachineID newElement)
std::unordered_map< MachineType, MachineID > AddrMapEntry
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.
AddrRangeMap< AddrMapEntry, 3 > downstreamAddrMap
Cycles ticksToCycles(Tick t) const
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
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 *)
void recvTimingResp(PacketPtr pkt)
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 Tue Sep 7 2021 14:53:49 for gem5 by doxygen 1.8.17