1 #ifndef __CPU_BETA_CPU_SAT_COUNTER_HH__
2 #define __CPU_BETA_CPU_SAT_COUNTER_HH__
7 * Private counter class for the internal saturating counters.
8 * Implements an n bit saturating counter and provides methods to
9 * increment, decrement, and read it.
10 * @todo Consider making this something that more closely mimics a
11 * built in class so you can use ++ or --.
17 * Constructor for the counter.
22 * Constructor for the counter.
23 * @param bits How many bits the counter will have.
25 SatCounter(unsigned bits);
28 * Constructor for the counter.
29 * @param bits How many bits the counter will have.
30 * @param initial_val Starting value for each counter.
32 SatCounter(unsigned bits, unsigned initial_val);
35 * Sets the number of bits.
37 void setBits(unsigned bits);
40 * Increments the counter's current value.
45 * Decrements the counter's current value.
50 * Read the counter's value.
52 const uint8_t read() const
62 #endif // __CPU_BETA_CPU_SAT_COUNTER_HH__