Skip to content

Instantly share code, notes, and snippets.

@rishi93
Created December 6, 2018 13:54
Show Gist options
  • Select an option

  • Save rishi93/534afcec3cf8948aad1527867dc528d8 to your computer and use it in GitHub Desktop.

Select an option

Save rishi93/534afcec3cf8948aad1527867dc528d8 to your computer and use it in GitHub Desktop.
A simple example in VHDL
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity special_counter is
port(
clk : in std_logic;
rst : in std_logic;
output : out std_logic_vector(0 to 5)
);
end entity;
architecture behavioral of special_counter is
signal count1 : std_logic_vector(0 to 2);
signal count2 : std_logic_vector(0 to 5);
begin
count_process : process(clk, rst)
begin
if rst = '1' then
count1 <= "000";
count2 <= "000000";
elsif(rising_edge(clk)) then
count1 <= count1 + 1;
if count1 = "101" then
count2 <= count2 + 1;
end if;
end if;
end process;
output <= count2;
end architecture;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment