-
Notifications
You must be signed in to change notification settings - Fork 0
/
flipFlop.vhd
36 lines (31 loc) · 992 Bytes
/
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
35
36
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 comportamento of flipFlop is
begin
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;