----------------------------------------------------------------- -- vector_to_ascii.vhd -- Christopher Kowalski -- -- ASCII converter from a recieved ASCII value to an encoded bit -- Vector -- -- See the code ascii_to_vector.vhd for the ASCII converstion table. -- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity vector_to_ascii is port(ascii : out std_logic_vector(6 downto 0); reset, clock, load : in std_logic; done : out std_logic; vector : in std_logic_vector(4 downto 0)); end vector_to_ascii; architecture behavioural of vector_to_ascii is -- declare internal signals begin convert : process (clock) is -- process variable variable count:natural range 0 to 2; begin if rising_edge(clock) then if reset = '1' then ascii <= (others => '0'); count := 0; done <= '0'; elsif load = '1' then if count = 2 then -- This gives the circuit time to have the done <= '1'; -- correct value at it's output. else case vector is when "00000" => ascii <= "0000000"; when "00001" => ascii <= "0100000"; when "00010" => ascii <= "0101110"; when "00011" => ascii <= "0110000"; when "00100" => ascii <= "0110001"; when "00101" => ascii <= "0110010"; when "00110" => ascii <= "0110011"; when "00111" => ascii <= "0110100"; when "01000" => ascii <= "0110101"; when "01001" => ascii <= "0110110"; when "01010" => ascii <= "0110111"; when "01011" => ascii <= "0111000"; when "01100" => ascii <= "0111001"; when "01101" => ascii <= "0111010"; when "01110" => ascii <= "1000001"; when "01111" => ascii <= "1000010"; when "10000" => ascii <= "1000011"; when "10001" => ascii <= "1000100"; when "10010" => ascii <= "1000101"; when "10011" => ascii <= "1000110"; when "10100" => ascii <= "1101101"; when "10101" => ascii <= "1001110"; when "10110" => ascii <= "1001111"; when "10111" => ascii <= "1010010"; when "11000" => ascii <= "1010011"; when "11001" => ascii <= "1010100"; when "11010" => ascii <= "1010101"; when "11011" => ascii <= "1010110"; when "11100" => ascii <= "1010111"; when "11101" => ascii <= "1011010"; when "11110" => ascii <= "0001101"; when "11111" => ascii <= "1111111"; when others => ascii <= "1111111"; end case; count:= (count +1); end if; elsif load = '0' then done <= '0'; count := 0; end if; end if; end process convert; end behavioural;