Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.all;
  3. use IEEE.std_logic_unsigned.all;
  4.  
  5. entity BCD_Excess is
  6. port ( B : in std_logic_vector(3 downto 0);
  7. E : out std_logic_vector(3 downto 0) );
  8. end BCD_Excess;
  9.  
  10. architecture Wspolbiezne of BCD_Excess is
  11. begin
  12.  
  13. -- E(3) <= not ( (not B(3) and not B(2))
  14. -- or (not B(3) and not B(1) and not B(0)) );
  15. -- E(2) <= (not B(2) and B(0)) or (not B(2) and B(1))
  16. -- or (B(2) and not B(1) and not B(0));
  17. -- E(1) <= (not B(1) and not B(0)) or (B(1) and B(0) );
  18. -- E(0) <= not B(0);
  19.  
  20.  
  21. --E <= B+3;
  22. process(B)
  23. begin
  24. -- case B is
  25. -- when "0000" => E <= "0011";
  26. -- when "0001" => E <= "0100";
  27. -- when "0010" => E <= "0101";
  28. -- when "0011" => E <= "0110";
  29. -- when "0100" => E <= "0111";
  30. -- when "0101" => E <= "1000";
  31. -- when "0110" => E <= "1001";
  32. -- when "0111" => E <= "1010";
  33. -- when "1000" => E <= "1011";
  34. -- when "1001" => E <= "1100";
  35. -- when others => E <= "----";
  36. -- end case;
  37.  
  38. if B < 10 then
  39. E <= B + 3;
  40. else
  41. E <= "0000";
  42. end if ;
  43.  
  44.  
  45. end process;
  46. end Wspolbiezne;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement