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

Subversion Repositories udp_ip_stack

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

Show entire file | Details | Blame | View Log

Rev 10 Rev 18
Line 17... Line 17...
-- Revision 0.02 - separated RX and TX clocks
-- Revision 0.02 - separated RX and TX clocks
-- Revision 0.03 - Added mac_tx_tfirst
-- Revision 0.03 - Added mac_tx_tfirst
-- 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.axi.all;
use work.axi.all;
use work.ipv4_types.all;
use work.ipv4_types.all;
use work.arp_types.all;
use work.arp_types.all;
use work.arp;
use work.arp;
use work.arpv2;
use work.arpv2;
 
 
entity IP_complete_nomac is
entity IP_complete_nomac is
         generic (
         generic (
 
    use_arpv2 : boolean := true;        -- use ARP with multipule entries. for signel entry, set
 
                                        -- to false
 
    no_default_gateway : boolean := false;  -- set to false if communicating with devices accessed
 
                                           -- through a "default gateway or router"
                        CLOCK_FREQ                      : integer := 125000000;                                                 -- freq of data_in_clk -- needed to timout cntr
                        CLOCK_FREQ                      : integer := 125000000;                                                 -- freq of data_in_clk -- needed to timout cntr
                        ARP_TIMEOUT                     : integer := 60;                                                                        -- ARP response timeout (s)
                        ARP_TIMEOUT                     : integer := 60;                                                                        -- ARP response timeout (s)
                        ARP_MAX_PKT_TMO : integer := 5;                                                                 -- # wrong nwk pkts received before set error
                        ARP_MAX_PKT_TMO : integer := 5;                                                                 -- # wrong nwk pkts received before set error
                        MAX_ARP_ENTRIES         : integer := 255                                                                        -- max entries in the ARP store
                        MAX_ARP_ENTRIES         : integer := 255                                                                        -- max entries in the ARP store
                        );
                        );
    Port (
  port (
                        -- IP Layer signals
                        -- IP Layer signals
                        ip_tx_start                             : in std_logic;
                        ip_tx_start                             : in std_logic;
                        ip_tx                                           : in ipv4_tx_type;                                                              -- IP tx cxns
                        ip_tx                                           : in ipv4_tx_type;                                                              -- IP tx cxns
                        ip_tx_result                    : out std_logic_vector (1 downto 0);             -- tx status (changes during transmission)
                        ip_tx_result                    : out std_logic_vector (1 downto 0);             -- tx status (changes during transmission)
                        ip_tx_data_out_ready    : out std_logic;                                                                        -- indicates IP TX is ready to take data
                        ip_tx_data_out_ready    : out std_logic;                                                                        -- indicates IP TX is ready to take data
                        ip_rx_start                             : out std_logic;                                                                        -- indicates receipt of ip frame.
                        ip_rx_start                             : out std_logic;                                                                        -- indicates receipt of ip frame.
                        ip_rx                                           : out ipv4_rx_type;
                        ip_rx                                           : out ipv4_rx_type;
                        -- system signals
                        -- system signals
                        rx_clk                                  : in  STD_LOGIC;
    rx_clk               : in  std_logic;
                        tx_clk                                  : in  STD_LOGIC;
    tx_clk               : in  std_logic;
                        reset                                   : in  STD_LOGIC;
    reset                : in  std_logic;
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
    our_ip_address       : in  std_logic_vector (31 downto 0);
                        our_mac_address                 : in std_logic_vector (47 downto 0);
                        our_mac_address                 : in std_logic_vector (47 downto 0);
                        control                                 : in ip_control_type;
                        control                                 : in ip_control_type;
                        -- status signals
                        -- status signals
                        arp_pkt_count                   : out STD_LOGIC_VECTOR(7 downto 0);                      -- count of arp pkts received
    arp_pkt_count        : out std_logic_vector(7 downto 0);  -- count of arp pkts received
                        ip_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
    ip_pkt_count         : out std_logic_vector(7 downto 0);  -- number of IP pkts received for us
                        -- MAC Transmitter
                        -- MAC Transmitter
                        mac_tx_tdata         : out  std_logic_vector(7 downto 0);        -- data byte to tx
                        mac_tx_tdata         : out  std_logic_vector(7 downto 0);        -- data byte to tx
                        mac_tx_tvalid        : out  std_logic;                                                  -- tdata is valid
                        mac_tx_tvalid        : out  std_logic;                                                  -- tdata is valid
                        mac_tx_tready        : in std_logic;                                                    -- mac is ready to accept data
                        mac_tx_tready        : in std_logic;                                                    -- mac is ready to accept data
                        mac_tx_tfirst        : out  std_logic;                                                  -- indicates first byte of frame
                        mac_tx_tfirst        : out  std_logic;                                                  -- indicates first byte of frame
Line 68... Line 72...
end IP_complete_nomac;
end IP_complete_nomac;
 
 
 
 
architecture structural of IP_complete_nomac is
architecture structural of IP_complete_nomac is
 
 
    COMPONENT IPv4
  component IPv4
    PORT(
    port(
                        -- IP Layer signals
                        -- IP Layer signals
                        ip_tx_start                             : in std_logic;
                        ip_tx_start                             : in std_logic;
                        ip_tx                                           : in ipv4_tx_type;                                                              -- IP tx cxns
                        ip_tx                                           : in ipv4_tx_type;                                                              -- IP tx cxns
                        ip_tx_result                    : out std_logic_vector (1 downto 0);             -- tx status (changes during transmission)
                        ip_tx_result                    : out std_logic_vector (1 downto 0);             -- tx status (changes during transmission)
                        ip_tx_data_out_ready    : out std_logic;                                                                        -- indicates IP TX is ready to take data
                        ip_tx_data_out_ready    : out std_logic;                                                                        -- indicates IP TX is ready to take data
                        ip_rx_start                             : out std_logic;                                                                        -- indicates receipt of ip frame.
                        ip_rx_start                             : out std_logic;                                                                        -- indicates receipt of ip frame.
                        ip_rx                                           : out ipv4_rx_type;
                        ip_rx                                           : out ipv4_rx_type;
                        -- system control signals
                        -- system control signals
                        rx_clk                                  : in  STD_LOGIC;
      rx_clk               : in  std_logic;
                        tx_clk                                  : in  STD_LOGIC;
      tx_clk               : in  std_logic;
                        reset                                   : in  STD_LOGIC;
      reset                : in  std_logic;
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
      our_ip_address       : in  std_logic_vector (31 downto 0);
                        our_mac_address                 : in std_logic_vector (47 downto 0);
                        our_mac_address                 : in std_logic_vector (47 downto 0);
                        -- system status signals
                        -- system status signals
                        rx_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
      rx_pkt_count         : out std_logic_vector(7 downto 0);  -- number of IP pkts received for us
                        -- ARP lookup signals
                        -- ARP lookup signals
                        arp_req_req                             : out arp_req_req_type;
                        arp_req_req                             : out arp_req_req_type;
                        arp_req_rslt                    : in arp_req_rslt_type;
                        arp_req_rslt                    : in arp_req_rslt_type;
                        -- MAC layer RX signals
                        -- MAC layer RX signals
                        mac_data_in                     : in  STD_LOGIC_VECTOR (7 downto 0);             -- ethernet frame (from dst mac addr through to last byte of frame)
      mac_data_in          : in  std_logic_vector (7 downto 0);  -- ethernet frame (from dst mac addr through to last byte of frame)
                        mac_data_in_valid       : in  STD_LOGIC;                                                                        -- indicates data_in valid on clock
      mac_data_in_valid    : in  std_logic;  -- indicates data_in valid on clock
                        mac_data_in_last                : in  STD_LOGIC;                                                                        -- indicates last data in frame
      mac_data_in_last     : in  std_logic;  -- indicates last data in frame
                        -- MAC layer TX signals
                        -- MAC layer TX signals
                        mac_tx_req                              : out std_logic;                                                                        -- indicates that ip wants access to channel (stays up for as long as tx)
                        mac_tx_req                              : out std_logic;                                                                        -- indicates that ip wants access to channel (stays up for as long as tx)
                        mac_tx_granted                  : in std_logic;                                                                 -- indicates that access to channel has been granted            
                        mac_tx_granted                  : in std_logic;                                                                 -- indicates that access to channel has been granted            
                        mac_data_out_ready      : in std_logic;                                                                 -- indicates system ready to consume data
                        mac_data_out_ready      : in std_logic;                                                                 -- indicates system ready to consume data
                        mac_data_out_valid      : out std_logic;                                                                        -- indicates data out is valid
                        mac_data_out_valid      : out std_logic;                                                                        -- indicates data out is valid
                        mac_data_out_first      : out std_logic;                                                                        -- with data out valid indicates the first byte of a frame
                        mac_data_out_first      : out std_logic;                                                                        -- with data out valid indicates the first byte of a frame
                        mac_data_out_last               : out std_logic;                                                                        -- with data out valid indicates the last byte of a frame
                        mac_data_out_last               : out std_logic;                                                                        -- with data out valid indicates the last byte of a frame
                        mac_data_out                    : out std_logic_vector (7 downto 0)                      -- ethernet frame (from dst mac addr through to last byte of frame)      
                        mac_data_out                    : out std_logic_vector (7 downto 0)                      -- ethernet frame (from dst mac addr through to last byte of frame)      
         );
         );
         END COMPONENT;
  end component;
 
 
    COMPONENT arp
  component arp
         generic (
         generic (
                        CLOCK_FREQ                      : integer := 125000000;                                                 -- freq of data_in_clk -- needed to timout cntr
                        CLOCK_FREQ                      : integer := 125000000;                                                 -- freq of data_in_clk -- needed to timout cntr
                        ARP_TIMEOUT                     : integer := 60;                                                                        -- ARP response timeout (s)
                        ARP_TIMEOUT                     : integer := 60;                                                                        -- ARP response timeout (s)
                        ARP_MAX_PKT_TMO : integer := 1;                                                                 -- (added for compatibility with arpv2. this value not used in this impl)
                        ARP_MAX_PKT_TMO : integer := 1;                                                                 -- (added for compatibility with arpv2. this value not used in this impl)
                        MAX_ARP_ENTRIES         : integer := 1                                                                          -- (added for compatibility with arpv2. this value not used in this impl)
                        MAX_ARP_ENTRIES         : integer := 1                                                                          -- (added for compatibility with arpv2. this value not used in this impl)
                        );
                        );
    Port (
    port (
                        -- lookup request signals
                        -- lookup request signals
                        arp_req_req                     : in arp_req_req_type;
                        arp_req_req                     : in arp_req_req_type;
                        arp_req_rslt            : out arp_req_rslt_type;
                        arp_req_rslt            : out arp_req_rslt_type;
                        -- MAC layer RX signals
                        -- MAC layer RX signals
                        data_in_clk             : in  STD_LOGIC;
      data_in_clk     : in  std_logic;
                        reset                           : in  STD_LOGIC;
      reset           : in  std_logic;
                        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
                        -- MAC layer TX signals
                        -- MAC layer TX signals
                        mac_tx_req                      : out std_logic;                                                                        -- indicates that ip wants access to channel (stays up for as long as tx)
                        mac_tx_req                      : out std_logic;                                                                        -- indicates that ip wants access to channel (stays up for as long as tx)
                        mac_tx_granted          : in std_logic;                                                                 -- indicates that access to channel has been granted            
                        mac_tx_granted          : in std_logic;                                                                 -- indicates that access to channel has been granted            
                        data_out_clk            : in std_logic;
                        data_out_clk            : in std_logic;
                        data_out_ready          : in std_logic;                                                                 -- indicates system ready to consume data
                        data_out_ready          : in std_logic;                                                                 -- indicates system ready to consume data
                        data_out_valid          : out std_logic;                                                                        -- indicates data out is valid
                        data_out_valid          : out std_logic;                                                                        -- indicates data out is valid
                        data_out_first          : out std_logic;                                                                        -- with data out valid indicates the first byte of a frame
                        data_out_first          : out std_logic;                                                                        -- with data out valid indicates the first byte of a frame
                        data_out_last           : out std_logic;                                                                        -- with data out valid indicates the last byte of a frame
                        data_out_last           : out std_logic;                                                                        -- with data out valid indicates the last byte of a frame
                        data_out                                : out std_logic_vector (7 downto 0);             -- ethernet frame (from dst mac addr through to last byte of frame)
                        data_out                                : out std_logic_vector (7 downto 0);             -- ethernet frame (from dst mac addr through to last byte of frame)
                        -- system signals
                        -- system signals
                        our_mac_address         : in STD_LOGIC_VECTOR (47 downto 0);
      our_mac_address : in  std_logic_vector (47 downto 0);
                        our_ip_address  : in STD_LOGIC_VECTOR (31 downto 0);
      our_ip_address  : in  std_logic_vector (31 downto 0);
                        control                         : in arp_control_type;
                        control                         : in arp_control_type;
                        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
                        );
                        );
         END COMPONENT;
  end component;
 
 
    COMPONENT tx_arbitrator
  component tx_arbitrator
    PORT(
    port(
                clk                             : in std_logic;
                clk                             : in std_logic;
                reset                           : in std_logic;
                reset                           : in std_logic;
 
 
                req_1                           : in  std_logic;
                req_1                           : in  std_logic;
                grant_1                 : out std_logic;
                grant_1                 : out std_logic;
Line 161... Line 165...
      data              : out  std_logic_vector(7 downto 0);     -- data byte to tx
      data              : out  std_logic_vector(7 downto 0);     -- data byte to tx
      valid             : out  std_logic;                                                       -- tdata is valid
      valid             : out  std_logic;                                                       -- tdata is valid
      first             : out  std_logic;                                                       -- indicates first byte of frame
      first             : out  std_logic;                                                       -- indicates first byte of frame
      last              : out  std_logic                                                        -- indicates last byte of frame
      last              : out  std_logic                                                        -- indicates last byte of frame
         );
         );
         END COMPONENT;
  end component;
 
 
 
 
        -------------------
        -------------------
        -- Configuration
        -- Configuration
        --
        --
Line 173... Line 177...
        -- implementation of the ARP layer to use
        -- implementation of the ARP layer to use
        -------------------
        -------------------
 
 
 
 
--      for arp_layer : arp use entity work.arp;                        -- single slot arbitrator
--      for arp_layer : arp use entity work.arp;                        -- single slot arbitrator
        for arp_layer : arp use entity work.arpv2;                      -- multislot arbitrator
--  for arp_layer : arp use entity work.arpv2;  -- multislot arbitrator
 
 
 
 
 
 
        ---------------------------
        ---------------------------
        -- Signals
        -- Signals
Line 223... Line 227...
 
 
   ------------------------------------------------------------------------------
   ------------------------------------------------------------------------------
   -- Instantiate the IP layer
   -- Instantiate the IP layer
   ------------------------------------------------------------------------------
   ------------------------------------------------------------------------------
 
 
    IP_layer : IPv4 PORT MAP
  IP_layer : IPv4 port map
                (
                (
          ip_tx_start                   => ip_tx_start,
          ip_tx_start                   => ip_tx_start,
          ip_tx                                         => ip_tx,
          ip_tx                                         => ip_tx,
          ip_tx_result                  => ip_tx_result,
          ip_tx_result                  => ip_tx_result,
          ip_tx_data_out_ready=> ip_tx_data_out_ready,
          ip_tx_data_out_ready=> ip_tx_data_out_ready,
Line 254... Line 258...
        );
        );
 
 
   ------------------------------------------------------------------------------
   ------------------------------------------------------------------------------
   -- Instantiate the ARP layer
   -- Instantiate the ARP layer
   ------------------------------------------------------------------------------
   ------------------------------------------------------------------------------
        arp_layer : arp
  signle_entry_arp: if (not use_arpv2) generate
 
    arp_layer : entity work.arp
                        generic map (
                        generic map (
                         CLOCK_FREQ                     => CLOCK_FREQ,
                         CLOCK_FREQ                     => CLOCK_FREQ,
                         ARP_TIMEOUT            => ARP_TIMEOUT,
                         ARP_TIMEOUT            => ARP_TIMEOUT,
                         ARP_MAX_PKT_TMO        => ARP_MAX_PKT_TMO,
                         ARP_MAX_PKT_TMO        => ARP_MAX_PKT_TMO,
                         MAX_ARP_ENTRIES        => MAX_ARP_ENTRIES
                         MAX_ARP_ENTRIES        => MAX_ARP_ENTRIES
                         )
                         )
                         Port map(
      port map(
                        -- request signals
                        -- request signals
                          arp_req_req                                   => arp_req_req_int,
                          arp_req_req                                   => arp_req_req_int,
                          arp_req_rslt                                  => arp_req_rslt_int,
                          arp_req_rslt                                  => arp_req_rslt_int,
                          -- rx signals
                          -- rx signals
                          data_in_clk                   => rx_clk,
                          data_in_clk                   => rx_clk,
Line 286... Line 291...
                          our_mac_address                               => our_mac_address,
                          our_mac_address                               => our_mac_address,
                          our_ip_address                                => our_ip_address,
                          our_ip_address                                => our_ip_address,
                          control                                               => control.arp_controls,
                          control                                               => control.arp_controls,
                          req_count                                             => arp_pkt_count
                          req_count                                             => arp_pkt_count
                          );
                          );
 
  end generate signle_entry_arp;
 
 
 
  multi_entry_arp: if (use_arpv2) generate
 
    arp_layer : entity work.arpv2
 
      generic map (
 
        no_default_gateway => no_default_gateway,
 
        CLOCK_FREQ      => CLOCK_FREQ,
 
        ARP_TIMEOUT     => ARP_TIMEOUT,
 
        ARP_MAX_PKT_TMO => ARP_MAX_PKT_TMO,
 
        MAX_ARP_ENTRIES => MAX_ARP_ENTRIES
 
        )
 
      port map(
 
        -- request signals
 
        arp_req_req     => arp_req_req_int,
 
        arp_req_rslt    => arp_req_rslt_int,
 
        -- rx signals
 
        data_in_clk     => rx_clk,
 
        reset           => reset,
 
        data_in         => mac_rx_tdata,
 
        data_in_valid   => mac_rx_tvalid,
 
        data_in_last    => mac_rx_tlast,
 
        -- tx signals
 
        mac_tx_req      => arp_mac_req,
 
        mac_tx_granted  => arp_mac_grant,
 
        data_out_clk    => tx_clk,
 
        data_out_ready  => mac_tx_tready,
 
        data_out_valid  => arp_mac_valid,
 
        data_out_first  => arp_mac_first,
 
        data_out_last   => arp_mac_last,
 
        data_out        => arp_mac_data_out,
 
        -- system signals
 
        our_mac_address => our_mac_address,
 
        our_ip_address  => our_ip_address,
 
        control         => control.arp_controls,
 
        req_count       => arp_pkt_count
 
        );
 
  end generate multi_entry_arp;
 
 
   ------------------------------------------------------------------------------
   ------------------------------------------------------------------------------
   -- Instantiate the TX Arbitrator 
   -- Instantiate the TX Arbitrator 
   ------------------------------------------------------------------------------
   ------------------------------------------------------------------------------
        mac_tx_arb : tx_arbitrator
        mac_tx_arb : tx_arbitrator
                 Port map(
    port map(
                                clk                                             => tx_clk,
                                clk                                             => tx_clk,
                                reset                           => reset,
                                reset                           => reset,
 
 
                                req_1                                                   => ip_mac_req,
                                req_1                                                   => ip_mac_req,
                                grant_1                                         => ip_mac_grant,
                                grant_1                                         => ip_mac_grant,

powered by: WebSVN 2.1.0

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