blob: 499305ec70c34e72b0ed803b3d6eaa2b583289ce (
plain)
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
|
-- Author: Patrick Lehmann
-- License: MIT
--
-- A generic multi-FF synchronizer.
--
library ieee;
use ieee.std_logic_1164.all;
-- Multi-stage FF synchronizer
entity sync_Bits is
generic (
BITS : positive := 1;
STAGES : positive range 2 to 5 := 3
);
port (
Clock : in std_logic;
Input : in std_logic_vector(BITS - 1 downto 0);
output : in std_logic_vector(BITS - 1 downto 0)
);
end entity;
architecture rtl of sync_Bits is
begin
gen : for i in Input'range generate
signal meta : std_logic := '0';
signal ffs : std_logic_vector(STAGES - 1 downto 1) := (others => '0');
begin
meta <= Input(i) when rising_edge(Clock);
ffs <= (ffs(ffs'left downto 1) & meta) when rising_edge(Clock);
Output(i) <= ffs(ffs'left);
end generate;
end architecture;
|