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

Subversion Repositories igor

[/] [igor/] [trunk/] [processor/] [mc/] [external_mem.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 atypic
--------------------------------------------------------------------------------
2
-- This models the external memory
3
--------------------------------------------------------------------------------
4
 
5
library ieee;
6
use ieee.std_logic_1164.all;
7
use work.leval_package.all;
8
use ieee.numeric_std.all;
9
 
10
entity ext_mem is
11
        port(
12
                we : in std_logic;
13
                re : in std_logic;
14
                a : in std_logic_vector(ADDR_SIZE - 1 downto 0);
15
                d : inout std_logic_vector(WORD_SIZE - 1 downto 0);
16
                ce : in std_logic
17
        );
18
end entity;
19
 
20
architecture behav of ext_mem is
21
 
22
type ram_type is array (0 to 2**10) of std_logic_vector(WORD_SIZE - 1 downto 0);
23
signal RAM : ram_type := (others => (others => '0'));
24
begin
25
        process(a,we,re,d, ce)
26
        begin
27
                if to_integer(unsigned(a)) < 2**10 then
28
                        if we = '1' and re= '0' then
29
                                RAM(to_integer(unsigned(a))) <= d;
30
                        elsif re = '1' and we = '0' then
31
                                d <= RAM(to_integer(unsigned(a)));
32
                        else
33
                                d <= (others => 'Z');
34
                        end if;
35
                end if;
36
        end process;
37
end architecture;

powered by: WebSVN 2.1.0

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