Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   VHDL (http://www.velocityreviews.com/forums/f18-vhdl.html)
-   -   signed to unsigned (http://www.velocityreviews.com/forums/t22562-signed-to-unsigned.html)

Patrick 06-07-2004 09:34 AM

signed to unsigned
 
hello,

I have to convert a signed signal to an unsigned one... I tried this code ?
What do you think about ? I just invert the sign bit (bit 13)...

But i forgot a part of resolution...


-- Conversion signed -> unsigned
CONV_US : process (clk_smp,reset)
begin
if reset = '1' then I_filter_14_US <= (others => '0');
Q_filter_14_US <= (others => '0');
elsif (clk_smp'event and clk_smp='1') then
I_filter_14_US(13 downto 13) <= not I_filter_14(13 downto 13);
I_filter_14_US(12 downto 0) <= I_filter_14(12 downto 0);
Q_filter_14_US(13 downto 13) <= not Q_filter_14(13 downto 13);
Q_filter_14_US(12 downto 0) <= Q_filter_14(12 downto 0);
end if;
end process CONV_US;

Ralf Hildebrandt 06-07-2004 01:59 PM

Re: signed to unsigned
 
Patrick wrote:

> I have to convert a signed signal to an unsigned one...


For conversions look into the packages, that are provided by your EDA
tool vendor.
If you use IEEE.numeric_stad.all, take the following piece of code:

A_us<=unsigned(B_s);


Ralf



All times are GMT. The time now is 09:47 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57