www.pudn.com > jaguar2s.zip > LSHIFTER.VHD
--************************************************************
--************************************************************
--*----------------------------------------------------------*
--*|Version :1.0 |
--*|Date of Last Revision :12/23/1998 |
--*----------------------------------------------------------*
--************************************************************
-- Copyright (C) 1999 Drey Enterprises Inc. All Rights Reserved.
--************************************************************
-- Warning: This file is protected by Federal Copyright Law,
-- with all rights reserved. It is unlawful to reproduce
-- any parts of this file, in any form, without expressed
-- written permission from Drey Enterprises Inc. This Copyright
-- is actively enforced.
--************************************************************
--************************************************************
library ieee;
use ieee.std_logic_1164.all;
entity Lshifter is
generic(
EXP_WIDTH :integer := 5;
WORD_WIDTH :integer := 32
);
port(
shftval :in std_logic_vector(EXP_WIDTH-1 downto 0);
a :in std_logic_vector(WORD_WIDTH/2-1 downto 0);
b :out std_logic_vector(WORD_WIDTH/2-1 downto 0)
);
end Lshifter;
architecture behavior of Lshifter is
begin
process(shftval,a)
variable i,j :integer;
variable a_prev :std_logic_vector(WORD_WIDTH/2-1 downto 0);
variable a_next :std_logic_vector(WORD_WIDTH/2-1 downto 0);
variable pow2 :integer;
begin
a_prev := a;
pow2:=1;
for i in 0 to EXP_WIDTH-1 loop
for j in 0 to WORD_WIDTH/2-1 loop
if (shftval(i) = '1') then
if (j-pow2 < 0) then
a_next(j) := '0';
else
a_next(j) := a_prev(j-pow2);
end if;
else
a_next(j) := a_prev(j);
end if;
end loop;
a_prev := a_next;
pow2:= pow2*2;
end loop;
b <= a_next;
end process;
end behavior;