-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflipflop.vhd
34 lines (32 loc) · 1.07 KB
/
flipflop.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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity flipflop is
port (DIN : in STD_LOGIC;
DOUT : out STD_LOGIC;
ENABLE : in STD_LOGIC;
CLK,RST : in STD_LOGIC
);
end entity;
architecture rtl of flipflop is
begin
-- In Altera devices, register signals have a set priority.
-- The HDL design should reflect this priority.
process(RST, CLK)
begin
-- The asynchronous reset signal has the highest priority
if (RST = '1') then
DOUT <= '0'; -- Código reconfigurável.
else
-- At a clock edge, if asynchronous signals have not taken priority,
-- respond to the appropriate synchronous signal.
-- Check for synchronous reset, then synchronous load.
-- If none of these takes precedence, update the register output
-- to be the register input.
if (rising_edge(CLK)) then
if (ENABLE = '1') then
DOUT <= DIN;
end if;
end if;
end if;
end process;
end architecture;