issue converting of std_logic_vectors into integers

A

Andy Luotto

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
 
K

KJ

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top