Re: the reach of VHDL
- From: whygee <whygee@xxxxx>
- Date: Thu, 04 Jun 2009 03:22:33 +0200
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...
prashantayg
--
http://ygdes.com / http://yasep.org
.
- Follow-Ups:
- Re: the reach of VHDL
- From: Bond
- Re: the reach of VHDL
- References:
- the reach of VHDL
- From: Bond
- the reach of VHDL
- Prev by Date: Re: Secure netlist
- Next by Date: Re: Has anyone tried to install a Xilinx floating license? The documentation (UG631 (v 11.1.0) April 27, 2009) says that the required
- Previous by thread: Re: the reach of VHDL
- Next by thread: Re: the reach of VHDL
- Index(es):
Relevant Pages
|