Advertisement
grubent

blokB

Nov 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.57 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.std_logic_1164.all;
  3. use IEEE.numeric_std.all;
  4.  
  5. entity blokB is
  6. port
  7. (
  8.     B_in : in std_logic_vector(5 downto 0);
  9.     B_out : out std_logic_vector(4 downto 0)
  10. );
  11. end entity;
  12.  
  13. architecture structB of blokB is
  14. begin
  15.  
  16. process(B_in)
  17. constant i : std_logic_vector(8 downto 0):= "101010101";
  18. variable j : std_logic_vector(14 downto 0);
  19. begin
  20. j := std_logic_vector(unsigned(B_in) * unsigned(i)) ;
  21.     if j(9)='1' then
  22. B_out <= std_logic_vector(unsigned(j(14 downto 10)) + 1);
  23.     else
  24. B_out <= j(14 downto 10);
  25.     end if;
  26. end process;
  27. end architecture;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement