D
dangerlee
Guest
I try to establish a logical left shifter.
Synthesizer XST synthesizes a 32-bit latch.
I want to eliminate latch.
How can I do?
Thanks!!
-------------------------------------------------------------------
entity barrelshifter is
port(
BS_value :in std_logic_vector(31 downto 0);
BS_amount :in std_logic_vector(5 downto 0);
BS_operand2 ut std_logic_vector(31 downto 0)
);
end barrelshifter;
architecture Behavioral of barrelshifter is
constant cZeroSpace : std_logic_vector(31 downto 0) :=X"00000000";
signal sAmount : integer;
begin
sAmount <= conv_integer(BS_amount);
process(sAmount, BS_value)
begin
case sAmount is
when 0 =>
BS_operand2 <= BS_value;
when 1 to 31 =>
for i in 1 to 31 loop
if i = sAmount then
BS_operand2 <= BS_value((31-i) downto 0) & cZeroSpace((i-1) downto 0);
end if;
end loop;
when others =>
BS_operand2 <= cZeroSpace;
end case;
end process;
end Behavioral;
Synthesizer XST synthesizes a 32-bit latch.
I want to eliminate latch.
How can I do?
Thanks!!
-------------------------------------------------------------------
entity barrelshifter is
port(
BS_value :in std_logic_vector(31 downto 0);
BS_amount :in std_logic_vector(5 downto 0);
BS_operand2 ut std_logic_vector(31 downto 0)
);
end barrelshifter;
architecture Behavioral of barrelshifter is
constant cZeroSpace : std_logic_vector(31 downto 0) :=X"00000000";
signal sAmount : integer;
begin
sAmount <= conv_integer(BS_amount);
process(sAmount, BS_value)
begin
case sAmount is
when 0 =>
BS_operand2 <= BS_value;
when 1 to 31 =>
for i in 1 to 31 loop
if i = sAmount then
BS_operand2 <= BS_value((31-i) downto 0) & cZeroSpace((i-1) downto 0);
end if;
end loop;
when others =>
BS_operand2 <= cZeroSpace;
end case;
end process;
end Behavioral;