PDA

View Full Version : vhdl code

Sara
02-22-2007, 04:48 AM
HI

http://forums.parallax.com/images/smilies/rolleyes.gif·http://forums.parallax.com/images/smilies/rolleyes.gif·http://forums.parallax.com/images/smilies/rolleyes.gif

I have problem with VHDL code how can i use number like 21,42333 as integer· in VHDL to calculate this

equation:

q=tan-1(sin (x-y)/(cos z*tan d - sin z *cos(x-y))

all values x,y,z,d is input must be in integer·

http://forums.parallax.com/images/smilies/smhair.gif·http://forums.parallax.com/images/smilies/smhair.gif http://forums.parallax.com/images/smilies/smhair.gif http://forums.parallax.com/images/smilies/shocked.gif http://forums.parallax.com/images/smilies/shocked.gif http://forums.parallax.com/images/smilies/shocked.gif

Mike Green
02-22-2007, 05:05 AM
What units are being used for the transcendental functions? Are they in degrees? Are they in radians? Are they in some other units?

If they're in degrees, you're probably not going to be able to use the fractional portion of a number like 21.42333 except perhaps in the x-y terms. How are the transcendentals computed? Are they done in floating point? Are they done by table lookup? How are the results represented? How are you expected to compute the intermediate terms of your equation? In floating point?

You're going to have to answer some of these questions before anyone here could even venture a suggestion.

Sara
02-22-2007, 05:47 AM
these values from gps . It is in degrees ,min,second i have to use it to calculate this equation
aNd use the value of the output to move the stepper motor by using FPGA.

SteveW
02-22-2007, 09:46 PM
Err, this is going to need a pretty big FPGA, a usable floating point library and a substantial amount of effort.
If it was me, I'd be looking at compiling up a small micro, and doing the floating point work in software. At that point, you might wonder if the FPGA was the right choice after all.
At the moment, your project isn't very well defined, but looks a lot like a moneypit and timepit. If you're doing this for its educational value, then go for it. You'll learn a huge amount before finishing it...
(Note that VHDL for simulation and VHDL for synthesis are rather different worlds)

Steve