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

Subversion Repositories mblite

[/] [mblite/] [trunk/] [hw/] [std/] [dsram.vhd] - Blame information for rev 5

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

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

powered by: WebSVN 2.1.0

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