convertion real to std_logic_vector

Mar 24, 2007 2 Replies

Hi , please my problem is how to use real constant for example 0.1913 and multiply it with an std_logic_vector(7 downto 0) and as an exmple to remplace reals b std_logic_vector , i did find that



-- Y = 0.299 * R.000 + 0.587 * G.000 + 0.114 * B.000 -- Y = 0x132 * R + 0x259 * G + 0x074 * B -- -- Cr = 0.713(R - Y) -- Cr = 0.500 * R.000 + -0.419 * G.000 - 0.0813 * B.000 -- Cr = (R >> 1) - 0x1AD * G - 0x053 * B



-- Cb = 0.565(B - Y) -- Cb = -0.169 * R.000 + -0.332 * G.000 + 0.500 * B.000 -- Cb = (B >> 1) - 0x0AD * R - 0x153 * G



please i cant get how the reals are converted like that (hexadecimal), is any one can explain it to me ? please and thank you



Represent your real constants as two's complement fixed-point fractions. For instance, if you're going to use the hardware multiplier in a Xilinx FPGA, it is convenient to use 18-bit representation, so you multiply

0.1913 by 2^17, resulting in a fixed-point constant 0x061f2.

REALLY THANK YOU FOR YOUR EXPLAINATION THANK YOU , i did get it now thank you

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required