-- Decode a 2-digit binary number into two numbers. library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; -- Comment out the Actel Library -- library asyl; -- use asyl.arith.all; -- input: A 2-digit binary number, which has the range from 000000 to -- 111011, i.e 0 to 59. The maximum is 59 as we use this for our -- clock. -- tenth: A 1-digit binary number which indicates the first digit of the -- binary number -- one: A 1-digit binary number which indicates the one of the binary -- number entity mdecoder is port ( input: in std_logic_vector(5 downto 0); tenth: out std_logic_vector(5 downto 0); one: out std_logic_vector(5 downto 0) ); end mdecoder; architecture behaviour of mdecoder is begin mdecode : process(input) variable temp: std_logic_vector(5 downto 0); begin if input >= "110010" then tenth <= "000101"; one <= input - "110010"; elsif input >= "101000" then tenth <= "000100"; one <= input - "101000"; elsif input >= "011110" then tenth <= "000011"; one <= input - "011110"; elsif input >= "010100" then tenth <= "000010"; one <= input - "010100"; elsif input >= "001010" then tenth <= "000001"; one <= input - "001010"; else tenth <= "000000"; one <= input; end if; end process mdecode; end behaviour;