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++) {
90 for (uint32_t
i = 0;
i < size;
i++) {
101 .
name(
name() +
".fully_busy_cycles")
102 .
desc(
"cycles for which number of transistions == max transitions")
184 for (MsgVecType::iterator vec_iter = buf_iter->second->begin();
185 vec_iter != buf_iter->second->end();
190 if (*vec_iter != NULL &&
191 (wokeUpMsgBufs.count(*vec_iter) == 0)) {
192 (*vec_iter)->reanalyzeAllMessages(
clockEdge());
193 wokeUpMsgBufs.insert(*vec_iter);
196 wokeUpMsgVecs.push_back(buf_iter->second);
200 wb_iter != wokeUpMsgVecs.end();
218 const MemoryMsg *mem_msg = (
const MemoryMsg*)mem_queue->peek();
220 if (mem_msg->m_Len > 0) {
221 req_size = mem_msg->m_Len;
225 = std::make_shared<Request>(mem_msg->m_addr, req_size, 0,
m_masterId);
227 if (mem_msg->getType() == MemoryRequestType_MEMORY_WB) {
230 pkt->setData(mem_msg->m_DataBlk.getData(
getOffset(mem_msg->m_addr),
232 }
else if (mem_msg->getType() == MemoryRequestType_MEMORY_READ) {
234 uint8_t *newData =
new uint8_t[req_size];
235 pkt->dataDynamic(newData);
237 panic(
"Unknown memory request type (%s) for addr %p",
238 MemoryRequestType_to_string(mem_msg->getType()),
243 pkt->pushSenderState(s);
307 int num_functional_writes = 0;
311 num_functional_writes++;
316 return num_functional_writes + 1;
325 std::shared_ptr<MemoryMsg> msg = std::make_shared<MemoryMsg>(
clockEdge());
326 (*msg).m_addr = pkt->
getAddr();
330 (*msg).m_OriginalRequestorMachId = s->
id;
334 (*msg).m_Type = MemoryRequestType_MEMORY_READ;
335 (*msg).m_MessageSize = MessageSizeType_Response_Data;
338 (*msg).m_DataBlk.setData(pkt->
getPtr<uint8_t>(), 0,
341 (*msg).m_Type = MemoryRequestType_MEMORY_WB;
342 (*msg).m_MessageSize = MessageSizeType_Writeback_Control;
344 panic(
"Incorrect packet type received from memory controller!");
368 controller->recvTimingResp(pkt);
374 const std::string &_label)
376 reqQueue(*_controller, *this, _label),
377 snoopRespQueue(*_controller, *this, false, _label),
378 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)
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.
void scheduleEvent(Cycles timeDelta)
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
Histogram & init(size_type size)
Set the parameters of this histogram.
std::set< MessageBuffer * > MsgBufType
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.
virtual MessageBuffer * getMemRespQueue() const =0
RubyControllerParams Params
static bool getWarmupEnabled()
Tick cyclesToTicks(Cycles c) const
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
void setConsumer(Consumer *consumer)
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.
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.
virtual MessageBuffer * getMemReqQueue() const =0
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.
virtual const std::string name() const
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.
NodeID addressToNodeID(Addr addr, MachineType mtype)
Map an address to the correct NodeID.
const Params * params() const
void stallBuffer(MessageBuffer *buf, Addr addr)
bool serviceMemoryQueue()
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.
virtual void regStats()
Callback to set stat parameters.
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.