How do I scale a 9-b signed 2's complement data by 17/sqrt(21)?

My task is to scale up a 9-bit data by 17/sqrt(21) (= 3.7097), with the best precision possible. Without considering clipping and range issues, I am using multiplication by 59/16, which gives 0.599% error. What better approach can I use?

I am going to implement the calculation in ASIC, thus less complexity is what I am expecting.

Reply to
Mr. Ken
Loading thread data ...

Reply to
Peter Alfke

Well, within a same clock cycle. I am unable to have pipelining at the moment. Anyway, pipelined divider will become an option in later stage of my assignment.

I
Reply to
Mr. Ken

I

Thank you John_H. the 115/31 idea is interesting. I will make one and see how much resource it consumes. If resource consumption is fine, it will be greatly increase the precision of my design!

Reply to
Mr. Ken

5316/1433 Error=0.0001133%
Reply to
Zara

That's too much resource I guess. John_H's 115/31 offers very good precision, only if I can make a /31 as small as possible.

Reply to
Mr. Ken

Mr. Ken schrieb:

But I guess this is a starting point. How wide will the result be? Minimum is 11 bits. Having a precision greatert than 1/2^10 ~ 0.001 is useless. A signed 16 Bit bit result need no more then 1/2^15 ~ 0.00003

Hmm. Nice approach. But why not investigating further?

Y = X * M / D

D M error

16 59,3552 59 0,0059843114 32 118,7104 119 -0,0024395504 64 237,4208 237 0,0017723805 almost 11 bit signed 128 474,8416 475 -0,0003335849 256 949,6832 950 -0,0003335849 512 1899,3664 1899 0,0001929064 1024 3798,7328 3799 -0,0000703392 2048 7597,4656 7597 0,0000612836 almost 16 bit signed 4096 15194,9312 15195 -0,0000045278

So choose the precision you want.

The division is free when using powers of two. So all you need is a

6..14 bit multiplier.

Regards Falk

Reply to
Falk Brunner

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

References:

The 115/31 was the strangest idea offered. If you need the result in a single clock, please look *seriously* at the simple multiplier. These are designed as library elements for very fast results and can easily accommodate your "one clock cycle" requirement.

If your clock is 20 MHz, doing the 115/31 might be reasonable but it sure isn't single-clock friendly!

Another consideration: does this value get used somewhere that you can algebraically manipulate the values so a /31 or /sqrt(21) can be "pulled in" to other number manipulation?

PLEASE consider the multiplier.

Reply to
John_H

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.