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/] [eth_dm9000a_ctrl/] [1.0/] [vhd/] [DM9kA_controller.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : DM9kA controller
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : DM9kA_controller.vhd
6
-- Author     : Jussi Nieminen
7
-- Company    : TUT
8
-- Last update: 2012-04-04
9
-- Platform   : 
10
-------------------------------------------------------------------------------
11
-- Description: Top level of controller unit. Used withDM9000A Ethernet PHY chip,
12
-- which is used e.g. in Altera/Terasic DE2 FPGA board.
13
-- Contains 4 or 5 sub-modules (rx can be disabled=nonexisting).
14
-------------------------------------------------------------------------------
15
-- Revisions  :
16
-- Date        Version  Author  Description
17
-- 2009/08/24  1.0      niemin95        Created
18
-------------------------------------------------------------------------------
19
 
20
library ieee;
21
use ieee.std_logic_1164.all;
22
use work.DM9kA_ctrl_pkg.all;
23
 
24
entity DM9kA_controller is
25
  generic (
26
    disable_rx_g : integer := 0
27
    );
28
 
29
  port (
30
    clk               : in    std_logic;
31
    rst_n             : in    std_logic;
32
    eth_clk_out       : out   std_logic;
33
    eth_reset_out     : out   std_logic;
34
    eth_cmd_out       : out   std_logic;
35
    eth_write_out     : out   std_logic;
36
    eth_read_out      : out   std_logic;
37
    eth_interrupt_in  : in    std_logic;
38
    eth_data_inout    : inout std_logic_vector(data_width_c-1 downto 0);
39
    eth_chip_sel_out  : out   std_logic;  -- active low
40
 
41
    tx_data_in        : in    std_logic_vector(data_width_c-1 downto 0);
42
    tx_data_valid_in  : in    std_logic;
43
    tx_re_out         : out   std_logic;
44
    rx_re_in          : in    std_logic;
45
    rx_data_out       : out   std_logic_vector(data_width_c-1 downto 0);
46
    rx_data_valid_out : out   std_logic;
47
    target_MAC_in     : in    std_logic_vector(47 downto 0);
48
    new_tx_in         : in    std_logic;
49
    tx_len_in         : in    std_logic_vector(tx_len_w_c-1 downto 0);
50
    tx_frame_type_in  : in    std_logic_vector(15 downto 0);
51
    new_rx_out        : out   std_logic;
52
 
53
    rx_len_out        : out   std_logic_vector(tx_len_w_c-1 downto 0);
54
    rx_frame_type_out : out   std_logic_vector(15 downto 0);
55
    rx_erroneous_out  : out   std_logic;
56
    ready_out         : out   std_logic;
57
    fatal_error_out   : out   std_logic
58
    );
59
 
60
end DM9kA_controller;
61
 
62
 
63
architecture structural of DM9kA_controller is
64
 
65
  signal register_addrs     : std_logic_vector((submodules_c+1) * 8 - 1 downto 0);
66
  signal config_datas       : std_logic_vector((submodules_c+1) * 8 - 1 downto 0);
67
  signal read_not_writes    : std_logic_vector(submodules_c downto 0);
68
  signal configs_valid      : std_logic_vector(submodules_c downto 0);
69
  signal data_to_submodules : std_logic_vector(data_width_c-1 downto 0);
70
  signal data_to_sb_valid   : std_logic;
71
  signal busy_to_submodules : std_logic;
72
 
73
  signal comm_reqs   : std_logic_vector(submodules_c-1 downto 0);
74
  signal comm_grants : std_logic_vector(submodules_c-1 downto 0);
75
 
76
  signal init_ready      : std_logic;
77
  signal init_sleep_time : std_logic_vector(sleep_time_w_c-1 downto 0);
78
  signal interrupt       : std_logic;
79
 
80
  signal tx_data_send_comm       : std_logic_vector(data_width_c-1 downto 0);
81
  signal tx_data_valid_send_comm : std_logic;
82
  signal tx_re_comm_send         : std_logic;
83
 
84
  signal rx_data_comm_read       : std_logic_vector(data_width_c-1 downto 0);
85
  signal rx_data_valid_comm_read : std_logic;
86
  signal rx_re_read_comm         : std_logic;
87
  signal tx_ready_int_send       : std_logic;
88
  signal rx_waiting_int_read     : std_logic;
89
 
90
 
91
-------------------------------------------------------------------------------
92
begin  -- structural
93
-------------------------------------------------------------------------------
94
 
95
--  debug_out(15 downto 13) <= comm_reqs;
96
--  debug_out(12 downto 10) <= comm_grants;
97
 
98
 
99
  --
100
  -- Structure
101
  --
102
  --         DM9000A chip
103
  --             ^ |
104
  --             | V
105
  --
106
  --    init -> comm  <---> interrupt handler
107
  --            ^  |
108
  --            |  V
109
  --         send  read
110
  --          ^      |
111
  --          |      V
112
  --
113
  --         "application"
114
 
115
 
116
 
117
  comm_module : entity work.DM9kA_comm_module
118
    port map (
119
      clk                    => clk,
120
      rst_n                  => rst_n,
121
      comm_requests_in       => comm_reqs,
122
      comm_grants_out        => comm_grants,
123
      interrupt_out          => interrupt,
124
 
125
      -- send -> comm
126
      tx_data_in             => tx_data_send_comm,
127
      tx_data_valid_in       => tx_data_valid_send_comm,
128
      tx_re_out              => tx_re_comm_send,
129
 
130
      -- comm -> rx
131
      rx_data_out            => rx_data_comm_read,
132
      rx_data_valid_out      => rx_data_valid_comm_read,
133
      rx_re_in               => rx_re_read_comm,
134
 
135
      -- init ->
136
      init_ready_in          => init_ready,
137
      init_sleep_time_in     => init_sleep_time,
138
 
139
      -- to/from other sub-modules
140
      register_addrs_in      => register_addrs,
141
      config_datas_in        => config_datas,
142
      read_not_write_in      => read_not_writes,
143
      configs_valid_in       => configs_valid,
144
      data_to_submodules_out => data_to_submodules,
145
      data_to_sb_valid_out   => data_to_sb_valid,
146
      busy_to_submodules_out => busy_to_submodules,
147
 
148
      -- to eth chip
149
      eth_data_inout         => eth_data_inout,
150
      eth_clk_out            => eth_clk_out,
151
      eth_cmd_out            => eth_cmd_out,
152
      eth_chip_sel_out       => eth_chip_sel_out,
153
      eth_interrupt_in       => eth_interrupt_in,
154
      eth_read_out           => eth_read_out,
155
      eth_write_out          => eth_write_out,
156
      eth_reset_out          => eth_reset_out
157
      );
158
 
159
  init_module : entity work.DM9kA_init_module
160
    port map (
161
      clk                     => clk,
162
      rst_n                   => rst_n,
163
      ready_out               => init_ready,
164
      sleep_time_out          => init_sleep_time,
165
      reg_addr_out            => register_addrs((submodules_c+1)*8 - 1 downto submodules_c*8),
166
      config_data_out         => config_datas((submodules_c+1)*8 - 1 downto submodules_c*8),
167
      read_not_write_out      => read_not_writes(submodules_c),
168
      config_valid_out        => configs_valid(submodules_c),
169
      data_from_comm_in       => data_to_submodules,
170
      data_from_comm_valid_in => data_to_sb_valid,
171
      comm_busy_in            => busy_to_submodules
172
      );
173
 
174
  ready_out <= init_ready;
175
 
176
 
177
  send_module : entity work.DM9kA_send_module
178
    port map (
179
      clk                     => clk,
180
      rst_n                   => rst_n,
181
      tx_completed_in         => tx_ready_int_send,
182
 
183
      -- To/from comm module
184
      reg_addr_out            => register_addrs(3*8-1 downto 2*8),
185
      config_data_out         => config_datas(3*8-1 downto 2*8),
186
      read_not_write_out      => read_not_writes(2),
187
      config_valid_out        => configs_valid(2),
188
      data_from_comm_in       => data_to_submodules,
189
      data_from_comm_valid_in => data_to_sb_valid,
190
      comm_busy_in            => busy_to_submodules,
191
 
192
      comm_req_out            => comm_reqs(2),
193
      comm_grant_in           => comm_grants(2),
194
      tx_data_out             => tx_data_send_comm,
195
      tx_data_valid_out       => tx_data_valid_send_comm,
196
      tx_re_in                => tx_re_comm_send,
197
 
198
      -- From application
199
      tx_data_in              => tx_data_in,
200
      tx_data_valid_in        => tx_data_valid_in,
201
      tx_re_out               => tx_re_out,
202
      tx_MAC_addr_in          => target_MAC_in,
203
      new_tx_in               => new_tx_in,
204
      tx_len_in               => tx_len_in,
205
      tx_frame_type_in        => tx_frame_type_in
206
      );
207
 
208
  int_handler_module : entity work.DM9kA_interrupt_handler
209
    port map (
210
      clk                     => clk,
211
      rst_n                   => rst_n,
212
      interrupt_in            => eth_interrupt_in,
213
      comm_req_out            => comm_reqs(0),
214
      comm_grant_in           => comm_grants(0),
215
 
216
      -- Interrupt reasons
217
      rx_waiting_out          => rx_waiting_int_read,
218
      tx_ready_out            => tx_ready_int_send,
219
 
220
      reg_addr_out            => register_addrs(7 downto 0),
221
      config_data_out         => config_datas(7 downto 0),
222
      read_not_write_out      => read_not_writes(0),
223
      config_valid_out        => configs_valid(0),
224
      data_from_comm_in       => data_to_submodules,
225
      data_from_comm_valid_in => data_to_sb_valid,
226
      comm_busy_in            => busy_to_submodules
227
      );
228
 
229
  enable_rx : if disable_rx_g = 0 generate
230
    read_module : entity work.DM9kA_read_module
231
      port map (
232
        clk                     => clk,
233
        rst_n                   => rst_n,
234
        rx_waiting_in           => rx_waiting_int_read,
235
        rx_data_in              => rx_data_comm_read,
236
        rx_data_valid_in        => rx_data_valid_comm_read,
237
        rx_re_out               => rx_re_read_comm,
238
        reg_addr_out            => register_addrs(2*8-1 downto 8),
239
        config_data_out         => config_datas(2*8-1 downto 8),
240
        read_not_write_out      => read_not_writes(1),
241
        config_valid_out        => configs_valid(1),
242
        data_from_comm_in       => data_to_submodules,
243
        data_from_comm_valid_in => data_to_sb_valid,
244
        comm_busy_in            => busy_to_submodules,
245
        comm_req_out            => comm_reqs(1),
246
        comm_grant_in           => comm_grants(1),
247
        rx_data_out             => rx_data_out,
248
        rx_data_valid_out       => rx_data_valid_out,
249
        rx_re_in                => rx_re_in,
250
        new_rx_out              => new_rx_out,
251
        rx_len_out              => rx_len_out,
252
        frame_type_out          => rx_frame_type_out,
253
        rx_erroneous_out        => rx_erroneous_out,
254
        fatal_error_out         => fatal_error_out
255
        );
256
  end generate enable_rx;
257
 
258
  disable_rx : if disable_rx_g = 1 generate
259
    comm_reqs(1) <= '0';
260
  end generate disable_rx;
261
 
262
end structural;

powered by: WebSVN 2.1.0

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