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.communication/] [n2h2/] [1.0/] [vhd/] [n2h2_chan.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : N2H2 Top level
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : n2h2.vhd
6
-- Author     : kulmala3
7
-- Created    : 30.03.2005
8
-- Last update: 2011-04-04
9
-- Description: Wires together rx and tx
10
-------------------------------------------------------------------------------
11
-- Copyright (c) 2005 
12
-------------------------------------------------------------------------------
13
-- Revisions  :
14
-- Date        Version  Author  Description
15
-- 30.03.2005  1.0      AK      Created
16
-------------------------------------------------------------------------------
17
library ieee;
18
use ieee.std_logic_1164.all;
19
--use work.log2_pkg.all;
20
 
21
entity n2h2 is
22
 
23
  generic (
24
    data_width_g       : integer := 32;  -- 32 and 64 supported
25
    addr_width_g       : integer := 32;
26
    amount_width_g     : integer := 16;
27
    n_chans_g          : integer := 8;
28
    n_chans_bits_g     : integer := 3;   -- how many bits to show n_chans
29
    -- eg 2 for 4, 3 for 5, basically log2(n_chans_g)
30
    hibi_addr_cmp_lo_g : integer := 8;
31
    hibi_addr_cmp_hi_g : integer := 31
32
    );
33
 
34
  port (
35
    clk_cfg : in std_logic;             -- not even used...
36
    clk_tx  : in std_logic;
37
    clk_rx  : in std_logic;
38
    rst_n   : in std_logic;             -- THIS IS ACTIVE HIGH!
39
 
40
    -- avalon master (rx) if
41
    avalon_addr_out_rx       : out std_logic_vector(addr_width_g-1 downto 0);
42
    avalon_we_out_rx         : out std_logic;
43
    avalon_be_out_rx         : out std_logic_vector(data_width_g/8-1 downto 0);
44
    avalon_writedata_out_rx  : out std_logic_vector(data_width_g-1 downto 0);
45
    avalon_waitrequest_in_rx : in  std_logic;
46
 
47
    --avalon slave if (config)
48
    avalon_cfg_addr_in         : in  std_logic_vector(n_chans_bits_g+4-1 downto 0);
49
    avalon_cfg_writedata_in    : in  std_logic_vector(addr_width_g-1 downto 0);
50
    avalon_cfg_we_in           : in  std_logic;
51
    avalon_cfg_readdata_out    : out std_logic_vector(addr_width_g-1 downto 0);
52
    avalon_cfg_re_in           : in  std_logic;
53
    avalon_cfg_cs_in           : in  std_logic;
54
    avalon_cfg_waitrequest_out : out std_logic;
55
 
56
    -- Avalon master read interface (tx)
57
    avalon_addr_out_tx         : out std_logic_vector(addr_width_g-1 downto 0);
58
    avalon_re_out_tx           : out std_logic;
59
    avalon_readdata_in_tx      : in  std_logic_vector(data_width_g-1 downto 0);
60
    avalon_waitrequest_in_tx   : in  std_logic;
61
    avalon_readdatavalid_in_tx : in  std_logic;
62
 
63
    -- hibi (rx) if
64
    hibi_data_in  : in  std_logic_vector(data_width_g-1 downto 0);
65
    hibi_av_in    : in  std_logic;
66
    hibi_empty_in : in  std_logic;
67
    hibi_comm_in  : in  std_logic_vector(4 downto 0);
68
    hibi_re_out   : out std_logic;
69
 
70
    -- hibi write interface (tx)
71
    hibi_data_out : out std_logic_vector(data_width_g-1 downto 0);
72
    hibi_av_out   : out std_logic;
73
    hibi_full_in  : in  std_logic;
74
    hibi_comm_out : out std_logic_vector(4 downto 0);
75
    hibi_we_out   : out std_logic;
76
 
77
    rx_irq_out : out std_logic
78
 
79
    );
80
 
81
end n2h2;
82
 
83
architecture structural of n2h2 is
84
 
85
  signal tx_start_from_rx     : std_logic;
86
  signal tx_comm_from_rx      : std_logic_vector(4 downto 0);
87
  signal tx_mem_addr_from_rx  : std_logic_vector(addr_width_g-1 downto 0);
88
  signal tx_hibi_addr_from_rx : std_logic_vector(addr_width_g-1 downto 0);
89
  signal tx_amount_from_rx    : std_logic_vector(amount_width_g-1 downto 0);
90
  signal tx_status_done_to_rx : std_logic;
91
  signal real_rst_n           : std_logic;
92
 
93
  component n2h2_rx_channels
94
    generic (
95
      n_chans_g          : integer;
96
      n_chans_bits_g     : integer;
97
      data_width_g       : integer;
98
      addr_width_g       : integer;
99
      hibi_addr_cmp_hi_g : integer;
100
      hibi_addr_cmp_lo_g : integer;
101
      amount_width_g     : integer);
102
    port (
103
      clk                     : in  std_logic;
104
      rst_n                   : in  std_logic;
105
      avalon_addr_out         : out std_logic_vector(addr_width_g-1 downto 0);
106
      avalon_we_out           : out std_logic;
107
      avalon_be_out           : out std_logic_vector(data_width_g/8-1 downto 0);
108
      avalon_writedata_out    : out std_logic_vector(data_width_g-1 downto 0);
109
      avalon_waitrequest_in   : in  std_logic;
110
      hibi_data_in            : in  std_logic_vector(data_width_g-1 downto 0);
111
      hibi_av_in              : in  std_logic;
112
      hibi_empty_in           : in  std_logic;
113
      hibi_comm_in            : in  std_logic_vector(4 downto 0);
114
      hibi_re_out             : out std_logic;
115
      avalon_cfg_addr_in      : in  std_logic_vector(n_chans_bits_g+4-1 downto 0);
116
      avalon_cfg_writedata_in : in  std_logic_vector(addr_width_g-1 downto 0);
117
      avalon_cfg_we_in        : in  std_logic;
118
      avalon_cfg_readdata_out : out std_logic_vector(addr_width_g-1 downto 0);
119
      avalon_cfg_re_in        : in  std_logic;
120
      avalon_cfg_cs_in        : in  std_logic;
121
      avalon_cfg_waitrequest_out : out std_logic;
122
      rx_irq_out              : out std_logic;
123
      tx_start_out            : out std_logic;
124
      tx_comm_out             : out std_logic_vector(4 downto 0);
125
      tx_mem_addr_out         : out std_logic_vector(addr_width_g-1 downto 0);
126
      tx_hibi_addr_out        : out std_logic_vector(addr_width_g-1 downto 0);
127
      tx_amount_out           : out std_logic_vector(amount_width_g-1 downto 0);
128
      tx_status_done_in       : in  std_logic);
129
  end component;
130
 
131
  component n2h2_tx
132
    generic (
133
      data_width_g   : integer;
134
      addr_width_g   : integer;
135
      amount_width_g : integer);
136
    port (
137
      clk                     : in  std_logic;
138
      rst_n                   : in  std_logic;
139
      avalon_addr_out         : out std_logic_vector(addr_width_g-1 downto 0);
140
      avalon_re_out           : out std_logic;
141
      avalon_readdata_in      : in  std_logic_vector(data_width_g-1 downto 0);
142
      avalon_waitrequest_in   : in  std_logic;
143
      avalon_readdatavalid_in : in  std_logic;
144
 
145
      hibi_data_out      : out std_logic_vector(data_width_g-1 downto 0);
146
      hibi_av_out        : out std_logic;
147
      hibi_full_in       : in  std_logic;
148
      hibi_comm_out      : out std_logic_vector(4 downto 0);
149
      hibi_we_out        : out std_logic;
150
      tx_start_in        : in  std_logic;
151
      tx_status_done_out : out std_logic;
152
      tx_comm_in         : in  std_logic_vector(4 downto 0);
153
      tx_hibi_addr_in    : in  std_logic_vector(addr_width_g-1 downto 0);
154
      tx_ram_addr_in     : in  std_logic_vector(addr_width_g-1 downto 0);
155
      tx_amount_in       : in  std_logic_vector(amount_width_g-1 downto 0));
156
  end component;
157
 
158
 
159
begin  -- structural
160
 
161
 
162
 
163
  real_rst_n <= rst_n;
164
 
165
  assert data_width_g = 64 or data_width_g = 32 report "Data width other than 32 or 64 not currently supported" severity failure;
166
 
167
   n2h2_rx_chan_1 : n2h2_rx_channels
168
    generic map (
169
      n_chans_g          => n_chans_g,
170
      n_chans_bits_g     => n_chans_bits_g,
171
      data_width_g       => data_width_g,
172
      addr_width_g       => addr_width_g,
173
      hibi_addr_cmp_hi_g => hibi_addr_cmp_hi_g,
174
      hibi_addr_cmp_lo_g => hibi_addr_cmp_lo_g,
175
      amount_width_g     => amount_width_g
176
      )
177
    port map (
178
      clk                     => clk_rx,
179
      rst_n                   => real_rst_n,
180
      avalon_addr_out         => avalon_addr_out_rx,
181
      avalon_we_out           => avalon_we_out_rx,
182
      avalon_be_out           => avalon_be_out_rx,
183
      avalon_writedata_out    => avalon_writedata_out_rx,
184
      avalon_waitrequest_in   => avalon_waitrequest_in_rx,
185
      hibi_data_in            => hibi_data_in,
186
      hibi_av_in              => hibi_av_in,
187
      hibi_empty_in           => hibi_empty_in,
188
      hibi_comm_in            => hibi_comm_in,
189
      hibi_re_out             => hibi_re_out,
190
      avalon_cfg_addr_in      => avalon_cfg_addr_in,
191
      avalon_cfg_writedata_in => avalon_cfg_writedata_in,
192
      avalon_cfg_we_in        => avalon_cfg_we_in,
193
      avalon_cfg_readdata_out => avalon_cfg_readdata_out,
194
      avalon_cfg_re_in        => avalon_cfg_re_in,
195
      avalon_cfg_cs_in        => avalon_cfg_cs_in,
196
      avalon_cfg_waitrequest_out => avalon_cfg_waitrequest_out,
197
      rx_irq_out              => rx_irq_out,
198
      tx_start_out            => tx_start_from_rx,
199
      tx_comm_out             => tx_comm_from_rx,
200
      tx_mem_addr_out         => tx_mem_addr_from_rx,
201
      tx_hibi_addr_out        => tx_hibi_addr_from_rx,
202
      tx_amount_out           => tx_amount_from_rx,
203
      tx_status_done_in       => tx_status_done_to_rx
204
      );
205
 
206
  n2h2_tx_1 : n2h2_tx
207
    generic map (
208
      data_width_g   => data_width_g,
209
      addr_width_g   => addr_width_g,
210
      amount_width_g => amount_width_g)
211
    port map (
212
      clk                     => clk_tx,
213
      rst_n                   => real_rst_n,
214
      avalon_addr_out         => avalon_addr_out_tx,
215
      avalon_re_out           => avalon_re_out_tx,
216
      avalon_readdata_in      => avalon_readdata_in_tx,
217
      avalon_waitrequest_in   => avalon_waitrequest_in_tx,
218
      avalon_readdatavalid_in => avalon_readdatavalid_in_tx,
219
      hibi_data_out           => hibi_data_out,
220
      hibi_av_out             => hibi_av_out,
221
      hibi_full_in            => hibi_full_in,
222
      hibi_comm_out           => hibi_comm_out,
223
      hibi_we_out             => hibi_we_out,
224
      tx_start_in             => tx_start_from_rx,
225
      tx_status_done_out      => tx_status_done_to_rx,
226
      tx_hibi_addr_in         => tx_hibi_addr_from_rx,
227
      tx_comm_in              => tx_comm_from_rx,
228
      tx_ram_addr_in          => tx_mem_addr_from_rx,
229
      tx_amount_in            => tx_amount_from_rx
230
      );
231
 
232
end structural;

powered by: WebSVN 2.1.0

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