1 |
2051e520
|
Arnaud Dieumegard
|
library IEEE;
|
2 |
|
|
|
3 |
|
|
use IEEE.std_logic_1164.all;
|
4 |
|
|
|
5 |
|
|
entity crossdomain_sync is
|
6 |
|
|
port
|
7 |
|
|
(
|
8 |
|
|
i_clock: in std_logic; -- System clock.
|
9 |
|
|
i_reset: in std_logic; -- System reset.
|
10 |
|
|
i_signal: in std_logic; -- Asynchronous signal.
|
11 |
|
|
o_signal: out std_logic -- Synchronous signal.
|
12 |
|
|
);
|
13 |
|
|
end crossdomain_sync;
|
14 |
|
|
|
15 |
|
|
architecture Behavioral of crossdomain_sync is
|
16 |
|
|
signal signal_r1: std_logic;
|
17 |
|
|
signal signal_r2: std_logic;
|
18 |
|
|
begin
|
19 |
|
|
P_R1_HANDLER: process (i_clock, i_reset)
|
20 |
|
|
begin
|
21 |
|
|
if (i_reset = '1')
|
22 |
|
|
then
|
23 |
|
|
signal_r1 <= '0';
|
24 |
|
|
else
|
25 |
|
|
if (rising_edge(i_clock))
|
26 |
|
|
then
|
27 |
|
|
signal_r1 <= i_signal;
|
28 |
|
|
end if;
|
29 |
|
|
end if;
|
30 |
|
|
end process;
|
31 |
|
|
|
32 |
|
|
P_R2_HANDLER: process (i_clock, i_reset)
|
33 |
|
|
begin
|
34 |
|
|
if (i_reset = '1')
|
35 |
|
|
then
|
36 |
|
|
signal_r2 <= '0';
|
37 |
|
|
else
|
38 |
|
|
if (rising_edge(i_clock))
|
39 |
|
|
then
|
40 |
|
|
signal_r2 <= i_signal;
|
41 |
|
|
end if;
|
42 |
|
|
end if;
|
43 |
|
|
end process;
|
44 |
|
|
|
45 |
|
|
o_signal <= signal_r2;
|
46 |
|
|
|
47 |
|
|
end;
|