itpp_sci  1.0.0
it++ based simulation framework for scicoslab, scilab and scipy
sim_counter.hpp
1 /*xxx
2 * \brief - modulo N up counter with clock enable signal
3 * \author maki
4 */
5 
6 
7 
8 #ifndef SIM_COUNTER_HPP
9 #define SIM_COUNTER_HPP
10 
11 #include <itpp/itbase.h>
12 
13 using namespace itpp;
14 using namespace std;
15 
16 
17 namespace SIM
18 {
19 
24 class counter
25 {
26  int cnt;
27  int Nmod;
28 
29 public:
31  {
32  cnt = 0;
33  Nmod = 2;
34  };
35 
37  {
38  };
39 
44  void set_N(int N);
45 
50  void set_state(int c);
51 
55  int get_N()
56  {
57  return (Nmod);
58  };
59 
63  int get_state()
64  {
65  return (cnt);
66  };
67 
70  void reset()
71  {
72  cnt = 0;
73  };
74 
79  bvec generate(const bvec &ce);
80 
81 };
82 
83 } // SIM
84 #endif //SIM_counter
counter()
Definition: sim_counter.hpp:30
binary modulo N up counter Core function SIM::counter.generate()
Definition: sim_counter.hpp:24
int get_state()
Definition: sim_counter.hpp:63
SIM layer implements low level simulation models with itpp base classes as operational types...
Definition: sim_amp.hpp:15
void reset()
Definition: sim_counter.hpp:70
Definition: _sci_assert.cpp:35
int get_N()
Definition: sim_counter.hpp:55
~counter()
Definition: sim_counter.hpp:36