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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [VHDL/] [large_ram/] [RAM4kx16.vhdl] - Blame information for rev 13

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
LIBRARY ieee;
21
USE ieee.std_logic_1164.ALL;
22
USE ieee.numeric_std.ALL;
23
 
24
LIBRARY UNISIM;
25
USE UNISIM.vcomponents.ALL;
26
 
27
ENTITY RAM4kx16 IS
28
 
29
  PORT (
30
    CLK   : IN  STD_LOGIC;
31
    ADDRA : IN  STD_LOGIC_VECTOR(14 DOWNTO 0);
32
    DINA  : IN  STD_LOGIC_VECTOR(15 DOWNTO 0);
33
    WEA   : IN  STD_LOGIC;
34
    DOUTA : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
35
    ADDRB : IN  STD_LOGIC_VECTOR(14 DOWNTO 0);
36
    DOUTB : OUT STD_LOGIC_VECTOR(15 DOWNTO 0));
37
 
38
END RAM4kx16;
39
 
40
ARCHITECTURE Behavioral OF RAM4kx16 IS
41
 
42
  COMPONENT RAM2kx16
43
    PORT (
44
      CLK   : IN  STD_LOGIC;
45
      ADDRA : IN  STD_LOGIC_VECTOR(10 DOWNTO 0);
46
      DINA  : IN  STD_LOGIC_VECTOR(15 DOWNTO 0);
47
      WEA   : IN  STD_LOGIC;
48
      DOUTA : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
49
      ADDRB : IN  STD_LOGIC_VECTOR(10 DOWNTO 0);
50
      DOUTB : OUT STD_LOGIC_VECTOR(15 DOWNTO 0));
51
  END COMPONENT;
52
 
53
  TYPE connect_t IS ARRAY (0 TO 1) OF STD_LOGIC_VECTOR(15 DOWNTO 0);
54
 
55
  SIGNAL conn_a : connect_t;
56
  SIGNAL conn_b : connect_t;
57
 
58
BEGIN  -- Behavioral
59
 
60
  RAM_GEN : FOR I IN 0 TO 1 GENERATE
61
    RAMI : RAM2kx16
62
      PORT MAP (
63
        CLK   => CLK ,
64
        ADDRA => ADDRA(10 DOWNTO 0),
65
        DINA  => DINA,
66
        WEA   => WEA,
67
        DOUTA => conn_a(I),
68
        ADDRB => ADDRB(10 DOWNTO 0),
69
        DOUTB => conn_b(I));
70
  END GENERATE RAM_GEN;
71
 
72
  BUS1: PROCESS (ADDRA(14 DOWNTO 11), conn_a)
73
  BEGIN  -- PROCESS BUS1
74
     DOUTA <= conn_a(to_integer(unsigned(ADDRA(14 DOWNTO 11))));
75
  END PROCESS BUS1;
76
 
77
  BUS2: PROCESS (ADDRB(14 DOWNTO 11), conn_b)
78
  BEGIN  -- PROCESS BUS1
79
     DOUTB <= conn_b(to_integer(unsigned(ADDRB(14 DOWNTO 11))));
80
  END PROCESS BUS2;
81
 
82
END Behavioral;

powered by: WebSVN 2.1.0

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