misc: Allow dynamic length for synchronizer

This commit is contained in:
Markus Koch 2021-08-28 19:08:07 +02:00
parent 38f96cdc63
commit 3900d454f9

View File

@ -3,6 +3,9 @@ use ieee.std_logic_1164.all;
use ieee.numeric_std.all; use ieee.numeric_std.all;
entity synchronizer is entity synchronizer is
generic(
SIZE : integer := 3
);
port( port(
clk : in std_logic; clk : in std_logic;
rst : in std_logic; rst : in std_logic;
@ -12,7 +15,7 @@ entity synchronizer is
end entity synchronizer; end entity synchronizer;
architecture RTL of synchronizer is architecture RTL of synchronizer is
signal sr : std_logic_vector(2 downto 0); signal sr : std_logic_vector(SIZE - 1 downto 0);
begin begin
sync : process(clk, rst) is sync : process(clk, rst) is
begin begin