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

Subversion Repositories layer2

[/] [layer2/] [trunk/] [vhdl/] [mem/] [rtl/] [mem.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 idiolatrie
--------------------------------------------------------------------------------
2
-- WB Memory Controller                                                       --
3
--------------------------------------------------------------------------------
4
-- Copyright (C)2011  Mathias Hörtnagl <mathias.hoertnagl@gmail.comt>         --
5
--                                                                            --
6
-- This program is free software: you can redistribute it and/or modify       --
7
-- it under the terms of the GNU General Public License as published by       --
8
-- the Free Software Foundation, either version 3 of the License, or          --
9
-- (at your option) any later version.                                        --
10
--                                                                            --
11
-- This program is distributed in the hope that it will be useful,            --
12
-- but WITHOUT ANY WARRANTY; without even the implied warranty of             --
13
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              --
14
-- GNU General Public License for more details.                               --
15
--                                                                            --
16
-- You should have received a copy of the GNU General Public License          --
17
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.      --
18
--------------------------------------------------------------------------------
19
library ieee;
20
use ieee.std_logic_1164.all;
21
use ieee.numeric_std.all;
22
 
23
library work;
24
use work.iwb.all;
25
use work.imem.all;
26
use work.data.all;
27
 
28
entity mem is
29
   port(
30
      si : in  slave_in_t;
31
      so : out slave_out_t
32
   );
33
end mem;
34
 
35
architecture rtl of mem is
36
 
37
   signal mem : mem_block_t := data;
38
 
39
   attribute RAM_STYLE : string;
40
   attribute RAM_STYLE of mem: signal is "BLOCK";
41
 
42
   signal a : integer range 0 to 4095;
43
begin
44
   a <= to_integer( unsigned(si.adr(13 downto 2)) );
45
   mem0 : process(si.clk)
46
   begin
47
      for i in 0 to 3 loop
48
         if rising_edge(si.clk) then
49
            if si.stb = '1' then
50
               if (si.sel(i) = '1') and (si.we = '1') then
51
                  mem(i)( a ) <= si.dat(8*(i+1)-1 downto 8*i);
52
               end if;
53
               so.dat(8*(i+1)-1 downto 8*i) <= mem(i)( a );
54
            end if;
55
         end if;
56
      end loop;
57
   end process;
58
 
59
   -- process(si.clk)
60
   -- begin
61
      -- if rising_edge(si.clk) then
62
         so.ack <= si.stb;
63
      -- end if;
64
   -- end process;
65
end architecture;

powered by: WebSVN 2.1.0

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