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

Subversion Repositories the_wizardry_project

[/] [the_wizardry_project/] [trunk/] [Wizardry/] [VHDL/] [Wizardry Top Level/] [Address Generation/] [NIDS Components/] [EmPAC/] [protocol_fsm.vhd] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 mcwaccent
----------------------------------------------------------------------------------
2
--
3
--  This file is a part of Technica Corporation Wizardry Project
4
--
5
--  Copyright (C) 2004-2009, Technica Corporation  
6
--
7
--  This program is free software: you can redistribute it and/or modify
8
--  it under the terms of the GNU General Public License as published by
9
--  the Free Software Foundation, either version 3 of the License, or
10
--  (at your option) any later version.
11
--
12
--  This program is distributed in the hope that it will be useful,
13
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
--  GNU General Public License for more details.
16
--
17
--  You should have received a copy of the GNU General Public License
18
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
--
20
----------------------------------------------------------------------------------
21
----------------------------------------------------------------------------------
22
-- Module Name: protocol_fsm - Behavioral 
23
-- Project Name: Wizardry
24
-- Target Devices: Virtex 4 ML401
25
-- Description: Contains FSM that classifies the phy data, providing a corresponding 
26
-- field identifier called "field_type".  This is the "brains" of EmPAC.
27
-- Revision: 1.0
28
-- Additional Comments: 
29
--
30
----------------------------------------------------------------------------------
31
library IEEE;
32
use IEEE.STD_LOGIC_1164.ALL;
33
use IEEE.STD_LOGIC_ARITH.ALL;
34
use IEEE.STD_LOGIC_UNSIGNED.ALL;
35
use work.empac_constants.all;
36
---- Uncomment the following library declaration if instantiating
37
---- any Xilinx primitives in this code.
38
--library UNISIM;
39
--use UNISIM.VComponents.all;
40
 
41
entity protocol_fsm is
42
port(clock : in std_logic;
43
          reset : in std_logic;
44
          EmPAC_leds : out std_logic_vector(8 downto 0);
45
          phy_data_valid : in std_logic;
46
          field_data_early : in std_logic_vector(31 downto 0);
47
          opt : in std_logic;
48
          length1 : in std_logic_vector(17 downto 0);--teger;
49
          TCP_type : in std_logic;
50
          UDP_type : in std_logic;
51
          icmp_type : in std_logic;
52
          protocol_ind : out std_logic;
53
          length_ind : out std_logic;
54
          port_ind : out std_logic;
55
          field_type_out : out std_logic_vector(7 downto 0);
56
          field_type_early : out std_logic_vector(7 downto 0);
57
          data_ready : out std_logic;
58
          field_data : out std_logic_vector(31 downto 0);
59
          end_of_frame : out std_logic);
60
end protocol_fsm;
61
 
62
architecture Behavioral of protocol_fsm is
63
 
64
signal CurrentState,NextState : StateType;
65
--signal data_tmp : std_logic_vector(31 downto 0);
66
signal field_width : std_logic_vector(1 downto 0);
67
signal length_s : integer;
68
signal fw : integer;
69
signal count : integer;
70
signal vlf : std_logic;
71
signal field_data_s : std_logic_Vector(31 downto 0);
72
signal data_ready_off : std_logic;
73
signal rst : std_logic;
74
signal data_ready_s : std_logic;
75
signal phy_data_valid_reg : std_logic;
76
signal field_type : std_logic_vector(7 downto 0);
77
 
78
begin
79
field_type_early <= field_type;
80
fw <= conv_integer(field_width);
81
length_s <= conv_integer(length1-1);
82
----data_tmp <= field_data_early;
83
--data_ready <= data_ready_s or vlf;
84
process(clock)
85
begin
86
        if rising_edge(clock) then
87
                field_type_out <= field_type;
88
        end if;
89
end process;
90
 
91
process(clock)
92
begin
93
        if rising_edge(clock) then
94
                field_data <= field_data_s;
95
        end if;
96
end process;
97
 
98
process(clock)
99
begin
100
        if rising_edge(clock) then
101
                phy_data_valid_reg <= phy_data_valid;
102
        end if;
103
end process;
104
 
105
--cnt : process(reset,clock,fw,length_s,rst)
106
--begin
107
----if reset = '1' then
108
----    count <= 0;
109
--if rising_edge(clock) then
110
--      if reset = '1' then
111
--              count <= 0;
112
--      else
113
--              if rst = '1' then
114
--                      count <= 0;
115
--              elsif vlf = '1' then
116
--                      if (count = length_s)then-- - 1) then-- or (count = fw)) then
117
--                              count <= 0;
118
--                      else
119
--                              count <= count + 1;
120
--                      end if;
121
--              else
122
--                      if (count = fw) then
123
--                              count <= 0;
124
--      --                      data_ready <= '1';
125
--                      else
126
--                              count <= count + 1;
127
--      --                      data_ready <= '0';
128
--                      end if;
129
--              end if;
130
--      end if;
131
--end if;
132
--end process;
133
cnt : process(reset,clock,fw,length_s,phy_data_valid,vlf,count)
134
begin
135
--if reset = '1' then
136
--      count <= 0;
137
if rising_edge(clock) then
138
        if reset = '1' then
139
                count <= 0;
140
        else
141
                if phy_data_valid = '1' then
142
                        if vlf = '1' then
143
                                if (count = length_s) then
144
                                        count <= 0;
145
                                else
146
                                        count <= count + 1;
147
                                end if;
148
                        elsif (count = fw) then
149
                                count <= 0;
150
                        else
151
                                count <= count + 1;
152
                        end if;
153
                else
154
                        count <= 0;
155
                end if;
156
        end if;
157
end if;
158
end process;
159
 
160
process(clock,reset,vlf,data_ready_off,fw,count)
161
begin
162
        if rising_edge(clock) then
163
                if reset = '1' then
164
                        data_ready <= '0';
165
                else
166
                        if data_ready_off = '1' then
167
                                data_ready <= '0';
168
                        elsif vlf = '1' then
169
                                data_ready <= '1';
170
                        elsif count = fw then
171
                                data_ready <= '1';
172
                        else
173
                                data_ready <= '0';
174
                        end if;
175
                end if;
176
        end if;
177
end process;
178
 
179
--process(count,clock,vlf,reset,fw,data_ready_off,length_s)
180
--variable  cnt_v : integer := 0;
181
--begin
182
--      if rising_edge(clock) then
183
--              if reset = '1' then
184
--                      data_ready_s <= '0';
185
--                      cnt_v := 0;
186
--              else--if rising_edge(clock) then
187
--                      if data_ready_off = '1' then
188
--                              data_ready_s <= '0';
189
--                              cnt_v := 0;
190
--                      elsif vlf = '1' then
191
--                              if cnt_v = 3 then
192
--                                      cnt_v := 0;
193
--                                      data_ready_s <= '1';
194
--                              elsif count = length_s then--conv_integer(length1_s) then--cnt_v = conv_integer(length1) then -- -1) then
195
--                                      data_ready_s <= '1';
196
--                              else
197
--                                      data_ready_s <= '0';
198
--                                      cnt_v := cnt_v + 1;
199
--                              end if;
200
--                      else
201
--                              if  count = fw then -- -1 then
202
--                                      data_ready_s <= '1';
203
--                              else
204
--                                      data_ready_s <= '0';
205
--                              end if;
206
--                      end if;
207
--              end if;
208
--      end if;
209
--end process;
210
 
211
--process(clock)
212
--begin
213
----wait until clock'event and clock = '1';
214
--      if rising_edge(clock) then
215
--              field_data <= field_data_s;
216
--      end if;
217
--end process;
218
 
219
fsm : process(CurrentState,phy_data_valid,phy_data_valid_reg,count,field_data_early,TCP_type,UDP_type,opt,length_s,icmp_type)--,field_data_early)
220
begin
221
        case CurrentState is
222
                when ftreset =>
223
                                if phy_data_valid = '1' then
224
                                        NextState <= ft2;
225
                                else
226
                                        NextState <= ftreset;
227
                                end if;
228
                                field_width <= "11";
229
--                               
230
                                protocol_ind <= '0';
231
                                length_ind <= '0';
232
                                port_ind <= '0';
233
                                vlf <= '0';
234
                                field_data_s <= "00000000000000000000000000000000";--field_data_early;
235
                                field_type <= X"00";
236
                                data_ready_off <= '1';
237
                                rst <= '1';
238
                                EmPAC_leds <= "110000000";
239
                                end_of_frame <= '1';
240
 
241
--              when ft0 =>
242
--                              if count = 3 then
243
--                                      NextState <= ft1;
244
--                              else
245
--                                      NextState <= ft0;
246
--                              end if;
247
--                              field_width <= "11";
248
----                             
249
--                              protocol_ind <= '0';
250
--                              length_ind <= '0';
251
--                              port_ind <= '0';
252
--                              vlf <= '0';
253
--                              field_data_s <= field_data_early;
254
--                              field_type <= X"00";
255
--                    data_ready_off <= '0';
256
--                              EmPAC_leds <= "000000000";
257
--              when ft1 =>
258
--                              if count = 3 then
259
--                                      NextState <= ft2;
260
--                              else
261
--                                      NextState <= ft1;
262
--                              end if;
263
--                              field_width <= "11";
264
----                             
265
--                              protocol_ind <= '0';
266
--                              length_ind <= '0';
267
--                              port_ind <= '0';
268
--                              vlf <= '0';
269
--                              field_data_s <= field_data_early;
270
--                              field_type <= X"01";
271
--                    data_ready_off <= '0';
272
--                              EmPAC_leds <= "000000001";
273
 
274
                when ft2 =>
275
                                if count = 3 then
276
                                        NextState <= ft3;
277
                                else
278
                                        NextState <= ft2;
279
                                end if;
280
                                field_width <= "11";
281
 
282
                                protocol_ind <= '0';
283
                                length_ind <= '0';
284
                                port_ind <= '0';
285
                                vlf <= '0';
286
                                field_data_s <= field_data_early;
287
                                field_type <= X"02";
288
                                data_ready_off <= '0';
289
                                rst <= '0';
290
                                EmPAC_leds <= "000000010";
291
                                end_of_frame <= '0';
292
 
293
                when ft3 =>
294
                                if count = 1 then
295
                                        NextState <= ft4;
296
                                else
297
                                        NextState <= ft3;
298
                                end if;
299
                                field_width <= "01";
300
 
301
                                protocol_ind <= '0';
302
                                length_ind <= '0';
303
                                port_ind <= '0';
304
                                vlf <= '0';
305
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
306
                                field_type <= X"03";
307
                      data_ready_off <= '0';
308
                                rst <= '0';
309
                                EmPAC_leds <= "000000011";
310
                                end_of_frame <= '0';
311
 
312
                when ft4 =>
313
                                if count = 3 then
314
                                        NextState <= ft5;
315
                                else
316
                                        NextState <= ft4;
317
                                end if;
318
                                field_width <= "11";
319
 
320
                                protocol_ind <= '0';
321
                                length_ind <= '0';
322
                                port_ind <= '0';
323
                                vlf <= '0';
324
                                field_data_s <= field_data_early;
325
                                field_type <= X"04";
326
                      data_ready_off <= '0';
327
                                rst <= '0';
328
                                EmPAC_leds <= "000000100";
329
                                end_of_frame <= '0';
330
 
331
                when ft5 =>
332
                                if count = 1 then
333
                                        NextState <= ft6;
334
                                else
335
                                        NextState <= ft5;
336
                                end if;
337
                                field_width <= "01";
338
 
339
                                protocol_ind <= '0';
340
                                length_ind <= '0';
341
                                port_ind <= '0';
342
                                vlf <= '0';
343
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
344
                                field_type <= X"05";
345
                      data_ready_off <= '0';
346
                                rst <= '0';
347
                                EmPAC_leds <= "000000101";
348
                                end_of_frame <= '0';
349
 
350
                when ft6 =>
351
--                      if count = 1 then
352
                                if count = 1 and field_data_early(15 downto 0) = X"0800" then
353
                                        NextState <= ft19;
354
                                elsif count = 1 and field_data_early(15 downto 0) = X"86DD" then
355
                                        NextState <= ft33;
356
                                elsif count = 1 and field_data_early(15 downto 0) = X"0806" then
357
                                        NextState <= ft7;
358
                                elsif count = 1 then
359
                                        NextState <= unknown_protocol;
360
                                elsif count = 0 then
361
                                        NextState <= ft6;
362
                                else
363
                                        NextState <= ft6;
364
                                end if;
365
--                      end if;
366
                        field_width <= "01";
367
                        protocol_ind <= '1';
368
                        length_ind <= '0';
369
                        port_ind <= '0';
370
                        vlf <= '0';
371
                        field_data_s <= X"0000" & field_data_early(15 downto 0);
372
         field_type <= X"06";
373
                   data_ready_off <= '0';
374
                        rst <= '0';
375
                        EmPAC_leds <= "000000110";
376
                        end_of_frame <= '0';
377
 
378
                when ft7 =>
379
                                if count = 1 then
380
                                        NextState <= ft8;
381
                                else
382
                                        NextState <= ft7;
383
                                end if;
384
                                field_width <= "01";
385
 
386
                                protocol_ind <= '0';
387
                                length_ind <= '0';
388
                                port_ind <= '0';
389
                                vlf <= '0';
390
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
391
                      field_type <= X"07";
392
                      data_ready_off <= '0';
393
                                rst <= '0';
394
                                EmPAC_leds <= "000000111";
395
                                end_of_frame <= '0';
396
 
397
                when ft8 =>
398
                                if count = 1 then
399
                                        NextState <= ft9;
400
                                else
401
                                        NextState <= ft8;
402
                                end if;
403
                                field_width <= "01";
404
 
405
                                protocol_ind <= '0';
406
                                length_ind <= '0';
407
                                port_ind <= '0';
408
                                vlf <= '0';
409
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
410
                      field_type <= X"08";
411
                      data_ready_off <= '0';
412
                                rst <= '0';
413
                                EmPAC_leds <= "000001000";
414
                                end_of_frame <= '0';
415
 
416
                when ft9 =>
417
                                if count = 0 then
418
                                        NextState <= ftA;
419
                                else
420
                                        NextState <= ft9;
421
                                end if;
422
                                field_width <= "00";
423
 
424
                                protocol_ind <= '0';
425
                                length_ind <= '0';
426
                                port_ind <= '0';
427
                                vlf <= '0';
428
                                field_data_s <= X"000000" & field_data_early(7 downto 0);
429
                      field_type <= X"09";
430
                      data_ready_off <= '0';
431
                                rst <= '0';
432
                                 EmPAC_leds <= "000001001";
433
                                end_of_frame <= '0';
434
                when ftA =>
435
                                if count = 0 then
436
                                        NextState <= ftB;
437
                                else
438
                                        NextState <= ftA;
439
                                end if;
440
                                field_width <= "00";
441
 
442
                                protocol_ind <= '0';
443
                                length_ind <= '0';
444
                                port_ind <= '0';
445
                                vlf <= '0';
446
                                field_data_s <= X"000000" & field_data_early(7 downto 0);
447
                      field_type <= X"0A";
448
                      data_ready_off <= '0';
449
                                rst <= '0';
450
                                EmPAC_leds <= "000001010";
451
                                end_of_frame <= '0';
452
 
453
                when ftB =>
454
                                if count = 1 then
455
                                        NextState <= ft_C;
456
                                else
457
                                        NextState <= ftB;
458
                                end if;
459
                                field_width <= "01";
460
 
461
                                protocol_ind <= '0';
462
                                length_ind <= '0';
463
                                port_ind <= '0';
464
                                vlf <= '0';
465
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
466
                      field_type <= X"0B";
467
                      data_ready_off <= '0';
468
                                rst <= '0';
469
                                EmPAC_leds <= "000001011";
470
                                end_of_frame <= '0';
471
 
472
                when ft_C  =>
473
                                if count = 3 then
474
                                        NextState <= ftD;
475
                                else
476
                                        NextState <= ft_C;
477
                                end if;
478
                                field_width <= "11";
479
 
480
                                protocol_ind <= '0';
481
                                length_ind <= '0';
482
                                port_ind <= '0';
483
                                vlf <= '0';
484
                                field_data_s <= field_data_early;
485
                      field_type <= X"0C";
486
                      data_ready_off <= '0';
487
                                rst <= '0';
488
                                EmPAC_leds <= "000001100";
489
                                end_of_frame <= '0';
490
 
491
                when ftD =>
492
                                if count = 1 then
493
                                        NextState <= ftE;
494
                                else
495
                                        NextState <= ftD;
496
                                end if;
497
                                field_width <= "01";
498
 
499
                                protocol_ind <= '0';
500
                                length_ind <= '0';
501
                                port_ind <= '0';
502
                                vlf <= '0';
503
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
504
                      field_type <= X"0D";
505
                      data_ready_off <= '0';
506
                                rst <= '0';
507
                                EmPAC_leds <= "000001101";
508
                                end_of_frame <= '0';
509
 
510
                when ftE =>
511
                                if count = 3 then
512
                                        NextState <= ftF;
513
                                else
514
                                        NextState <= ftE;
515
                                end if;
516
                                field_width <= "11";
517
 
518
                                protocol_ind <= '0';
519
                                length_ind <= '0';
520
                                port_ind <= '0';
521
                                vlf <= '0';
522
                                field_data_s <= field_data_early;
523
                      field_type <= X"0E";
524
                      data_ready_off <= '0';
525
                                rst <= '0';
526
                                EmPAC_leds <= "000001110";
527
                                end_of_frame <= '0';
528
 
529
                when ftF =>
530
                                if count = 3 then
531
                                        NextState <= ft10;
532
                                else
533
                                        NextState <= ftF;
534
                                end if;
535
                                field_width <= "11";
536
 
537
                                protocol_ind <= '0';
538
                                length_ind <= '0';
539
                                port_ind <= '0';
540
                                vlf <= '0';
541
                                field_data_s <= field_data_early;
542
                      field_type <= X"0F";
543
                      data_ready_off <= '0';
544
                                rst <= '0';
545
                                EmPAC_leds <= "000001111";
546
                                end_of_frame <= '0';
547
 
548
                when ft10 =>
549
                                if count = 1 then
550
                                        NextState <= ft11;
551
                                else
552
                                        NextState <= ft10;
553
                                end if;
554
                                field_width <= "01";
555
 
556
                                protocol_ind <= '0';
557
                                length_ind <= '0';
558
                                port_ind <= '0';
559
                                vlf <= '0';
560
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
561
                      field_type <= X"10";
562
                      data_ready_off <= '0';
563
                                rst <= '0';
564
                                EmPAC_leds <= "000010000";
565
                                end_of_frame <= '0';
566
 
567
                when ft11 =>
568
                                if count = 3 then
569
                                        NextState <= ft12;
570
                                else
571
                                        NextState <= ft11;
572
                                end if;
573
                                field_width <= "11";
574
 
575
                                protocol_ind <= '0';
576
                                length_ind <= '0';
577
                                port_ind <= '0';
578
                                vlf <= '0';
579
                                field_data_s <= field_data_early;
580
                      field_type <= X"11";
581
                      data_ready_off <= '0';
582
                                rst <= '0';
583
                                EmPAC_leds <= "000010001";
584
                                end_of_frame <= '0';
585
 
586
                when ft12 =>
587
                                if count = 3 then
588
                                        NextState <= ft13;
589
                                else
590
                                        NextState <= ft12;
591
                                end if;
592
                                field_width <= "11";
593
 
594
                                protocol_ind <= '0';
595
                                length_ind <= '0';
596
                                port_ind <= '0';
597
                                vlf <= '0';
598
                                field_data_s <= field_data_early;
599
                      field_type <= X"12";
600
                      data_ready_off <= '0';
601
                                rst <= '0';
602
                                EmPAC_leds <= "000010010";
603
                                end_of_frame <= '0';
604
 
605
                when ft13 =>
606
                                if count = 3 then
607
                                        NextState <= ft14;
608
                                else
609
                                        NextState <= ft13;
610
                                end if;
611
                                field_width <= "11";
612
 
613
                                protocol_ind <= '0';
614
                                length_ind <= '0';
615
                                port_ind <= '0';
616
                                vlf <= '0';
617
                                field_data_s <= field_data_early;
618
                      field_type <= X"13";
619
                      data_ready_off <= '0';
620
                                rst <= '0';
621
                                EmPAC_leds <= "000010011";
622
                                end_of_frame <= '0';
623
 
624
                when ft14 =>
625
                                if count = 3 then
626
                                        NextState <= ft15;
627
                                else
628
                                        NextState <= ft14;
629
                                end if;
630
                                field_width <= "11";
631
 
632
                                protocol_ind <= '0';
633
                                length_ind <= '0';
634
                                port_ind <= '0';
635
                                vlf <= '0';
636
                                field_data_s <= field_data_early;
637
                      field_type <= X"14";
638
                                data_ready_off <= '0';
639
                                rst <= '0';
640
                                EmPAC_leds <= "000010100";
641
                                end_of_frame <= '0';
642
 
643
                when ft15 =>
644
                                if count = 3 then
645
                                        NextState <= ft16;
646
                                else
647
                                        NextState <= ft15;
648
                                end if;
649
                                field_width <= "11";
650
 
651
                                protocol_ind <= '0';
652
                                length_ind <= '0';
653
                                port_ind <= '0';
654
                                vlf <= '0';
655
                                field_data_s <= field_data_early;
656
                      field_type <= X"15";
657
                                data_ready_off <= '0';
658
                                rst <= '0';
659
                                EmPAC_leds <= "000010101";
660
                                end_of_frame <= '0';
661
 
662
                when ft16 =>
663
                                if count = 1 then
664
                                        NextState <= ft17;
665
                                else
666
                                        NextState <= ft16;
667
                                end if;
668
                                field_width <= "01";
669
 
670
                                protocol_ind <= '0';
671
                                length_ind <= '0';
672
                                port_ind <= '0';
673
                                vlf <= '0';
674
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
675
                      field_type <= X"16";
676
                      data_ready_off <= '0';
677
                                rst <= '0';
678
                                EmPAC_leds <= "000010110";
679
                                end_of_frame <= '0';
680
 
681
                when ft17 =>
682
                                if count = 3 then
683
                                        NextState <= ft18;
684
                                else
685
                                        NextState <= ft17;
686
                                end if;
687
                                field_width <= "11";
688
 
689
                                protocol_ind <= '0';
690
                                length_ind <= '1';
691
                                port_ind <= '0';
692
                                vlf <= '0';
693
                                field_data_s <= field_data_early;
694
                      field_type <= X"17";
695
                      data_ready_off <= '0';
696
                                rst <= '0';
697
                                EmPAC_leds <= "000010111";
698
                                end_of_frame <= '0';
699
                when ft18 =>
700
--                              if phy_data_valid = '0' then
701
                                        NextState <= ftreset;
702
--                              elsif count = 0 then
703
--                                      NextState <= ft2;
704
--                              else
705
--                                      NextState <= ft18;
706
--                              end if;
707
                                field_width <= "00";
708
                                --branch_ind <= '1';
709
                                protocol_ind <= '1';
710
                                length_ind <= '0';
711
                                port_ind <= '0';
712
                                vlf <= '0';
713
                                field_data_s <= X"000000" & field_data_early(7 downto 0);
714
                      field_type <= X"18";
715
                      data_ready_off <= '0';
716
                                rst <= '0';
717
                                EmPAC_leds <= "000011000";
718
                                end_of_frame <= '0';
719
 
720
                when ft19 =>
721
                                if count = 0 then
722
                                        NextState <= ft1A;
723
                                else
724
                                        NextState <= ft19;
725
                                end if;
726
                                field_width <= "00";
727
 
728
                                protocol_ind <= '0';
729
                                length_ind <= '1';
730
                                port_ind <= '0';
731
                                vlf <= '0';
732
                                field_data_s <= X"000000" & field_data_early(7 downto 0);
733
                      field_type <= X"19";
734
                      data_ready_off <= '0';
735
                                rst <= '0';
736
                                EmPAC_leds <= "000011001";
737
                                end_of_frame <= '0';
738
 
739
                when ft1A =>
740
                                if count = 0 then
741
                                        NextState <= ft1B;
742
                                else
743
                                        NextState <= ft1A;
744
                                end if;
745
                                field_width <= "00";
746
 
747
                                protocol_ind <= '0';
748
                                length_ind <= '0';
749
                                port_ind <= '0';
750
                                vlf <= '0';
751
                                field_data_s <= X"000000" & field_data_early(7 downto 0);
752
                      field_type <= X"1A";
753
                      data_ready_off <= '0';
754
                                rst <= '0';
755
                                EmPAC_leds <= "000011010";
756
                                end_of_frame <= '0';
757
 
758
                when ft1B =>
759
                                if count = 1 then
760
                                        NextState <= ft1C;
761
                                else
762
                                        NextState <= ft1B;
763
                                end if;
764
                                field_width <= "01";
765
 
766
                                protocol_ind <= '0';
767
                                length_ind <= '1';
768
                                port_ind <= '0';
769
                                vlf <= '0';
770
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
771
                      field_type <= X"1B";
772
                      data_ready_off <= '0';
773
                                rst <= '0';
774
                                EmPAC_leds <= "000011011";
775
                                end_of_frame <= '0';
776
 
777
                when ft1C =>
778
                                if count = 1 then
779
                                        NextState <= ft1D;
780
                                else
781
                                        NextState <= ft1C;
782
                                end if;
783
                                field_width <= "01";
784
 
785
                                protocol_ind <= '0';
786
                                length_ind <= '0';
787
                                port_ind <= '0';
788
                                vlf <= '0';
789
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
790
                      field_type <= X"1C";
791
                      data_ready_off <= '0';
792
                                rst <= '0';
793
                                EmPAC_leds <= "000011100";
794
                                end_of_frame <= '0';
795
 
796
                when ft1D =>
797
                                if count = 1 then
798
                                        NextState <= ft1E;
799
                                else
800
                                        NextState <= ft1D;
801
                                end if;
802
                                field_width <= "01";
803
 
804
                                protocol_ind <= '0';
805
                                length_ind <= '0';
806
                                port_ind <= '0';
807
                                vlf <= '0';
808
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
809
                      field_type <= X"1D";
810
                      data_ready_off <= '0';
811
                                rst <= '0';
812
                                EmPAC_leds <= "000011101";
813
                                end_of_frame <= '0';
814
 
815
                when ft1E =>
816
                                if count = 0 then
817
                                        NextState <= ft1F;
818
                                else
819
                                        NextState <= ft1E;
820
                                end if;
821
                                field_width <= "00";
822
 
823
                                protocol_ind <= '0';
824
                                length_ind <= '0';
825
                                port_ind <= '0';
826
                                vlf <= '0';
827
                                field_data_s <= X"000000" & field_data_early(7 downto 0);
828
                      field_type <= X"1E";
829
                      data_ready_off <= '0';
830
                                rst <= '0';
831
                                EmPAC_leds <= "000011110";
832
                                end_of_frame <= '0';
833
 
834
                when ft1F =>
835
                                if count = 0 then
836
                                        NextState <= ft20;
837
                                else
838
                                        NextState <= ft1F;
839
                                end if;
840
                                field_width <= "00";
841
 
842
                                protocol_ind <= '1';
843
                                length_ind <= '0';
844
                                port_ind <= '0';
845
                                vlf <= '0';
846
                                field_data_s <= X"000000" & field_data_early(7 downto 0);
847
                      field_type <= X"1F";
848
                      data_ready_off <= '0';
849
                                rst <= '0';
850
                                EmPAC_leds <= "000011111";
851
                                end_of_frame <= '0';
852
 
853
                when ft20 =>
854
                                if count = 1 then
855
                                        NextState <= ft21;
856
                                else
857
                                        NextState <= ft20;
858
                                end if;
859
                                field_width <= "01";
860
 
861
                                protocol_ind <= '0';
862
                                length_ind <= '0';
863
                                port_ind <= '0';
864
                                vlf <= '0';
865
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
866
                      field_type <= X"20";
867
                      data_ready_off <= '0';
868
                                rst <= '0';
869
                                EmPAC_leds <= "000100000";
870
                                end_of_frame <= '0';
871
 
872
                when ft21 =>
873
                                if count = 3 then
874
                                        NextState <= ft22;
875
                                else
876
                                        NextState <= ft21;
877
                                end if;
878
                                field_width <= "11";
879
 
880
                                protocol_ind <= '0';
881
                                length_ind <= '0';
882
                                port_ind <= '0';
883
                                vlf <= '0';
884
                                field_data_s <= field_data_early;
885
                      field_type <= X"21";
886
                      data_ready_off <= '0';
887
                                rst <= '0';
888
                                EmPAC_leds <= "000100001";
889
                                end_of_frame <= '0';
890
 
891
                when ft22 =>
892
--                              if (count = 3 and opt = '1') then
893
----                                    if opt = '1' then--IPv4_header_len > "000000000000010100" then
894
--                                              NextState <= ft23;
895
--                                      elsif (count = 3 and TCP_type = '1') then--field_data_early(15 downto 0) = X"06" then--protocol_type = X"06" then
896
--                                              NextState <= ft24;
897
--                                      elsif (count = 3 and UDP_type = '1') then--field_data_early(15 downto 0) = X"11" then --protocol_type = X"11" then
898
--                                              NextState <= ft2E;
899
--                                      elsif (count = 3 and opt='0' and TCP_type = '0' and UDP_type = '0') then
900
--                                              NextState <=  unknown_protocol;
901
----                                    end if;
902
--                              else
903
--                                      NextState <= ft22;
904
--                              end if;
905
                                if (count = 3) then
906
                                        if (opt = '1') then
907
                                                NextState <= ft23;
908
                                        elsif (TCP_type = '1') then
909
                                                NextState <= ft24;
910
                                        elsif (UDP_type = '1') then
911
                                                NextState <= ft2E;
912
                                        elsif (ICMP_type =  '1') then
913
                                                Nextstate <= icmp_protocol;
914
                                        else --if ((opt = '0') and (TCP_type = '0') and (UDP_type = '0') ) then
915
                                                NextState <= unknown_protocol;
916
                                        end if;
917
                                else
918
                                        NextState <= ft22;
919
                                end if;
920
                                field_width <= "11";
921
                                --branch_ind <= '1';
922
                                protocol_ind <= '0';
923
                                length_ind <= '0';
924
                                port_ind <= '0';
925
                                vlf <= '0';
926
                                field_data_s <= field_data_early;
927
                      field_type <= X"22";
928
                      data_ready_off <= '0';
929
                                rst <= '0';
930
                                EmPAC_leds <= "000100010";
931
                                end_of_frame <= '0';
932
 
933
                when ft23 =>
934
                                if (count = length_s)then---1) then
935
                                        NextState <= ft17;
936
                                else
937
                                        NextState <= ft23;
938
                                end if;
939
                                field_width <= "XX";
940
                                --branch_ind <= '1';
941
                                protocol_ind <= '0';
942
                                length_ind <= '0';
943
                                port_ind <= '0';
944
                                vlf <= '1';
945
                                field_data_s <= field_data_early;
946
                      field_type <= X"23";
947
                      data_ready_off <= '0';
948
                                rst <= '0';
949
                                EmPAC_leds <= "000100011";
950
                                end_of_frame <= '0';
951
 
952
                when ft24 =>
953
                                if count = 1 then
954
                                        NextState <= ft25;
955
                                else
956
                                        NextState <= ft24;
957
                                end if;
958
                                field_width <= "01";
959
 
960
                                protocol_ind <= '0';
961
                                length_ind <= '0';
962
                                port_ind <= '1';
963
                                vlf <= '0';
964
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
965
                      field_type <= X"24";
966
                      data_ready_off <= '0';
967
                                rst <= '0';
968
                                EmPAC_leds <= "000100100";
969
                                end_of_frame <= '0';
970
 
971
                when ft25 =>
972
                                if count = 1 then
973
                                        NextState <= ft26;
974
                                else
975
                                        NextState <= ft25;
976
                                end if;
977
                                field_width <= "01";
978
 
979
                                protocol_ind <= '0';
980
                                length_ind <= '0';
981
                                port_ind <= '1';
982
                                vlf <= '0';
983
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
984
                      field_type <= X"25";
985
                      data_ready_off <= '0';
986
                                rst <= '0';
987
                                EmPAC_leds <= "000100101";
988
                                end_of_frame <= '0';
989
 
990
                when ft26 =>
991
                                if count = 3 then
992
                                        NextState <= ft27;
993
                                else
994
                                        NextState <= ft26;
995
                                end if;
996
                                field_width <= "11";
997
 
998
                                protocol_ind <= '0';
999
                                length_ind <= '0';
1000
                                port_ind <= '0';
1001
                                vlf <= '0';
1002
                                field_data_s <= field_data_early;
1003
                      field_type <= X"26";
1004
                      data_ready_off <= '0';
1005
                                rst <= '0';
1006
                                EmPAC_leds <= "000100110";
1007
                                end_of_frame <= '0';
1008
 
1009
                when ft27 =>
1010
                                if count = 3 then
1011
                                        NextState <= ft28;
1012
                                else
1013
                                        NextState <= ft27;
1014
                                end if;
1015
                                field_width <= "11";
1016
 
1017
                                protocol_ind <= '0';
1018
                                length_ind <= '0';
1019
                                port_ind <= '0';
1020
                                vlf <= '0';
1021
                                field_data_s <= field_data_early;
1022
                      field_type <= X"27";
1023
                      data_ready_off <= '0';
1024
                                rst <= '0';
1025
                                EmPAC_leds <= "000100111";
1026
                                end_of_frame <= '0';
1027
 
1028
                when ft28 =>
1029
                                if count = 1 then
1030
                                        NextState <= ft29;
1031
                                else
1032
                                        NextState <= ft28;
1033
                                end if;
1034
                                field_width <= "01";
1035
 
1036
                                protocol_ind <= '0';
1037
                                length_ind <= '1';
1038
                                port_ind <= '0';
1039
                                vlf <= '0';
1040
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1041
                      field_type <= X"28";
1042
                      data_ready_off <= '0';
1043
                                rst <= '0';
1044
                                EmPAC_leds <= "000101000";
1045
                                end_of_frame <= '0';
1046
 
1047
                when ft29 =>
1048
                                if count = 1 then
1049
                                        NextState <= ft2A;
1050
                                else
1051
                                        NextState <= ft29;
1052
                                end if;
1053
                                field_width <= "01";
1054
 
1055
                                protocol_ind <= '0';
1056
                                length_ind <= '0';
1057
                                port_ind <= '0';
1058
                                vlf <= '0';
1059
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1060
                      field_type <= X"29";
1061
                      data_ready_off <= '0';
1062
                                rst <= '0';
1063
                                EmPAC_leds <= "000101001";
1064
                                end_of_frame <= '0';
1065
 
1066
                when ft2A =>
1067
                                if count = 1 then
1068
                                        NextState <= ft2B;
1069
                                else
1070
                                        NextState <= ft2A;
1071
                                end if;
1072
                                field_width <= "01";
1073
 
1074
                                protocol_ind <= '0';
1075
                                length_ind <= '0';
1076
                                port_ind <= '0';
1077
                                vlf <= '0';
1078
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1079
                      field_type <= X"2A";
1080
                      data_ready_off <= '0';
1081
                                rst <= '0';
1082
                                EmPAC_leds <= "000101010";
1083
                                end_of_frame <= '0';
1084
 
1085
                when ft2B =>
1086
                                if count = 1 and opt = '1' then
1087
                                        --if opt = '1' then
1088
                                                NextState <= ft2C;
1089
                                elsif count = 1 and opt = '0' then
1090
                                                NextState <= ft2D;
1091
--                                      end if;
1092
                                else
1093
                                        NextState <= ft2B;
1094
                                end if;
1095
                                field_width <= "01";
1096
 
1097
                                protocol_ind <= '0';
1098
                                length_ind <= '0';
1099
                                port_ind <= '0';
1100
                                vlf <= '0';
1101
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1102
                      field_type <= X"2B";
1103
                      data_ready_off <= '0';
1104
                                rst <= '0';
1105
                                EmPAC_leds <= "000101011";
1106
                                end_of_frame <= '0';
1107
 
1108
                when ft2C =>
1109
                                if (count = length_s)then---1 then
1110
                                        NextState <= ft17;
1111
                                else
1112
                                        NextState <= ft2C;
1113
                                end if;
1114
                                field_width <= "XX";
1115
 
1116
                                protocol_ind <= '0';
1117
                                length_ind <= '0';
1118
                                port_ind <= '0';
1119
                                vlf <= '1';
1120
                                field_data_s <= field_data_early;
1121
                      field_type <= X"2C";
1122
                      data_ready_off <= '0';
1123
                                rst <= '0';
1124
                                EmPAC_leds <= "000101100";
1125
                                end_of_frame <= '0';
1126
 
1127
                when ft2D =>
1128
                                if (count = length_s)then-- - 1 then
1129
                                        NextState <= ft17;
1130
                                else
1131
                                        NextState <= ft2D;
1132
                                end if;
1133
                                field_width <= "XX";
1134
 
1135
                                protocol_ind <= '0';
1136
                                length_ind <= '0';
1137
                                port_ind <= '0';
1138
                                vlf <= '1';
1139
                                field_data_s <= field_data_early;
1140
                      field_type <= X"2D";
1141
                      data_ready_off <= '0';
1142
                                rst <= '0';
1143
                                EmPAC_leds <= "000101101";
1144
                                end_of_frame <= '0';
1145
 
1146
                when ft2E =>
1147
                                if count = 1 then
1148
                                        NextState <= ft2F;
1149
                                else
1150
                                        NextState <= ft2E;
1151
                                end if;
1152
                                field_width <= "01";
1153
 
1154
                                protocol_ind <= '0';
1155
                                length_ind <= '0';
1156
                                port_ind <= '1';
1157
                                vlf <= '0';
1158
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1159
                      field_type <= X"2E";
1160
                      data_ready_off <= '0';
1161
                                rst <= '0';
1162
                                EmPAC_leds <= "000101110";
1163
                                end_of_frame <= '0';
1164
                when ft2F =>
1165
                                if count = 1 then
1166
                                        NextState <= ft30;
1167
                                else
1168
                                        NextState <= ft2F;
1169
                                end if;
1170
                                field_width <= "01";
1171
 
1172
                                protocol_ind <= '0';
1173
                                length_ind <= '0';
1174
                                port_ind <= '1';
1175
                                vlf <= '0';
1176
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1177
                      field_type <= X"2F";
1178
                      data_ready_off <= '0';
1179
                                rst <= '0';
1180
                                EmPAC_leds <= "000101111";
1181
                                end_of_frame <= '0';
1182
 
1183
                when ft30 =>
1184
                                if count = 1 then
1185
                                        NextState <= ft31;
1186
                                else
1187
                                        NextState <= ft30;
1188
                                end if;
1189
                                field_width <= "01";
1190
--                               
1191
                                protocol_ind <= '0';
1192
                                length_ind <= '1';
1193
                                port_ind <= '0';
1194
                                vlf <= '0';
1195
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1196
                      field_type <= X"30";
1197
                      data_ready_off <= '0';
1198
                                rst <= '0';
1199
                                EmPAC_leds <= "000110000";
1200
                                end_of_frame <= '0';
1201
 
1202
                when ft31 =>
1203
                                if count = 1 then
1204
                                        NextState <= ft32;
1205
                                else
1206
                                        NextState <= ft31;
1207
                                end if;
1208
                                field_width <= "01";
1209
--                               
1210
                                protocol_ind <= '0';
1211
                                length_ind <= '0';
1212
                                port_ind <= '0';
1213
                                vlf <= '0';
1214
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1215
                      field_type <= X"31";
1216
                      data_ready_off <= '0';
1217
                                rst <= '0';
1218
                                EmPAC_leds <= "000110001";
1219
                                end_of_frame <= '0';
1220
 
1221
                when ft32 =>
1222
                                if (count = length_s)then-- -1 then
1223
                                        NextState <= ft17;
1224
                                else
1225
                                        NextState <= ft32;
1226
                                end if;
1227
                                field_width <= "XX";
1228
--                               
1229
                                protocol_ind <= '0';
1230
                                length_ind <= '0';
1231
                                port_ind <= '0';
1232
                                vlf <= '1';
1233
                                field_data_s <= field_data_early;
1234
                      field_type <= X"32";
1235
                                data_ready_off <= '0';
1236
                                rst <= '0';
1237
                                EmPAC_leds <= "000110010";
1238
                                end_of_frame <= '0';
1239
 
1240
                when ft33 =>
1241
                                if count = 0 then
1242
                                        NextState <= ft34;
1243
                                else
1244
                                        NextState <= ft33;
1245
                                end if;
1246
                                field_width <= "00";
1247
                                protocol_ind <= '0';
1248
                                length_ind <= '0';
1249
                                port_ind <= '0';
1250
                                vlf <= '0';
1251
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1252
                                field_type <= X"33";
1253
                                data_ready_off <= '0';
1254
                                rst <= '0';
1255
                                EmPAC_leds <= "000110011";
1256
                                end_of_frame <= '0';
1257
 
1258
                when ft34 =>
1259
                                if count = 0 then
1260
                                        NextState <= ft35;
1261
                                else
1262
                                        NextState <= ft34;
1263
                                end if;
1264
                                field_width <= "00";
1265
                                protocol_ind <= '0';
1266
                                length_ind <= '0';
1267
                                port_ind <= '0';
1268
                                vlf <= '0';
1269
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1270
                                field_type <= X"34";
1271
                                data_ready_off <= '0';
1272
                                rst <= '0';
1273
                                EmPAC_leds <= "000110100";
1274
                                end_of_frame <= '0';
1275
 
1276
                when ft35 =>
1277
                                if count = 1 then
1278
                                        NextState <= ft36;
1279
                                else
1280
                                        NextState <= ft35;
1281
                                end if;
1282
                                field_width <= "01";
1283
                                protocol_ind <= '0';
1284
                                length_ind <= '0';
1285
                                port_ind <= '0';
1286
                                vlf <= '0';
1287
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1288
                                field_type <= X"35";
1289
                                data_ready_off <= '0';
1290
                                rst <= '0';
1291
                                EmPAC_leds <= "000110101";
1292
                                end_of_frame <= '0';
1293
 
1294
                when ft36 =>
1295
                                if count = 1 then
1296
                                        NextState <= ft37;
1297
                                else
1298
                                        NextState <= ft36;
1299
                                end if;
1300
                                field_width <= "01";
1301
                                protocol_ind <= '0';
1302
                                length_ind <= '1';
1303
                                port_ind <= '0';
1304
                                vlf <= '0';
1305
                                field_data_s <= X"0000" & field_data_early(15 downto 0);
1306
                                field_type <= X"36";
1307
                                data_ready_off <= '0';
1308
                                rst <= '0';
1309
                                EmPAC_leds <= "000110110";
1310
                                end_of_frame <= '0';
1311
 
1312
                when ft37 =>
1313
                                if count = 0 then
1314
                                        NextState <= ft38;
1315
                                else
1316
                                        NextState <= ft37;
1317
                                end if;
1318
                                field_width <= "00";
1319
                                protocol_ind <= '1';
1320
                                length_ind <= '0';
1321
                                port_ind <= '0';
1322
                                vlf <= '0';
1323
                                field_data_s <= X"000000" & field_data_early(7 downto 0);
1324
                                field_type <= X"37";
1325
                                data_ready_off <= '0';
1326
                                rst <= '0';
1327
                                EmPAC_leds <= "000110111";
1328
                                end_of_frame <= '0';
1329
 
1330
                when ft38 =>
1331
                                if count = 0 then
1332
                                        NextState <= ft39;
1333
                                else
1334
                                        NextState <= ft38;
1335
                                end if;
1336
                                field_width <= "00";
1337
                                protocol_ind <= '0';
1338
                                length_ind <= '0';
1339
                                port_ind <= '0';
1340
                                vlf <= '0';
1341
                                field_data_s <= field_data_early;
1342
                                field_type <= X"38";
1343
                                data_ready_off <= '0';
1344
                                rst <= '0';
1345
                                EmPAC_leds <= "000111000";
1346
                                end_of_frame <= '0';
1347
 
1348
                when ft39 =>
1349
                                if count = 3 then
1350
                                        NextState <= ft3A;
1351
                                else
1352
                                        NextState <= ft39;
1353
                                end if;
1354
                                field_width <= "11";
1355
                                protocol_ind <= '0';
1356
                                length_ind <= '0';
1357
                                port_ind <= '0';
1358
                                vlf <= '0';
1359
                                field_data_s <= field_data_early;
1360
                                field_type <= X"39";
1361
                                data_ready_off <= '0';
1362
                                rst <= '0';
1363
                                EmPAC_leds <= "000111001";
1364
                                end_of_frame <= '0';
1365
 
1366
                when ft3A =>
1367
                                if count = 3 then
1368
                                        NextState <= ft3B;
1369
                                else
1370
                                        NextState <= ft3A;
1371
                                end if;
1372
                                field_width <= "11";
1373
                                protocol_ind <= '0';
1374
                                length_ind <= '0';
1375
                                port_ind <= '0';
1376
                                vlf <= '0';
1377
                                field_data_s <= field_data_early;
1378
                                field_type <= X"3A";
1379
                                data_ready_off <= '0';
1380
                                rst <= '0';
1381
                                EmPAC_leds <= "000111010";
1382
                                end_of_frame <= '0';
1383
 
1384
                when ft3B =>
1385
                                if count = 3 then
1386
                                        NextState <= ft3C;
1387
                                else
1388
                                        NextState <= ft3B;
1389
                                end if;
1390
                                field_width <= "11";
1391
                                protocol_ind <= '0';
1392
                                length_ind <= '0';
1393
                                port_ind <= '0';
1394
                                vlf <= '0';
1395
                                field_data_s <= field_data_early;
1396
                                field_type <= X"3B";
1397
                                data_ready_off <= '0';
1398
                                rst <= '0';
1399
                                EmPAC_leds <= "000111011";
1400
                                end_of_frame <= '0';
1401
 
1402
                when ft3C =>
1403
                                if count = 3 then
1404
                                        NextState <= ft3D;
1405
                                else
1406
                                        NextState <= ft3C;
1407
                                end if;
1408
                                field_width <= "11";
1409
                                protocol_ind <= '0';
1410
                                length_ind <= '0';
1411
                                port_ind <= '0';
1412
                                vlf <= '0';
1413
                                field_data_s <= field_data_early;
1414
                                field_type <= X"3C";
1415
                                data_ready_off <= '0';
1416
                                rst <= '0';
1417
                                EmPAC_leds <= "000111100";
1418
                                end_of_frame <= '0';
1419
 
1420
                when ft3D =>
1421
                                if count = 3 then
1422
                                        NextState <= ft3E;
1423
                                else
1424
                                        NextState <= ft3D;
1425
                                end if;
1426
                                field_width <= "11";
1427
                                protocol_ind <= '0';
1428
                                length_ind <= '0';
1429
                                port_ind <= '0';
1430
                                vlf <= '0';
1431
                                field_data_s <= field_data_early;
1432
                                field_type <= X"3D";
1433
                                data_ready_off <= '0';
1434
                                rst <= '0';
1435
                                EmPAC_leds <= "000111101";
1436
                                end_of_frame <= '0';
1437
 
1438
                when ft3E =>
1439
                                if count = 3 then
1440
                                        NextState <= ft3F;
1441
                                else
1442
                                        NextState <= ft3E;
1443
                                end if;
1444
                                field_width <= "11";
1445
                                protocol_ind <= '0';
1446
                                length_ind <= '0';
1447
                                port_ind <= '0';
1448
                                vlf <= '0';
1449
                                field_data_s <= field_data_early;
1450
                                field_type <= X"3E";
1451
                                data_ready_off <= '0';
1452
                                rst <= '0';
1453
                                EmPAC_leds <= "000111110";
1454
                                end_of_frame <= '0';
1455
 
1456
                when ft3F =>
1457
                                if count = 3 then
1458
                                        NextState <= ft40;
1459
                                else
1460
                                        NextState <= ft3F;
1461
                                end if;
1462
                                field_width <= "11";
1463
                                protocol_ind <= '0';
1464
                                length_ind <= '0';
1465
                                port_ind <= '0';
1466
                                vlf <= '0';
1467
                                field_data_s <= field_data_early;
1468
                                field_type <= X"3F";
1469
                                data_ready_off <= '0';
1470
                                rst <= '0';
1471
                                EmPAC_leds <= "000111111";
1472
                                end_of_frame <= '0';
1473
 
1474
---------------------------------------------------------------------------------------------------             
1475
                when ft40 =>
1476
                                if count = 3 and opt = '1' then
1477
--                                      if opt = '1' then--IPv4_header_len > "000000000000010100" then
1478
                                                NextState <= ft41;
1479
                                        elsif count = 3 and TCP_type = '1' then--field_data_early(15 downto 0) = X"06" then--protocol_type = X"06" then
1480
                                                NextState <= ft24;
1481
                                        elsif count = 3 and UDP_type = '1' then--field_data_early(15 downto 0) = X"11" then --protocol_type = X"11" then
1482
                                                NextState <= ft2E;
1483
                                        elsif count = 3 and opt='0' and TCP_type = '0' and UDP_type = '0' then
1484
                                                NextState <=  unknown_protocol;
1485
--                                      end if;
1486
                                else
1487
                                        NextState <= ft40;
1488
                                end if;
1489
                                field_width <= "11";
1490
                                protocol_ind <= '0';
1491
                                length_ind <= '0';
1492
                                port_ind <= '0';
1493
                                vlf <= '0';
1494
                                field_data_s <= field_data_early;
1495
                                field_type <= X"40";
1496
                                data_ready_off <= '0';
1497
                                rst <= '0';
1498
                                EmPAC_leds <= "001000000";
1499
                                end_of_frame <= '0';
1500
 
1501
--------------------------------------------------------------------------------------------------                              
1502
 
1503
                when ft41 =>
1504
                                if (count = length_s) then-- -1 then
1505
                                        NextState <= ft17;
1506
                                else
1507
                                        NextState <= ft41;
1508
                                end if;
1509
                                field_width <= "XX";
1510
                                protocol_ind <= '1';
1511
                                length_ind <= '0';
1512
                                port_ind <= '0';
1513
                                vlf <= '1';
1514
                                field_data_s <= field_data_early;
1515
                                field_type <= X"41";
1516
                                data_ready_off <= '0';
1517
                                rst <= '0';
1518
                                EmPAC_leds <= "001000001";
1519
                                end_of_frame <= '0';
1520
 
1521
                when unknown_protocol =>
1522
                        if phy_data_valid = '0' then---was if phy_data_valid_reg = 0
1523
                                NextState <= ftreset;
1524
                        else
1525
                                NextState <= unknown_protocol;
1526
                        end if;
1527
                        field_width <= "XX";
1528
                        protocol_ind <= '0';
1529
                        length_ind <= '0';
1530
                        port_ind <= '0';
1531
                        vlf <= '1';
1532
                        field_data_s <= field_data_early;
1533
                        field_type <= X"42";
1534
                        data_ready_off <= '0';
1535
                        rst <= '0';
1536
                        EmPAC_leds <= "001000010";
1537
                        end_of_frame <= '0';
1538
 
1539
                when icmp_protocol =>
1540
--                      if phy_data_valid = '0' then---was if phy_data_valid_reg = 0
1541
--                              NextState <= ftreset;
1542
--                      else 
1543
                                NextState <= unknown_protocol;
1544
--                      end if;
1545
                        field_width <= "XX";
1546
                        protocol_ind <= '0';
1547
                        length_ind <= '0';
1548
                        port_ind <= '0';
1549
                        vlf <= '1';
1550
                        field_data_s <= field_data_early;
1551
                        field_type <= X"43";
1552
                        data_ready_off <= '0';
1553
                        rst <= '0';
1554
                        EmPAC_leds <= "001000010";
1555
                        end_of_frame <= '0';
1556
 
1557
                when others =>
1558
                        NextState <= unknown_protocol;
1559
                        field_width <= "XX";
1560
--                       
1561
                        protocol_ind <= '0';
1562
                        length_ind <= '0';
1563
                        port_ind <= '0';
1564
                        vlf <= '0';
1565
                        field_data_s <= X"00000000";
1566
                        field_type <= "XXXXXXXX";
1567
                        data_ready_off <= '0';
1568
                        rst <= '0';
1569
                        EmPAC_leds <= "001000011";
1570
                        end_of_frame <= '0';
1571
 
1572
        end case;
1573
end process;
1574
 
1575
nxt_state_logic:process(clock,reset)--(clock,reset)
1576
begin
1577
        if rising_Edge(clock) then
1578
                if reset = '1' then
1579
                        currentstate <= ftreset;
1580
                else
1581
                        currentstate <= nextstate;
1582
                end if;
1583
        end if;
1584
end process;
1585
 
1586
end Behavioral;
1587
 

powered by: WebSVN 2.1.0

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