itpp_sci  1.0.0
it++ based simulation framework for scicoslab, scilab and scipy
sim_bert.hpp
1 /*xxx
2 * \brief - bit error rate tester
3 * \author maki
4 */
5 
6 
7 
8 #ifndef SIM_BERT_HPP
9 #define SIM_BERT_HPP
10 
11 #include <itpp/itbase.h>
12 #include <itpp/comm/sequence.h>
13 
14 #include "sim\_sim_enum_def.h"
15 #include "sim\sim_lfsr.hpp"
16 #include "sim\sim_lsr.hpp"
17 
18 
19 using namespace itpp;
20 using namespace std;
21 
22 namespace SIM
23 {
24 
51 class bert
52 {
53 private:
54  bvec one;
55 
56  bert_fsm_state FSM;
57  bert_fsm_state y0;
58  int metrics;
59 
60 
61  lsr lsrx;
62  lsr lsry;
63  lfsr prbs;
64 
65  int cnt_bit;
66  int cnt_err;
67 
68  int acc_cnt_bit;
69  int acc_cnt_err;
70 
71  int bit_reloaded;
72  int bit_preset;
73 
74  int T0; //<! thresholds for entering SYNC
75  int T1; //<! thresholds for leaving SYNC
76  int T2; //<! thresholds for entering RELOAD
77  int symbol_size;
78 
79  bert_adr adr;
80 
81 public:
82 
83  bert()
84  {
85  FSM = BERT_FSM_RESET;
86  cnt_bit = 0; // only static const data members can be initialized within a class
87  cnt_err = 0;
88  acc_cnt_bit = 0;
89  acc_cnt_err = 0;
90  bit_reloaded = 0;
91  bit_preset = 0;
92  one = bvec("1");
93  };
94 
96  {
97  };
98 
102  void set_prbs(int M);
103 
107  void set_poly(const bvec &bpoly);
108 
112  void set_symbol_size(int W);
113 
118  void set_length(int L);
119 
125  void set_threshold(const ivec &T);
126 
131  void set_fsm(bert_fsm_state state);
132 
136  void set_output(bert_fsm_state yout);
137 
141  void set_adr(bert_adr a);
142 
146  int get_length(void);
147 
151  int get_symbol_size(void);
152 
156  ivec get_threshold(void);
157 
161  ivec get_cnt(void);
162 
166  ivec get_acc_cnt(void);
167 
171  int get_metrics();
172 
176  bert_fsm_state get_fsm(void); // y0 = FSM
177 
181  bvec get_state();
182 
186  bvec get_poly();
187 
191  bert_fsm_state get_output(void);
192 
195  void clear_counters(void);
196 
204  ivec process(const bvec &ce, const bmat &x);
205 
206 };
207 
208 
209 }
210 #endif //SIM_bert
SIM layer implements low level simulation models with itpp base classes as operational types...
Definition: sim_amp.hpp:15
linear shift register Core function: SIM::lsr.process()
Definition: sim_lsr.hpp:35
Definition: _sci_assert.cpp:35
~bert()
Definition: sim_bert.hpp:95
BERT - Bit Error Rate Tester Core function SIM::bert.process() .
Definition: sim_bert.hpp:51
bert()
Definition: sim_bert.hpp:83
linear feedback shift register Core function: SIM::lfsr.generate()
Definition: sim_lfsr.hpp:47