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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [VHDL/] [registers/] [rf.vhdl] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
LIBRARY ieee;
21
USE ieee.std_logic_1164.ALL;
22
USE ieee.numeric_std.ALL;
23
 
24
ENTITY rf IS
25
 
26
  PORT (
27
    CLK : IN  STD_LOGIC;
28
    D   : IN  STD_LOGIC_VECTOR(7 DOWNTO 0);
29
    Q1  : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
30
    Q2  : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
31
    A1  : IN  STD_LOGIC_VECTOR(1 DOWNTO 0);
32
    A2  : IN  STD_LOGIC_VECTOR(1 DOWNTO 0);
33
    WR  : IN  STD_LOGIC);
34
 
35
END ENTITY rf;
36
 
37
ARCHITECTURE Behavioral OF rf IS
38
 
39
  TYPE rf_type IS ARRAY(0 TO 3) OF STD_LOGIC_VECTOR(7 DOWNTO 0);
40
 
41
  SIGNAL reg : rf_type;
42
 
43
BEGIN  -- ARCHITECTURE Behavioral
44
 
45
  PROCESS (CLK)
46
  BEGIN
47
    IF rising_edge(CLK) THEN
48
      IF WR = '0' THEN
49
        reg(to_integer(UNSIGNED(A1))) <= reg(to_integer(UNSIGNED(A1)));
50
      ELSE
51
        reg(to_integer(UNSIGNED(A1))) <= D;
52
      END IF;
53
    END IF;
54
  END PROCESS;
55
 
56
  Q1 <= reg(to_integer(UNSIGNED(A1)));
57
  Q2 <= reg(to_integer(UNSIGNED(A2)));
58
 
59
END ARCHITECTURE Behavioral;

powered by: WebSVN 2.1.0

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