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

Subversion Repositories mblite

[/] [mblite/] [trunk/] [hw/] [std/] [sram.vhd] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 takar
----------------------------------------------------------------------------------------------
2
--
3
--      Input file         : sram.vhd
4
--      Design name        : sram
5
--      Author             : Tamar Kranenburg
6
--      Company            : Delft University of Technology
7
--                         : Faculty EEMCS, Department ME&CE
8
--                         : Systems and Circuits group
9
--
10
--      Description        : Single Port Synchronous Random Access Memory
11
--
12
----------------------------------------------------------------------------------------------
13
 
14
LIBRARY ieee;
15
USE ieee.std_logic_1164.ALL;
16
USE ieee.std_logic_unsigned.ALL;
17
 
18
LIBRARY mblite;
19
USE mblite.std_Pkg.ALL;
20
 
21
ENTITY sram IS GENERIC
22
(
23
    WIDTH : positive := 32;
24
    SIZE  : positive := 16
25
);
26
PORT
27
(
28
    dat_o : OUT std_ulogic_vector(WIDTH - 1 DOWNTO 0);
29
    dat_i : IN std_ulogic_vector(WIDTH - 1 DOWNTO 0);
30
    adr_i : IN std_ulogic_vector(SIZE - 1 DOWNTO 0);
31
    wre_i : IN std_ulogic;
32
    ena_i : IN std_ulogic;
33
    clk_i : IN std_ulogic
34
);
35
END sram;
36
 
37
ARCHITECTURE arch OF sram IS
38
    TYPE ram_type IS array(2 ** SIZE - 1 DOWNTO 0) OF std_ulogic_vector(WIDTH - 1 DOWNTO 0);
39
    SIGNAL ram :  ram_type;
40
BEGIN
41
    PROCESS(clk_i)
42
    BEGIN
43
        IF rising_edge(clk_i) THEN
44
            IF ena_i = '1' THEN
45
                IF wre_i = '1' THEN
46
                   ram(my_conv_integer(adr_i)) <= dat_i;
47
                END IF;
48
                dat_o <= ram(my_conv_integer(adr_i));
49
            END IF;
50
        END IF;
51
    END PROCESS;
52
END arch;
53
 

powered by: WebSVN 2.1.0

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