OpenCores
URL https://opencores.org/ocsvn/fast-crc/fast-crc/trunk

Subversion Repositories fast-crc

[/] [fast-crc/] [trunk/] [vhdl/] [gf_multiplier.vhd] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 trueno
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.std_logic_arith.all;
4
use ieee.std_logic_unsigned.all;
5
use work.all;
6
 
7
entity gf_multiplier is
8
 
9
  port (
10
    reset  : in  std_logic;             -- #RESET
11
    phi1   : in  std_logic;
12
    phi2   : in  std_logic;
13
    input  : in  std_logic_vector(31 downto 0);
14
                                        -- Input to the Galois Field multiplier. It
15
                                        -- comes from the feedback of the FCS
16
    output_fcs : out std_logic_vector(15 downto 0);  -- LS Word 
17
    -- "inout" to be able to read the signal (feedback)
18
    output_xor : out std_logic_vector(15 downto 0));   -- MS Word
19
 
20
end gf_multiplier;
21
 
22
 
23
 
24
architecture structural of gf_multiplier is
25
 
26
  -- The output register is half the size of the rest
27
  component gf_phi1_register_out
28
    port (
29
      reset        : in  std_logic;           -- #RESET
30
      phi1         : in  std_logic;           -- Clock
31
      input_wip    : in  std_logic_vector(31 downto 0);
32
      output_final : out std_logic_vector(31 downto 0));
33
  end component;
34
 
35
  -- These components below are the best example of bad VHDL coding
36
 
37
  component gf_phi1_register_2
38
    port (
39
      reset      : in  std_logic;                      -- #RESET
40
      phi1       : in  std_logic;                      -- Clock
41
      input_wip  : in  std_logic_vector(31 downto 0);  -- The incoming WIP
42
      input_fcs  : in  std_logic_vector(31 downto 0);
43
                    -- The original data for that step. Since we are using pipelining
44
                    -- we have to grant that we will have the original FCS data
45
                    -- available.
46
      output_wip : out std_logic_vector(31 downto 0);
47
                    -- The modified data -our "WIP"-
48
      output_fcs : out std_logic_vector(31 downto 0));
49
                    -- The original data is kept untouched
50
  end component;
51
 
52
  component gf_phi2_register_3
53
    port (
54
      reset      : in  std_logic;                      -- #RESET
55
      phi2       : in  std_logic;                      -- Clock
56
      input_wip  : in  std_logic_vector(31 downto 0);  -- The incoming WIP
57
      input_fcs  : in  std_logic_vector(31 downto 0);
58
                    -- The original data for that step. Since we are using pipelining
59
                    -- we have to grant that we will have the original FCS data
60
                    -- available.
61
      output_wip : out std_logic_vector(31 downto 0);
62
                    -- The modified data -our "WIP"-
63
      output_fcs : out std_logic_vector(31 downto 0));
64
                    -- The original data is kept untouched
65
  end component;
66
 
67
  component gf_phi1_register_4
68
    port (
69
      reset      : in  std_logic;                      -- #RESET
70
      phi1       : in  std_logic;                      -- Clock
71
      input_wip  : in  std_logic_vector(31 downto 0);  -- The incoming WIP
72
      input_fcs  : in  std_logic_vector(31 downto 0);
73
                    -- The original data for that step. Since we are using pipelining
74
                    -- we have to grant that we will have the original FCS data
75
                    -- available.
76
      output_wip : out std_logic_vector(31 downto 0);
77
                    -- The modified data -our "WIP"-
78
      output_fcs : out std_logic_vector(31 downto 0));
79
                    -- The original data is kept untouched
80
  end component;
81
 
82
  component gf_phi2_register_5
83
    port (
84
      reset      : in  std_logic;                      -- #RESET
85
      phi2       : in  std_logic;                      -- Clock
86
      input_wip  : in  std_logic_vector(31 downto 0);  -- The incoming WIP
87
      input_fcs  : in  std_logic_vector(31 downto 0);
88
                    -- The original data for that step. Since we are using pipelining
89
                    -- we have to grant that we will have the original FCS data
90
                    -- available.
91
      output_wip : out std_logic_vector(31 downto 0);
92
                    -- The modified data -our "WIP"-
93
      output_fcs : out std_logic_vector(31 downto 0));
94
                    -- The original data is kept untouched
95
  end component;
96
 
97
  component gf_phi1_register_6
98
    port (
99
      reset      : in  std_logic;                      -- #RESET
100
      phi1       : in  std_logic;                      -- Clock
101
      input_wip  : in  std_logic_vector(31 downto 0);  -- The incoming WIP
102
      input_fcs  : in  std_logic_vector(31 downto 0);
103
                    -- The original data for that step. Since we are using pipelining
104
                    -- we have to grant that we will have the original FCS data
105
                    -- available.
106
      output_wip : out std_logic_vector(31 downto 0);
107
                    -- The modified data -our "WIP"-
108
      output_fcs : out std_logic_vector(31 downto 0));
109
                    -- The original data is kept untouched
110
  end component;
111
 
112
  component gf_phi2_register_7
113
    port (
114
      reset      : in  std_logic;                      -- #RESET
115
      phi2       : in  std_logic;                      -- Clock
116
      input_wip  : in  std_logic_vector(31 downto 0);  -- The incoming WIP
117
      input_fcs  : in  std_logic_vector(31 downto 0);
118
                    -- The original data for that step. Since we are using pipelining
119
                    -- we have to grant that we will have the original FCS data
120
                    -- available.
121
      output_wip : out std_logic_vector(31 downto 0);
122
                    -- The modified data -our "WIP"-
123
      output_fcs : out std_logic_vector(31 downto 0));
124
                    -- The original data is kept untouched
125
  end component;
126
 
127
  component gf_phi1_register_8
128
    port (
129
      reset      : in  std_logic;                      -- #RESET
130
      phi1       : in  std_logic;                      -- Clock
131
      input_wip  : in  std_logic_vector(31 downto 0);  -- The incoming WIP
132
      input_fcs  : in  std_logic_vector(31 downto 0);
133
                    -- The original data for that step. Since we are using pipelining
134
                    -- we have to grant that we will have the original FCS data
135
                    -- available.
136
      output_wip : out std_logic_vector(31 downto 0);
137
                    -- The modified data -our "WIP"-
138
      output_fcs : out std_logic_vector(31 downto 0));
139
                    -- The original data is kept untouched
140
  end component;
141
 
142
  component gf_phi2_register_9
143
    port (
144
      reset      : in  std_logic;                      -- #RESET
145
      phi2       : in  std_logic;                      -- Clock
146
      input_wip  : in  std_logic_vector(31 downto 0);  -- The incoming WIP
147
      input_fcs  : in  std_logic_vector(31 downto 0);
148
                    -- The original data for that step. Since we are using pipelining
149
                    -- we have to grant that we will have the original FCS data
150
                    -- available.
151
      output_wip : out std_logic_vector(31 downto 0);
152
                    -- The modified data -our "WIP"-
153
      output_fcs : out std_logic_vector(31 downto 0));
154
                    -- The original data is kept untouched
155
  end component;
156
 
157
  -- These components below are the best example of bad VHDL coding
158
 
159
  component gf_xor_2x
160
    port (
161
      input_wip  : in  std_logic_vector(31 downto 0);
162
      input_fcs  : in  std_logic_vector(31 downto 0);
163
      output_wip : out  std_logic_vector(31 downto 0));
164
  end component;
165
 
166
  component gf_xor_3x
167
    port (
168
      input_wip  : in  std_logic_vector(31 downto 0);
169
      input_fcs  : in  std_logic_vector(31 downto 0);
170
      output_wip : out  std_logic_vector(31 downto 0));
171
  end component;
172
 
173
  component gf_xor_4x
174
    port (
175
      input_wip  : in  std_logic_vector(31 downto 0);
176
      input_fcs  : in  std_logic_vector(31 downto 0);
177
      output_wip : out  std_logic_vector(31 downto 0));
178
  end component;
179
 
180
  component gf_xor_5x
181
    port (
182
      input_wip  : in  std_logic_vector(31 downto 0);
183
      input_fcs  : in  std_logic_vector(31 downto 0);
184
      output_wip : out  std_logic_vector(31 downto 0));
185
  end component;
186
 
187
  component gf_xor_6x
188
    port (
189
      input_wip  : in  std_logic_vector(31 downto 0);
190
      input_fcs  : in  std_logic_vector(31 downto 0);
191
      output_wip : out  std_logic_vector(31 downto 0));
192
  end component;
193
 
194
  component gf_xor_7x
195
    port (
196
      input_wip  : in  std_logic_vector(31 downto 0);
197
      input_fcs  : in  std_logic_vector(31 downto 0);
198
      output_wip : out  std_logic_vector(31 downto 0));
199
  end component;
200
 
201
  component gf_xor_8x
202
    port (
203
      input_wip  : in  std_logic_vector(31 downto 0);
204
      input_fcs  : in  std_logic_vector(31 downto 0);
205
      output_wip : out  std_logic_vector(31 downto 0));
206
  end component;
207
 
208
  component gf_xor_9x
209
    port (
210
      input_wip  : in  std_logic_vector(31 downto 0);
211
      input_fcs  : in  std_logic_vector(31 downto 0);
212
      output_wip : out  std_logic_vector(31 downto 0));
213
  end component;
214
 
215
--  component gf_xor_10x
216
--    port (
217
--      input_wip  : in  std_logic_vector(31 downto 0);
218
--      input_fcs  : in  std_logic_vector(31 downto 0);
219
--      output_wip : out  std_logic_vector(31 downto 0));
220
--  end component;
221
 
222
 
223
  -- The XOR right after the input is smaller
224
  component gf_xor_input
225
    port (
226
      input_fcs  : in  std_logic_vector(31 downto 0);
227
      output_wip : out std_logic_vector(31 downto 0));
228
  end component;
229
 
230
  -- We now declare all the signals needed to comunicate the
231
  -- different components
232
  signal btw2_3   : std_logic_vector(31 downto 0);  -- Original data
233
  signal btw3_4   : std_logic_vector(31 downto 0);  -- Original data
234
  signal btw4_5   : std_logic_vector(31 downto 0);  -- Original data
235
  signal btw5_6   : std_logic_vector(31 downto 0);  -- Original data
236
  signal btw6_7   : std_logic_vector(31 downto 0);  -- Original data
237
  signal btw7_8   : std_logic_vector(31 downto 0);  -- Original data
238
  signal btw8_9   : std_logic_vector(31 downto 0);  -- Original data
239
  signal btw9_10  : std_logic_vector(31 downto 0);  -- Original data
240
--  signal btw10_11 : std_logic_vector(31 downto 0);  -- Original data
241
 
242
  signal btw1x_2   : std_logic_vector(31 downto 0);  -- WIP data
243
  signal btw2_2x   : std_logic_vector(31 downto 0);  -- WIP data
244
  signal btw2x_3   : std_logic_vector(31 downto 0);  -- WIP data
245
  signal btw3_3x   : std_logic_vector(31 downto 0);  -- WIP data
246
  signal btw3x_4   : std_logic_vector(31 downto 0);  -- WIP data
247
  signal btw4_4x   : std_logic_vector(31 downto 0);  -- WIP data
248
  signal btw4x_5   : std_logic_vector(31 downto 0);  -- WIP data
249
  signal btw5_5x   : std_logic_vector(31 downto 0);  -- WIP data
250
  signal btw5x_6   : std_logic_vector(31 downto 0);  -- WIP data
251
  signal btw6_6x   : std_logic_vector(31 downto 0);  -- WIP data
252
  signal btw6x_7   : std_logic_vector(31 downto 0);  -- WIP data
253
  signal btw7_7x   : std_logic_vector(31 downto 0);  -- WIP data
254
  signal btw7x_8   : std_logic_vector(31 downto 0);  -- WIP data
255
  signal btw8_8x   : std_logic_vector(31 downto 0);  -- WIP data
256
  signal btw8x_9   : std_logic_vector(31 downto 0);  -- WIP data
257
  signal btw9_9x   : std_logic_vector(31 downto 0);  -- WIP data
258
  signal btw9x_10  : std_logic_vector(31 downto 0);  -- WIP data
259
--  signal btw10_10x : std_logic_vector(31 downto 0);  -- WIP data
260
--  signal btw10x_11 : std_logic_vector(31 downto 0);  -- WIP data
261
--  signal btw11_11x : std_logic_vector(31 downto 0);  -- WIP data
262
--  signal btw11_12  : std_logic_vector(31 downto 0);  -- Not connected
263
 
264
begin  -- structural
265
 
266
  GF1x : gf_xor_input port map (input_fcs => input, output_wip => btw1x_2);
267
  GF2  : gf_phi1_register_2 port map (reset => reset, phi1 => phi1,
268
                                   input_wip  => btw1x_2, input_fcs  => input,
269
                                   output_wip => btw2_2x, output_fcs => btw2_3);
270
 
271
  GF2x : gf_xor_2x port map (input_wip  => btw2_2x, input_fcs  => btw2_3,
272
                          output_wip => btw2x_3);
273
  GF3  : gf_phi2_register_3 port map (reset => reset, phi2 => phi2,
274
                                   input_wip  => btw2x_3, input_fcs  => btw2_3,
275
                                   output_wip => btw3_3x, output_fcs => btw3_4);
276
 
277
  GF3x : gf_xor_3x port map (input_wip  => btw3_3x, input_fcs  => btw3_4,
278
                          output_wip => btw3x_4);
279
  GF4  : gf_phi1_register_4 port map (reset => reset, phi1 => phi1,
280
                                   input_wip  => btw3x_4, input_fcs  => btw3_4,
281
                                   output_wip => btw4_4x, output_fcs => btw4_5);
282
 
283
  GF4x : gf_xor_4x port map (input_wip  => btw4_4x, input_fcs  => btw4_5,
284
                          output_wip => btw4x_5);
285
  GF5  : gf_phi2_register_5 port map (reset => reset, phi2 => phi2,
286
                                   input_wip  => btw4x_5, input_fcs  => btw4_5,
287
                                   output_wip => btw5_5x, output_fcs => btw5_6);
288
 
289
  GF5x : gf_xor_5x port map (input_wip  => btw5_5x, input_fcs  => btw5_6,
290
                          output_wip => btw5x_6);
291
  GF6  : gf_phi1_register_6 port map (reset => reset, phi1 => phi1,
292
                                   input_wip  => btw5x_6, input_fcs  => btw5_6,
293
                                   output_wip => btw6_6x, output_fcs => btw6_7);
294
 
295
  GF6x : gf_xor_6x port map (input_wip  => btw6_6x, input_fcs  => btw6_7,
296
                          output_wip => btw6x_7);
297
  GF7  : gf_phi2_register_7 port map (reset => reset, phi2 => phi2,
298
                                   input_wip  => btw6x_7, input_fcs  => btw6_7,
299
                                   output_wip => btw7_7x, output_fcs => btw7_8);
300
 
301
  GF7x : gf_xor_7x port map (input_wip  => btw7_7x, input_fcs  => btw7_8,
302
                          output_wip => btw7x_8);
303
  GF8  : gf_phi1_register_8 port map (reset => reset, phi1 => phi1,
304
                                   input_wip  => btw7x_8, input_fcs  => btw7_8,
305
                                   output_wip => btw8_8x, output_fcs => btw8_9);
306
 
307
  GF8x : gf_xor_8x port map (input_wip  => btw8_8x, input_fcs  => btw8_9,
308
                          output_wip => btw8x_9);
309
  GF9  : gf_phi2_register_9 port map (reset => reset, phi2 => phi2,
310
                                   input_wip  => btw8x_9, input_fcs  => btw8_9,
311
                                   output_wip => btw9_9x, output_fcs => btw9_10);
312
 
313
  GF9x : gf_xor_9x port map (input_wip  => btw9_9x, input_fcs  => btw9_10,
314
                          output_wip => btw9x_10);
315
  GF10 : gf_phi1_register_out port map (reset => reset, phi1 => phi1,
316
                                   input_wip  => btw9x_10,
317
                                   output_final(15 downto 0) => output_xor,
318
                                   output_final(31 downto 16)  => output_fcs);
319
 
320
--  GF10x : gf_xor_10x port map (input_wip  => btw10_10x, input_fcs  => btw10_11,
321
--                           output_wip => btw10x_11);
322
--  GF11  : gf_phi2_register port map (reset => reset, phi2 => phi2,
323
--                                   input_wip  => btw10x_11, input_fcs  => btw10_11,
324
--                                   output_wip => btw11_11x, output_fcs => btw11_12);
325
 
326
-- The last register is smaller since it just have to plug its output into
327
-- the FCS and the final big XOR
328
 
329
--  GF12 : gf_phi1_register_out port map (reset => reset, phi1 => phi1,
330
--                                       input_wip  => btw11_11x,
331
--                                       output_final(31 downto 16) => output_xor,
332
--                                       output_final(15 downto 0) => output_fcs);
333
 
334
end structural;
335
 
336
 
337
configuration cfg_gf_multiplier of gf_multiplier is
338
 
339
  for structural
340
    for GF1x : gf_xor_input use entity work.gf_xor_input(behavior); end for;
341
    for GF2  : gf_phi1_register_2
342
              use entity work.gf_phi1_register_2(behavior); end for;
343
    for GF2x : gf_xor_2x
344
              use entity work.gf_xor_2x(behavior); end for;
345
    for GF3  : gf_phi2_register_3
346
              use entity work.gf_phi2_register_3(behavior); end for;
347
    for GF3x : gf_xor_3x
348
              use entity work.gf_xor_3x(behavior); end for;
349
    for GF4  : gf_phi1_register_4
350
              use entity work.gf_phi1_register_4(behavior); end for;
351
    for GF4x : gf_xor_4x
352
              use entity work.gf_xor_4x(behavior); end for;
353
    for GF5  : gf_phi2_register_5
354
              use entity work.gf_phi2_register_5(behavior); end for;
355
    for GF5x : gf_xor_5x
356
              use entity work.gf_xor_5x(behavior); end for;
357
    for GF6  : gf_phi1_register_6
358
              use entity work.gf_phi1_register_6(behavior); end for;
359
    for GF6x : gf_xor_6x
360
              use entity work.gf_xor_6x(behavior); end for;
361
    for GF7  : gf_phi2_register_7
362
              use entity work.gf_phi2_register_7(behavior); end for;
363
    for GF7x : gf_xor_7x
364
              use entity work.gf_xor_7x(behavior); end for;
365
    for GF8  : gf_phi1_register_8
366
              use entity work.gf_phi1_register_8(behavior); end for;
367
    for GF8x : gf_xor_8x
368
              use entity work.gf_xor_8x(behavior); end for;
369
    for GF9  : gf_phi2_register_9
370
              use entity work.gf_phi2_register_9(behavior); end for;
371
    for GF9x : gf_xor_9x
372
              use entity work.gf_xor_9x(behavior); end for;
373
    for GF10 : gf_phi1_register_out
374
              use entity work.gf_phi1_register_out(behavior); end for;
375
--    for GF10x : gf_xor_10x
376
--              use entity work.gf_xor_10x(behavior); end for;
377
--    for GF11  : gf_phi2_register
378
--              use entity work.gf_phi2_register(behavior); end for;
379
--    for GF12  : gf_phi1_register_out
380
--              use entity work.gf_phi1_register_out(behavior); end for;
381
  end for;
382
 
383
end cfg_gf_multiplier;
384
 

powered by: WebSVN 2.1.0

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