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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [processor/] [VHDL/] [scarts_core/] [regfram.vhd] - Blame information for rev 7

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

Line No. Rev Author Line
1 3 jlechner
-----------------------------------------------------------------------
2
-- This file is part of SCARTS.
3
-- 
4
-- SCARTS is free software: you can redistribute it and/or modify
5
-- it under the terms of the GNU General Public License as published by
6
-- the Free Software Foundation, either version 3 of the License, or
7
-- (at your option) any later version.
8
-- 
9
-- SCARTS is distributed in the hope that it will be useful,
10
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-- GNU General Public License for more details.
13
-- 
14
-- You should have received a copy of the GNU General Public License
15
-- along with SCARTS.  If not, see <http://www.gnu.org/licenses/>.
16
-----------------------------------------------------------------------
17
 
18
 
19
library ieee;
20
use ieee.std_logic_1164.all;
21
use ieee.numeric_std.all;
22
 
23
use work.scarts_core_pkg.all;
24
use work.scarts_pkg.all;
25
 
26
entity scarts_regfram is
27
  generic (
28
    CONF : scarts_conf_type);
29
  port (
30
    wclk        : in  std_ulogic;
31
    rclk        : in  std_ulogic;
32
    enable      : in  std_ulogic;
33
 
34
    wdata       : in  std_logic_vector(CONF.word_size-1 downto 0);
35
    waddr       : in  std_logic_vector(REGADDR_W-1 downto 0);
36
    wen         : in  std_ulogic;
37
    raddr       : in  std_logic_vector(REGADDR_W-1 downto 0);
38
    rdata       : out std_logic_vector(CONF.word_size-1 downto 0)
39
    );
40
end scarts_regfram;
41
 
42
architecture behaviour of scarts_regfram is
43
 
44
constant WORD_W : natural := CONF.word_size;
45
 
46
subtype WORD is std_logic_vector(WORD_W-1 downto 0);
47
type ram_array is array (0 to 15) of WORD;
48
 
49
signal ram : ram_array := (others => (others => '0'));
50
 
51
begin
52
 
53
  process(wclk)
54
  begin
55
    if rising_edge(wclk) then
56
      if enable = '1' then
57
        if wen = '1' then
58
          ram(to_integer(unsigned(waddr))) <= wdata(WORD_W-1 downto 0);
59
        end if;
60
      end if;
61
    end if;
62
  end process;
63
 
64
  process(rclk)
65
  begin
66
    if rising_edge(rclk) then
67
      if enable = '1' then
68
        rdata <= (others => '0');
69
        rdata(WORD_W-1 downto 0) <= ram(to_integer(unsigned(raddr)));
70
      end if;
71
    end if;
72
  end process;
73
 
74
end behaviour;

powered by: WebSVN 2.1.0

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