Converted signed 16 Bit to unsigned?

S

Steffen Koepf

Hello,

I have a AD Converter that delivers a 16 Bit signed value 8000 - 0 - 7FFF

I want to convert this to unsigned 16 Bit from 0 - 8000 - FFFF

by

signal RecRegA : std_logic_vector (15 downto 0);

signal RecRegA1 : std_logic_vector (15 downto 0);


RecRegA1 <= std_logic_vector(unsigned(RecRegA) + 32768);


This works in the lower 3/4 range. But as soon as the result exceeds 7FFF
the result is unpredictable. Why?

Thanks in advance,

Steffen
 
G

Gabor

Steffen said:
Hello,

I have a AD Converter that delivers a 16 Bit signed value 8000 - 0 - 7FFF

I want to convert this to unsigned 16 Bit from 0 - 8000 - FFFF

by

signal RecRegA : std_logic_vector (15 downto 0);

signal RecRegA1 : std_logic_vector (15 downto 0);


RecRegA1 <= std_logic_vector(unsigned(RecRegA) + 32768);


This works in the lower 3/4 range. But as soon as the result exceeds 7FFF
the result is unpredictable. Why?

Thanks in advance,

Steffen
That's a lot of conversions. All you really need to do is invert the
MSB of the first vector. What libraries are you using?

-- Gabor
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top