itpp_sci  1.0.0
it++ based simulation framework for scicoslab, scilab and scipy
sim_lfsr.hpp
1 /*xxx
2 * \brief - SIM::lfsr for linear feedback shift register
3 * \author maki
4 */
5 
6 
7 
8 #ifndef SIM_LFSR_HPP
9 #define SIM_LFSR_HPP
10 
11 #include <itpp/itbase.h>
12 #include <itpp/comm/sequence.h>
13 
14 using namespace itpp;
15 using namespace std;
16 
17 
18 namespace SIM
19 {
20 
47 class lfsr : public itpp::LFSR
48 {
49 private:
50  bvec y0;
51  bvec s0;
52  int symbol_size;
53  bvec poly_gen;
54  bool rev_flag;
55 
56 public:
57  lfsr()
58  {
59  rev_flag = true; // by default it is not compatible with LFSR to provide easy sync with bit symbols
60  symbol_size = 1;
61  };
63  {
64 
65  };
66 
73  void set_poly(const bvec &bpoly);
74 
81  void set_prbs(int M);
82 
88  void set_symbol_size(int W);
89 
94  void set_reset_state(const bvec &binit);
95 
100  void set_output(const bvec &yout);
101 
106  void set_rev_flag(bool flag);
107 
111  bvec get_poly();
112 
117  bvec get_state();
118 
122  int get_symbol_size();
123 
127  bvec get_reset_state();
128 
132  bvec get_output();
133 
138  bool get_rev_flag();
139 
140 
145  bmat generate(const bvec &ce);
146 
147 };
148 
149 
150 }
151 #endif //SIM_lfsr
SIM layer implements low level simulation models with itpp base classes as operational types...
Definition: sim_amp.hpp:15
Definition: _sci_assert.cpp:35
lfsr()
Definition: sim_lfsr.hpp:57
~lfsr()
Definition: sim_lfsr.hpp:62
linear feedback shift register Core function: SIM::lfsr.generate()
Definition: sim_lfsr.hpp:47