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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [VHDL/] [qreg/] [qreg.vhdl] - Blame information for rev 31

Go to most recent revision | 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
-- Uncomment the following library declaration if instantiating
25
-- any Xilinx primitives in this code.
26
--library UNISIM;
27
--use UNISIM.VComponents.all;
28
 
29
ENTITY qreg IS
30
  GENERIC (
31
    w_data : NATURAL := 16);
32
  PORT (D0  : IN  STD_LOGIC_VECTOR(w_data -1 DOWNTO 0);
33
        D1  : IN  STD_LOGIC_VECTOR(w_data -1 DOWNTO 0);
34
        S   : IN  STD_LOGIC;
35
        EN  : IN  STD_LOGIC;
36
        CLK : IN  STD_LOGIC;
37
        RST : IN  STD_LOGIC;
38
        Q   : OUT STD_LOGIC_VECTOR(w_data -1 DOWNTO 0));
39
END qreg;
40
 
41
ARCHITECTURE Behavioral_2 OF qreg IS
42
 
43
BEGIN
44
 
45
  -- purpose: Register with multiplexed input
46
  -- type   : sequential
47
  -- inputs : CLK,D0,D1,S,EN
48
  -- outputs: Q
49
  qreg : PROCESS (CLK)
50
  BEGIN  -- PROCESS qreg
51
    IF rising_edge(CLK) THEN            -- rising clock edge
52
      IF RST = '1' THEN
53
        Q <= STD_LOGIC_VECTOR(TO_UNSIGNED(0, w_data));
54
      ELSE
55
        IF EN = '1' THEN
56
          IF S = '0' THEN
57
            Q <= D0;
58
          ELSE
59
            Q <= D1;
60
          END IF;
61
        END IF;
62
      END IF;
63
    END IF;
64
  END PROCESS qreg;
65
 
66
END Behavioral_2;

powered by: WebSVN 2.1.0

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