Re: the reach of VHDL



Hi,

Bond wrote:
I have to use the
formula A=(t1/t2-50)/12.5. can a hardware module process this kind of
formula or it should be left for microblaze.

the formula is not perfectly clear but I can infer a few things from past readings,
particularly from the ever inspiring DSP litterature.

The "/12.5" is clearly coming from a power of two, just do the maths :
*1 /1
*2 /(1/2)=/0.5
*4 /(1/4)=/0.25
*8 /(1/8)=/0.125
so if you divide by 0.125, you multiply by 8
Since you divide by 12.5, you actually use another 100x factor.

now : when you multiply by 8, you add 3 LSB (you add no information, these LSB remain zeroed).
For the 100x factor, you can "scale" the whole algorithm with this factor.
That is : the 100x multiply is only done by a display interface (just move the decimal point
when you printf() it).

This means that you don't need to perform the /12.5 division at all in VHDL.
Also, look at Digital Signal Processing sites and books, because
this domain uses a lot of "fixed point" binary representation
(you clearly don't need floating point numbers here !)

Now, the "-50" term is unclear.
It is either the data that was sampled 50ms ago, or a "magic constant"...

This kind of division may be handled with a multi-cycle Newton-Raphson technique,
which uses multiplies and add/sub operators.

Or you can use a simple 1-bit-per-cycle divider if speed allows it, and space is constrained
(probably the best solution).

BTW, beware of the obvious case of x/0...

prashanta
yg

--
http://ygdes.com / http://yasep.org
.



Relevant Pages

  • Re: multiply/divide algorithm
    ... yes there are algorithms to do multiply and divide. ... fixed-point multiplies. ... I'm sorry that responses to your post weren't all attempting to be helpful ...
    (comp.lang.verilog)
  • Re: [PATCH] SLAB : use a multiply instead of a divide in obj_to_index()
    ... can be used from other parts of the kernel as well? ... AFAIK this particular divide is the only one that hurts performance on ... s for the version using multiplies ... When some objects are allocated by one CPU but freed by another CPU we can ...
    (Linux-Kernel)
  • Re: Fast Binary to BCD method on ARM9 with huge numbers?
    ... The legacy codebase works in BCD, ... I also need all the digits, ... For a simple improvement, instead of dividing my ten, divide by ... If you've got an ARM with long multiplies, ...
    (comp.arch.embedded)
  • Re: Divide instruction in IA64
    ... > just as fast as a real divide? ... along the line but the 1992 Alpha Architecture Handbook says: ... Having prior knowledge of the possible sizes of the divisor ... number of multiplies to about five (compared to a best case of one and a ...
    (comp.os.vms)