Go to the documentation of this file.
43 #include "debug/RubyQueue.hh"
45 #include "mem/ruby/protocol/MemoryMsg.hh"
52 m_clusterID(
p.cluster_id),
53 m_id(
p.
system->getRequestorId(this)), m_is_blocking(false),
54 m_number_of_TBEs(
p.number_of_TBEs),
55 m_transitions_per_cycle(
p.transitions_per_cycle),
56 m_buffer_size(
p.buffer_size), m_recycle_latency(
p.recycle_latency),
57 m_mandatory_queue_latency(
p.mandatory_queue_latency),
59 addrRanges(
p.addr_ranges.begin(),
p.addr_ranges.end()),
74 for (uint32_t
i = 0;
i < size;
i++) {
88 for (
auto abs_cntrl :
params().downstream_destinations) {
89 MachineID mid = abs_cntrl->getMachineID();
91 for (
const auto &addr_range : ranges) {
98 "%s: %s mapped to multiple machines of the same type\n",
99 name(), addr_range.to_string());
112 for (uint32_t
i = 0;
i < size;
i++) {
150 bool has_other_msgs =
false;
152 for (
unsigned int port = 0; port < msgVec->size(); ++port) {
153 if ((*msgVec)[port] == buf) {
155 (*msgVec)[port] = NULL;
156 }
else if ((*msgVec)[port] != NULL) {
157 has_other_msgs =
true;
160 if (!has_other_msgs) {
222 for (MsgVecType::iterator vec_iter = buf_iter->second->begin();
223 vec_iter != buf_iter->second->end();
228 if (*vec_iter != NULL &&
229 (wokeUpMsgBufs.count(*vec_iter) == 0)) {
230 (*vec_iter)->reanalyzeAllMessages(
clockEdge());
231 wokeUpMsgBufs.insert(*vec_iter);
234 wokeUpMsgVecs.push_back(buf_iter->second);
238 wb_iter != wokeUpMsgVecs.end();
256 const MemoryMsg *mem_msg = (
const MemoryMsg*)mem_queue->peek();
258 if (mem_msg->m_Len > 0) {
259 req_size = mem_msg->m_Len;
263 = std::make_shared<Request>(mem_msg->m_addr, req_size, 0,
m_id);
265 if (mem_msg->getType() == MemoryRequestType_MEMORY_WB) {
270 }
else if (mem_msg->getType() == MemoryRequestType_MEMORY_READ) {
272 uint8_t *newData =
new uint8_t[req_size];
275 panic(
"Unknown memory request type (%s) for addr %p",
276 MemoryRequestType_to_string(mem_msg->getType()),
351 int num_functional_writes = 0;
355 return num_functional_writes + 1;
364 std::shared_ptr<MemoryMsg> msg = std::make_shared<MemoryMsg>(
clockEdge());
365 (*msg).m_addr = pkt->
getAddr();
369 (*msg).m_OriginalRequestorMachId =
s->id;
373 (*msg).m_Type = MemoryRequestType_MEMORY_READ;
374 (*msg).m_MessageSize = MessageSizeType_Response_Data;
377 (*msg).m_DataBlk.setData(pkt->
getPtr<uint8_t>(), 0,
380 (*msg).m_Type = MemoryRequestType_MEMORY_WB;
381 (*msg).m_MessageSize = MessageSizeType_Writeback_Control;
383 panic(
"Incorrect packet type received from memory controller!");
410 "%s: couldn't find mapping for address %x\n",
name(),
addr);
413 assert(!entry.empty());
415 if (mtype == MachineType_NUM) {
417 "%s: address %x mapped to multiple machine types.\n",
name(),
addr);
418 return entry.begin()->second;
420 auto j = entry.find(mtype);
422 "%s: couldn't find mapping for address %x\n",
name(),
addr);
438 controller->serviceMemoryQueue();
444 :
RequestPort(_name, _controller,
id), controller(_controller)
452 "cycles for which number of transistions == max transitions"),
453 ADD_STAT(delayHistogram,
"delay_histogram")
void blockOnQueue(Addr, MessageBuffer *)
virtual void regStats()
Callback to set stat parameters.
void add(MachineID newElement)
Stats::Histogram delayHistogram
Histogram for profiling delay for the messages this controller cares for.
WaitingBufType m_waiting_buffers
static uint32_t getBlockSizeBytes()
Tick recvAtomic(PacketPtr pkt)
AbstractController * controller
iterator insert(const AddrRange &r, const V &d)
MachineType getType() const
virtual MessageBuffer * getMemReqQueue() const =0
const_iterator end() const
NodeID addressToNodeID(Addr addr, MachineType mtype)
Map an address to the correct NodeID.
void registerDumpCallback(const std::function< void()> &callback)
Register a callback that should be called whenever statistics are about to be dumped.
void stallBuffer(MessageBuffer *buf, Addr addr)
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
uint64_t Tick
Tick count type.
MachineID mapAddressToMachine(Addr addr, MachineType mtype) const
Map an address to the correct MachineID.
std::vector< Stats::Histogram * > delayVCHistogram
MemoryPort(const std::string &_name, AbstractController *_controller, PortID id=InvalidPortID)
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
std::shared_ptr< Request > RequestPtr
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
void reanalyzeMessages(Addr addr, Tick current_time)
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
void setConsumer(Consumer *consumer)
unsigned int m_cur_in_port
void enqueue(MsgPtr message, Tick curTime, Tick delta)
MachineID mapAddressToDownstreamMachine(Addr addr, MachineType mtype=MachineType_NUM) const
Maps an address to the correct dowstream MachineID (i.e.
bool serviceMemoryQueue()
bool isBlocked(Addr) const
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
void wakeUpBuffers(Addr addr)
Tick cyclesToTicks(Cycles c) const
ClockedObjectParams Params
Parameters of ClockedObject.
virtual void regStats()
Callback to set stat parameters.
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
RubyTester::SenderState SenderState
void wakeUpBuffer(MessageBuffer *buf, Addr addr)
static PacketPtr createRead(const RequestPtr &req)
Constructor-like methods that return Packets based on Request objects.
Ports are used to interface objects to each other.
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...
bool functionalRead(Packet *pkt)
int functionalMemoryWrite(PacketPtr)
void recvTimingResp(PacketPtr pkt)
std::map< Addr, MessageBuffer * > m_block_map
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
virtual void collateStats()
Function for collating statistics from all the controllers of this particular type.
std::unordered_map< MachineType, MachineID > AddrMapEntry
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
const std::string & name()
static uint32_t getNumberOfVirtualNetworks()
const FlagsType nozero
Don't print if this is zero.
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
virtual const std::string name() const
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
A function used to return the port associated with this bus object.
static PacketPtr createWrite(const RequestPtr &req)
Stats::Scalar fullyBusyCycles
Counter for the number of cycles when the transitions carried out were equal to the maximum allowed.
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...
static bool getWarmupEnabled()
Cycles ticksToCycles(Tick t) const
const_iterator contains(const AddrRange &r) const
Find entry that contains the given address range.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
AbstractController::ControllerStats stats
const_iterator intersects(const AddrRange &r) const
Find entry that intersects with the given address range.
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Addr getOffset(Addr addr)
void reset()
Reset stat value to default.
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Cycles is a wrapper class for representing cycle counts, i.e.
T * getPtr()
get a pointer to the data ptr.
std::set< MessageBuffer * > MsgBufType
AbstractController(const Params &p)
Histogram & init(size_type size)
Set the parameters of this histogram.
const Params & params() const
SenderState * senderState
This packet's sender state.
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time,...
void profileMsgDelay(uint32_t virtualNetwork, Cycles delay)
Profiles the delay associated with messages.
void allocate()
Allocate memory for the packet.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
AddrRangeMap< AddrMapEntry, 3 > downstreamAddrMap
virtual MessageBuffer * getMemRespQueue() const =0
std::string csprintf(const char *format, const Args &...args)
NetDest downstreamDestinations
std::vector< MessageBuffer * > MsgVecType
void scheduleEvent(Cycles timeDelta)
#define panic(...)
This implements a cprintf based panic() function.
ControllerStats(Stats::Group *parent)
virtual void resetStats()=0
Callback to reset stats.
void functionalMemoryRead(PacketPtr)
Generated on Tue Jun 22 2021 15:28:30 for gem5 by doxygen 1.8.17