forked from peterotte/A2ExpTrigger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RegisterClocked.vhd
48 lines (41 loc) · 1.06 KB
/
RegisterClocked.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
-- Peter-Bernd Otte
-- 24.9.2012
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ClockedRegister is
GENERIC (
NCh : integer
);
Port ( Inputs : in STD_LOGIC_VECTOR (NCh-1 downto 0);
Outputs : out STD_LOGIC_VECTOR (NCh-1 downto 0);
ClockedClock : in std_logic;
Clock : in std_logic;
Reset : in STD_LOGIC);
end ClockedRegister;
architecture Behavioral of ClockedRegister is
signal Inter_Out : std_logic_vector(NCh-1 downto 0);
signal LastClockedClock, LastLastClockedClock : std_logic;
begin
process (clock)
begin
if rising_edge(clock) then
LastClockedClock <= ClockedClock;
LastLastClockedClock <= LastClockedClock;
end if;
end process;
process (clock)
begin
if rising_edge(clock) then
if (Reset = '1') then
Inter_Out <= (others => '0');
elsif (LastClockedClock = '1') and (LastLastClockedClock = '0') then
Inter_Out <= Inputs;
else
Inter_Out <= Inter_Out;
end if;
end if;
end process;
Outputs <= Inter_Out;
end Behavioral;