TITLE: Project #2: LED Display Gizmo (looper)
AUTHOR: Chuck McManis
LAST UPDATE: 04-Apr-2004

Ok, so I’ve got my 10hz oscillator chip running, now what ? Well we’re designing chips right? So the next step seems to be how can I use the chip I just designed in a new project and that became the next step on the path to VHDL enlightenment.

The LED Looper project uses a 7 segment display (8 LEDs total if you count the decimal point). The goal of the project was to re-use the clock generator I built in project #1 in a new project.

The VHDL construct that includes other VHDL is the ‘component’ statement. I think of this statement to be loosely analogous to the C prototype statement. It says I know there is a component named foo that has the following pins. Then later you can hook up an instance of foo and connect it to your internal signals.

An alternative way of doing this is to generate a schematic symbol for each of your VHDL “sub” parts, then wire them together in the schematic. That is visually pretty appealing and perhaps a good compromise for small circuits.

One interesting thing in the WebPACK tools is that when you save the VHDL file that has both the component statement and the instantiation of that component in the same file, the tool re-organizes the list box to make the component a “child” of the main design. That is cute but beware when you go to synthesize something, if you don’t have the master component selected it won’t get synthesized! Only the highlighted (aka selected) component gets synthesized and its children (or dependent) components! Not realizing this lead to some interesting non-circuits.

One of the neat VHDL things I learned from this project was how the & operator works on type STD_LOGIC_VECTOR. Instead of treating it like the logical function AND, this operator is the concatenation operation. Thus the expression ‘1’ & “000” becomes “1000” not “0” as some C programmers might guess.

The Project

Design a circuit that repeatedly illuminates six (6) LEDs in sequence. Use the CLOCK_10HZ circuit from Project 1 as a component in your new design. To test this project you will need a seven segment LED display (there is one on-board the XESS board, the BED-SPARTAN2+ board will need to use a plug-on board.) This circuit should define the following pins.

Signal Definitions
Pin Direction Description
CLK_IN IN This pin should be connected to the 24Mhz on board oscillator at location P77.
LEDS[5..0] OUT Connect these pins to the outer segments (labeled a-f) of a seven segment LED display. For a BED-7SEGMENT-DISPLAYS board, connect it to J4 and use locations P179, P180, P175, P174, P173 and P178.
RESET* IN This active low pin should reset the LED display to the point where segment A is the only LED illuminated. Connect it to the test jumper at location P61.

This project builds on the first one by using the clock generator from project 1 as a “component” in this one. There are several styles of doing hardware design with VHDL and one of them is to define a bunch of small chips (like our clock generator) and then “wire them up” as we’ve done here to some LEDs in a 7 segment display.

Purpose

The purpose of this project is to practice using the ‘component’ keyword in VHDL to instantiate a previously solved problem into the current model. A very useful technique since you can build a bunch of simple parts, and then wire them together in a “super part” and build any circuit you want really. You could for example define components for AND, OR, NAND, and XOR functions then wire them up as you might chips on a circuit board. This is a very easy to understand process for hardware types (less easy for software types.)

Discussion

The LED looper is a circuit that illuminates 6 of the seven segments of an LED display in sequence. This creates the illusion that an LED is looping around the center of the display.

The big feature of this project will be that you instantiate a CLOCK_10HZ component and then hook it up internally to drive your segment driver circuit. It is helpful to remember when doing this project that, unlike software, you can assign a signal in one statement and still use its previous value. This will help when you are implementing a re-circulating shift register that moves one active bit around and around.

Going Further

This is a fun circuit and it makes a great little display. If you’re into “active” jewelry you could make people dizzy. Once you’ve got the basic LED going in a loop, try extending it to multiple displays. There are lots of ways to take this project forward.