OpenCores
URL https://opencores.org/ocsvn/product_code_iterative_decoder/product_code_iterative_decoder/trunk

Subversion Repositories product_code_iterative_decoder

[/] [product_code_iterative_decoder/] [trunk/] [source/] [product_code.vhdl] - Blame information for rev 18

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 18 arif_endro
-- ------------------------------------------------------------------------
2 14 arif_endro
-- Copyright (C) 2005 Arif Endro Nugroho
3 18 arif_endro
-- All rights reserved.
4 2 arif_endro
-- 
5 18 arif_endro
-- Redistribution and use in source and binary forms, with or without
6
-- modification, are permitted provided that the following conditions
7
-- are met:
8 2 arif_endro
-- 
9 18 arif_endro
-- 1. Redistributions of source code must retain the above copyright
10
--    notice, this list of conditions and the following disclaimer.
11
-- 2. Redistributions in binary form must reproduce the above copyright
12
--    notice, this list of conditions and the following disclaimer in the
13
--    documentation and/or other materials provided with the distribution.
14 2 arif_endro
-- 
15 18 arif_endro
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
16
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
19
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
-- POSSIBILITY OF SUCH DAMAGE.
26 2 arif_endro
-- 
27 18 arif_endro
-- End Of License.
28
-- ------------------------------------------------------------------------
29 2 arif_endro
 
30
library IEEE;
31
use IEEE.std_logic_1164.all;
32
 
33
entity product_code is
34
   port (
35
     clock   : in  bit;
36
     start   : in  bit;
37
     rxin    : in  bit_vector (07 downto 00);
38
     y0d     : out bit;
39
     y1d     : out bit;
40
     y2d     : out bit;
41
     y3d     : out bit
42
     );
43
end product_code;
44
 
45
architecture structural of product_code is
46
 
47
   component ser2par8bit
48
      port (
49
         clock : in  bit;
50
         clear : in  bit;
51
         start : in  bit;
52
         rxin  : in  bit_vector (07 downto 00);
53
         y0    : out bit_vector (07 downto 00);
54
         y1    : out bit_vector (07 downto 00);
55
         y2    : out bit_vector (07 downto 00);
56
         y3    : out bit_vector (07 downto 00);
57
         r0    : out bit_vector (07 downto 00);
58
         r1    : out bit_vector (07 downto 00);
59
         c0    : out bit_vector (07 downto 00);
60
         c1    : out bit_vector (07 downto 00)
61
         );
62
   end component;
63
 
64
   component ext_val
65
      port (
66
         ext_a_i : in  bit_vector (07 downto 00);
67
         ext_b_i : in  bit_vector (07 downto 00);
68
         ext_r_o : out bit_vector (07 downto 00)
69
         );
70
   end component;
71
 
72
   component adder_08bit
73
      port (
74
         addend_08bit   : in  bit_vector (07 downto 00);
75
         augend_08bit   : in  bit_vector (07 downto 00);
76
         adder08_output : out bit_vector (08 downto 00)
77
         );
78
   end component;
79
 
80
   signal y0e : bit_vector (07 downto 00);
81
   signal y1e : bit_vector (07 downto 00);
82
   signal y2e : bit_vector (07 downto 00);
83
   signal y3e : bit_vector (07 downto 00);
84
 
85
   signal y0 : bit_vector (07 downto 00);
86
   signal y1 : bit_vector (07 downto 00);
87
   signal y2 : bit_vector (07 downto 00);
88
   signal y3 : bit_vector (07 downto 00);
89
   signal r0 : bit_vector (07 downto 00);
90
   signal r1 : bit_vector (07 downto 00);
91
   signal c0 : bit_vector (07 downto 00);
92
   signal c1 : bit_vector (07 downto 00);
93
 
94
   signal ext_b_c_0_b : bit_vector (08 downto 00);
95
   signal ext_b_c_1_b : bit_vector (08 downto 00);
96
   signal ext_b_c_2_b : bit_vector (08 downto 00);
97
   signal ext_b_c_3_b : bit_vector (08 downto 00);
98
 
99
   signal augend_sum_c_0 : bit_vector (07 downto 00);
100
   signal augend_sum_c_1 : bit_vector (07 downto 00);
101
   signal augend_sum_c_2 : bit_vector (07 downto 00);
102
   signal augend_sum_c_3 : bit_vector (07 downto 00);
103
 
104
   signal ext_r_r_0 : bit_vector (07 downto 00);
105
   signal ext_r_r_1 : bit_vector (07 downto 00);
106
   signal ext_r_r_2 : bit_vector (07 downto 00);
107
   signal ext_r_r_3 : bit_vector (07 downto 00);
108
 
109
   signal ext_b_r_0_b : bit_vector (08 downto 00);
110
   signal ext_b_r_1_b : bit_vector (08 downto 00);
111
   signal ext_b_r_2_b : bit_vector (08 downto 00);
112
   signal ext_b_r_3_b : bit_vector (08 downto 00);
113
 
114
   signal ext_b_r_0 : bit_vector (07 downto 00);
115
   signal ext_b_r_1 : bit_vector (07 downto 00);
116
   signal ext_b_r_2 : bit_vector (07 downto 00);
117
   signal ext_b_r_3 : bit_vector (07 downto 00);
118
 
119
   signal ext_r_c_0 : bit_vector (07 downto 00);
120
   signal ext_r_c_1 : bit_vector (07 downto 00);
121
   signal ext_r_c_2 : bit_vector (07 downto 00);
122
   signal ext_r_c_3 : bit_vector (07 downto 00);
123
 
124
   signal ext_b_c_0 : bit_vector (07 downto 00);
125
   signal ext_b_c_1 : bit_vector (07 downto 00);
126
   signal ext_b_c_2 : bit_vector (07 downto 00);
127
   signal ext_b_c_3 : bit_vector (07 downto 00);
128
 
129
   signal y0p_b : bit_vector (08 downto 00);
130
   signal y1p_b : bit_vector (08 downto 00);
131
   signal y2p_b : bit_vector (08 downto 00);
132
   signal y3p_b : bit_vector (08 downto 00);
133
 
134
   signal y0p : bit;
135
   signal y1p : bit;
136
   signal y2p : bit;
137
   signal y3p : bit;
138
 
139
   constant gnd : bit := '0';
140
 
141
begin
142
 
143
ext_b_c_0 (07 downto 00) <= ext_b_c_0_b (07 downto 00);
144
ext_b_c_1 (07 downto 00) <= ext_b_c_1_b (07 downto 00);
145
ext_b_c_2 (07 downto 00) <= ext_b_c_2_b (07 downto 00);
146
ext_b_c_3 (07 downto 00) <= ext_b_c_3_b (07 downto 00);
147
 
148
ext_b_r_0 (07 downto 00) <= ext_b_r_0_b (07 downto 00);
149
ext_b_r_1 (07 downto 00) <= ext_b_r_1_b (07 downto 00);
150
ext_b_r_2 (07 downto 00) <= ext_b_r_2_b (07 downto 00);
151
ext_b_r_3 (07 downto 00) <= ext_b_r_3_b (07 downto 00);
152
 
153
first : ser2par8bit
154
   port map (
155
      clock => clock,
156
      clear => gnd,
157
      start => start,
158
      rxin  => rxin,
159
      y0    => y0,
160
      y1    => y1,
161
      y2    => y2,
162
      y3    => y3,
163
      r0    => r0,
164
      r1    => r1,
165
      c0    => c0,
166
      c1    => c1
167
      );
168
 
169
sum_r_0 : adder_08bit
170
   port map (
171
      addend_08bit   => y0,
172
      augend_08bit   => y0e,
173
      adder08_output => ext_b_r_1_b
174
      );
175
 
176
sum_r_1 : adder_08bit
177
   port map (
178
      addend_08bit   => y1,
179
      augend_08bit   => y1e,
180
      adder08_output => ext_b_r_0_b
181
      );
182
 
183
sum_r_2 : adder_08bit
184
   port map (
185
      addend_08bit   => y2,
186
      augend_08bit   => y2e,
187
      adder08_output => ext_b_r_3_b
188
      );
189
 
190
sum_r_3 : adder_08bit
191
   port map (
192
      addend_08bit   => y3,
193
      augend_08bit   => y3e,
194
      adder08_output => ext_b_r_2_b
195
      );
196
 
197
sum_c_0 : adder_08bit
198
   port map (
199
      addend_08bit   => y0,
200
      augend_08bit   => augend_sum_c_0,
201
      adder08_output => ext_b_c_2_b
202
      );
203
 
204
sum_c_1 : adder_08bit
205
   port map (
206
      addend_08bit   => y1,
207
      augend_08bit   => augend_sum_c_1,
208
      adder08_output => ext_b_c_3_b
209
      );
210
 
211
sum_c_2 : adder_08bit
212
   port map (
213
      addend_08bit   => y2,
214
      augend_08bit   => augend_sum_c_2,
215
      adder08_output => ext_b_c_0_b
216
      );
217
 
218
sum_c_3 : adder_08bit
219
   port map (
220
      addend_08bit   => y3,
221
      augend_08bit   => augend_sum_c_3,
222
      adder08_output => ext_b_c_1_b
223
      );
224
 
225
sum_p_0 : adder_08bit
226
   port map (
227
      addend_08bit   => ext_b_r_1,
228
      augend_08bit   => ext_r_r_0,
229
      adder08_output => y0p_b
230
      );
231
 
232
sum_p_1 : adder_08bit
233
   port map (
234
      addend_08bit   => ext_b_r_0,
235
      augend_08bit   => ext_r_r_1,
236
      adder08_output => y1p_b
237
      );
238
 
239
sum_p_2 : adder_08bit
240
   port map (
241
      addend_08bit   => ext_b_r_3,
242
      augend_08bit   => ext_r_r_2,
243
      adder08_output => y2p_b
244
      );
245
 
246
sum_p_3 : adder_08bit
247
   port map (
248
      addend_08bit   => ext_b_r_2,
249
      augend_08bit   => ext_r_r_3,
250
      adder08_output => y3p_b
251
      );
252
 
253
row0 : ext_val
254
   port map (
255
      ext_a_i => r0,
256
      ext_b_i => ext_b_r_0,
257
      ext_r_o => ext_r_r_0
258
      );
259
 
260
row1 : ext_val
261
   port map (
262
      ext_a_i => r0,
263
      ext_b_i => ext_b_r_1,
264
      ext_r_o => ext_r_r_1
265
      );
266
 
267
row2 : ext_val
268
   port map (
269
      ext_a_i => r1,
270
      ext_b_i => ext_b_r_2,
271
      ext_r_o => ext_r_r_2
272
      );
273
 
274
row3 : ext_val
275
   port map (
276
      ext_a_i => r1,
277
      ext_b_i => ext_b_r_3,
278
      ext_r_o => ext_r_r_3
279
      );
280
 
281
col0 : ext_val
282
   port map (
283
      ext_a_i => c0,
284
      ext_b_i => ext_b_c_0,
285
      ext_r_o => ext_r_c_0
286
      );
287
 
288
col1 : ext_val
289
   port map (
290
      ext_a_i => c1,
291
      ext_b_i => ext_b_c_1,
292
      ext_r_o => ext_r_c_1
293
      );
294
 
295
col2 : ext_val
296
   port map (
297
      ext_a_i => c0,
298
      ext_b_i => ext_b_c_2,
299
      ext_r_o => ext_r_c_2
300
      );
301
 
302
col3 : ext_val
303
   port map (
304
      ext_a_i => c1,
305
      ext_b_i => ext_b_c_3,
306
      ext_r_o => ext_r_c_3
307
      );
308
 
309
process (start)
310
begin
311
   if (start = '1' and start'event) then
312
 
313 4 arif_endro
      y0p <= y0p_b (08);
314
      y1p <= y1p_b (08);
315
      y2p <= y2p_b (08);
316
      y3p <= y3p_b (08);
317 2 arif_endro
 
318
   end if;
319
end process;
320
 
321
process (start)
322
begin
323
   if (start = '0' and start'event) then
324
 
325
      y0d <= y0p;
326
      y1d <= y1p;
327
      y2d <= y2p;
328
      y3d <= y3p;
329
 
330
   end if;
331
end process;
332
 
333
process (clock, start)
334
begin
335
 
336
   if (clock = '0' and clock'event) then
337
 
338
      if (start = '1') then
339
         y0e <= ( others => '0' );
340
         y1e <= ( others => '0' );
341
         y2e <= ( others => '0' );
342
         y3e <= ( others => '0' );
343
 
344
         augend_sum_c_0 <= ( others => '0' );
345
         augend_sum_c_1 <= ( others => '0' );
346
         augend_sum_c_2 <= ( others => '0' );
347
         augend_sum_c_3 <= ( others => '0' );
348
      else
349
         y0e <= ext_r_c_0;
350
         y1e <= ext_r_c_1;
351
         y2e <= ext_r_c_2;
352
         y3e <= ext_r_c_3;
353
 
354
         augend_sum_c_0 <= ext_r_r_0;
355
         augend_sum_c_1 <= ext_r_r_1;
356
         augend_sum_c_2 <= ext_r_r_2;
357
         augend_sum_c_3 <= ext_r_r_3;
358
      end if;
359
 
360
   end if;
361
end process;
362
 
363
end structural;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.