Skip to content

Instantly share code, notes, and snippets.

@pd0wm
Last active December 18, 2015 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pd0wm/5763830 to your computer and use it in GitHub Desktop.
Save pd0wm/5763830 to your computer and use it in GitHub Desktop.
if (rising_edge(clk)) then
counter := counter + 1;
if (sensor_mem /= sensor_in and sensor_in = '1') then
if (counter_trigger < (counter - 10)) then
hold_counter := hold_counter + 1;
end if;
if (counter_trigger > (counter + 10)) then
hold_counter := 0;
end if;
counter := 0;
end if;
sensor_mem := sensor_in;
if (hold_counter >= hold_time) then
sensor_out <= '1';
else
sensor_out <= '0';
end if;
end if;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment