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.storage/] [sdram2hibi/] [1.0/] [vhd/] [sdram_toplevel_stratix.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : sdram2hibi and sdram_controller top-level
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : sdram_top.vhd
6
-- Author     : 
7
-- Company    : 
8
-- Created    : 2005-10-13
9
-- Last update: 2012-04-11
10
-- Platform   : 
11
-- Standard   : VHDL'87
12
-------------------------------------------------------------------------------
13
-- Description:
14
-- 
15
-------------------------------------------------------------------------------
16
-- Copyright (c) 2005 
17
-------------------------------------------------------------------------------
18
-- Revisions  :
19
-- Date        Version  Author  Description
20
-- 2005-10-13  1.0      penttin5        Created
21
-- 2012-01-22  1.001    alhonen fixed names.  hibiv3.
22
-------------------------------------------------------------------------------
23
 
24
library ieee;
25
use ieee.std_logic_1164.all;
26
use ieee.std_logic_arith.all;
27
use ieee.std_logic_unsigned.all;
28
 
29
entity sdram_toplevel is
30
 
31
  generic (
32
    own_hibi_base_addr_g : integer := 0;
33
    hibi_data_width_g    : integer := 32;
34
    mem_data_width_g     : integer := 32;
35
    mem_addr_width_g     : integer := 22;
36
    comm_width_g         : integer := 5;
37
    input_fifo_depth_g   : integer := 10;
38
    num_of_read_ports_g  : integer := 4;
39
    num_of_write_ports_g : integer := 4;
40
    offset_width_g       : integer := 16;
41
    rq_fifo_depth_g      : integer := 3;
42
    op_arb_type_g        : integer := 0;  -- 1=fixed prior
43
    port_arb_type_g      : integer := 0;
44
    blk_rd_prior_g       : integer := 0;  -- rd has the highest prior
45
    blk_wr_prior_g       : integer := 1;
46
    single_op_prior_g    : integer := 2;
47
    block_overlap_g      : integer := 0;
48
    clk_freq_mhz_g       : integer := 50;  -- clock frequency in MHz
49
    block_read_length_g  : integer := 30
50
    );
51
 
52
  port (
53
    clk           : in  std_logic;
54
    rst_n         : in  std_logic;
55
    hibi_addr_in  : in  std_logic_vector(hibi_data_width_g - 1 downto 0);
56
    hibi_data_in  : in  std_logic_vector(hibi_data_width_g - 1 downto 0);
57
    hibi_comm_in  : in  std_logic_vector(comm_width_g - 1 downto 0);
58
    hibi_empty_in : in  std_logic;
59
    hibi_re_out   : out std_logic;
60
 
61
    hibi_addr_out : out std_logic_vector(hibi_data_width_g - 1 downto 0);
62
    hibi_data_out : out std_logic_vector(hibi_data_width_g - 1 downto 0);
63
    hibi_comm_out : out std_logic_vector(comm_width_g - 1 downto 0);
64
    hibi_full_in  : in  std_logic;
65
    hibi_we_out   : out std_logic;      -- this is asynchronous
66
 
67
    hibi_msg_addr_in  : in  std_logic_vector(hibi_data_width_g - 1 downto 0);
68
    hibi_msg_data_in  : in  std_logic_vector(hibi_data_width_g - 1 downto 0);
69
    hibi_msg_comm_in  : in  std_logic_vector(comm_width_g - 1 downto 0);
70
    hibi_msg_empty_in : in  std_logic;
71
    hibi_msg_re_out   : out std_logic;
72
 
73
    hibi_msg_data_out : out std_logic_vector(hibi_data_width_g - 1 downto 0);
74
    hibi_msg_addr_out : out std_logic_vector(hibi_data_width_g - 1 downto 0);
75
    hibi_msg_comm_out : out std_logic_vector(comm_width_g - 1 downto 0);
76
    hibi_msg_full_in  : in  std_logic;
77
    hibi_msg_we_out   : out std_logic;
78
 
79
    sdram_data_inout  : inout std_logic_vector(31 downto 0);
80
    sdram_cke_out     : out   std_logic;
81
    sdram_cs_n_out    : out   std_logic;
82
    sdram_we_n_out    : out   std_logic;
83
    sdram_ras_n_out   : out   std_logic;
84
    sdram_cas_n_out   : out   std_logic;
85
    sdram_dqm_out     : out   std_logic_vector(3 downto 0);
86
    sdram_ba_out      : out   std_logic_vector(1 downto 0);
87
    sdram_address_out : out   std_logic_vector(11 downto 0)
88
    );
89
 
90
end sdram_toplevel;
91
 
92
architecture structural of sdram_toplevel is
93
 
94
  component sdram2hibi
95
    generic (
96
    own_hibi_base_addr_g : integer := 0;
97
    hibi_data_width_g    : integer := 32;
98
    mem_data_width_g     : integer := 32;
99
    mem_addr_width_g     : integer := 22;
100
    comm_width_g         : integer := 3;
101
    input_fifo_depth_g   : integer := 5;
102
    num_of_read_ports_g  : integer := 4;
103
    num_of_write_ports_g : integer := 4;
104
    offset_width_g       : integer := 16;
105
    rq_fifo_depth_g      : integer := 3;
106
    op_arb_type_g        : integer := 1;  -- fixed prior
107
    port_arb_type_g      : integer := 0;
108
    blk_rd_prior_g       : integer := 0;  -- rd has the highest prior
109
    blk_wr_prior_g       : integer := 1;
110
    single_op_prior_g    : integer := 2;
111
    block_overlap_g      : integer := 0
112
      );
113
 
114
    port (
115
      clk   : in std_logic;
116
      rst_n : in std_logic;
117
 
118
      hibi_addr_in  : in  std_logic_vector(hibi_data_width_g - 1 downto 0);
119
      hibi_data_in  : in  std_logic_vector(hibi_data_width_g - 1 downto 0);
120
      hibi_comm_in  : in  std_logic_vector(comm_width_g - 1 downto 0);
121
      hibi_empty_in : in  std_logic;
122
      hibi_re_out   : out std_logic;
123
 
124
      hibi_addr_out : out std_logic_vector(hibi_data_width_g - 1 downto 0);
125
      hibi_data_out : out std_logic_vector(hibi_data_width_g - 1 downto 0);
126
      hibi_comm_out : out std_logic_vector(comm_width_g - 1 downto 0);
127
      hibi_full_in  : in  std_logic;
128
      hibi_we_out   : out std_logic;    -- this is asynchronic
129
 
130
      hibi_msg_addr_in  : in  std_logic_vector(hibi_data_width_g - 1
131
                                               downto 0);
132
      hibi_msg_data_in  : in  std_logic_vector(hibi_data_width_g - 1
133
                                               downto 0);
134
      hibi_msg_comm_in  : in  std_logic_vector(comm_width_g - 1 downto 0);
135
      hibi_msg_empty_in : in  std_logic;
136
      hibi_msg_re_out   : out std_logic;
137
 
138
      hibi_msg_data_out : out std_logic_vector(hibi_data_width_g - 1
139
                                               downto 0);
140
      hibi_msg_addr_out : out std_logic_vector(hibi_data_width_g - 1
141
                                               downto 0);
142
      hibi_msg_comm_out : out std_logic_vector(comm_width_g - 1 downto 0);
143
      hibi_msg_full_in  : in  std_logic;
144
      hibi_msg_we_out   : out std_logic;
145
 
146
      sdram_ctrl_write_on_in     : in  std_logic;
147
      sdram_ctrl_comm_out        : out std_logic_vector(1 downto 0);
148
      sdram_ctrl_addr_out        : out std_logic_vector(21 downto 0);
149
      sdram_ctrl_data_amount_out : out std_logic_vector(mem_addr_width_g - 1
150
                                                        downto 0);
151
      sdram_ctrl_input_one_d_out : out std_logic;
152
      sdram_ctrl_input_empty_out : out std_logic;
153
      sdram_ctrl_output_full_out : out std_logic;
154
      sdram_ctrl_busy_in         : in  std_logic;
155
      sdram_ctrl_re_in           : in  std_logic;
156
      sdram_ctrl_we_in           : in  std_logic;
157
 
158
      -- this is asynchronic but it is read to register in sdram_controller
159
      sdram_ctrl_data_out        : out std_logic_vector(31 downto 0);
160
      sdram_ctrl_data_in         : in  std_logic_vector(31 downto 0);
161
      -- byte select is not implemented!!!
162
      sdram_ctrl_byte_select_out : out std_logic_vector(3 downto 0)
163
      );
164
 
165
  end component;
166
 
167
  component sdram_controller
168
    generic (
169
      clk_freq_mhz_g      : integer := 143;  -- clock frequency in MHz
170
      mem_addr_width_g    : integer := 22;
171
      block_read_length_g : integer := 10
172
      );
173
 
174
    port (
175
      clk   : in std_logic;
176
      rst_n : in std_logic;
177
 
178
      command_in             : in    std_logic_vector(1 downto 0);
179
      address_in             : in    std_logic_vector(21 downto 0);
180
      data_amount_in         : in    std_logic_vector(mem_addr_width_g - 1
181
                                                      downto 0);
182
      byte_select_in         : in    std_logic_vector(3 downto 0);
183
      input_empty_in         : in    std_logic;
184
      input_one_d_in         : in    std_logic;
185
      output_full_in         : in    std_logic;
186
      data_in                : in    std_logic_vector(31 downto 0);
187
      write_on_out           : out   std_logic;
188
      busy_out               : out   std_logic;
189
      output_we_out          : out   std_logic;  -- this is asynchronous
190
      input_re_out           : out   std_logic;
191
      data_out               : out   std_logic_vector(31 downto 0);
192
      sdram_data_inout       : inout std_logic_vector(31 downto 0);
193
      sdram_cke_out          : out   std_logic;
194
      sdram_cs_n_out         : out   std_logic;
195
      sdram_we_n_out         : out   std_logic;
196
      sdram_ras_n_out        : out   std_logic;
197
      sdram_cas_n_out        : out   std_logic;
198
      sdram_dqm_out          : out   std_logic_vector(3 downto 0);
199
      sdram_ba_out           : out   std_logic_vector(1 downto 0);
200
      sdram_address_out      : out   std_logic_vector(11 downto 0)
201
      );
202
  end component;
203
 
204
  signal write_on_ctrl_sdram2hibi : std_logic;
205
  signal comm_sdram2hibi_ctrl : std_logic_vector(1 downto 0);
206
  signal addr_sdram2hibi_ctrl : std_logic_vector(21 downto 0);
207
  signal amount_sdram2hibi_ctrl : std_logic_vector(mem_addr_width_g - 1
208
                                                   downto 0);
209
  signal one_d_sdram2hibi_ctrl       : std_logic;
210
  signal empty_sdram2hibi_ctrl       : std_logic;
211
  signal full_sdram2hibi_ctrl        : std_logic;
212
  signal busy_ctrl_sdram2hibi        : std_logic;
213
  signal re_ctrl_sdram2hibi          : std_logic;
214
  signal we_ctrl_sdram2hibi          : std_logic;
215
  signal data_sdram2hibi_ctrl        : std_logic_vector(31 downto 0);
216
  signal data_ctrl_sdram2hibi        : std_logic_vector(31 downto 0);
217
  signal byte_select_sdram2hibi_ctrl : std_logic_vector(3 downto 0);
218
 
219
begin  -- structural
220
 
221
    -- The sdram2hibi needs to know its own base hibi address.
222
  assert own_hibi_base_addr_g /= 0 report "Please set own_hibi_base_addr_g" severity failure;
223
 
224
  sdram2hibi_1 : sdram2hibi
225
    generic map (
226
      own_hibi_base_addr_g => own_hibi_base_addr_g,
227
      hibi_data_width_g    => hibi_data_width_g,
228
      mem_data_width_g     => mem_data_width_g,
229
      mem_addr_width_g     => mem_addr_width_g,
230
      comm_width_g         => comm_width_g,
231
      input_fifo_depth_g   => input_fifo_depth_g,
232
      num_of_read_ports_g  => num_of_read_ports_g,
233
      num_of_write_ports_g => num_of_write_ports_g,
234
      offset_width_g       => offset_width_g,
235
      rq_fifo_depth_g      => rq_fifo_depth_g,
236
      op_arb_type_g        => op_arb_type_g,
237
      port_arb_type_g      => port_arb_type_g,
238
      blk_rd_prior_g       => blk_rd_prior_g,
239
      blk_wr_prior_g       => blk_wr_prior_g,
240
      single_op_prior_g    => single_op_prior_g,
241
      block_overlap_g      => block_overlap_g
242
      )
243
    port map (
244
      clk           => clk,
245
      rst_n         => rst_n,
246
      hibi_addr_in  => hibi_addr_in,
247
      hibi_data_in  => hibi_data_in,
248
      hibi_comm_in  => hibi_comm_in,
249
      hibi_empty_in => hibi_empty_in,
250
      hibi_re_out   => hibi_re_out,
251
 
252
      hibi_addr_out => hibi_addr_out,
253
      hibi_data_out => hibi_data_out,
254
      hibi_comm_out => hibi_comm_out,
255
      hibi_full_in  => hibi_full_in,
256
      hibi_we_out   => hibi_we_out,
257
 
258
      hibi_msg_addr_in  => hibi_msg_addr_in,
259
      hibi_msg_data_in  => hibi_msg_data_in,
260
      hibi_msg_comm_in  => hibi_msg_comm_in,
261
      hibi_msg_empty_in => hibi_msg_empty_in,
262
      hibi_msg_re_out   => hibi_msg_re_out,
263
 
264
      hibi_msg_data_out => hibi_msg_data_out,
265
      hibi_msg_addr_out => hibi_msg_addr_out,
266
      hibi_msg_comm_out => hibi_msg_comm_out,
267
      hibi_msg_full_in  => hibi_msg_full_in,
268
      hibi_msg_we_out   => hibi_msg_we_out,
269
 
270
      sdram_ctrl_write_on_in     => write_on_ctrl_sdram2hibi,
271
      sdram_ctrl_comm_out        => comm_sdram2hibi_ctrl,
272
      sdram_ctrl_addr_out        => addr_sdram2hibi_ctrl,
273
      sdram_ctrl_data_amount_out => amount_sdram2hibi_ctrl,
274
      sdram_ctrl_input_one_d_out => one_d_sdram2hibi_ctrl,
275
      sdram_ctrl_input_empty_out => empty_sdram2hibi_ctrl,
276
      sdram_ctrl_output_full_out => full_sdram2hibi_ctrl,
277
      sdram_ctrl_busy_in         => busy_ctrl_sdram2hibi,
278
      sdram_ctrl_re_in           => re_ctrl_sdram2hibi,
279
      sdram_ctrl_we_in           => we_ctrl_sdram2hibi,
280
      sdram_ctrl_data_out        => data_sdram2hibi_ctrl,
281
      sdram_ctrl_data_in         => data_ctrl_sdram2hibi,
282
 
283
      --not implemented!!!
284
      sdram_ctrl_byte_select_out => byte_select_sdram2hibi_ctrl
285
      );
286
 
287
  sdram_controller_1 : sdram_controller
288
    generic map (
289
      clk_freq_mhz_g      => clk_freq_mhz_g,
290
      mem_addr_width_g    => mem_addr_width_g,
291
      block_read_length_g => block_read_length_g
292
      )
293
    port map (
294
      clk                    => clk,
295
      rst_n                  => rst_n,
296
      command_in             => comm_sdram2hibi_ctrl,
297
      address_in             => addr_sdram2hibi_ctrl,
298
      data_amount_in         => amount_sdram2hibi_ctrl,
299
      byte_select_in         => byte_select_sdram2hibi_ctrl,
300
      input_empty_in         => empty_sdram2hibi_ctrl,
301
      input_one_d_in         => one_d_sdram2hibi_ctrl,
302
      output_full_in         => full_sdram2hibi_ctrl,
303
      data_in                => data_sdram2hibi_ctrl,
304
      write_on_out           => write_on_ctrl_sdram2hibi,
305
      busy_out               => busy_ctrl_sdram2hibi,
306
      output_we_out          => we_ctrl_sdram2hibi,
307
      input_re_out           => re_ctrl_sdram2hibi,
308
      data_out               => data_ctrl_sdram2hibi,
309
      sdram_data_inout       => sdram_data_inout,
310
      sdram_cke_out          => sdram_cke_out,
311
      sdram_cs_n_out         => sdram_cs_n_out,
312
      sdram_we_n_out         => sdram_we_n_out,
313
      sdram_ras_n_out        => sdram_ras_n_out,
314
      sdram_cas_n_out        => sdram_cas_n_out,
315
      sdram_dqm_out          => sdram_dqm_out,
316
      sdram_ba_out           => sdram_ba_out,
317
      sdram_address_out      => sdram_address_out
318
      );
319
 
320
end structural;

powered by: WebSVN 2.1.0

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