gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
gem5::GenericSatCounter< T > Class Template Reference

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

#include <sat_counter.hh>

Public Member Functions

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

Private Attributes

initialVal
 
maxVal
 
counter
 

Detailed Description

template<class T>
class gem5::GenericSatCounter< T >

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

Template Parameters
TThe type of the underlying counter container.

Definition at line 60 of file sat_counter.hh.

Constructor & Destructor Documentation

◆ GenericSatCounter()

template<class T>
gem5::GenericSatCounter< T >::GenericSatCounter ( )
delete

The default constructor should never be used.

Member Data Documentation

◆ counter

template<class T>
T gem5::GenericSatCounter< T >::counter
private

Definition at line 331 of file sat_counter.hh.

Referenced by operator T(), and gem5::GenericSatCounter< uint8_t >::swap().

◆ initialVal

template<class T>
T gem5::GenericSatCounter< T >::initialVal
private

Definition at line 329 of file sat_counter.hh.

Referenced by gem5::GenericSatCounter< uint8_t >::swap().

◆ maxVal

template<class T>
T gem5::GenericSatCounter< T >::maxVal
private

Definition at line 330 of file sat_counter.hh.

Referenced by gem5::GenericSatCounter< uint8_t >::swap().


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

Generated on Mon May 26 2025 09:19:21 for gem5 by doxygen 1.13.2