Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- process(clk, rst)
- variable counter : unsigned(31 downto 0) := (others => '0');
- variable flipflops : std_logic_vector(1 downto 0) := (others => '0');
- begin
- if(rst = '1') then
- counter := (others => '0');
- flipflops := (others => '0');
- leds_counter <= (others => '0');
- elsif(rising_edge(clk)) then
- flipflops(1) := flipflops(0);
- flipflops(0) := button;
- if(flipflops(1) = '1' and flipflops(0) = '1') then
- counter := to_unsigned(100_000_000 / 20, counter'length);
- elsif(counter > 0) then
- counter := counter - 1;
- else
- if(button = '1') then
- leds_counter <= leds_counter + 1;
- end if;
- end if;
- end if;
- end process;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement