library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity delay_gen2 is generic( clkDelay : integer := 10; repeat : boolean := false ); port( clk : in std_logic; reset : in std_logic; enOut : out std_logic := '0' ); end entity delay_gen2; architecture RTL of delay_gen2 is signal count : integer range 0 to clkDelay - 1 := 0; begin process(clk) begin if rising_edge(clk) then if (reset = '1') then count <= 0; --enOut <= '0'; end if; enOut <= '0'; -- das Enable ist für 99 Taktzyklen inaktiv -- Da nur der letzte zugewiesene Wert übernommen wird, funktioniert dies hier sehr gut! if count < clkDelay - 1 then -- Teiler durch 100 count <= count + 1; else if (repeat = true) then count <= 0; end if; enOut <= '1'; -- das Enable ist für 1 Taktzyklus aktiv end if; end if; end process; end architecture RTL;