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

Subversion Repositories udp_ip_stack

[/] [udp_ip_stack/] [trunk/] [rtl/] [vhdl/] [arp_RX.vhd] - Diff between revs 10 and 18

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 10 Rev 18
Line 25... Line 25...
-- Revision 0.01 - File Created - refactored from arp v0.02 module
-- Revision 0.01 - File Created - refactored from arp v0.02 module
-- Additional Comments: 
-- Additional Comments: 
--
--
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
library IEEE;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_1164.all;
use IEEE.NUMERIC_STD.ALL;
use IEEE.NUMERIC_STD.all;
use work.arp_types.all;
use work.arp_types.all;
 
 
entity arp_rx is
entity arp_rx is
    Port (
  port (
                        -- MAC layer RX signals
                        -- MAC layer RX signals
                        data_in                                 : in  STD_LOGIC_VECTOR (7 downto 0);             -- ethernet frame (from dst mac addr through to last byte of frame)
    data_in               : in  std_logic_vector (7 downto 0);  -- ethernet frame (from dst mac addr through to last byte of frame)
                        data_in_valid           : in  STD_LOGIC;                                                                        -- indicates data_in valid on clock
    data_in_valid         : in  std_logic;    -- indicates data_in valid on clock
                        data_in_last            : in  STD_LOGIC;                                                                        -- indicates last data in frame
    data_in_last          : in  std_logic;    -- indicates last data in frame
                        -- ARP output signals
                        -- ARP output signals
                        recv_who_has            : out std_logic;                                                                        -- pulse will be latched
                        recv_who_has            : out std_logic;                                                                        -- pulse will be latched
                        arp_entry_for_who_has   : out arp_entry_t;                                              -- target for who_has msg (Iie, who to reply to)
                        arp_entry_for_who_has   : out arp_entry_t;                                              -- target for who_has msg (Iie, who to reply to)
                        recv_I_have                     : out std_logic;                                                                        -- pulse will be latched
                        recv_I_have                     : out std_logic;                                                                        -- pulse will be latched
                        arp_entry_for_I_have    : out arp_entry_t;                                                      -- arp target for I_have msg
                        arp_entry_for_I_have    : out arp_entry_t;                                                      -- arp target for I_have msg
                        -- control and status signals
                        -- control and status signals
                        req_count                       : out STD_LOGIC_VECTOR(7 downto 0);                      -- count of arp pkts received
    req_count             : out std_logic_vector(7 downto 0);   -- count of arp pkts received
                        -- system signals
                        -- system signals
                        our_ip_address  : in STD_LOGIC_VECTOR (31 downto 0);
    our_ip_address        : in  std_logic_vector (31 downto 0);
                        rx_clk                          : in std_logic;
                        rx_clk                          : in std_logic;
                        reset                           : in  STD_LOGIC
    reset                 : in  std_logic
                        );
                        );
end arp_rx;
end arp_rx;
 
 
 
 
architecture Behavioral of arp_rx is
architecture Behavioral of arp_rx is
Line 112... Line 112...
        -- Hardware Length /= 6
        -- Hardware Length /= 6
        -- Protocol Length /= 4
        -- Protocol Length /= 4
        -- Operation /= 1 or 2
        -- Operation /= 1 or 2
        -- Target IP /= our IP (i.er. message is not meant for us)
        -- Target IP /= our IP (i.er. message is not meant for us)
        --
        --
        function not_our_arp(data : STD_LOGIC_VECTOR; count : unsigned; our_ip : std_logic_vector) return std_logic is
  function not_our_arp(data : std_logic_vector; count : unsigned; our_ip : std_logic_vector) return std_logic is
        begin
        begin
                if
                if
                        (count = 12 and data /= x"08") or                                               -- PDU type 0806 : ARP
                        (count = 12 and data /= x"08") or                                               -- PDU type 0806 : ARP
                        (count = 13 and data /= x"06") or
                        (count = 13 and data /= x"06") or
                        (count = 14 and data /= x"00") or                                               -- HW type 1 : eth
                        (count = 14 and data /= x"00") or                                               -- HW type 1 : eth
Line 150... Line 150...
                dataval,set_mac5,set_mac4,set_mac3,set_mac2,set_mac1,set_mac0,set_ip3,set_ip2,set_ip1,set_ip0, set_err_data,
                dataval,set_mac5,set_mac4,set_mac3,set_mac2,set_mac1,set_mac0,set_ip3,set_ip2,set_ip1,set_ip0, set_err_data,
                count_arp_rcvd
                count_arp_rcvd
                )
                )
        begin
        begin
                -- set output followers
                -- set output followers
                req_count <= STD_LOGIC_VECTOR(arp_req_count);
    req_count <= std_logic_vector(arp_req_count);
 
 
                -- set defaults for combinatorial outputs
                -- set defaults for combinatorial outputs
                recv_who_has <= '0';
                recv_who_has <= '0';
                arp_entry_for_who_has.ip <= (others => '0');
                arp_entry_for_who_has.ip <= (others => '0');
                arp_entry_for_who_has.mac <= (others => '0');
                arp_entry_for_who_has.mac <= (others => '0');
Line 207... Line 207...
                                                rx_count_mode <= INCR;
                                                rx_count_mode <= INCR;
                                                -- handle early frame termination
                                                -- handle early frame termination
                                                if data_in_last = '1' then
                                                if data_in_last = '1' then
                                                        next_rx_state <= IDLE;
                                                        next_rx_state <= IDLE;
                                                        set_rx_state <= '1';
                                                        set_rx_state <= '1';
                                                else
            --else
 
            end if;
                                                        -- check for end of frame. Also, detect and discard if not our frame
                                                        -- check for end of frame. Also, detect and discard if not our frame
                                                        if rx_count = 42 then
              if rx_count = 41 then     -- TB 2013-01-14 15:09:45 was 42
                                                                next_rx_state <= PROCESS_ARP;
                                                                next_rx_state <= PROCESS_ARP;
                                                                set_rx_state <= '1';
                                                                set_rx_state <= '1';
                                                        elsif not_our_arp(data_in,rx_count,our_ip_address) = '1' then
                                                        elsif not_our_arp(data_in,rx_count,our_ip_address) = '1' then
                                                                dataval <= data_in;
                                                                dataval <= data_in;
                                                                set_err_data <= '1';
                                                                set_err_data <= '1';
Line 261... Line 262...
                                                                dataval <= data_in;
                                                                dataval <= data_in;
                                                        elsif rx_count = 31 then
                                                        elsif rx_count = 31 then
                                                                set_ip0 <= '1';
                                                                set_ip0 <= '1';
                                                                dataval <= data_in;
                                                                dataval <= data_in;
                                                        end if;
                                                        end if;
                                                end if;
--            end if;
                                end case;
                                end case;
 
 
                        when PROCESS_ARP =>
                        when PROCESS_ARP =>
                                next_rx_state <= WAIT_END;
                                next_rx_state <= WAIT_END;
                                set_rx_state <= '1';
                                set_rx_state <= '1';

powered by: WebSVN 2.1.0

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