Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.41 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 Z_case of BCD_Excess is
  11.     --V1/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\
  12.    
  13.     --E(3)<= not((not B(3)and not B(2))or (not B(3) and not B(1) and not B(0)));
  14.     --E(2)<=(not B(2)and B(0)) or (not B(2) and B(1)) or (B(2) and not B(1) and not B(0));
  15.     --E(1)<=(not B(1) and not B(0)) or (B(1)and B(0));
  16.     --E(0)<= not B(0);
  17.    
  18.     --V2/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\
  19.    
  20.     --E <= B + 3;
  21.    
  22.     --V3/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\
  23.    
  24.     --process(B)
  25.     --begin
  26.     --  case B is
  27.     --      when "0000" => E <= "0011";
  28.     --      when "0001" => E <= "0100";
  29.     --      when "0010" => E <= "0101";
  30.     --      when "0011" => E <= "0110";
  31.     --      when "0100" => E <= "0111";
  32.     --      when "0101" => E <= "1000";
  33.     --      when "0110" => E <= "1001";
  34.     --      when "0111" => E <= "1010";
  35.     --      when "1000" => E <= "1011";
  36.     --      when "1001" => E <= "1100";
  37.     --      when others => E <= "----";
  38.     --  end case;
  39.     --end process;
  40.    
  41.     --V4/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\
  42. begin
  43.     process(B)
  44.     begin
  45.         if B < "1010" then
  46.             E <= B+3;
  47.         else
  48.             E <= "0000";
  49.         end if;
  50.     end process;
  51. end Z_case;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement