Advertisement
Guest User

shifter

a guest
Jul 7th, 2015
172
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.  
  4. entity DIVISOR is
  5.     Port (
  6.         CLK : in std_logic;
  7.         D : in   std_logic_vector (3 downto 0);
  8.         A : in   std_logic_vector (7 downto 0);
  9.         S : out  std_logic_vector (7 downto 0));
  10. end DIVISOR;
  11.  
  12. architecture comportamento of DIVISOR is
  13. begin
  14.     process(CLK)
  15.     begin
  16.         if CLK'EVENT AND CLK = '1' THEN
  17.             if (D="0010") then
  18.                 S <= "0" & A(7 downto 1);
  19.             elsif (D="0100") then
  20.                 S <= "00" & A(7 downto 2);
  21.             elsif (D="1000") then
  22.                 S <= "000" & A(7 downto 3);
  23.             end if;
  24.         end if;
  25.     end process;
  26. end comportamento;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement