logical left shifter or latch ??

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 :eek: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;
 
Maybe the tool does not recognise that BS_operand2 always gets a value.
You can try to help the tool by adding an extra line; see below

begin
BS_operand2<=X"00000000"; -- ADDED
case sAmount is

Egbert Molenkamp


"dangerlee" <nkoplm@pchome.com.tw> schreef in bericht
news:f018b60b.0405042340.4af45242@posting.google.com...
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 :eek: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;
 
dangerlee wrote:
I try to establish a logical left shifter.
Synthesizer XST synthesizes a 32-bit latch.
There may be a logical error in your code.

I want to eliminate latch.
How can I do?
By writing and using a VHDL simulation testbench.
Run the testbench, watch the waveforms,
trace the code, edit, recompile, repeat.

-- Mike Treseler
 
thankx your help.
adding an extra line can make a multi-source problem.

"Egbert Molenkamp" <molenkam_no_spam@cs.utwente.nl> wrote in message news:<c7aooe$nvi$1@ares.cs.utwente.nl>...
Maybe the tool does not recognise that BS_operand2 always gets a value.
You can try to help the tool by adding an extra line; see below

begin
BS_operand2<=X"00000000"; -- ADDED
case sAmount is

Egbert Molenkamp
 
Check your code. You probably added the line at the wrong position!
The statement
BS_operand2<=X"00000000";
should be IN the process where you already assign to BS_operand2. So just
above the case statement.
This can never cause a multi-source problem.
In fact the external behaviour is the same assuming that you always assigned
a value to BS_operand2 in this process.

Does the tool inform you for wich object a latch is used? I assumed it is
for BS_operand2.
In the case statement you assign always a value to BS_operand2. But if a
tool can not detect it it will use a latch.
Therefore I suggested to add the additional statement at first statement in
the process. Now the tool recognise that it does not need a latch for
BS_operand2.

I'm curious to know if this helps.

Egbert Molenkamp


"dangerlee" <nkoplm@pchome.com.tw> wrote in message
news:f018b60b.0405061807.778db851@posting.google.com...
thankx your help.
adding an extra line can make a multi-source problem.

"Egbert Molenkamp" <molenkam_no_spam@cs.utwente.nl> wrote in message
news:<c7aooe$nvi$1@ares.cs.utwente.nl>...
Maybe the tool does not recognise that BS_operand2 always gets a value.
You can try to help the tool by adding an extra line; see below

begin
BS_operand2<=X"00000000"; -- ADDED
case sAmount is

Egbert Molenkamp
 

Welcome to EDABoard.com

Sponsor

Back
Top