43 #include "debug/RubyQueue.hh" 45 #include "mem/ruby/protocol/MemoryMsg.hh" 53 m_clusterID(p->cluster_id),
54 m_masterId(p->
system->getMasterId(this)), m_is_blocking(false),
55 m_number_of_TBEs(p->number_of_TBEs),
56 m_transitions_per_cycle(p->transitions_per_cycle),
57 m_buffer_size(p->buffer_size), m_recycle_latency(p->recycle_latency),
58 m_mandatory_queue_latency(p->mandatory_queue_latency),
60 addrRanges(p->addr_ranges.begin(), p->addr_ranges.end())
72 params()->ruby_system->registerAbstractController(
this);
75 for (uint32_t
i = 0;
i < size;
i++) {
86 for (uint32_t
i = 0;
i < size;
i++) {
98 .
desc(
"cycles for which number of transistions == max transitions")
180 for (MsgVecType::iterator vec_iter = buf_iter->second->begin();
181 vec_iter != buf_iter->second->end();
186 if (*vec_iter != NULL &&
187 (wokeUpMsgBufs.count(*vec_iter) == 0)) {
188 (*vec_iter)->reanalyzeAllMessages(
clockEdge());
189 wokeUpMsgBufs.insert(*vec_iter);
192 wokeUpMsgVecs.push_back(buf_iter->second);
196 wb_iter != wokeUpMsgVecs.end();
248 pkt->dataDynamic(newData);
251 pkt->pushSenderState(s);
275 pkt->pushSenderState(s);
300 pkt->pushSenderState(s);
315 int num_functional_writes = 0;
319 num_functional_writes++;
324 return num_functional_writes + 1;
333 std::shared_ptr<MemoryMsg> msg = std::make_shared<MemoryMsg>(
clockEdge());
334 (*msg).m_addr = pkt->
getAddr();
338 (*msg).m_OriginalRequestorMachId = s->
id;
342 (*msg).m_Type = MemoryRequestType_MEMORY_READ;
343 (*msg).m_MessageSize = MessageSizeType_Response_Data;
346 (*msg).m_DataBlk.setData(pkt->
getPtr<uint8_t>(), 0,
349 (*msg).m_Type = MemoryRequestType_MEMORY_WB;
350 (*msg).m_MessageSize = MessageSizeType_Writeback_Control;
352 panic(
"Incorrect packet type received from memory controller!");
376 controller->recvTimingResp(pkt);
382 const std::string &_label)
384 reqQueue(*_controller, *this, _label),
385 snoopRespQueue(*_controller, *this, false, _label),
386 controller(_controller)
#define panic(...)
This implements a cprintf based panic() function.
RubyTester::SenderState SenderState
Ports are used to interface objects to each other.
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Tick recvAtomic(PacketPtr pkt)
virtual MessageBuffer * getMemoryQueue() const =0
const uint8_t * getData(int offset, int len) const
WaitingBufType m_waiting_buffers
Cycles is a wrapper class for representing cycle counts, i.e.
const std::string & name()
void recvTimingResp(PacketPtr pkt)
virtual void regStats()
Callback to set stat parameters.
AbstractController(const Params *p)
MachineID mapAddressToMachine(Addr addr, MachineType mtype) const
Map an address to the correct MachineID.
std::shared_ptr< Request > RequestPtr
static uint32_t getNumberOfVirtualNetworks()
The QueuedMasterPort combines two queues, a request queue and a snoop response queue, that both share the same port.
static PacketPtr createWrite(const RequestPtr &req)
std::map< Addr, MessageBuffer * > m_block_map
virtual void regStats()
Callback to set stat parameters.
Histogram & init(size_type size)
Set the parameters of this histogram.
std::set< MessageBuffer * > MsgBufType
void queueMemoryRead(const MachineID &id, Addr addr, Cycles latency)
std::vector< MessageBuffer * > MsgVecType
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
T * getPtr()
get a pointer to the data ptr.
RubyControllerParams Params
static bool getWarmupEnabled()
Tick cyclesToTicks(Cycles c) const
void queueMemoryWrite(const MachineID &id, Addr addr, Cycles latency, const DataBlock &block)
std::string csprintf(const char *format, const Args &...args)
Callback class used for collating statistics from all the controller of this type.
virtual void resetStats()=0
Callback to reset stats.
uint64_t Tick
Tick count type.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
std::vector< Stats::Histogram * > m_delayVCHistogram
int functionalMemoryWrite(PacketPtr)
Addr getOffset(Addr addr)
bool trySatisfyFunctional(PacketPtr pkt)
Check the list of buffered packets against the supplied functional request.
void profileMsgDelay(uint32_t virtualNetwork, Cycles delay)
Profiles the delay associated with messages.
Stats::Scalar m_fully_busy_cycles
Counter for the number of cycles when the transitions carried out were equal to the maximum allowed...
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual const std::string name() const
static PacketPtr createRead(const RequestPtr &req)
Constructor-like methods that return Packets based on Request objects.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
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 reset()
Reset stat value to default.
unsigned int m_cur_in_port
void registerDumpCallback(Callback *cb)
Register a callback that should be called whenever statistics are about to be dumped.
void blockOnQueue(Addr, MessageBuffer *)
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Cycles ticksToCycles(Tick t) const
MemoryPort(const std::string &_name, AbstractController *_controller, const std::string &_label)
void schedTimingReq(PacketPtr pkt, Tick when)
Schedule the sending of a timing request.
void wakeUpBuffers(Addr addr)
SenderState * senderState
This packet's sender state.
void queueMemoryWritePartial(const MachineID &id, Addr addr, Cycles latency, const DataBlock &block, int size)
NodeID addressToNodeID(Addr addr, MachineType mtype)
Map an address to the correct NodeID.
const Params * params() const
void stallBuffer(MessageBuffer *buf, Addr addr)
const MasterID m_masterId
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void functionalMemoryRead(PacketPtr)
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time...
const FlagsType nozero
Don't print if this is zero.
bool isBlocked(Addr) const
static uint32_t getBlockSizeBytes()
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
A function used to return the port associated with this bus object.
void enqueue(MsgPtr message, Tick curTime, Tick delta)
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Stats::Histogram m_delayHistogram
Histogram for profiling delay for the messages this controller cares for.