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

Subversion Repositories mblite

[/] [mblite/] [trunk/] [hw/] [std/] [sram.vhd] - Diff between revs 6 and 8

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 6 Rev 8
Line 9... Line 9...
--
--
--      Description        : Single Port Synchronous Random Access Memory
--      Description        : Single Port Synchronous Random Access Memory
--
--
----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
 
 
LIBRARY ieee;
library ieee;
USE ieee.std_logic_1164.ALL;
use ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.ALL;
use ieee.std_logic_unsigned.all;
 
 
LIBRARY mblite;
library mblite;
USE mblite.std_Pkg.ALL;
use mblite.std_Pkg.all;
 
 
ENTITY sram IS GENERIC
entity sram is generic
(
(
    WIDTH : positive := 32;
    WIDTH : positive := 32;
    SIZE  : positive := 16
    SIZE  : positive := 16
);
);
PORT
port
(
(
    dat_o : OUT std_logic_vector(WIDTH - 1 DOWNTO 0);
    dat_o : out std_logic_vector(WIDTH - 1 downto 0);
    dat_i : IN std_logic_vector(WIDTH - 1 DOWNTO 0);
    dat_i : in std_logic_vector(WIDTH - 1 downto 0);
    adr_i : IN std_logic_vector(SIZE - 1 DOWNTO 0);
    adr_i : in std_logic_vector(SIZE - 1 downto 0);
    wre_i : IN std_logic;
    wre_i : in std_logic;
    ena_i : IN std_logic;
    ena_i : in std_logic;
    clk_i : IN std_logic
    clk_i : in std_logic
);
);
END sram;
end sram;
 
 
ARCHITECTURE arch OF sram IS
architecture arch of sram is
    TYPE ram_type IS array(2 ** SIZE - 1 DOWNTO 0) OF std_logic_vector(WIDTH - 1 DOWNTO 0);
    type ram_type is array(2 ** SIZE - 1 downto 0) of std_logic_vector(WIDTH - 1 downto 0);
    SIGNAL ram :  ram_type;
    signal ram :  ram_type;
BEGIN
begin
    PROCESS(clk_i)
    process(clk_i)
    BEGIN
    begin
        IF rising_edge(clk_i) THEN
        if rising_edge(clk_i) then
            IF ena_i = '1' THEN
            if ena_i = '1' then
                IF wre_i = '1' THEN
                if wre_i = '1' then
                   ram(my_conv_integer(adr_i)) <= dat_i;
                   ram(my_conv_integer(adr_i)) <= dat_i;
                END IF;
                end if;
                dat_o <= ram(my_conv_integer(adr_i));
                dat_o <= ram(my_conv_integer(adr_i));
            END IF;
            end if;
        END IF;
        end if;
    END PROCESS;
    end process;
END arch;
end arch;
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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