You are on page 1of 2

Lab: Rotating Lights

Purpose: Learn how to write VHDL code for simple controllers.

Problem:

Design and implement a controller that will make the six peripheral LED segments in a
7-segement LED display to move around in a clockwise or counterclockwise direction,
depending on the input of a switch W.

Instructions:

Since there are six light patterns, one for each LED being on and the rest of them off, we
can use six states and assign one light pattern to one state. Each state will go to the next
state in a sequential clockwise direction if the switch W is not pressed and to the previous
state in a sequential counterclockwise direction if W is pressed. The resulting state
diagram is shown below. The six output signals (a, b, c, d, e, and f) correspond to the six
peripheral segments in a 7-segment LED display. A 1 to the segment will turn on that
LED, while a 0 will turn it off.

fedcba = 000001 s0 s1 fedcba = 000010

W' W
W'
W a
W'
f b
fedcba = 100000 s5 s2 fedcba = 000100
e c
W' W' W d
W W'

s4 s3
fedcba = 010000 fedcba = 001000
W

Design this controller by using the VHDL code for the Number Guessing Game as a
template.

• The VHDL code for the Number Guessing Game is listed here.
• The clock divider code is listed here.
Bonus 10%:

The circuit for this rotating lights controller is shown below. Implement this circuit and
verify that it works exactly light your VHDL code.
W

f
D2 Q2
e a
Clk
Q'2 d f b
Clear
c e c
D1 Q1 b d
Clk
a
Q'1
Clear

D0 Q0
Clk
Q'0
Clear
Clock
Reset

You might also like