Go to the documentation of this file.
49 #include "debug/RubyQueue.hh"
58 using stl_helpers::operator<<;
62 m_max_size(
p.buffer_size), m_time_last_time_size_checked(0),
63 m_time_last_time_enqueue(0), m_time_last_time_pop(0),
64 m_last_arrival_time(0), m_strict_fifo(
p.ordered),
65 m_randomization(
p.randomization),
66 m_allow_zero_latency(
p.allow_zero_latency),
67 ADD_STAT(m_not_avail_count,
"Number of times this buffer did not have "
69 ADD_STAT(m_buf_msgs,
"Average number of messages in buffer"),
70 ADD_STAT(m_stall_time,
"Average number of cycles messages are stalled in "
72 ADD_STAT(m_stall_count,
"Number of times messages were stalled"),
73 ADD_STAT(m_occupancy,
"Average occupancy of buffer capacity")
139 unsigned int current_size = 0;
140 unsigned int current_stall_size = 0;
161 if (current_size + current_stall_size +
n <=
m_max_size) {
164 DPRINTF(RubyQueue,
"n: %d, current_size: %d, heap size: %d, "
166 n, current_size + current_stall_size,
176 DPRINTF(RubyQueue,
"Peeking at head of queue.\n");
180 DPRINTF(RubyQueue,
"Message: %s\n", (*msg_ptr));
211 "Delta equals zero and allow_zero_latency is false during enqueue");
212 Tick arrival_time = 0;
220 arrival_time = current_time + delta;
234 assert(arrival_time >= current_time);
237 panic(
"FIFO ordering violated: %s name: %s current time: %d "
238 "delta: %d arrival_time: %d last arrival_time: %d\n",
239 *
this,
name(), current_time, delta, arrival_time,
250 Message* msg_ptr = message.get();
251 assert(msg_ptr != NULL);
254 "ensure we aren't dequeued early");
269 DPRINTF(RubyQueue,
"Enqueue arrival_time: %lld, Message: %s\n",
270 arrival_time, *(message.get()));
281 DPRINTF(RubyQueue,
"Popping\n");
288 message->updateDelayedTicks(current_time);
289 Tick delay = message->getDelayedTicks();
303 if (decrement_messages) {
345 DPRINTF(RubyQueue,
"Recycling.\n");
350 Tick future_time = current_time + recycle_latency;
351 node->setLastEnqueueTime(future_time);
361 while (!
lt.empty()) {
363 assert(
m->getLastEnqueueTime() <= schdTick);
367 std::greater<MsgPtr>());
371 DPRINTF(RubyQueue,
"Requeue arrival_time: %lld, Message: %s\n",
372 schdTick, *(
m.get()));
381 DPRINTF(RubyQueue,
"ReanalyzeMessages %#x\n",
addr);
399 DPRINTF(RubyQueue,
"ReanalyzeAllMessages\n");
447 DPRINTF(RubyQueue,
"Deferring enqueueing message: %s, Address %#x\n",
448 *(message.get()),
addr);
457 assert(msg_vec.size() > 0);
483 std::sort_heap(copy.begin(), copy.end(), std::greater<MsgPtr>());
491 (
m_prio_heap.front()->getLastEnqueueTime() <= current_time));
497 DPRINTF(RubyQueue,
"functional %s for %#x\n",
498 is_read ?
"read" :
"write", pkt->
getAddr());
500 uint32_t num_functional_accesses = 0;
509 num_functional_accesses++;
511 num_functional_accesses++;
521 it != (map_iter->second).end(); ++it) {
527 num_functional_accesses++;
529 num_functional_accesses++;
533 return num_functional_accesses;
Tick curTick()
The universal simulation clock.
void recycle(Tick current_time, Tick recycle_latency)
void unregisterDequeueCallback()
std::shared_ptr< Message > MsgPtr
Tick m_time_last_time_size_checked
void enqueueDeferredMessages(Addr addr, Tick curTime, Tick delay)
Consumer * m_consumer
Consumer to signal a wakeup(), can be NULL.
MessageBufferParams Params
void reanalyzeList(std::list< MsgPtr > &, Tick)
const FlagsType nozero
Don't print if this is zero.
DeferredMsgMapType m_deferred_msg_map
void enqueue(MsgPtr message, Tick curTime, Tick delta)
MessageBuffer(const Params &p)
Tick dequeue(Tick current_time, bool decrement_messages=true)
Updates the delay cycles of the message at the head of the queue, removes it from the queue and retur...
Tick getLastEnqueueTime() const
void stallMessage(Addr addr, Tick current_time)
statistics::Average m_stall_time
statistics::Formula m_occupancy
void reanalyzeMessages(Addr addr, Tick current_time)
void ccprintf(cp::Print &print)
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
const Message * peek() const
Function for extracting the message at the head of the message queue.
unsigned int m_size_last_time_size_checked
unsigned int m_stalled_at_cycle_start
unsigned int m_msgs_this_cycle
void setMsgCounter(uint64_t c)
uint32_t functionalAccess(Packet *pkt, bool is_read, WriteMask *mask)
virtual void storeEventInfo(int info)
unsigned int m_size_at_cycle_start
std::enable_if_t< std::is_integral< T >::value, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
virtual std::string name() const
void print(std::ostream &out) const
statistics::Scalar m_not_avail_count
#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....
uint64_t Tick
Tick count type.
virtual bool functionalWrite(Packet *pkt)
Addr getOffset(Addr addr)
static int getRandomization()
const MessageRandomization m_randomization
StallMsgMapType m_stall_msg_map
A map from line addresses to lists of stalled messages for that line.
Abstract superclass for simulation objects.
const unsigned int m_max_size
The maximum capacity.
virtual bool functionalRead(Packet *pkt)
The two functions below are used for reading / writing the message functionally.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void updateDelayedTicks(Tick curTime)
Update the delay this message has experienced so far.
bool isDeferredMsgMapEmpty(Addr addr) const
bool isReady(Tick current_time) const
std::vector< MsgPtr > m_prio_heap
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void registerDequeueCallback(std::function< void()> callback)
static bool getWarmupEnabled()
Tick m_time_last_time_pop
bool areNSlotsAvailable(unsigned int n, Tick curTime)
int m_stall_map_size
Current size of the stall map.
void setLastEnqueueTime(const Tick &time)
std::function< void()> m_dequeue_callback
statistics::Average m_buf_msgs
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
bool hasStalledMsg(Addr addr) const
statistics::Scalar m_stall_count
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
const bool m_allow_zero_latency
void deferEnqueueingMessage(Addr addr, MsgPtr message)
void scheduleEventAbsolute(Tick timeAbs)
void reanalyzeAllMessages(Tick current_time)
unsigned int getSize(Tick curTime)
Tick m_time_last_time_enqueue
#define panic(...)
This implements a cprintf based panic() function.
Generated on Tue Sep 21 2021 12:25:41 for gem5 by doxygen 1.8.17