Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Help with Efficient Conversion?

I am looking to convert a 16bit number(X) to another 16 bit number(Y). X is a count coming from a Tach output on a Fan. Y is the fan's corresponding RPM. (note: this is a inverse relationship)

The relationship is Y = 60 / (X*1.706e-6)

To keep it fixed point so far the best I have come up with is 2 divides:

First I = X / 58 (I is intermedite value) then take 606000 / I to get Y.

X ranges from about 5858 to 30000.

I am worried about the real estate of 2 divides, since I will need 8 channels of this (8x2=16 divides) on my cyclone II.

Any help improving this calculation? Thanks!

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    How often do you need a result? If you need this result several million times a second, yes, I'd worry about the area. If it's once per millisecond, then don't use the LPM_DIVIDE, but write a tail divider that gives a result once per 32 clock cycles or so.

    Best regards,

    Ben
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    if the clock rate is much higher than the sample rate, you can TDM or channelize your arithmetic to save resources

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I you want exactly a calculation of the given expression, I would calculate 35294118/X, using an serial divider.