The method allow exact tabulation of 2^N values of sine and cosine. It is extremely fast, simple and accurate.

It is based on two formulas:

cos(p) = (cos(p+h) + cos(p-h)) / (2.cos(h))

cos(h/2) = sqrt((1 + cos(h)) / 2)

The principle is to compute the value beetwen already computed values, for this you use the first formula. This double the value count in the table.

Then you use the second formula to compute the ponderation factor for next step.

If your tabulation bounds are PI/2, PI: you will first compute the value in between

but first compute the ponderation factor : cos(PI/4) = sqrt((1 + cos(PI/2)) / 2)

cos(PI/4) = (cos(PI/2) + cos(0)) / 2(cos(PI/4))

then compute : cos(PI/8) = sqrt((1 + cos(PI/4)) / 2)

and :

cos(3PI/8) = (cos(PI/2) + cos(PI/4)) / 2(cos(PI/8))

cos(PI/8) = (cos(PI/4) + cos(0)) / 2(cos(PI/4))

then compute : cos(PI/16) = sqrt((1 + cos(PI/8)) / 2)

and :

cos(7PI/16) = (cos(PI/2) + cos(3PI/8)) / 2(cos(PI/16))

cos(5PI/16) = (cos(3PI/8) + cos(PI/4)) / 2(cos(PI/16))

cos(3PI/16) = (cos(PI/4) + cos(PI/8)) / 2(cos(PI/16))

cos(PI/16) = (cos(PI/8) + cos(0)) / 2(cos(PI/16))

And so on so forth. Notice I did not use any aproximation of PI.

In these calculations you add similar values so truncation errors are very low.

The only lib fucntion used here is square root in the vixinity of 1.

Thanks for your suggestion. One my aims of the challenge is to get more experience with Verilog. I might take a look at MyHDL in the future.

/Niels.

]]>Thanks for the tip! The power nice and stable; I checked with a scope.

I’m using the USB connector to power the board.

Regards,

Niels.

I hope so too! It is a big risk, but I don’t particularly like breadboarding — I’m too impatient 🙂

Regards,

Niels.