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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [rtl/] [techmap/] [mem/] [ram32_inferred.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sergeykhbr
-----------------------------------------------------------------------------
2
--! @file
3
--! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4
--! @author    Sergey Khabarov - sergeykhbr@gmail.com
5
--! @brief     32-bits RAM implementation based on registers
6
------------------------------------------------------------------------------
7
 
8
library ieee;
9
use ieee.std_logic_1164.all;
10
library commonlib;
11
use commonlib.types_common.all;
12
 
13
entity Ram32_inferred is
14
generic (
15
    generic_abits    : integer := 10
16
);
17
port (
18
    i_clk         : in std_logic;
19
    i_address     : in std_logic_vector(generic_abits-1 downto 0);
20
    i_wr_ena      : in std_logic;
21
    i_data       : in std_logic_vector(31 downto 0);
22
    o_data       : out std_logic_vector(31 downto 0)
23
);
24
end;
25
 
26
architecture rtl of Ram32_inferred is
27
 
28
type ram_type is array ((2**generic_abits)-1 downto 0) of std_logic_vector (31 downto 0);
29
signal RAM       : ram_type;
30
signal adr       : std_logic_vector(generic_abits-1 downto 0);
31
 
32
begin
33
 
34
  -- registers:
35
  regs : process(i_clk) begin
36
    if rising_edge(i_clk) then
37
      if(i_wr_ena='1') then
38
        RAM(conv_integer(i_address)) <= i_data;
39
      end if;
40
      adr <= i_address;
41
    end if;
42
  end process;
43
 
44
  o_data <= RAM(conv_integer(adr));
45
 
46
end;
47
 
48
 

powered by: WebSVN 2.1.0

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