gem5  v20.1.0.0
Public Member Functions | Private Attributes | List of all members
SatCounter Class Reference

Implements an n bit saturating counter and provides methods to increment, decrement, and read it. More...

#include <sat_counter.hh>

Public Member Functions

 SatCounter ()=delete
 The default constructor should never be used. More...
 
 SatCounter (unsigned bits, uint8_t initial_val=0)
 Constructor for the counter. More...
 
 SatCounter (const SatCounter &other)
 Copy constructor. More...
 
SatCounteroperator= (const SatCounter &other)
 Copy assignment. More...
 
 SatCounter (SatCounter &&other)
 Move constructor. More...
 
SatCounteroperator= (SatCounter &&other)
 Move assignment. More...
 
void swap (SatCounter &other)
 Swap the contents of every member of the class. More...
 
SatCounteroperator++ ()
 Pre-increment operator. More...
 
SatCounter operator++ (int)
 Post-increment operator. More...
 
SatCounteroperator-- ()
 Pre-decrement operator. More...
 
SatCounter operator-- (int)
 Post-decrement operator. More...
 
SatCounteroperator>>= (const int &shift)
 Shift-right-assignment. More...
 
SatCounteroperator<<= (const int &shift)
 Shift-left-assignment. More...
 
SatCounteroperator+= (const int &value)
 Add-assignment. More...
 
SatCounteroperator-= (const int &value)
 Subtract-assignment. More...
 
 operator uint8_t () const
 Read the counter's value. More...
 
void reset ()
 Reset the counter to its initial value. More...
 
double calcSaturation () const
 Calculate saturation percentile of the current counter's value with regard to its maximum possible value. More...
 
bool isSaturated () const
 Whether the counter has achieved its maximum value or not. More...
 
uint8_t saturate ()
 Saturate the counter. More...
 

Private Attributes

uint8_t initialVal
 
uint8_t maxVal
 
uint8_t counter
 

Detailed Description

Implements an n bit saturating counter and provides methods to increment, decrement, and read it.

Definition at line 54 of file sat_counter.hh.

Constructor & Destructor Documentation

◆ SatCounter()

SatCounter::SatCounter ( )
delete

The default constructor should never be used.

Member Data Documentation

◆ counter

uint8_t SatCounter::counter
private

◆ initialVal

uint8_t SatCounter::initialVal
private

Definition at line 323 of file sat_counter.hh.

Referenced by operator=(), reset(), SatCounter(), and swap().

◆ maxVal

uint8_t SatCounter::maxVal
private

The documentation for this class was generated from the following file:

Generated on Wed Sep 30 2020 14:02:31 for gem5 by doxygen 1.8.17