DP-HLS
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
loop_counter.h
Go to the documentation of this file.
1 #ifndef LOOP_COUNTER_H
2 #define LOOP_COUNTER_H
3 
4 template <int LENGTH>
6 {
7 public:
9  this->value = 0;
10  };
11 
12  LoopCounter(int start) {
13  this->value = start;
14  }
15 
16  int val() {
17  return this->value;
18  }
19 
20  void operator++() {
21  this->value = (this->value == LENGTH) ? 0 : this->value + 1;
22  }
23 
24  void operator--(){
25  this->value = (this->value == 0) ? (LENGTH - 1) : this->value - 1;
26  }
27 
28 private:
29  int value;
30 };
31 
32 #endif // !LOOP_COUNTER_H
Definition: loop_counter.h:5
LoopCounter(int start)
Definition: loop_counter.h:12
void operator++()
Definition: loop_counter.h:20
LoopCounter()
Definition: loop_counter.h:8
void operator--()
Definition: loop_counter.h:24
int val()
Definition: loop_counter.h:16