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

Subversion Repositories riscompatible

[/] [riscompatible/] [trunk/] [rtl/] [reg.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 borin
library ieee;
2
use ieee.std_logic_1164.all;
3
-------------------------------------------------------------------------------------------------------------------
4
entity reg is
5
    generic
6
    (
7
        NumBits : Natural:=5
8
    );
9
    port
10
    (
11
        Clk_I : in std_logic;
12
        Clr_I : in std_logic;
13
        Wen_I : in std_logic;
14
        Data_I : in std_logic_vector (NumBits-1 downto 0);
15
        Data_O : out std_logic_vector (NumBits-1 downto 0)
16
    );
17
end reg;
18
-------------------------------------------------------------------------------------------------------------------
19
architecture ark1 of reg is
20
begin
21
    process (Clk_I)
22
        variable Data_v : std_logic_vector (Numbits-1 downto 0);
23
    begin
24
        if rising_edge(Clk_I) then
25
            if Clr_I = '1' then
26
                Data_v := (others => '0');
27
            elsif Wen_I = '1' then
28
                Data_v := Data_i;
29
            end if;
30
        end if;
31
        Data_O <= Data_v;
32
    end process;
33
end ark1;

powered by: WebSVN 2.1.0

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