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

Subversion Repositories mblite

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

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 8 takar
library ieee;
17
use ieee.std_logic_1164.all;
18
use ieee.std_logic_unsigned.all;
19 2 takar
 
20 8 takar
library mblite;
21
use mblite.std_Pkg.all;
22 2 takar
 
23 8 takar
entity dsram is generic
24 2 takar
(
25
    WIDTH : positive := 32;
26
    SIZE  : positive := 8
27
);
28 8 takar
port
29 2 takar
(
30 8 takar
    dat_o   : out std_logic_vector(WIDTH - 1 downto 0);
31
    adr_i   : in std_logic_vector(SIZE - 1 downto 0);
32
    ena_i   : in std_logic;
33
    dat_w_i : in std_logic_vector(WIDTH - 1 downto 0);
34
    adr_w_i : in std_logic_vector(SIZE - 1 downto 0);
35
    wre_i   : in std_logic;
36
    clk_i   : in std_logic
37 2 takar
);
38 8 takar
end dsram;
39 2 takar
 
40 8 takar
architecture arch of dsram is
41
    type ram_type is array(2 ** SIZE - 1 downto 0) of std_logic_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 2 takar
                    ram(my_conv_integer(adr_w_i)) <= dat_w_i;
50 8 takar
                end if;
51 2 takar
                dat_o <= ram(my_conv_integer(adr_i));
52 8 takar
            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.