48 lines
845 B
VHDL
48 lines
845 B
VHDL
library IEEE;
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
|
|
|
entity DigitalFilter16 is
|
|
port(
|
|
clk : in STD_LOGIC;
|
|
input : in STD_LOGIC;
|
|
output : out STD_LOGIC
|
|
);
|
|
end DigitalFilter16;
|
|
|
|
architecture Behavioral of DigitalFilter16 is
|
|
signal count : natural range 0 to 15 := 0;
|
|
signal latch : std_logic := '0';
|
|
begin
|
|
|
|
process(clk)
|
|
begin
|
|
if rising_edge(clk) then
|
|
if input = '1' then
|
|
if latch = '0' then
|
|
latch <= '1';
|
|
count <= 0;
|
|
else
|
|
if count < 15 then
|
|
count <= count + 1;
|
|
else
|
|
output <= '1';
|
|
count <= 0;
|
|
end if;
|
|
end if;
|
|
else
|
|
if latch = '1' then
|
|
latch <= '0';
|
|
count <= 0;
|
|
else
|
|
if count < 15 then
|
|
count <= count + 1;
|
|
else
|
|
output <= '0';
|
|
count <= 0;
|
|
end if;
|
|
end if;
|
|
end if;
|
|
end if;
|
|
end process;
|
|
|
|
end Behavioral; |