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

Subversion Repositories System09

[/] [System09/] [trunk/] [rtl/] [Spartan3/] [ram16k_b16.vhd] - Blame information for rev 172

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 172 davidgb
-- $Id: ram16k_b16.vhd,v 1.2 2008/03/14 15:52:43 dilbert57 Exp $
2
--===========================================================================--
3
--                                                                           --
4
--  ram16k_b16.vhd - 16KByte Block RAM Component for Spartan 3/3E            --
5
--                                                                           --
6
--===========================================================================--
7
--
8
--  File name      : ram16k_b16.vhd
9
--
10
--  Entity name    : ram_16k
11
--
12
--  Purpose        : Implements 16K of Synchronous Static RAM 
13
--                   using 16 x Spartan 3/3E RAMB16_S9 block rams
14
--                   Used in the Digilent Spartan 3E500 System09 design
15
--                  
16
--  Dependencies   : ieee.Std_Logic_1164
17
--                   ieee.std_logic_arith
18
--                   unisim.vcomponents
19
--
20
--  Uses           : RAMB16_S9
21
--
22
--  Author         : John E. Kent
23
--
24
--  Email          : dilbert57@opencores.org      
25
--
26
--  Web            : http://opencores.org/project,system09
27
--
28
--
29
--  Copyright (C) 2005 - 2010 John Kent
30
--
31
--  This program is free software: you can redistribute it and/or modify
32
--  it under the terms of the GNU General Public License as published by
33
--  the Free Software Foundation, either version 3 of the License, or
34
--  (at your option) any later version.
35
--
36
--  This program is distributed in the hope that it will be useful,
37
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
38
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
39
--  GNU General Public License for more details.
40
--
41
--  You should have received a copy of the GNU General Public License
42
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
43
--
44
--===========================================================================--
45
--                                                                           --
46
--                              Revision  History                            --
47
--                                                                           --
48
--===========================================================================--
49
--
50
-- Version Author      Date          Changes
51
--
52
--
53
library IEEE;
54
use IEEE.STD_LOGIC_1164.ALL;
55
use IEEE.STD_LOGIC_ARITH.ALL;
56
library unisim;
57
  use unisim.vcomponents.all;
58
 
59
entity ram_16k is
60
  port (
61
    clk      : in  std_logic;
62
    rst      : in  std_logic;
63
    cs       : in  std_logic;
64
    addr     : in  std_logic_vector (13 downto 0);
65
    rw       : in  std_logic;
66
    data_in  : in  std_logic_vector (7 downto 0);
67
    data_out : out std_logic_vector (7 downto 0)
68
  );
69
end ram_16k;
70
 
71
architecture rtl of ram_16k is
72
 
73
  signal we         : std_logic;
74
  signal dp         : std_logic_vector(15 downto 0);
75
  signal ce         : std_logic_vector(15 downto 0);
76
  signal data_out_0 : std_logic_vector(7 downto 0);
77
  signal data_out_1 : std_logic_vector(7 downto 0);
78
  signal data_out_2 : std_logic_vector(7 downto 0);
79
  signal data_out_3 : std_logic_vector(7 downto 0);
80
  signal data_out_4 : std_logic_vector(7 downto 0);
81
  signal data_out_5 : std_logic_vector(7 downto 0);
82
  signal data_out_6 : std_logic_vector(7 downto 0);
83
  signal data_out_7 : std_logic_vector(7 downto 0);
84
 
85
begin
86
 
87
  RAM0 : RAMB16_S9
88
    port map (
89
      do   => data_out_0,
90
      dop(0) => dp(0),
91
      addr => addr(10 downto 0),
92
      clk  => clk,
93
      di   => data_in,
94
      dip(0) => dp(0),
95
      en   => ce(0),
96
      ssr  => rst,
97
      we   => we
98
    );
99
 
100
  RAM1 : RAMB16_S9
101
    port map (
102
      do   => data_out_1,
103
      dop(0) => dp(1),
104
      addr => addr(10 downto 0),
105
      clk  => clk,
106
      di   => data_in,
107
      dip(0) => dp(1),
108
      en   => ce(1),
109
      ssr  => rst,
110
      we   => we
111
    );
112
 
113
  RAM2 : RAMB16_S9
114
    port map (
115
      do   => data_out_2,
116
      dop(0) => dp(2),
117
      addr => addr(10 downto 0),
118
      clk  => clk,
119
      di   => data_in,
120
      dip(0) => dp(2),
121
      en   => ce(2),
122
      ssr  => rst,
123
      we   => we
124
    );
125
 
126
  RAM3 : RAMB16_S9
127
    port map (
128
      do   => data_out_3,
129
      dop(0) => dp(3),
130
      addr => addr(10 downto 0),
131
      clk  => clk,
132
      di   => data_in,
133
      dip(0) => dp(3),
134
      en   => ce(3),
135
      ssr  => rst,
136
      we   => we
137
    );
138
 
139
  RAM4 : RAMB16_S9
140
    port map (
141
      do   => data_out_4,
142
      dop(0) => dp(4),
143
      addr => addr(10 downto 0),
144
      clk  => clk,
145
      di   => data_in,
146
      dip(0) => dp(4),
147
      en   => ce(4),
148
      ssr  => rst,
149
      we   => we
150
    );
151
 
152
  RAM5 : RAMB16_S9
153
    port map (
154
      do   => data_out_5,
155
      dop(0) => dp(5),
156
      addr => addr(10 downto 0),
157
      clk  => clk,
158
      di   => data_in,
159
      dip(0) => dp(5),
160
      en   => ce(5),
161
      ssr  => rst,
162
      we   => we
163
    );
164
 
165
  RAM6 : RAMB16_S9
166
    port map (
167
      do   => data_out_6,
168
      dop(0) => dp(6),
169
      addr => addr(10 downto 0),
170
      clk  => clk,
171
      di   => data_in,
172
      dip(0) => dp(6),
173
      en   => ce(6),
174
      ssr  => rst,
175
      we   => we
176
    );
177
 
178
  RAM7 : RAMB16_S9
179
    port map (
180
      do   => data_out_7,
181
      dop(0) => dp(7),
182
      addr => addr(10 downto 0),
183
      clk  => clk,
184
      di   => data_in,
185
      dip(0) => dp(7),
186
      en   => ce(7),
187
      ssr  => rst,
188
      we   => we
189
    );
190
 
191
my_ram_32k : process ( cs, rw, addr,
192
                       data_out_0, data_out_1, data_out_2, data_out_3,
193
                       data_out_4, data_out_5, data_out_6, data_out_7)
194
begin
195
         we <= not rw;
196
 
197
         case addr(13 downto 11) is
198
         when "000" =>
199
             data_out <= data_out_0;
200
         when "001" =>
201
             data_out <= data_out_1;
202
         when "010" =>
203
             data_out <= data_out_2;
204
         when "011" =>
205
             data_out <= data_out_3;
206
         when "100" =>
207
             data_out <= data_out_4;
208
         when "101" =>
209
             data_out <= data_out_5;
210
         when "110" =>
211
             data_out <= data_out_6;
212
         when "111" =>
213
             data_out <= data_out_7;
214
         when others =>
215
             null;
216
    end case;
217
 
218
    ce(0)  <= cs and not( addr(13) ) and not( addr(12) ) and not( addr(11) );
219
    ce(1)  <= cs and not( addr(13) ) and not( addr(12) ) and      addr(11)  ;
220
    ce(2)  <= cs and not( addr(13) ) and      addr(12)   and not( addr(11) );
221
    ce(3)  <= cs and not( addr(13) ) and      addr(12)   and      addr(11)  ;
222
    ce(4)  <= cs and      addr(13)   and not( addr(12) ) and not( addr(11) );
223
    ce(5)  <= cs and      addr(13)   and not( addr(12) ) and      addr(11)  ;
224
    ce(6)  <= cs and      addr(13)   and      addr(12)   and not( addr(11) );
225
    ce(7)  <= cs and      addr(13)   and      addr(12)   and      addr(11)  ;
226
end process;
227
 
228
end architecture rtl;
229
 

powered by: WebSVN 2.1.0

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