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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [src/] [components/] [data_reg.vhdl] - Blame information for rev 29

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
ENTITY data_reg IS
25
 
26
  GENERIC (
27
    w_data      : NATURAL := 16;
28
    reset_value : NATURAL := 0);
29
 
30
  PORT (
31
    RST : IN  STD_LOGIC;
32
    CLK : IN  STD_LOGIC;
33
    ENA : IN  STD_LOGIC;
34
    D   : IN  STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);
35
    Q   : OUT STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0));
36
 
37
END ENTITY data_reg;
38
 
39
ARCHITECTURE Behavioral OF data_reg IS
40
 
41
BEGIN  -- ARCHITECTURE Behavioral
42
 
43
  -- purpose: Data register with synchronous reset
44
  -- type   : sequential
45
  -- inputs : CLK, RST, ENA, D
46
  -- outputs: Q
47
  DREG : PROCESS (CLK) IS
48
  BEGIN  -- PROCESS DREG
49
    IF rising_edge(CLK) THEN
50
      IF RST = '1' THEN
51
        Q <= STD_LOGIC_VECTOR(to_unsigned(reset_value, w_data));
52
      ELSE
53
        IF ENA = '1' THEN
54
          Q <= D;
55
        END IF;
56
      END IF;
57
    END IF;
58
  END PROCESS DREG;
59
 
60
END ARCHITECTURE Behavioral;
61 9 lcdsgmtr
 
62
LIBRARY ieee;
63
USE ieee.STD_LOGIC_1164.ALL;
64
USE ieee.numeric_std.ALL;
65
 
66
ENTITY data_reg_2 IS
67
 
68
  GENERIC (
69
    w_data      : NATURAL := 16;
70
    reset_value : NATURAL := 0);
71
 
72
  PORT (
73
    CLK : IN  STD_LOGIC;
74
    D   : IN  STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);
75
    Q   : OUT STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0));
76
 
77
END ENTITY data_reg_2;
78
 
79
ARCHITECTURE Behavioral OF data_reg_2 IS
80
 
81
BEGIN  -- ARCHITECTURE Behavioral
82
 
83
  -- purpose: Data register with synchronous reset
84
  -- type   : sequential
85
  -- inputs : CLK, RST, ENA, D
86
  -- outputs: Q
87
  DREG : PROCESS (CLK) IS
88
  BEGIN  -- PROCESS DREG
89
    IF rising_edge(CLK) THEN
90
          Q <= D;
91
    END IF;
92
  END PROCESS DREG;
93
 
94
END ARCHITECTURE Behavioral;

powered by: WebSVN 2.1.0

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