Studentenversion des ESY6/A Praktikums "signal_processing".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sync_ff.vhd 1016B

1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. entity sync_ff is
  4. generic
  5. (
  6. DEPTH : positive range 2 to 5 := 2;
  7. RST_VALUE : std_logic := '0'
  8. );
  9. port
  10. (
  11. --! Destination domain clock
  12. clk : in std_logic;
  13. --! Low active destination domain reset
  14. reset : in std_logic;
  15. --! Single bit data input
  16. din : in std_logic;
  17. --! Single bit data output
  18. dout : out std_logic
  19. );
  20. end entity sync_ff;
  21. architecture rtl of sync_ff is
  22. signal sync : std_logic_vector( DEPTH - 1 downto 0 );
  23. begin
  24. p_sync: process ( clk, reset ) is
  25. begin
  26. if ( reset = '1' ) then
  27. sync <= ( others => RST_VALUE );
  28. elsif ( rising_edge( clk ) ) then
  29. sync( DEPTH - 1 downto 1 ) <= sync( DEPTH - 2 downto 0 );
  30. sync( 0 ) <= din;
  31. end if;
  32. end process p_sync;
  33. c_dout: dout <= sync( DEPTH - 1 );
  34. end architecture rtl;