floating number

D

Dkthechamp

Guest
Hi,

I am implementing a random number generator and need to muliply a
std_logic_vector by 2.3283064365e-10 value. Please suggest a
synthesizable method to do this multiplications.

Tools used:
Simulation: Modelsim 6.2
Synthesize: Xilinx ISE Web pack.

Thanks,
Deepak GUPTA
 
Dkthechamp wrote:

I am implementing a random number generator and need to muliply a
std_logic_vector by 2.3283064365e-10 value. Please suggest a
synthesizable method to do this multiplications.
There are easier ways to make a pseudo-random sequence,
but to answer your question, let's click up a calculator.

That's a pretty small fraction, so let's scale 1.0
as the roll-over count of a 64 bit register.
So for your example, the vector version of your fraction
would be 2**64 * 2.3283064365e-10 = 4294967295.9
Round off to an unsigned value: 4294967296 = x"0000040000000000"
Hmmm. That's a nice fraction.
Feels like a homework problem.
Unsigned multiplication is synthesizable, but you
will have to keep track of the scaling/decimal point manually.
Note that a multiply by a power of two is just a shift.

-- Mike Treseler
 
Mike Treseler wrote:

Dkthechamp wrote:

I am implementing a random number generator and need to muliply a
std_logic_vector by 2.3283064365e-10 value. Please suggest a
synthesizable method to do this multiplications.

There are easier ways to make a pseudo-random sequence,
but to answer your question, let's click up a calculator.

That's a pretty small fraction, so let's scale 1.0
as the roll-over count of a 64 bit register.
So for your example, the vector version of your fraction
would be 2**64 * 2.3283064365e-10 = 4294967295.9
Round off to an unsigned value: 4294967296 = x"0000040000000000"
Hmmm. That's a nice fraction.
Nice catch!

However, your conversion to hex is not correct, it should be 0x100000000
(2**32 decimal)

Using bc on the Unix command line:
% bc -l
obase=16
4294967296
100000000

--
Paul Uiterlinden
www.aimvalley.nl
e-mail addres: remove the not.
 
Paul Uiterlinden wrote:

Nice catch!
However, your conversion to hex is not correct, it should be 0x100000000
Nice catch also.
But now the correct answer is revealed :)

-- Mike Treseler
 
On May 28, 10:29 pm, Mike Treseler <mike_trese...@comcast.net> wrote:
Paul Uiterlinden wrote:
Nice catch!
However, your conversion to hex is not correct, it should be 0x100000000

Nice catch also.
But now the correct answer is revealed :)

-- Mike Treseler
Thanks guys :)
 
Mike Treseler wrote:

Nice catch also.
But now the correct answer is revealed :)
You started! :)

--
Paul Uiterlinden
www.aimvalley.nl
e-mail addres: remove the not.
 

Welcome to EDABoard.com

Sponsor

Back
Top