I24BCD.VHD
上传用户:dgjihui88
上传日期:2013-07-23
资源大小:43k
文件大小:2k
源码类别:

VHDL/FPGA/Verilog

开发平台:

MultiPlatform

  1. --The IEEE standard 1164 package, declares std_logic, rising_edge(), etc.
  2. library IEEE;
  3. use IEEE.std_logic_1164.all;
  4. use IEEE.std_logic_arith.all;
  5. use IEEE.std_logic_unsigned.all;
  6. entity i24bcd is
  7.   port (interg : in integer range 0 to 23;--interger number
  8.            ten : out std_logic_vector (3 downto 0) ;--decimal bit
  9.            one : out std_logic_vector (3 downto 0) );--individual bit
  10. end i24bcd;
  11. architecture arch of i24bcd is
  12. begin
  13.   with interg select
  14.    one<="0000" when 0,
  15.         "0001" when 1,
  16.         "0010" when 2,
  17.         "0011" when 3,
  18.         "0100" when 4,
  19.         "0101" when 5,
  20.         "0110" when 6,
  21.         "0111" when 7,
  22.         "1000" when 8,
  23.         "1001" when 9,
  24.         "0000" when 10,
  25.         "0001" when 11,
  26.         "0010" when 12,
  27.         "0011" when 13,
  28.         "0100" when 14,
  29.         "0101" when 15,
  30.         "0110" when 16,
  31.         "0111" when 17,
  32.         "1000" when 18,
  33.         "1001" when 19,
  34.         "0000" when 20,
  35.         "0001" when 21,
  36.         "0010" when 22,
  37.         "0011" when 23,
  38. "1110" when others;--error input
  39.   with interg select
  40.    ten<="0000" when 0,
  41.         "0000" when 1,
  42.         "0000" when 2,
  43.         "0000" when 3,
  44.         "0000" when 4,
  45.         "0000" when 5,
  46.         "0000" when 6,
  47.         "0000" when 7,
  48.         "0000" when 8,
  49.         "0000" when 9,
  50.         "0001" when 10,
  51.         "0001" when 11,
  52.         "0001" when 12,
  53.         "0001" when 13,
  54.         "0001" when 14,
  55.         "0001" when 15,
  56.         "0001" when 16,
  57.         "0001" when 17,
  58.         "0001" when 18,
  59.         "0001" when 19,
  60.         "0010" when 20,
  61.         "0010" when 21,
  62.         "0010" when 22,
  63.         "0010" when 23,
  64. "1110" when others;--error input
  65. end arch;