Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > issue converting of std_logic_vectors into integers

Reply
Thread Tools

issue converting of std_logic_vectors into integers

 
 
Andy Luotto
Guest
Posts: n/a
 
      09-12-2008
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_comple x_out);

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

please help to find where i am wrong

cheers
 
Reply With Quote
 
 
 
 
KJ
Guest
Posts: n/a
 
      09-12-2008
On Sep 12, 11:04*am, Andy Luotto <(E-Mail Removed)> 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_comple x_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_comple x_out));

KJ
 
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
Fully definable ports of array of std_logic_vectors? paragon.john@gmail.com VHDL 5 12-20-2007 07:09 PM
VHDL Query - Indexing / Arrays / std_logic_vectors X_Dreamer Hardware 2 10-31-2007 07:39 PM
adding std_logic_vectors in vhdl ohaqqi VHDL 3 10-18-2006 07:42 AM
VHDL -- Some sort of array of std_logic_vectors ? springer54@hotmail.com VHDL 8 03-05-2005 10:26 PM
Comparison between std_logic_vectors eneko VHDL 2 11-08-2004 04:24 PM



Advertisments