itpp_sci  1.0.0
it++ based simulation framework for scicoslab, scilab and scipy
sim_nco.hpp
1 /*xxx
2 * \brief nco - NCO with fixed point Q1.N accumulator
3 * \author maki
4 */
5 
6 
7 #ifndef SIM_NCO_HPP
8 #define SIM_NCO_HPP
9 
10 #include <itpp/itbase.h>
11 #include "sim\_sim_extension.hpp"
12 
13 
14 using namespace itpp;
15 using namespace std;
16 
17 namespace SIM
18 {
19 
31 class nco
32 {
33  int Nq_bits;
34  q63_t q_scale;
35  q63_t acc;
36  vec y0;
37 
38 public:
39 
40  nco()
41  {
42  y0.set_length(2);
43  y0(0) = 0.0;
44  y0(1) = 0.0;
45  Nq_bits = 31;
46  q_scale = (q63_t)pow2(Nq_bits); // 2^31
47  acc = 0;
48  };
49 
50  ~nco()
51  {
52  };
53 
57  void set_N(int n);
58 
62  void set_acc(double a);
63 
67  void set_output(const vec &yout);
68 
70  int get_N();
71 
73  double get_acc();
74 
76  vec get_output();
77 
83  mat process(const bvec &ce, const vec &x);
84 };
85 
86 } // namespace SIM
87 #endif //SIM_NCO_HPP
88 
SIM layer implements low level simulation models with itpp base classes as operational types...
Definition: sim_amp.hpp:15
fixed point NCO - numerically controlled oscillator Core function: SIM::nco.process() ...
Definition: sim_nco.hpp:31
~nco()
Definition: sim_nco.hpp:50
Definition: _sci_assert.cpp:35
nco()
Definition: sim_nco.hpp:40