fec_rsDecoderN31K29.vhd
Go to the documentation of this file.
1 -------------------------------------------------------
6 -------------------------------------------------------
7 
9 LIBRARY ieee;
10 USE ieee.std_logic_1164.all;
11 
13 USE work.lpgbtfpga_package.all;
14 
17  GENERIC (
18  N : integer := 31;
19  K : integer := 29;
20  SYMB_BITWIDTH : integer := 5
21  );
22  PORT (
23  payloadData_i : in std_logic_vector((K*SYMB_BITWIDTH)-1 downto 0);
24  fecData_i : in std_logic_vector(((N-K)*SYMB_BITWIDTH)-1 downto 0);
25 
26  data_o : out std_logic_vector((K*SYMB_BITWIDTH)-1 downto 0)
27  );
28 END rs_decoder_N31K29;
29 
31 ARCHITECTURE behavioral OF rs_decoder_N31K29 IS
32 
33  -- Functions
34  FUNCTION gf_multBy2_5 (
35  op : in std_logic_vector(4 downto 0)
36  )
37  RETURN std_logic_vector IS
38  VARIABLE tmp: std_logic_vector(4 downto 0);
39  BEGIN
40  tmp(0) := op(4);
41  tmp(1) := op(0);
42  tmp(2) := op(1) xor op(4);
43  tmp(3) := op(2);
44  tmp(4) := op(3);
45 
46  RETURN tmp;
47  END;
48 
49  FUNCTION gf_mult_5 (
50  op1 : in std_logic_vector(4 downto 0);
51  op2 : in std_logic_vector(4 downto 0)
52  )
53  RETURN std_logic_vector IS
54  VARIABLE tmp: std_logic_vector(4 downto 0);
55  BEGIN
56  tmp(0) := (((((op1(4) and op2(4)) xor (op1(1) and op2(4))) xor (op1(2) and op2(3))) xor (op1(3) and op2(2))) xor (op1(4) and op2(1))) xor (op1(0) and op2(0));
57  tmp(1) := ((((op1(1) and op2(0)) xor (op1(0) and op2(1))) xor (op1(4) and op2(2))) xor (op1(3) and op2(3))) xor (op1(2) and op2(4));
58  tmp(2) := (((((((((op1(2) and op2(0)) xor (op1(1) and op2(1))) xor (op1(4) and op2(1))) xor (op1(0) and op2(2))) xor (op1(3) and op2(2))) xor (op1(2) and op2(3))) xor (op1(4) and op2(3))) xor (op1(1) and op2(4))) xor (op1(3) and op2(4))) xor (op1(4) and op2(4));
59  tmp(3) := (((((((op1(3) and op2(0)) xor (op1(2) and op2(1))) xor (op1(1) and op2(2))) xor (op1(4) and op2(2))) xor (op1(0) and op2(3))) xor (op1(3) and op2(3))) xor (op1(2) and op2(4))) xor (op1(4) and op2(4));
60  tmp(4) := ((((((op1(4) and op2(0)) xor (op1(3) and op2(1))) xor (op1(2) and op2(2))) xor (op1(1) and op2(3))) xor (op1(4) and op2(3))) xor (op1(0) and op2(4))) xor (op1(3) and op2(4));
61 
62  RETURN tmp;
63  END;
64 
65  FUNCTION gf_inv_5 (
66  op : in std_logic_vector(4 downto 0)
67  )
68  RETURN std_logic_vector IS
69  VARIABLE tmp: std_logic_vector(4 downto 0);
70  BEGIN
71 
72  CASE op IS
73 
74  WHEN "00000" => tmp := "00000";
75  WHEN "00001" => tmp := "00001";
76  WHEN "00010" => tmp := "10010";
77  WHEN "00011" => tmp := "11100";
78  WHEN "00100" => tmp := "01001";
79  WHEN "00101" => tmp := "10111";
80  WHEN "00110" => tmp := "01110";
81  WHEN "00111" => tmp := "01100";
82  WHEN "01000" => tmp := "10110";
83  WHEN "01001" => tmp := "00100";
84  WHEN "01010" => tmp := "11001";
85  WHEN "01011" => tmp := "10000";
86  WHEN "01100" => tmp := "00111";
87  WHEN "01101" => tmp := "01111";
88  WHEN "01110" => tmp := "00110";
89  WHEN "01111" => tmp := "01101";
90  WHEN "10000" => tmp := "01011";
91  WHEN "10001" => tmp := "11000";
92  WHEN "10010" => tmp := "00010";
93  WHEN "10011" => tmp := "11101";
94  WHEN "10100" => tmp := "11110";
95  WHEN "10101" => tmp := "11010";
96  WHEN "10110" => tmp := "01000";
97  WHEN "10111" => tmp := "00101";
98  WHEN "11000" => tmp := "10001";
99  WHEN "11001" => tmp := "01010";
100  WHEN "11010" => tmp := "10101";
101  WHEN "11011" => tmp := "11111";
102  WHEN "11100" => tmp := "00011";
103  WHEN "11101" => tmp := "10011";
104  WHEN "11110" => tmp := "10100";
105  WHEN "11111" => tmp := "11011";
106  WHEN OTHERS => tmp := "00000";
107  END CASE;
108 
109  RETURN tmp;
110  END;
111 
112  FUNCTION gf_log_5 (
113  op : in std_logic_vector(4 downto 0)
114  )
115  RETURN std_logic_vector IS
116  VARIABLE tmp: std_logic_vector(4 downto 0);
117  BEGIN
118 
119  CASE op IS
120 
121  WHEN "00000" => tmp := "00000"; -- 0
122  WHEN "00001" => tmp := "00000"; -- 0
123  WHEN "00010" => tmp := "00001"; -- 1
124  WHEN "00011" => tmp := "10010"; -- 18
125  WHEN "00100" => tmp := "00010"; -- 2
126  WHEN "00101" => tmp := "00101"; -- 5
127  WHEN "00110" => tmp := "10011"; -- 19
128  WHEN "00111" => tmp := "01011"; -- 11
129  WHEN "01000" => tmp := "00011"; -- 3
130  WHEN "01001" => tmp := "11101"; -- 29
131  WHEN "01010" => tmp := "00110"; -- 6
132  WHEN "01011" => tmp := "11011"; -- 27
133  WHEN "01100" => tmp := "10100"; -- 20
134  WHEN "01101" => tmp := "01000"; -- 8
135  WHEN "01110" => tmp := "01100"; -- 12
136  WHEN "01111" => tmp := "10111"; -- 23
137  WHEN "10000" => tmp := "00100"; -- 4
138  WHEN "10001" => tmp := "01010"; -- 10
139  WHEN "10010" => tmp := "11110"; -- 30
140  WHEN "10011" => tmp := "10001"; -- 17
141  WHEN "10100" => tmp := "00111"; -- 7
142  WHEN "10101" => tmp := "10110"; -- 22
143  WHEN "10110" => tmp := "11100"; -- 28
144  WHEN "10111" => tmp := "11010"; -- 26
145  WHEN "11000" => tmp := "10101"; -- 21
146  WHEN "11001" => tmp := "11001"; -- 25
147  WHEN "11010" => tmp := "01001"; -- 9
148  WHEN "11011" => tmp := "10000"; -- 16
149  WHEN "11100" => tmp := "01101"; -- 13
150  WHEN "11101" => tmp := "01110"; -- 14
151  WHEN "11110" => tmp := "11000"; -- 24
152  WHEN "11111" => tmp := "01111"; -- 15
153  WHEN OTHERS => tmp := "00000";
154  END CASE;
155 
156  RETURN tmp;
157  END;
158 
159  -- Signals
160  SIGNAL msg : std_logic_vector((N*SYMB_BITWIDTH)-1 downto 0);
161  SIGNAL decMsg : std_logic_vector((K*SYMB_BITWIDTH)-1 downto 0);
162 
163  SIGNAL outSt1 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
164  SIGNAL outSt2 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
165  SIGNAL outSt3 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
166  SIGNAL outSt4 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
167  SIGNAL outSt5 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
168  SIGNAL outSt6 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
169  SIGNAL outSt7 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
170  SIGNAL outSt8 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
171  SIGNAL outSt9 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
172  SIGNAL outSt10 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
173  SIGNAL outSt11 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
174  SIGNAL outSt12 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
175  SIGNAL outSt13 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
176  SIGNAL outSt14 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
177  SIGNAL outSt15 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
178  SIGNAL outSt16 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
179  SIGNAL outSt17 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
180  SIGNAL outSt18 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
181  SIGNAL outSt19 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
182  SIGNAL outSt20 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
183  SIGNAL outSt21 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
184  SIGNAL outSt22 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
185  SIGNAL outSt23 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
186  SIGNAL outSt24 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
187  SIGNAL outSt25 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
188  SIGNAL outSt26 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
189  SIGNAL outSt27 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
190  SIGNAL outSt28 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
191  SIGNAL outSt29 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
192  SIGNAL outAdd0 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
193  SIGNAL outAdd1 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
194  SIGNAL outAdd2 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
195  SIGNAL outAdd3 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
196  SIGNAL outAdd4 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
197  SIGNAL outAdd5 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
198  SIGNAL outAdd6 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
199  SIGNAL outAdd7 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
200  SIGNAL outAdd8 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
201  SIGNAL outAdd9 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
202  SIGNAL outAdd10 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
203  SIGNAL outAdd11 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
204  SIGNAL outAdd12 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
205  SIGNAL outAdd13 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
206  SIGNAL outAdd14 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
207  SIGNAL outAdd15 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
208  SIGNAL outAdd16 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
209  SIGNAL outAdd17 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
210  SIGNAL outAdd18 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
211  SIGNAL outAdd19 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
212  SIGNAL outAdd20 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
213  SIGNAL outAdd21 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
214  SIGNAL outAdd22 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
215  SIGNAL outAdd23 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
216  SIGNAL outAdd24 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
217  SIGNAL outAdd25 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
218  SIGNAL outAdd26 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
219  SIGNAL outAdd27 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
220  SIGNAL outAdd28 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
221  SIGNAL outMult0 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
222  SIGNAL outMult1 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
223  SIGNAL outMult2 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
224  SIGNAL outMult3 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
225  SIGNAL outMult4 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
226  SIGNAL outMult5 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
227  SIGNAL outMult6 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
228  SIGNAL outMult7 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
229  SIGNAL outMult8 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
230  SIGNAL outMult9 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
231  SIGNAL outMult10 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
232  SIGNAL outMult11 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
233  SIGNAL outMult12 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
234  SIGNAL outMult13 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
235  SIGNAL outMult14 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
236  SIGNAL outMult15 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
237  SIGNAL outMult16 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
238  SIGNAL outMult17 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
239  SIGNAL outMult18 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
240  SIGNAL outMult19 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
241  SIGNAL outMult20 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
242  SIGNAL outMult21 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
243  SIGNAL outMult22 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
244  SIGNAL outMult23 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
245  SIGNAL outMult24 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
246  SIGNAL outMult25 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
247  SIGNAL outMult26 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
248  SIGNAL outMult27 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
249  SIGNAL outMult28 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
250  SIGNAL outMult29 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
251  SIGNAL syndr0 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
252  SIGNAL syndr1 : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
253  SIGNAL syndr0_inv : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
254  SIGNAL syndrProd : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
255  SIGNAL errorPos : std_logic_vector((SYMB_BITWIDTH-1) downto 0);
256 
257 BEGIN --========#### Architecture Body ####========--
258 
259  -- ---------------- The Parallel LFSR HDL description ---------------- --
260 
261  -- MSG mapping
262  msg <= fecData_i & payloadData_i;
263 
264  -- Evaluates the first syndrom
265  outSt1 <= msg(((SYMB_BITWIDTH + 0)-1) downto 0) xor msg(((2*SYMB_BITWIDTH)-1) downto SYMB_BITWIDTH);
266  outSt2 <= msg(((SYMB_BITWIDTH + (2*SYMB_BITWIDTH)-1)) downto (2*SYMB_BITWIDTH)) xor outSt1;
267  outSt3 <= msg(((SYMB_BITWIDTH + (3*SYMB_BITWIDTH)-1)) downto (3*SYMB_BITWIDTH)) xor outSt2;
268  outSt4 <= msg(((SYMB_BITWIDTH + (4*SYMB_BITWIDTH)-1)) downto (4*SYMB_BITWIDTH)) xor outSt3;
269  outSt5 <= msg(((SYMB_BITWIDTH + (5*SYMB_BITWIDTH)-1)) downto (5*SYMB_BITWIDTH)) xor outSt4;
270  outSt6 <= msg(((SYMB_BITWIDTH + (6*SYMB_BITWIDTH)-1)) downto (6*SYMB_BITWIDTH)) xor outSt5;
271  outSt7 <= msg(((SYMB_BITWIDTH + (7*SYMB_BITWIDTH)-1)) downto (7*SYMB_BITWIDTH)) xor outSt6;
272  outSt8 <= msg(((SYMB_BITWIDTH + (8*SYMB_BITWIDTH)-1)) downto (8*SYMB_BITWIDTH)) xor outSt7;
273  outSt9 <= msg(((SYMB_BITWIDTH + (9*SYMB_BITWIDTH)-1)) downto (9*SYMB_BITWIDTH)) xor outSt8;
274  outSt10 <= msg(((SYMB_BITWIDTH + (10*SYMB_BITWIDTH)-1)) downto (10*SYMB_BITWIDTH)) xor outSt9;
275  outSt11 <= msg(((SYMB_BITWIDTH + (11*SYMB_BITWIDTH)-1)) downto (11*SYMB_BITWIDTH)) xor outSt10;
276  outSt12 <= msg(((SYMB_BITWIDTH + (12*SYMB_BITWIDTH)-1)) downto (12*SYMB_BITWIDTH)) xor outSt11;
277  outSt13 <= msg(((SYMB_BITWIDTH + (13*SYMB_BITWIDTH)-1)) downto (13*SYMB_BITWIDTH)) xor outSt12;
278  outSt14 <= msg(((SYMB_BITWIDTH + (14*SYMB_BITWIDTH)-1)) downto (14*SYMB_BITWIDTH)) xor outSt13;
279  outSt15 <= msg(((SYMB_BITWIDTH + (15*SYMB_BITWIDTH)-1)) downto (15*SYMB_BITWIDTH)) xor outSt14;
280  outSt16 <= msg(((SYMB_BITWIDTH + (16*SYMB_BITWIDTH)-1)) downto (16*SYMB_BITWIDTH)) xor outSt15;
281  outSt17 <= msg(((SYMB_BITWIDTH + (17*SYMB_BITWIDTH)-1)) downto (17*SYMB_BITWIDTH)) xor outSt16;
282  outSt18 <= msg(((SYMB_BITWIDTH + (18*SYMB_BITWIDTH)-1)) downto (18*SYMB_BITWIDTH)) xor outSt17;
283  outSt19 <= msg(((SYMB_BITWIDTH + (19*SYMB_BITWIDTH)-1)) downto (19*SYMB_BITWIDTH)) xor outSt18;
284  outSt20 <= msg(((SYMB_BITWIDTH + (20*SYMB_BITWIDTH)-1)) downto (20*SYMB_BITWIDTH)) xor outSt19;
285  outSt21 <= msg(((SYMB_BITWIDTH + (21*SYMB_BITWIDTH)-1)) downto (21*SYMB_BITWIDTH)) xor outSt20;
286  outSt22 <= msg(((SYMB_BITWIDTH + (22*SYMB_BITWIDTH)-1)) downto (22*SYMB_BITWIDTH)) xor outSt21;
287  outSt23 <= msg(((SYMB_BITWIDTH + (23*SYMB_BITWIDTH)-1)) downto (23*SYMB_BITWIDTH)) xor outSt22;
288  outSt24 <= msg(((SYMB_BITWIDTH + (24*SYMB_BITWIDTH)-1)) downto (24*SYMB_BITWIDTH)) xor outSt23;
289  outSt25 <= msg(((SYMB_BITWIDTH + (25*SYMB_BITWIDTH)-1)) downto (25*SYMB_BITWIDTH)) xor outSt24;
290  outSt26 <= msg(((SYMB_BITWIDTH + (26*SYMB_BITWIDTH)-1)) downto (26*SYMB_BITWIDTH)) xor outSt25;
291  outSt27 <= msg(((SYMB_BITWIDTH + (27*SYMB_BITWIDTH)-1)) downto (27*SYMB_BITWIDTH)) xor outSt26;
292  outSt28 <= msg(((SYMB_BITWIDTH + (28*SYMB_BITWIDTH)-1)) downto (28*SYMB_BITWIDTH)) xor outSt27;
293  outSt29 <= msg(((SYMB_BITWIDTH + (29*SYMB_BITWIDTH)-1)) downto (29*SYMB_BITWIDTH)) xor outSt28;
294  syndr0 <= msg(((SYMB_BITWIDTH + (30*SYMB_BITWIDTH)-1)) downto (30*SYMB_BITWIDTH)) xor outSt29;
295 
296  -- Evaluates the second syndrom
297  outMult0 <= gf_multBy2_5(msg(SYMB_BITWIDTH-1 downto 0));
298  outMult1 <= gf_multBy2_5(outAdd0);
299  outMult2 <= gf_multBy2_5(outAdd1);
300  outMult3 <= gf_multBy2_5(outAdd2);
301  outMult4 <= gf_multBy2_5(outAdd3);
302  outMult5 <= gf_multBy2_5(outAdd4);
303  outMult6 <= gf_multBy2_5(outAdd5);
304  outMult7 <= gf_multBy2_5(outAdd6);
305  outMult8 <= gf_multBy2_5(outAdd7);
306  outMult9 <= gf_multBy2_5(outAdd8);
307  outMult10 <= gf_multBy2_5(outAdd9);
308  outMult11 <= gf_multBy2_5(outAdd10);
309  outMult12 <= gf_multBy2_5(outAdd11);
310  outMult13 <= gf_multBy2_5(outAdd12);
311  outMult14 <= gf_multBy2_5(outAdd13);
312  outMult15 <= gf_multBy2_5(outAdd14);
313  outMult16 <= gf_multBy2_5(outAdd15);
314  outMult17 <= gf_multBy2_5(outAdd16);
315  outMult18 <= gf_multBy2_5(outAdd17);
316  outMult19 <= gf_multBy2_5(outAdd18);
317  outMult20 <= gf_multBy2_5(outAdd19);
318  outMult21 <= gf_multBy2_5(outAdd20);
319  outMult22 <= gf_multBy2_5(outAdd21);
320  outMult23 <= gf_multBy2_5(outAdd22);
321  outMult24 <= gf_multBy2_5(outAdd23);
322  outMult25 <= gf_multBy2_5(outAdd24);
323  outMult26 <= gf_multBy2_5(outAdd25);
324  outMult27 <= gf_multBy2_5(outAdd26);
325  outMult28 <= gf_multBy2_5(outAdd27);
326  outMult29 <= gf_multBy2_5(outAdd28);
327 
328  outAdd0 <= outMult0 xor msg(((SYMB_BITWIDTH+SYMB_BITWIDTH)-1) downto SYMB_BITWIDTH);
329  outAdd1 <= outMult1 xor msg(((SYMB_BITWIDTH+2*SYMB_BITWIDTH)-1) downto (2*SYMB_BITWIDTH));
330  outAdd2 <= outMult2 xor msg(((SYMB_BITWIDTH+3*SYMB_BITWIDTH)-1) downto (3*SYMB_BITWIDTH));
331  outAdd3 <= outMult3 xor msg(((SYMB_BITWIDTH+4*SYMB_BITWIDTH)-1) downto (4*SYMB_BITWIDTH));
332  outAdd4 <= outMult4 xor msg(((SYMB_BITWIDTH+5*SYMB_BITWIDTH)-1) downto (5*SYMB_BITWIDTH));
333  outAdd5 <= outMult5 xor msg(((SYMB_BITWIDTH+6*SYMB_BITWIDTH)-1) downto (6*SYMB_BITWIDTH));
334  outAdd6 <= outMult6 xor msg(((SYMB_BITWIDTH+7*SYMB_BITWIDTH)-1) downto (7*SYMB_BITWIDTH));
335  outAdd7 <= outMult7 xor msg(((SYMB_BITWIDTH+8*SYMB_BITWIDTH)-1) downto (8*SYMB_BITWIDTH));
336  outAdd8 <= outMult8 xor msg(((SYMB_BITWIDTH+9*SYMB_BITWIDTH)-1) downto (9*SYMB_BITWIDTH));
337  outAdd9 <= outMult9 xor msg(((SYMB_BITWIDTH+10*SYMB_BITWIDTH)-1) downto (10*SYMB_BITWIDTH));
338  outAdd10 <= outMult10 xor msg(((SYMB_BITWIDTH+11*SYMB_BITWIDTH)-1) downto (11*SYMB_BITWIDTH));
339  outAdd11 <= outMult11 xor msg(((SYMB_BITWIDTH+12*SYMB_BITWIDTH)-1) downto (12*SYMB_BITWIDTH));
340  outAdd12 <= outMult12 xor msg(((SYMB_BITWIDTH+13*SYMB_BITWIDTH)-1) downto (13*SYMB_BITWIDTH));
341  outAdd13 <= outMult13 xor msg(((SYMB_BITWIDTH+14*SYMB_BITWIDTH)-1) downto (14*SYMB_BITWIDTH));
342  outAdd14 <= outMult14 xor msg(((SYMB_BITWIDTH+15*SYMB_BITWIDTH)-1) downto (15*SYMB_BITWIDTH));
343  outAdd15 <= outMult15 xor msg(((SYMB_BITWIDTH+16*SYMB_BITWIDTH)-1) downto (16*SYMB_BITWIDTH));
344  outAdd16 <= outMult16 xor msg(((SYMB_BITWIDTH+17*SYMB_BITWIDTH)-1) downto (17*SYMB_BITWIDTH));
345  outAdd17 <= outMult17 xor msg(((SYMB_BITWIDTH+18*SYMB_BITWIDTH)-1) downto (18*SYMB_BITWIDTH));
346  outAdd18 <= outMult18 xor msg(((SYMB_BITWIDTH+19*SYMB_BITWIDTH)-1) downto (19*SYMB_BITWIDTH));
347  outAdd19 <= outMult19 xor msg(((SYMB_BITWIDTH+20*SYMB_BITWIDTH)-1) downto (20*SYMB_BITWIDTH));
348  outAdd20 <= outMult20 xor msg(((SYMB_BITWIDTH+21*SYMB_BITWIDTH)-1) downto (21*SYMB_BITWIDTH));
349  outAdd21 <= outMult21 xor msg(((SYMB_BITWIDTH+22*SYMB_BITWIDTH)-1) downto (22*SYMB_BITWIDTH));
350  outAdd22 <= outMult22 xor msg(((SYMB_BITWIDTH+23*SYMB_BITWIDTH)-1) downto (23*SYMB_BITWIDTH));
351  outAdd23 <= outMult23 xor msg(((SYMB_BITWIDTH+24*SYMB_BITWIDTH)-1) downto (24*SYMB_BITWIDTH));
352  outAdd24 <= outMult24 xor msg(((SYMB_BITWIDTH+25*SYMB_BITWIDTH)-1) downto (25*SYMB_BITWIDTH));
353  outAdd25 <= outMult25 xor msg(((SYMB_BITWIDTH+26*SYMB_BITWIDTH)-1) downto (26*SYMB_BITWIDTH));
354  outAdd26 <= outMult26 xor msg(((SYMB_BITWIDTH+27*SYMB_BITWIDTH)-1) downto (27*SYMB_BITWIDTH));
355  outAdd27 <= outMult27 xor msg(((SYMB_BITWIDTH+28*SYMB_BITWIDTH)-1) downto (28*SYMB_BITWIDTH));
356  outAdd28 <= outMult28 xor msg(((SYMB_BITWIDTH+29*SYMB_BITWIDTH)-1) downto (29*SYMB_BITWIDTH));
357  syndr1 <= outMult29 xor msg(((SYMB_BITWIDTH+30*SYMB_BITWIDTH)-1) downto (30*SYMB_BITWIDTH));
358 
359  -- Evaluates position of error
360  syndr0_inv <= gf_inv_5(syndr0);
361  syndrProd <= gf_mult_5(syndr0_inv, syndr1);
362  errorPos <= gf_log_5(syndrProd);
363 
364  -- Correct message.. Correction on parity bits is ignored!
365  decMsg(((SYMB_BITWIDTH+28*SYMB_BITWIDTH)-1) downto (28*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+28*SYMB_BITWIDTH)-1) downto (28*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "00010" ELSE
366  msg(((SYMB_BITWIDTH+28*SYMB_BITWIDTH)-1) downto (28*SYMB_BITWIDTH));
367 
368  decMsg(((SYMB_BITWIDTH+27*SYMB_BITWIDTH)-1) downto (27*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+27*SYMB_BITWIDTH)-1) downto (27*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "00011" ELSE
369  msg(((SYMB_BITWIDTH+27*SYMB_BITWIDTH)-1) downto (27*SYMB_BITWIDTH));
370 
371  decMsg(((SYMB_BITWIDTH+26*SYMB_BITWIDTH)-1) downto (26*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+26*SYMB_BITWIDTH)-1) downto (26*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "00100" ELSE
372  msg(((SYMB_BITWIDTH+26*SYMB_BITWIDTH)-1) downto (26*SYMB_BITWIDTH));
373 
374  decMsg(((SYMB_BITWIDTH+25*SYMB_BITWIDTH)-1) downto (25*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+25*SYMB_BITWIDTH)-1) downto (25*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "00101" ELSE
375  msg(((SYMB_BITWIDTH+25*SYMB_BITWIDTH)-1) downto (25*SYMB_BITWIDTH));
376 
377  decMsg(((SYMB_BITWIDTH+24*SYMB_BITWIDTH)-1) downto (24*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+24*SYMB_BITWIDTH)-1) downto (24*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "00110" ELSE
378  msg(((SYMB_BITWIDTH+24*SYMB_BITWIDTH)-1) downto (24*SYMB_BITWIDTH));
379 
380  decMsg(((SYMB_BITWIDTH+23*SYMB_BITWIDTH)-1) downto (23*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+23*SYMB_BITWIDTH)-1) downto (23*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "00111" ELSE
381  msg(((SYMB_BITWIDTH+23*SYMB_BITWIDTH)-1) downto (23*SYMB_BITWIDTH));
382 
383  decMsg(((SYMB_BITWIDTH+22*SYMB_BITWIDTH)-1) downto (22*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+22*SYMB_BITWIDTH)-1) downto (22*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "01000" ELSE
384  msg(((SYMB_BITWIDTH+22*SYMB_BITWIDTH)-1) downto (22*SYMB_BITWIDTH));
385 
386  decMsg(((SYMB_BITWIDTH+21*SYMB_BITWIDTH)-1) downto (21*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+21*SYMB_BITWIDTH)-1) downto (21*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "01001" ELSE
387  msg(((SYMB_BITWIDTH+21*SYMB_BITWIDTH)-1) downto (21*SYMB_BITWIDTH));
388 
389  decMsg(((SYMB_BITWIDTH+20*SYMB_BITWIDTH)-1) downto (20*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+20*SYMB_BITWIDTH)-1) downto (20*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "01010" ELSE
390  msg(((SYMB_BITWIDTH+20*SYMB_BITWIDTH)-1) downto (20*SYMB_BITWIDTH));
391 
392  decMsg(((SYMB_BITWIDTH+19*SYMB_BITWIDTH)-1) downto (19*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+19*SYMB_BITWIDTH)-1) downto (19*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "01011" ELSE
393  msg(((SYMB_BITWIDTH+19*SYMB_BITWIDTH)-1) downto (19*SYMB_BITWIDTH));
394 
395  decMsg(((SYMB_BITWIDTH+18*SYMB_BITWIDTH)-1) downto (18*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+18*SYMB_BITWIDTH)-1) downto (18*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "01100" ELSE
396  msg(((SYMB_BITWIDTH+18*SYMB_BITWIDTH)-1) downto (18*SYMB_BITWIDTH));
397 
398  decMsg(((SYMB_BITWIDTH+17*SYMB_BITWIDTH)-1) downto (17*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+17*SYMB_BITWIDTH)-1) downto (17*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "01101" ELSE
399  msg(((SYMB_BITWIDTH+17*SYMB_BITWIDTH)-1) downto (17*SYMB_BITWIDTH));
400 
401  decMsg(((SYMB_BITWIDTH+16*SYMB_BITWIDTH)-1) downto (16*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+16*SYMB_BITWIDTH)-1) downto (16*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "01110" ELSE
402  msg(((SYMB_BITWIDTH+16*SYMB_BITWIDTH)-1) downto (16*SYMB_BITWIDTH));
403 
404  decMsg(((SYMB_BITWIDTH+15*SYMB_BITWIDTH)-1) downto (15*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+15*SYMB_BITWIDTH)-1) downto (15*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "01111" ELSE
405  msg(((SYMB_BITWIDTH+15*SYMB_BITWIDTH)-1) downto (15*SYMB_BITWIDTH));
406 
407  decMsg(((SYMB_BITWIDTH+14*SYMB_BITWIDTH)-1) downto (14*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+14*SYMB_BITWIDTH)-1) downto (14*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "10000" ELSE
408  msg(((SYMB_BITWIDTH+14*SYMB_BITWIDTH)-1) downto (14*SYMB_BITWIDTH));
409 
410  decMsg(((SYMB_BITWIDTH+13*SYMB_BITWIDTH)-1) downto (13*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+13*SYMB_BITWIDTH)-1) downto (13*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "10001" ELSE
411  msg(((SYMB_BITWIDTH+13*SYMB_BITWIDTH)-1) downto (13*SYMB_BITWIDTH));
412 
413  decMsg(((SYMB_BITWIDTH+12*SYMB_BITWIDTH)-1) downto (12*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+12*SYMB_BITWIDTH)-1) downto (12*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "10010" ELSE
414  msg(((SYMB_BITWIDTH+12*SYMB_BITWIDTH)-1) downto (12*SYMB_BITWIDTH));
415 
416  decMsg(((SYMB_BITWIDTH+11*SYMB_BITWIDTH)-1) downto (11*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+11*SYMB_BITWIDTH)-1) downto (11*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "10011" ELSE
417  msg(((SYMB_BITWIDTH+11*SYMB_BITWIDTH)-1) downto (11*SYMB_BITWIDTH));
418 
419  decMsg(((SYMB_BITWIDTH+10*SYMB_BITWIDTH)-1) downto (10*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+10*SYMB_BITWIDTH)-1) downto (10*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "10100" ELSE
420  msg(((SYMB_BITWIDTH+10*SYMB_BITWIDTH)-1) downto (10*SYMB_BITWIDTH));
421 
422  decMsg(((SYMB_BITWIDTH+9*SYMB_BITWIDTH)-1) downto (9*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+9*SYMB_BITWIDTH)-1) downto (9*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "10101" ELSE
423  msg(((SYMB_BITWIDTH+9*SYMB_BITWIDTH)-1) downto (9*SYMB_BITWIDTH));
424 
425  decMsg(((SYMB_BITWIDTH+8*SYMB_BITWIDTH)-1) downto (8*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+8*SYMB_BITWIDTH)-1) downto (8*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "10110" ELSE
426  msg(((SYMB_BITWIDTH+8*SYMB_BITWIDTH)-1) downto (8*SYMB_BITWIDTH));
427 
428  decMsg(((SYMB_BITWIDTH+7*SYMB_BITWIDTH)-1) downto (7*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+7*SYMB_BITWIDTH)-1) downto (7*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "10111" ELSE
429  msg(((SYMB_BITWIDTH+7*SYMB_BITWIDTH)-1) downto (7*SYMB_BITWIDTH));
430 
431  decMsg(((SYMB_BITWIDTH+6*SYMB_BITWIDTH)-1) downto (6*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+6*SYMB_BITWIDTH)-1) downto (6*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "11000" ELSE
432  msg(((SYMB_BITWIDTH+6*SYMB_BITWIDTH)-1) downto (6*SYMB_BITWIDTH));
433 
434  decMsg(((SYMB_BITWIDTH+5*SYMB_BITWIDTH)-1) downto (5*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+5*SYMB_BITWIDTH)-1) downto (5*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "11001" ELSE
435  msg(((SYMB_BITWIDTH+5*SYMB_BITWIDTH)-1) downto (5*SYMB_BITWIDTH));
436 
437  decMsg(((SYMB_BITWIDTH+4*SYMB_BITWIDTH)-1) downto (4*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+4*SYMB_BITWIDTH)-1) downto (4*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "11010" ELSE
438  msg(((SYMB_BITWIDTH+4*SYMB_BITWIDTH)-1) downto (4*SYMB_BITWIDTH));
439 
440  decMsg(((SYMB_BITWIDTH+3*SYMB_BITWIDTH)-1) downto (3*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+3*SYMB_BITWIDTH)-1) downto (3*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "11011" ELSE
441  msg(((SYMB_BITWIDTH+3*SYMB_BITWIDTH)-1) downto (3*SYMB_BITWIDTH));
442 
443  decMsg(((SYMB_BITWIDTH+2*SYMB_BITWIDTH)-1) downto (2*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+2*SYMB_BITWIDTH)-1) downto (2*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "11100" ELSE
444  msg(((SYMB_BITWIDTH+2*SYMB_BITWIDTH)-1) downto (2*SYMB_BITWIDTH));
445 
446  decMsg(((SYMB_BITWIDTH+1*SYMB_BITWIDTH)-1) downto (1*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+1*SYMB_BITWIDTH)-1) downto (1*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "11101" ELSE
447  msg(((SYMB_BITWIDTH+1*SYMB_BITWIDTH)-1) downto (1*SYMB_BITWIDTH));
448 
449  decMsg(((SYMB_BITWIDTH+0*SYMB_BITWIDTH)-1) downto (0*SYMB_BITWIDTH)) <= msg(((SYMB_BITWIDTH+0*SYMB_BITWIDTH)-1) downto (0*SYMB_BITWIDTH)) xor syndr0 WHEN errorPos = "11110" ELSE
450  msg(((SYMB_BITWIDTH+0*SYMB_BITWIDTH)-1) downto (0*SYMB_BITWIDTH));
451 
452  data_o <= decMsg;
453 
454 END behavioral;
455 --=================================================================================================--
456 --#################################################################################################--
457 --=================================================================================================--
in payloadData_istd_logic_vector%(%(K%*%SYMB_BITWIDTH)%-%1%%%downto%%%0%)
Message to be decoded.
in fecData_istd_logic_vector%(%((N%-%K)%*%SYMB_BITWIDTH)%-%1%%%downto%%%0%)
FEC USEd to decode.
rs_decoder_N31K29 - N31K29 Reed-Solomon decoder
out data_ostd_logic_vector%(%(K%*%SYMB_BITWIDTH)%-%1%%%downto%%%0%)
Decoded / corrected data.
_library_ ieeeieee
Include the IEEE VHDL standard LIBRARY.