gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
SatCounter Class Reference

Private counter class for the internal saturating counters. More...

#include <sat_counter.hh>

Public Member Functions

 SatCounter ()
 Constructor for the counter. More...
 
 SatCounter (unsigned bits)
 Constructor for the counter. More...
 
 SatCounter (unsigned bits, uint8_t initial_val)
 Constructor for the counter. More...
 
void setBits (unsigned bits)
 Sets the number of bits. More...
 
void reset ()
 
void increment ()
 Increments the counter's current value. More...
 
void decrement ()
 Decrements the counter's current value. More...
 
uint8_t read () const
 Read the counter's value. More...
 

Private Attributes

uint8_t initialVal
 
uint8_t maxVal
 
uint8_t counter
 

Detailed Description

Private counter class for the internal saturating counters.

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

Todo:
Consider making this something that more closely mimics a built in class so you can use ++ or –.

Definition at line 44 of file sat_counter.hh.

Constructor & Destructor Documentation

SatCounter::SatCounter ( )
inline

Constructor for the counter.

Definition at line 50 of file sat_counter.hh.

SatCounter::SatCounter ( unsigned  bits)
inline

Constructor for the counter.

Parameters
bitsHow many bits the counter will have.

Definition at line 58 of file sat_counter.hh.

SatCounter::SatCounter ( unsigned  bits,
uint8_t  initial_val 
)
inline

Constructor for the counter.

Parameters
bitsHow many bits the counter will have.
initial_valStarting value for each counter.

Definition at line 67 of file sat_counter.hh.

References fatal, and maxVal.

Member Function Documentation

void SatCounter::decrement ( )
inline

Decrements the counter's current value.

Definition at line 98 of file sat_counter.hh.

References counter.

void SatCounter::increment ( )
inline

Increments the counter's current value.

Definition at line 88 of file sat_counter.hh.

References counter, and maxVal.

uint8_t SatCounter::read ( ) const
inline

Read the counter's value.

Definition at line 108 of file sat_counter.hh.

References counter.

void SatCounter::reset ( )
inline

Definition at line 83 of file sat_counter.hh.

References counter, and initialVal.

void SatCounter::setBits ( unsigned  bits)
inline

Sets the number of bits.

Definition at line 81 of file sat_counter.hh.

References bits(), and maxVal.

Member Data Documentation

uint8_t SatCounter::counter
private

Definition at line 114 of file sat_counter.hh.

Referenced by decrement(), increment(), read(), and reset().

uint8_t SatCounter::initialVal
private

Definition at line 112 of file sat_counter.hh.

Referenced by reset().

uint8_t SatCounter::maxVal
private

Definition at line 113 of file sat_counter.hh.

Referenced by increment(), SatCounter(), and setBits().


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

Generated on Fri Jun 9 2017 13:04:18 for gem5 by doxygen 1.8.6