1 #include "base/misc.hh"
2 #include "cpu/beta_cpu/sat_counter.hh"
4 SatCounter::SatCounter()
5 : maxVal(0), counter(0)
9 SatCounter::SatCounter(unsigned bits
)
10 : maxVal((1 << bits
) - 1), counter(0)
14 SatCounter::SatCounter(unsigned bits
, unsigned initial_val
)
15 : maxVal((1 << bits
) - 1), counter(initial_val
)
17 // Check to make sure initial value doesn't exceed the max counter value.
18 if (initial_val
> maxVal
) {
19 panic("BP: Initial counter value exceeds max size.");
24 SatCounter::setBits(unsigned bits
)
26 maxVal
= (1 << bits
) - 1;
30 SatCounter::increment()
32 if(counter
< maxVal
) {
38 SatCounter::decrement()