Child pages
  • Marius Orehovschi's CS232 Project 2: Double Sevens
Skip to end of metadata
Go to start of metadata

In this project I learned how to create a combinational circuit using VHDL that displays numbers on seven segment displays. I used the seven segment display implementation to build a really simple VHDL adder which I ran on the DE1 board.

Displaying Digits

To represent a digit on a seven segment display, one needs to turn off the corresponding segments ('0' corresponds to a lit segment and '1' to a segment turned off). When implementing my display circuit I found it easiest to work with one segment at a time and use a truth table that shows what digits need the particular segment to be turned off.

Below I have my truth table showing what digits need segment with index 6 to be turned off:

(segment 6 needs to be turned off when showing 0, 1, 7, and 12 a.k.a. 'C')

I used a simple VHDL file called sevenseg that mapped a 4-bit number to a 7 bit combination representing a 7-digit display.

Here is what my final display circuit looks like:

And here is a video of it in action, using a 24MHz built-in clock and a 28-bit counter as the clock signal:

Simple Adder

I then used the seven segment display circuit to display two numbers on the two right displays (as single digit hexadecimals) and their sum as a two-digit hexadecimal on the two left displays.

For the addition operation, I wrote a simple VHDL file that augments each input with a leading '0' and assigns the result of their addition to a 5-bit number. For the display, I connected the most significant bit of the result and three bits that are always 0 to the left most display and the 4 remaining bits to the middle left display. Here are two images of my final circuit:

And a video of it in action:


In this project, I learned how to write circuit components in VHDL. I used this knowledge to display 4-bit numbers on 7-digit displays and to implement a simple adder.