Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > logical left shifter or latch ??

Reply
Thread Tools

logical left shifter or latch ??

 
 
dangerlee
Guest
Posts: n/a
 
      05-05-2004
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;
 
Reply With Quote
 
 
 
 
Egbert Molenkamp
Guest
Posts: n/a
 
      05-05-2004
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" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed) om...
> 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;



 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      05-05-2004
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
 
Reply With Quote
 
dangerlee
Guest
Posts: n/a
 
      05-07-2004
thankx your help.
adding an extra line can make a multi-source problem.

"Egbert Molenkamp" <(E-Mail Removed)> wrote in message news:<c7aooe$nvi$(E-Mail Removed)>...
> 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
>
>

 
Reply With Quote
 
Egbert Molenkamp
Guest
Posts: n/a
 
      05-07-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> thankx your help.
> adding an extra line can make a multi-source problem.
>
> "Egbert Molenkamp" <(E-Mail Removed)> wrote in message

news:<c7aooe$nvi$(E-Mail Removed)>...
> > 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
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help for "sll" shift left logical VHDL_HELP VHDL 4 03-07-2007 05:15 PM
detecting overflow in arithmetic left shifter dlamoris VHDL 0 10-26-2006 06:53 AM
Barrel shifter compilation in QuartusII ALuPin VHDL 0 02-20-2004 01:40 PM
Barrel shifter ALuPin VHDL 1 02-18-2004 09:54 AM
How to implenetment an efficient shifter Fano VHDL 9 10-16-2003 08:58 PM



Advertisments