aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/synth109/ram10.vhdl
blob: 77fd4c91563c0d146a624344a845fd3f0bbcf7e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity ram10 is
  generic (
    WIDTHB      : integer := 32;
    SIZEB       : integer := 64;
    ADDRWIDTHB  : integer := 6
    );

  port (
    clkB   : in  std_logic;
    enB    : in  std_logic;
    weB    : in  std_logic;
    addrB  : in  std_logic_vector(ADDRWIDTHB-1 downto 0);
    diB    : in  std_logic_vector(WIDTHB-1 downto 0);
    doB    : out std_logic_vector(WIDTHB-1 downto 0)
    );

end ram10;

architecture behavioral of ram10 is
  type ramType is array (0 to SIZEB-1) of std_logic_vector(WIDTHB-1 downto 0);
  shared variable ram : ramType;
begin
  process (clkB)
  begin
    if rising_edge(clkB) then
      if enB = '1' then
        if weB = '1' then
          ram(to_integer(unsigned(addrB))) := diB;
        end if;
        doB <= ram(to_integer(unsigned(addrB)));
      end if;
    end if;
  end process;
end behavioral;