logical left shifter or latch ??

Discussion in 'VHDL' started by dangerlee, May 5, 2004.

  1. dangerlee

    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;
     
    dangerlee, May 5, 2004
    #1
    1. Advertising

  2. 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" <> schreef in bericht
    news:...
    > 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;
     
    Egbert Molenkamp, May 5, 2004
    #2
    1. Advertising

  3. 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
     
    Mike Treseler, May 5, 2004
    #3
  4. dangerlee

    dangerlee Guest

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

    "Egbert Molenkamp" <> wrote in message news:<c7aooe$nvi$>...
    > 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, May 7, 2004
    #4
  5. 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" <> wrote in message
    news:...
    > thankx your help.
    > adding an extra line can make a multi-source problem.
    >
    > "Egbert Molenkamp" <> wrote in message

    news:<c7aooe$nvi$>...
    > > 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
    > >
    > >
     
    Egbert Molenkamp, May 7, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fano
    Replies:
    9
    Views:
    2,248
    Ray Andraka
    Oct 16, 2003
  2. ALuPin

    Barrel shifter

    ALuPin, Feb 18, 2004, in forum: VHDL
    Replies:
    1
    Views:
    1,432
    Jonathan Bromley
    Feb 18, 2004
  3. ALuPin
    Replies:
    0
    Views:
    673
    ALuPin
    Feb 20, 2004
  4. dlamoris
    Replies:
    0
    Views:
    885
    dlamoris
    Oct 26, 2006
  5. VHDL_HELP

    help for "sll" shift left logical

    VHDL_HELP, Mar 6, 2007, in forum: VHDL
    Replies:
    4
    Views:
    757
Loading...

Share This Page