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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.hwp.interface/] [udp_ip/] [1.0/] [vhd/] [udp_ip_lan91c111.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : UDP/IP and LAN91C111 Controller
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : udp_ip_lan91c111.vhd
6
-- Author     :   <alhonena@AHVEN>
7
-- Company    : 
8
-- Created    : 2011-09-19
9
-- Last update: 2011-11-07
10
-- Platform   : 
11
-- Standard   : VHDL'87
12
-------------------------------------------------------------------------------
13
-- Description: Direct interface for TX and RX operations on UDP/IP protocol
14
-- level with external LAN91C111 chip (e.g. Altera Stratix II S180 dev board)
15
-- This toplevel uses a 16-bit mode of LAN91C111 controller!
16
-------------------------------------------------------------------------------
17
-- Copyright (c) 2011 
18
-------------------------------------------------------------------------------
19
-- Revisions  :
20
-- Date        Version  Author  Description
21
-- 2011-09-19  1.0      alhonena        Created
22
-------------------------------------------------------------------------------
23
 
24
library ieee;
25
use ieee.std_logic_1164.all;
26
 
27
entity udp_ip_lan91c111 is
28
 
29
  generic (
30
    disable_rx_g  : integer := 0;
31
    disable_arp_g : integer := 0);      -- If you disable ARP, you must provide
32
                                        -- target MAC address (no_arp_target_MAC_in)
33
                                        -- with target IP address (target_addr_in)
34
 
35
  port (
36
    clk               : in  std_logic;  -- 25 MHz clock to ensure proper timing. LAN91C111 is used asynchronously.
37
    rst_n             : in  std_logic;
38
 
39
    -- to/from application
40
 
41
    -- TX
42
    new_tx_in         : in  std_logic;
43
    tx_len_in         : in  std_logic_vector( 10 downto 0 );
44
    target_addr_in    : in  std_logic_vector( 31 downto 0 );
45
    -- Use this with target_addr_in when disable_arp_g = 1:
46
    no_arp_target_MAC_in     : in  std_logic_vector( 47 downto 0 ) := (others => '0');
47
    target_port_in    : in  std_logic_vector( 15 downto 0 );
48
    source_port_in    : in  std_logic_vector( 15 downto 0 );
49
    tx_data_in        : in  std_logic_vector( 15 downto 0 );
50
    tx_data_valid_in  : in  std_logic;
51
    tx_re_out         : out std_logic;
52
 
53
    -- RX
54
    new_rx_out        : out std_logic;
55
    rx_data_valid_out : out std_logic;
56
    rx_data_out       : out std_logic_vector( 15 downto 0 );
57
    rx_re_in          : in  std_logic;
58
    rx_erroneous_out  : out std_logic;
59
    source_addr_out   : out std_logic_vector( 31 downto 0 );
60
    source_port_out   : out std_logic_vector( 15 downto 0 );
61
    dest_port_out     : out std_logic_vector( 15 downto 0 );
62
    rx_len_out        : out std_logic_vector( 10 downto 0 );
63
    rx_error_out      : out std_logic;   -- this means system error, not error
64
                                        -- in data caused by network etc.
65
    -- Status:
66
    link_up_out       : out std_logic;
67
    fatal_error_out   : out std_logic;  -- Something wrong with LAN91C111.
68
 
69
    -- To the external ethernet chip (SMSC LAN91C111)
70
    eth_data_inout    : inout std_logic_vector( 31 downto 0 );
71
    eth_addr_out      : out   std_logic_vector( 14 downto 0 );  -- note that they start indexing from 1! A1 on the datasheet goes to eth_addr_out(0).
72
    eth_interrupt_in  : in    std_logic;
73
    eth_read_out      : out   std_logic;
74
    eth_write_out     : out   std_logic;
75
    eth_nADS_out      : out   std_logic;
76
    eth_nAEN_out      : out   std_logic;
77
    eth_nBE_out       : out   std_logic_vector(3 downto 0)
78
 
79
    );
80
 
81
end udp_ip_lan91c111;
82
 
83
architecture structural of udp_ip_lan91c111 is
84
 
85
  signal tx_data       : std_logic_vector(15 downto 0);
86
  signal tx_data_valid : std_logic;
87
  signal tx_re         : std_logic;
88
  signal rx_re         : std_logic;
89
  signal rx_data       : std_logic_vector(15 downto 0);
90
  signal rx_data_valid : std_logic;
91
  signal target_MAC    : std_logic_vector(47 downto 0);
92
  signal new_tx        : std_logic;
93
  signal tx_len        : std_logic_vector(10 downto 0);
94
  signal tx_frame_type : std_logic_vector(15 downto 0);
95
  signal new_rx        : std_logic;
96
  signal rx_len        : std_logic_vector(10 downto 0);
97
  signal rx_frame_type : std_logic_vector(15 downto 0);
98
  signal rx_erroneous  : std_logic;
99
 
100
begin  -- structural
101
 
102
  assert not (disable_rx_g = 1 and disable_arp_g = 0) report "RX must be enabled if ARP is enabled" severity failure;
103
  assert disable_rx_g = 0 or disable_rx_g = 1 report "illegal value of disable_rx_g" severity failure;
104
  assert disable_arp_g = 0 or disable_arp_g = 1 report "illegal value of disable_arp_g" severity failure;
105
 
106
rx_disable: if disable_rx_g = 1 generate
107
  lan91c111_controller_1: entity work.lan91c111_controller
108
    generic map (
109
      enable_rx_g => '0',
110
      interface_width_g => 16)
111
    port map (
112
      clk               => clk,
113
      rst_n             => rst_n,
114
      eth_data_inout    => eth_data_inout,
115
      eth_addr_out      => eth_addr_out,
116
      eth_interrupt_in  => eth_interrupt_in,
117
      eth_read_out      => eth_read_out,
118
      eth_write_out     => eth_write_out,
119
      eth_nADS_out      => eth_nADS_out,
120
      eth_nAEN_out      => eth_nAEN_out,
121
      eth_nBE_out       => eth_nBE_out,
122
      tx_data_in        => tx_data,
123
      tx_data_valid_in  => tx_data_valid,
124
      tx_re_out         => tx_re,
125
      rx_re_in          => rx_re,
126
      rx_data_out       => rx_data,
127
      rx_data_valid_out => rx_data_valid,
128
      target_MAC_in     => target_MAC,
129
      new_tx_in         => new_tx,
130
      tx_len_in         => tx_len,
131
      tx_frame_type_in  => tx_frame_type,
132
      new_rx_out        => new_rx,
133
      rx_len_out        => rx_len,
134
      rx_frame_type_out => rx_frame_type,
135
      rx_erroneous_out  => rx_erroneous,
136
      ready_out         => link_up_out,
137
      fatal_error_out   => fatal_error_out);
138
 
139
end generate rx_disable;
140
 
141
rx_enable: if disable_rx_g = 0 generate
142
  lan91c111_controller_1: entity work.lan91c111_controller
143
    generic map (
144
      enable_rx_g => '1',
145
      interface_width_g => 16)
146
    port map (
147
      clk               => clk,
148
      rst_n             => rst_n,
149
      eth_data_inout    => eth_data_inout,
150
      eth_addr_out      => eth_addr_out,
151
      eth_interrupt_in  => eth_interrupt_in,
152
      eth_read_out      => eth_read_out,
153
      eth_write_out     => eth_write_out,
154
      eth_nADS_out      => eth_nADS_out,
155
      eth_nAEN_out      => eth_nAEN_out,
156
      eth_nBE_out       => eth_nBE_out,
157
      tx_data_in        => tx_data,
158
      tx_data_valid_in  => tx_data_valid,
159
      tx_re_out         => tx_re,
160
      rx_re_in          => rx_re,
161
      rx_data_out       => rx_data,
162
      rx_data_valid_out => rx_data_valid,
163
      target_MAC_in     => target_MAC,
164
      new_tx_in         => new_tx,
165
      tx_len_in         => tx_len,
166
      tx_frame_type_in  => tx_frame_type,
167
      new_rx_out        => new_rx,
168
      rx_len_out        => rx_len,
169
      rx_frame_type_out => rx_frame_type,
170
      rx_erroneous_out  => rx_erroneous,
171
      ready_out         => link_up_out,
172
      fatal_error_out   => fatal_error_out);
173
 
174
end generate rx_enable;
175
 
176
 
177
  udp_ip_1: entity work.udp_ip
178
    generic map (
179
      disable_rx_g  => disable_rx_g,
180
      disable_arp_g => disable_arp_g)
181
    port map (
182
      clk                  => clk,
183
      rst_n                => rst_n,
184
      new_tx_in            => new_tx_in,
185
      tx_len_in            => tx_len_in,
186
      target_addr_in       => target_addr_in,
187
      target_port_in       => target_port_in,
188
      source_port_in       => source_port_in,
189
      tx_data_in           => tx_data_in,
190
      tx_data_valid_in     => tx_data_valid_in,
191
      tx_re_out            => tx_re_out,
192
      new_rx_out           => new_rx_out,
193
      rx_data_valid_out    => rx_data_valid_out,
194
      rx_data_out          => rx_data_out,
195
      rx_re_in             => rx_re_in,
196
      rx_erroneous_out     => rx_erroneous_out,
197
      source_addr_out      => source_addr_out,
198
      source_port_out      => source_port_out,
199
      dest_port_out        => dest_port_out,
200
      rx_len_out           => rx_len_out,
201
      no_arp_target_MAC_in => no_arp_target_MAC_in,
202
      tx_data_out          => tx_data,
203
      tx_data_valid_out    => tx_data_valid,
204
      tx_re_in             => tx_re,
205
      target_MAC_out       => target_MAC,
206
      new_tx_out           => new_tx,
207
      tx_len_out           => tx_len,
208
      tx_frame_type_out    => tx_frame_type,
209
      rx_data_in           => rx_data,
210
      rx_data_valid_in     => rx_data_valid,
211
      rx_re_out            => rx_re,
212
      new_rx_in            => new_rx,
213
      rx_len_in            => rx_len,
214
      rx_frame_type_in     => rx_frame_type,
215
      rx_erroneous_in      => rx_erroneous,
216
      rx_error_out         => rx_error_out);
217
 
218
end structural;

powered by: WebSVN 2.1.0

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