Go to the documentation of this file.
44 #ifndef __CPU_MINOR_BUFFERS_HH__
45 #define __CPU_MINOR_BUFFERS_HH__
95 template <
typename ElemType>
101 { elem.reportData(
os); }
106 template <
typename PtrType>
112 { elem->reportData(
os); }
120 template <
typename ElemType>
124 static bool isBubble(
const ElemType &) {
return false; }
128 panic(
"bubble called but no bubble interface");
133 template <
typename ElemType>
138 {
return elem.isBubble(); }
140 static ElemType
bubble() {
return ElemType::bubble(); }
144 template <
typename PtrType,
typename ElemType>
149 {
return elem->isBubble(); }
151 static PtrType
bubble() {
return ElemType::bubble(); }
155 template <
typename ElemType,
156 typename ReportTraits = ReportTraitsAdaptor<ElemType>,
157 typename BubbleTraits = BubbleTraitsAdaptor<ElemType> >
169 const std::string &data_name,
170 int num_past,
int num_future,
171 int report_left = -1,
int report_right = -1) :
185 if (!BubbleTraits::isBubble((*
this)[
i]))
199 std::ostringstream
data;
206 const ElemType &datum = (*this)[
i];
208 ReportTraits::reportData(
data, datum);
220 template <
typename Data>
237 const std::string &data_name,
239 bool report_backwards =
false) :
241 buffer(
name, data_name, delay_, 0, (report_backwards ? -delay_ : 0),
242 (report_backwards ? 0 : -delay_))
290 template <
typename ElemType,
291 typename ReportTraits,
292 typename BubbleTraits = BubbleTraitsAdaptor<ElemType> >
310 const std::string &data_name,
313 (
name, data_name, depth, 0, -1, -depth),
323 for (
unsigned i = 0;
i <= depth;
i++)
324 (*
this)[-
i] = BubbleTraits::bubble();
336 if (!BubbleTraits::isBubble(elem))
370 ElemType bubble = BubbleTraits::bubble();
400 template <
typename ElemType,
401 typename ReportTraits = ReportTraitsAdaptor<ElemType>,
402 typename BubbleTraits = BubbleTraitsAdaptor<ElemType> >
419 Queue(
const std::string &
name,
const std::string &data_name,
420 unsigned int capacity_) :
434 if (!BubbleTraits::isBubble(
data)) {
439 warn(
"%s: No space to push data into queue of capacity"
464 warn(
"%s: No space is reservable in queue",
name());
487 return (ret < 0 ? 0 : ret);
496 return (ret < 0 ? 0 : ret);
513 std::ostringstream
data;
524 while (num_printed <= num_occupied) {
525 ReportTraits::reportData(
data,
queue[num_printed - 1]);
528 if (num_printed <= num_total)
532 int num_printed_reserved = 1;
534 while (num_printed_reserved <= num_reserved &&
535 num_printed <= num_total)
538 num_printed_reserved++;
541 if (num_printed <= num_total)
546 while (num_printed <= num_total) {
549 if (num_printed <= num_total)
568 template <
typename ElemType,
569 typename ReportTraits = ReportTraitsAdaptor<ElemType>,
570 typename BubbleTraits = BubbleTraitsAdaptor<ElemType> >
582 unsigned int capacity_) :
595 if (!BubbleTraits::isBubble(new_element)) {
599 queue.push(new_element);
621 queue.freeReservation();
656 return queue.unreservedRemainingSpace();
ElemType & front()
Head value.
bool stalled
If true, advance will not advance the pipeline.
A similar adaptor but for elements held by pointer ElemType should implement ReportIF.
unsigned int capacity
Need this here as queues usually don't have a limited capacity.
std::string dataName
Name to use for the data in MinorTrace.
const ElemType & front() const
static void reportData(std::ostream &os, const PtrType &elem)
virtual void reportData(std::ostream &os) const =0
Print the data in a format suitable to be the value in "name=value" trace lines.
ElemType & front()
Peek at the end element of the pipe.
Base class for space reservation requestable objects.
Output(typename Buffer::wire output_wire)
Wrapper for a queue type to act as a pipeline stage input queue.
unsigned int totalSpace() const
Number of slots available in an empty buffer.
const ElemType & front() const
std::string dataName
Name to use for the data in a MinorTrace line.
bool empty() const
Is the queue empty?
TimeBuffer with MinorTrace and Named interfaces.
void clearReservedSpace()
Clear all allocated space.
MinorBuffer< Data > Buffer
Cycles is a wrapper class for representing cycle counts, i.e.
Interface for things with names.
bool canReserve() const
Can a slot be reserved?
int reportLeft
The range of elements that should appear in trace lines.
Latch(const std::string &name, const std::string &data_name, Cycles delay_=Cycles(1), bool report_backwards=false)
forward/backwardDelay specify the delay from input to output in each direction.
...ReportTraits are trait classes with the same functionality as ReportIF, but with elements explicit...
bool isPopable()
There's data (not a bubble) at the end of the pipe.
void freeReservation()
Clear a single reserved slot.
Cycles delay
Delays, in cycles, writing data into the latch and seeing it on the latched wires.
Input input()
An interface to just the input of the buffer.
SelfStallingPipeline(const std::string &name, const std::string &data_name, unsigned depth)
virtual std::string name() const
static bool isBubble(const ElemType &)
static bool isBubble(const ElemType &elem)
void minorTrace() const
Report buffer states from 'slot' 'from' to 'to'.
void push(ElemType &data)
Push an element into the buffer if it isn't a bubble.
virtual bool isBubble() const =0
virtual bool canReserve() const =0
Can a slot be reserved?
Pass on call to the element where the element is a pointer.
std::deque< ElemType > queue
static void reportData(std::ostream &os, const ElemType &elem)
unsigned int unreservedRemainingSpace() const
Like remainingSpace but does not count reserved spaces.
Wraps a MinorBuffer with Input/Output interfaces to ensure that units within the model can only see t...
MinorBuffer(const std::string &name, const std::string &data_name, int num_past, int num_future, int report_left=-1, int report_right=-1)
unsigned int occupiedSpace() const
Number of slots already occupied in this buffer.
Interface class for data with 'bubble' values.
Queue(const std::string &name, const std::string &data_name, unsigned int capacity_)
const std::string & name()
Pass on call to the element.
void minorTrace(const char *fmt, Args ...args)
DPRINTFN for MinorTrace reporting.
unsigned int reservedSpace() const
Number of slots which are reserved.
TimeBuffer< ElemType >::wire popWire
Wire at the output end of the pipeline (for convenience)
void push(ElemType &elem)
Write an element to the back of the pipeline.
Interface class for data with reporting/tracing facilities.
virtual void reserve()=0
Reserve a slot in whatever structure this is attached to.
Output output()
An interface to just the output of the buffer.
unsigned int occupancy
The number of slots with non-bubbles in them.
static bool isBubble(const PtrType &elem)
void advance()
Try to advance the pipeline.
unsigned int remainingSpace() const
Number of slots yet to fill in this buffer.
void pop()
Pop the head item.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
A pipeline simulating class that will stall (not advance when advance() is called) if a non-bubble va...
unsigned int numReservedSlots
Number of slots currently reserved for future (reservation respecting) pushes.
virtual void freeReservation()=0
Free a reserved slot.
bool alreadyPushed()
Have we already pushed onto this pipe without advancing.
#define panic(...)
This implements a cprintf based panic() function.
void reserve()
Reserve space in the queue for future pushes.
TimeBuffer< ElemType >::wire pushWire
Wire at the input end of the pipeline (for convenience)
Generated on Sun Jul 30 2023 01:56:52 for gem5 by doxygen 1.8.17