library ieee;
use ieee.std_logic_1164.all;

entity decimal_digit is
    port (x : in std_logic_vector(3 downto 0);
          pins : out std_logic_vector(6 downto 0));
end entity;

architecture rtl of decimal_digit is
begin
    -- Derive the remaining six segment equations.
    pins(0) <= (not x(0) and not x(1) and x(2)) or (x(0) and not x(1) and not x(2) and not x(3));
    pins(1) <= '1';
    pins(2) <= '1';
    pins(3) <= '1';
    pins(4) <= '1';
    pins(5) <= '1';
    pins(6) <= '1';
end architecture;

library ieee;
use ieee.std_logic_1164.all;

entity decimal_pair is
    port (SW : in std_logic_vector(9 downto 0);
          HEX1, HEX0 : out std_logic_vector(6 downto 0));
end entity;

architecture rtl of decimal_pair is
begin
    left_digit : entity work.decimal_digit port map (SW(7 downto 4), HEX1);
    right_digit : entity work.decimal_digit port map (SW(3 downto 0), HEX0);
end architecture;
