Apollo 11 Trig Was Brief

In this day and age where a megabyte of memory isn’t a big deal, it is hard to recall when you had to conserve every byte of memory. If you are a student of such things, you might enjoy an annotated view of the Apollo 11 DSKY sine and cosine routines. Want to guess how many lines of code that takes? Try 35 for both.

Figuring out how it works takes a little knowledge of how the DSKY works and the number formats involved. Luckily, the site has a feature where you can click on the instructions and see comments and questions from other reviewers.

Continue reading “Apollo 11 Trig Was Brief”

CORDIC Brings Math To FPGA Designs

We are always excited when we see [Hamster] post an FPGA project, because it is usually something good. His latest post doesn’t disappoint and shows how he uses the CORDIC algorithm to generate very precise sine and cosine waves in VHDL. CORDIC (Coordinate Rotation Digital Computer; sometimes known as Volder’s algorithm) is a standard way to compute hyperbolic and trigonometric functions. What’s nice is that the algorithm only requires addition, subtraction, bit shifts, and a lookup table with an entry for each bit of precision you want. Of course, if you have addition and negative numbers, you already have subtraction. This is perfect for simple CPUs and FPGAs.

[Hamster] not only has the VHDL code but also provides a C version if you find that easier to read. In either case, the angle is scaled so that 360 degrees is a full 24-bit word to allow the most precision. Although it is common to compute the result in a loop, with the FPGA, you can do all the math in parallel and generate a new sample on each clock cycle.

Continue reading “CORDIC Brings Math To FPGA Designs”