library ieee;
use ieee.std_logic_1164.all;
--use ieee.std_logic_arith.all;

package NEED_IT_TO_COMPILE is
  function ROTATE_LEFT2(VECTOR : in std_logic_vector;
                       N : in integer) return std_logic_vector;
end package;

package body NEED_IT_TO_COMPILE is
  function ROTATE_LEFT2(VECTOR : in std_logic_vector;
                       N : in integer) return std_logic_vector is
    variable NEW_VECTOR : std_logic_vector(VECTOR'range);
    alias TEMP_NEW : std_logic_vector(VECTOR'length-1 downto 0) is NEW_VECTOR;
  begin
    TEMP_NEW := VECTOR;
    if (N > VECTOR'LENGTH) then
      report "N is too large"
      severity warning;
    else    
      TEMP_NEW := TEMP_NEW(TEMP_NEW'length-N-1 downto 0) 
              & TEMP_NEW(TEMP_NEW'length-1 downto TEMP_NEW'length-N);
    end if;
    return TEMP_NEW;
  end ROTATE_LEFT2;
end package body;

library ieee;
use ieee.std_logic_1164.all;
use work.need_it_to_compile.all;

entity test_rotate is
end test_rotate;

architecture test of test_rotate is
  signal a : std_logic_vector(45 to 59) := "100X-LLWWUZ1011";
  signal b : std_logic_vector(63 downto 56) := "11111101";
  signal c, h, i : std_logic_vector(0 to 14);
  signal d : std_logic_vector(7 downto 0);
begin
  process
    variable e : integer := 5;
    variable f : integer := 0;
    variable g : integer := 10;
  begin
    c <= rotate_left2(a, g);
    d <= rotate_left2(b, f);
    h <= rotate_left2(a, e);
    i <= rotate_left2(a, 50);
    wait;
  end process;
end test;
