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

Subversion Repositories spi_slave

[/] [spi_slave/] [trunk/] [pcore/] [opb_spi_slave_v1_00_a/] [hdl/] [vhdl/] [ram.vhd] - Blame information for rev 35

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dkoethe
-------------------------------------------------------------------------------
2
--* 
3
--* @short RAM Sync-Write, Async Read
4
--* 
5
--* @generic C_FIFO_WIDTH       RAM-With (1..xx)
6
--* @generic C_FIFO_SIZE_WIDTH  RAM Size = 2**C_FIFO_SIZE_WIDTH
7
--*
8
--*    @author: Daniel Köthe
9
--*   @version: 1.0
10
--* @date:      2007-11-11
11
--/
12
-------------------------------------------------------------------------------
13
library ieee;
14
use ieee.std_logic_1164.all;
15
use ieee.std_logic_unsigned.all;
16
 
17
entity ram is
18
  generic (
19
    C_FIFO_WIDTH      : integer := 8;
20
    C_FIFO_SIZE_WIDTH : integer := 4);
21
 
22
  port (clk  : in  std_logic;
23
        we   : in  std_logic;
24
        a    : in  std_logic_vector(C_FIFO_SIZE_WIDTH-1 downto 0);
25
        dpra : in  std_logic_vector(C_FIFO_SIZE_WIDTH-1 downto 0);
26
        di   : in  std_logic_vector(C_FIFO_WIDTH-1 downto 0);
27
        dpo  : out std_logic_vector(C_FIFO_WIDTH-1 downto 0));
28
end ram;
29
 
30
architecture behavior of ram is
31
  type ram_type is array (2**C_FIFO_SIZE_WIDTH-1 downto 0) of std_logic_vector (C_FIFO_WIDTH-1 downto 0);
32
  signal RAM : ram_type;
33
begin
34
 
35
  process (clk)
36
  begin
37
    if (clk'event and clk = '1') then
38
      if (we = '1') then
39
        RAM(conv_integer(a)) <= di;
40
      end if;
41
    end if;
42
  end process;
43
 
44
  dpo <= RAM(conv_integer(dpra));
45
 
46
end behavior;

powered by: WebSVN 2.1.0

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