issue converting of std_logic_vectors into integers

Discussion in 'VHDL' started by Andy Luotto, Sep 12, 2008.

  1. Andy Luotto

    Andy Luotto Guest

    i am having troubles to convert std_logic_vectors into unsigned
    integers.
    std_logic_vectors comes from a DUT i got for verification (no
    question to use signed or unsiged instad)
    I would like that 0x4b8 (11 bit std_logic vector, with MSB set to 1)
    will be converted into an integer as 0x4b8
    BUT the following code (please consider that i use std_logic_unsigned
    instead of std_logic_signed)

    integer cordic_complex_int_o
    cordic_complex is a std_logic_vector (11 downto 0)
    cordic_complex_int <=
    ieee.std_logic_unsigned.conv_integer(cordic_complex_out);

    i get cordic_complex_int_o 0xfffffcb8, i.e. bit 11 is ign extended

    please help to find where i am wrong

    cheers
     
    Andy Luotto, Sep 12, 2008
    #1
    1. Advertising

  2. Andy Luotto

    KJ Guest

    On Sep 12, 11:04 am, Andy Luotto <> wrote:
    > i am having troubles to convert std_logic_vectors into unsigned
    > integers.
    > std_logic_vectors comes from a DUT i got for verification  (no
    > question to use signed or unsiged instad)
    > I would like  that  0x4b8 (11 bit std_logic vector, with MSB set to 1)
    > will be converted into an integer as 0x4b8
    > BUT the following code (please consider that i use std_logic_unsigned
    > instead of std_logic_signed)
    >
    > integer cordic_complex_int_o
    > cordic_complex is a std_logic_vector (11 downto 0)
    > cordic_complex_int <=
    > ieee.std_logic_unsigned.conv_integer(cordic_complex_out);
    >
    > i get cordic_complex_int_o 0xfffffcb8, i.e. bit 11 is ign extended
    >
    > please help to find where i am wrong
    >
    > cheers


    1. Don't use std_logic_unsigned and conv_integer, use numeric_std
    instead it is an actual standard.
    2. cordic_complex_int <=
    ieee.numeric_std.to_integer(unsigned(cordic_complex_out));

    KJ
     
    KJ, Sep 12, 2008
    #2
    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. eneko
    Replies:
    2
    Views:
    1,943
    eneko
    Nov 8, 2004
  2. Replies:
    8
    Views:
    4,691
  3. ohaqqi
    Replies:
    3
    Views:
    8,684
    Daniel Kho
    Oct 18, 2006
  4. Replies:
    5
    Views:
    838
  5. Richard Nicholas
    Replies:
    11
    Views:
    329
Loading...

Share This Page