uaveiro-leci/1ano/2semestre/lsd/pratica05/AccN_Demo/RegN.vhd

26 lines
506 B
VHDL
Raw Permalink Normal View History

2023-03-22 12:52:09 +00:00
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity RegN is
generic ( N : positive := 8);
port
(
dataIn : in std_logic_vector((N-1) downto 0);
enable, reset, clk : in std_logic;
dataOut : out std_logic_vector((N-1) downto 0)
);
end RegN;
architecture Behavioral of RegN is
begin
process (clk, reset)
begin
if (reset = '1') then
dataOut <= (others => '0');
elsif (rising_edge(clk)) then
if (enable = '1') then
dataOut <= dataIn;
end if;
end if;
end process;
end Behavioral;