OpenCores
URL https://opencores.org/ocsvn/1g_ethernet_dpi/1g_ethernet_dpi/trunk

Subversion Repositories 1g_ethernet_dpi

[/] [1g_ethernet_dpi/] [tags/] [vmblite_base/] [hw/] [src/] [rtl/] [mblite/] [std/] [dsram.vhd] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 kuzmi4
----------------------------------------------------------------------------------------------
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_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
);
38
end dsram;
39
 
40
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
                    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.