FPGA Calculator Uses Joystick

FPGAs are great fun, but sometimes you need a few starter projects under your belt. These projects might be something you could just as well do with a CPU, but you have to start somewhere. [LambdaPI] recently shared a 4-bit calculator created using an FPGA, and you can see it in the video below.

The calculator uses a Papilio FPGA board and a LogicStart accessory board for the display and switches. The Papilio normally uses schematic-based entry and Arduino code, but [LambdaPI] used VHDL. You enter the two 4-bit numbers on the 8 switches and then the joystick selects one of four operations (add, subtract, multiply, and divide).

Inside the code, you’ll see that the FPGA does all four calculations at once. The joystick just selects which outputs go to the display. Each module also decodes the LEDs separately which is an interesting design choice. On the negative side, it duplicates a lot of code, but there is no need to change the format with for example division (which shows as a fixed-point decimal number).

We’ve seen Papilio boards doing duty as a 128 MHz Z80 CPU. Or you can use one to create an Ambilight. However, as a first project, this calculator can really fit the bill. If you don’t have any hardware, you could experiment with using EDA Playground.

9 thoughts on “FPGA Calculator Uses Joystick

    1. Most of the papillio boards are ancient spartan-3 devices. The slightly more recent boards are the spartan-6, but the toolchain for those is almost 5 years old now.

      Someone please release some affordable 7-series boards.

      1. I’m there, dude 🙂
        If nothing else it is a great conversation starter and if you are basic math, it will look like you are working on something more complex.

  1. Several FPGA development boards have devices that can run at hundreds of MHz, then choke the performance with [relatively] low speed interfaces. Depending on you choice of display [LED / LCD screen] a calculator actually makes sense, in that you can reduce the speed, measure the impact on power consumption, and still have a functional device.

    Mind you, finding a decent keyboard & display combination is still a major exercise.

  2. Quote [ Al Williams]: “The Papilio normally uses schematic-based entry and Arduino code”

    I have both the Papilio one (not the pro) and a LogicStart MegaWing.

    The base module Papilio does have HDL for a Arduino like board that is compatible with the Arduino IDE as far as I know but I have never used that.

    I use the Papilio purely for VHDL which I write in the Xilinx ISE. If I want something Arduino like then I just use an actual Arduino. Though the Arduino running on this FPGA would be very fast indeed and have some advantages.

    Also, in relation to the LogicStart MegaWing, it is designed as a learning board for VHDL and there are beginners tutorials aimed specifically for this add-on board.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.