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_saver.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
 
37
---- Uncomment the following library declaration if instantiating
38
---- any Xilinx primitives in this code.
39
--library UNISIM;
40
--use UNISIM.VComponents.all;
41
 
42
entity protocol_saver is
43
    Port ( clock : in std_logic;
44
                          reset : in std_logic;
45
                          Protocol_indicator : in  STD_LOGIC;
46
--                        optional : in std_logic;
47
           Field_data : in  STD_LOGIC_VECTOR (31 downto 0);
48
                          Field_type : in std_logic_vector(7 downto 0);
49
                          TCP_type_out : out std_logic;
50
                          UDP_type_out : out std_logic;
51
                          ICMP_type_out : out std_logic);
52
--                        eoframe : out std_logic;
53
--           Jump_address : out  STD_LOGIC_VECTOR (7 downto 0));
54
end protocol_saver;
55
 
56
architecture Behavioral of protocol_saver is
57
 
58
signal TCP_type : std_logic := '0';
59
signal UDP_type : std_logic := '0';
60
signal ICMP_type : std_logic := '0';
61
 
62
begin
63
 
64
process(protocol_indicator,field_data,clock,reset)
65
begin
66
--wait until clock'event and clock = '1';
67
        if rising_Edge(clock) then
68
                if reset = '1' then
69
                        TCP_type <= '0';
70
                        UDP_type <= '0';
71
                        ICMP_type <= '0';
72
                else--if rising_Edge(clock) then
73
                        if protocol_indicator = '1' then
74
                        --      if field_type = X"06" then                                                                              --Etherenet header protocol length is 2 bytes
75
                                        --protocol_type <= field_data(15 downto 0);
76
                                if field_type = X"1F" then
77
                                        if field_data(7 downto 0) = X"06" then
78
                                                TCP_type <= '1';
79
                                                UDP_type <= '0';
80
                                        ICMP_type <= '0';
81
                                        elsif field_data(7 downto 0) = X"11" then
82
                                                TCP_type <= '0';
83
                                                UDP_type <= '1';
84
                                        ICMP_type <= '0';
85
                                        elsif field_data(7 downto 0) = X"01" then
86
                                                TCP_type <= '0';
87
                                                UDP_type <= '0';
88
                                                ICMP_type <= '1';
89
                                        else
90
                                                TCP_type <= '0';
91
                                                UDP_type <= '0';
92
                                                ICMP_type <= '0';
93
                                        end if;
94
                                else
95
                                        TCP_type <= '0';
96
                                        UDP_type <= '0';
97
                                        ICMP_type <= '0';
98
                        --      elsif field_type = X"2A" then
99
                        --              protocol_type <= X"FFFD";
100
                        --      elsif eof = '1' then
101
                        --              protocol_type <= X"FFFF";
102
                        --      elsif field_type = X"1E" or field_type = X"36" then
103
                        --              protocol_type <= X"00" & field_data(7 downto 0);                --All other header's protocol length is 1 byte.
104
                                end if;
105
                        else
106
                        --      protocol_type <= protocol_type;                                                    --Retain last protocol value.
107
                                TCP_type <= TCP_type;
108
                                UDP_type <= UDP_type;
109
                                ICMP_type <= ICMP_type;
110
                        end if;
111
                end if;
112
        end if;
113
end process;
114
 
115
TCP_type_out <= TCP_type;
116
UDP_type_out <= UDP_type;
117
ICMP_type_out <= ICMP_type;
118
--opt:process--(optional,field_type)
119
--begin
120
--      wait until clock'event and clock = '1';
121
--      case optional is--_delay is--optional is
122
--              when '0' =>
123
--                      if ( (field_type = X"2C") or (field_type = X"31") or (field_type = X"40") ) then
124
--                              eof <= '1';
125
--                      else eof <= '0';
126
--                      end if;
127
--              when '1' => 
128
--                      if ( (field_type = X"22") or (field_type = X"2B") ) then
129
--                              eof <= '1';
130
--                      else eof <= '0';
131
--                      end if;
132
--              when others => eof <= '0';
133
--      end case;
134
--      
135
--end process;
136
 
137
end Behavioral;
138
 

powered by: WebSVN 2.1.0

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