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

Subversion Repositories jtag_master

[/] [jtag_master/] [trunk/] [rtl/] [bram.vhd] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 wesche
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
use IEEE.NUMERIC_STD.ALL;
4
 
5
entity RAM is
6
    Generic (
7
           Addrbreite  : natural := 10;  -- Speicherlänge = 2^Addrbreite
8
           Wortbreite  : natural := 8
9
           );
10
    Port ( clk   : in  STD_LOGIC;
11
           Write : in  STD_LOGIC;
12
           Awr   : in  STD_LOGIC_VECTOR (Addrbreite-1 downto 0);
13
           Ard   : in  STD_LOGIC_VECTOR (Addrbreite-1 downto 0);
14
           Din   : in  STD_LOGIC_VECTOR (Wortbreite-1 downto 0);
15
           Dout  : out STD_LOGIC_VECTOR (Wortbreite-1 downto 0)
16
         );
17
end RAM;
18
 
19
architecture BlockRAM of RAM is
20
type speicher is array(0 to (2**Addrbreite)-1) of STD_LOGIC_VECTOR(Wortbreite-1 downto 0);
21
signal memory : speicher;
22
begin
23
  process begin
24
    wait until rising_edge(CLK);
25
    if (Write='1') then
26
      memory(to_integer(unsigned(Awr))) <= Din;
27
    end if;
28
    Dout <= memory(to_integer(unsigned(Ard)));
29
  end process;
30
end BlockRAM;

powered by: WebSVN 2.1.0

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