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

Subversion Repositories wb_vga

[/] [wb_vga/] [trunk/] [wb_tk/] [wb_ram.vhd] - Blame information for rev 9

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

Line No. Rev Author Line
1 7 tantos
--
2
--  Wishbone bus toolkit.
3
--
4
--  (c) Copyright Andras Tantos <andras_tantos@yahoo.com> 2001/03/31
5
--  This code is distributed under the terms and conditions of the GNU General Public Lince.
6
--
7
--
8
-- ELEMENTS:
9
--   wb_ram: ram element.
10
 
11
-------------------------------------------------------------------------------
12
--
13
--  wb_ram
14
--
15
-------------------------------------------------------------------------------
16
 
17
library IEEE;
18
use IEEE.std_logic_1164.all;
19
 
20
library wb_tk;
21
use wb_tk.technology.all;
22
 
23
entity wb_ram is
24
        generic (
25
                data_width: positive := 8;
26
                addr_width: positive := 10
27
        );
28
        port (
29
        clk_i: in std_logic;
30
--              rst_i: in std_logic := '0';
31
                adr_i: in std_logic_vector (addr_width-1 downto 0);
32
--              sel_i: in std_logic_vector ((bus_width/8)-1 downto 0) := (others => '1');
33
                dat_i: in std_logic_vector (data_width-1 downto 0);
34
                dat_oi: in std_logic_vector (data_width-1 downto 0) := (others => '-');
35
                dat_o: out std_logic_vector (data_width-1 downto 0);
36
                cyc_i: in std_logic;
37
                ack_o: out std_logic;
38
                ack_oi: in std_logic := '-';
39
--              err_o: out std_logic;
40
--              err_oi: in std_logic := '-';
41
--              rty_o: out std_logic;
42
--              rty_oi: in std_logic := '-';
43
                we_i: in std_logic;
44
                stb_i: in std_logic
45
        );
46
end wb_ram;
47
 
48
architecture wb_ram of wb_ram is
49
        component ram
50
                generic (
51
                        data_width : positive;
52
                        addr_width : positive
53
                );
54
                port (
55
                        clk : in std_logic;
56
                        we : in std_logic;
57
                        addr : in std_logic_vector(addr_width-1 downto 0);
58
                        d_in : in std_logic_vector(data_width-1 downto 0);
59
                        d_out : out std_logic_vector(data_width-1 downto 0)
60
                );
61
        end component;
62
 
63
        signal mem_we: std_logic;
64
        signal mem_dat_o: std_logic_vector(data_width-1 downto 0);
65
begin
66
    mem_we <= we_i and stb_i and cyc_i;
67
    tech_ram: ram
68
        generic map (
69
            data_width => data_width,
70
            addr_width => addr_width
71
        )
72
        port map (
73
            clk => clk_i,
74
            we => mem_we,
75
            addr => adr_i,
76
            d_in => dat_i,
77
            d_out => mem_dat_o
78
        );
79
 
80
    dat_o_gen: for i in dat_o'RANGE generate
81
        dat_o(i) <= (mem_dat_o(i) and stb_i and cyc_i and not we_i) or (dat_oi(i) and not (stb_i and cyc_i and not we_i));
82
    end generate;
83
    ack_o <= ('1' and stb_i and cyc_i) or (ack_oi and not (stb_i and cyc_i));
84
end wb_ram;
85
 

powered by: WebSVN 2.1.0

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