Q:

8 bit shifter -VHDL

I am trying to use xilinx tools to define and simulate an 8-bit shifter in VHDL that can shift or rotate left or right by 0,1,2 or 3 bit positions. I'm trying to implement this on a digilent basys 2 board.
I am just beginning to learn vhdl programming. Can anyone please help?
Can anyone show me what the vhdl code should look like?

A:

shift and rotate functionality can be found in numeric_std package. below is some sample code as starting point:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;

entity EXAMPLE is
Port ( 
    clk : in  STD_LOGIC; -- master clock
    enable : in std_logic; -- when '1' --> rotate
    dir : in  STD_LOGIC; -- when '1': right, when '0': left
    nr : in  STD_LOGIC_VECTOR (1 downto 0); -- number of steps to rotate
    din : in  STD_LOGIC_VECTOR (7 downto 0); -- in vector
    dout : out  STD_LOGIC_VECTOR (7 downto 0)); -- out vector
end EXAMPLE;

architecture Behavioral of EXAMPLE is

begin

shifter: process(clk)
begin
   if rising_edge(clk) then
      if enable='1' then
         if dir='0' then -- right
            dout<=std_logic_vector(rotate_right(unsigned(din),to_integer(unsigned(nr))));
         else -- left
            dout<=std_logic_vector(rotate_left(unsigned(din), to_integer(unsigned(nr))));
         end if;
      end if;

    end if;
 end process shifter;
end Behavioral;

