1
|
library IEEE;
|
2
|
|
3
|
use IEEE.std_logic_1164.ALL;
|
4
|
|
5
|
entity latches is
|
6
|
port
|
7
|
(
|
8
|
i_clock: in std_logic;
|
9
|
i_reset: in std_logic;
|
10
|
i_a: in std_logic;
|
11
|
i_b: in std_logic;
|
12
|
i_c: in std_logic;
|
13
|
o_a: out std_logic;
|
14
|
o_b: out std_logic;
|
15
|
o_c: out std_logic
|
16
|
);
|
17
|
end entity latches;
|
18
|
|
19
|
architecture Behavioral of latches is
|
20
|
signal latch_0: std_logic;
|
21
|
begin
|
22
|
|
23
|
-- Taken from Xilinx's documentation:
|
24
|
-- "Latch With Positive Gate and Asynchronous Reset VHDL Coding Example"
|
25
|
-- 'latch_0' undefined for ((i_reset = '0') and (i_b = '0')), requiring the
|
26
|
-- use of memory (hence the latch).
|
27
|
process (i_reset, i_a, i_b)
|
28
|
begin
|
29
|
if (i_reset = '1')
|
30
|
then
|
31
|
latch_0 <= '0';
|
32
|
elsif (i_b = '1')
|
33
|
then
|
34
|
latch_0 <= i_a;
|
35
|
end if;
|
36
|
end process;
|
37
|
|
38
|
end architecture;
|