Orientation

Translate a lighting specification into sequential hardware

Design objective

Use the DE0-Nano onboard clock, reusable Verilog modules, and a finite state machine to control three two-colour bulbs. Each bulb contains one red LED and one blue LED; energizing both produces purple light.

Required pattern

  1. On reset, bulb 1 is red for 1 second.
  2. Bulb 1 turns off; bulb 2 is purple for 1 second.
  3. Bulb 2 turns off; bulb 3 is blue for 1 second.
  4. Bulb 3 becomes red for 1 second.
  5. Bulb 3 turns off; bulb 2 is purple for 1 second.
  6. The cycle repeats with bulb 1 red.
Required resources
ResourceQuantity
DE0-Nano and USB-Blaster connection1
Quartus Prime 25.1 Lite1
External LEDs: three red and three blue6
220 Ω resistors6
Breadboard and jumper wiresAs required
DE0-Nano User ManualVersion 1.9 or later board-equivalent reference
External-circuit safety

Disconnect board power before wiring or changing connections. Give every LED its own 220 Ω series resistor, verify LED polarity, use only the listed 3.3 V GPIO signals, and connect the circuit ground to a DE0-Nano GPIO-header GND pin. Inspect for shorts before powering the board.

Need a refresher?
→ Finite State Machines

States and sequence

Convert the specification into a complete state table

Choose five unique state names. For each step, enter the present state, the next state, six active-HIGH LED outputs, and the state duration. The next state in the final row must return to the state named in the first row.

Student-designed state table
StepPresent stateNext stateB1 redB1 blueB2 redB2 blueB3 redB3 blueDuration (s)Check
1
2
Six-bit active-HIGH output word: B1R B1B B2R B2B B3R B3B
3
4
5

Complete all five rows to validate the external sequence.

Timing

Derive a one-second state-enable pulse

Keep the FSM on CLOCK_50 and generate a one-cycle enable pulse at each one-second boundary. For the specified zero-based counter formulation, count from zero through the terminal value inclusive, assert the enable, and clear the counter on that same rising edge.

Need a refresher?
→ Clock Signals and Active Edges · → Binary Counters as Frequency Dividers

FSM design

Define the controller architecture

  • KEY0 resets the timing counter and controller to the first lighting state.
  • The state register changes only on a rising CLOCK_50 edge when the one-second enable is asserted.
  • All six active-HIGH outputs are fully defined for every legal state.
  • Provide deterministic recovery to the reset state for an unexpected encoding.
  • Do not assume a particular binary, one-hot, or Gray encoding unless you choose it and can justify it.

Need a refresher?
→ Finite State Machines · → Verilog Modules and Ports

Verilog

Implement the timing, controller, and integration

Write synthesizable Verilog from your state diagram and timing plan. Use nonblocking assignments for clocked state. If you use combinational procedural logic, give next-state and output signals complete assignments so no latch is inferred. Do not use simulation delays, forever, or repeat.

  1. Implement the one-second enable logic.
  2. Implement the five-state controller and six outputs.
  3. Integrate the modules under one top-level entity with CLOCK_50, KEY0, and the six LED ports.
  4. Analyze and synthesize; inspect warnings and the inferred state machine before compilation.

Need a refresher?
→ Combinational Logic in Verilog

Build and program

Wire, assign, compile, and program

Verified physical I/O contract
FunctionBoard signalFPGA locationPolarity
50 MHz clockCLOCK_50PIN_R8Rising-edge clock
ResetKEY0PIN_J15Active LOW when pressed
Bulb 1 redGPIO_00PIN_D3Active HIGH
Bulb 1 blueGPIO_01PIN_C3Active HIGH
Bulb 2 redGPIO_02PIN_A2Active HIGH
Bulb 2 blueGPIO_03PIN_A3Active HIGH
Bulb 3 redGPIO_04PIN_B3Active HIGH
Bulb 3 blueGPIO_05PIN_B4Active HIGH
Wire each channel identically

GPIO output → 220 Ω resistor → LED anode; LED cathode → common GND. Labels identify red and blue channels; colour is never the only identifier.

  1. With power disconnected, build and inspect all six current-limited LED channels.
  2. Apply the listed Pin Planner assignments using 3.3-V LVTTL.
  3. Compile the design, program the generated .sof, then press KEY0 to establish the first state.

Need refreshers?
→ Pin Planner · → Programming the FPGA

Verify

Observe the full physical cycle and timing

Press and release KEY0, then observe at least one complete five-state cycle and the return to the first state. Record what the hardware actually does; do not infer observations from the code.

Physical verification record
StepObserved active LEDsMeasured/observed duration (s)Matches planned state?
1 after reset
2
3
4
5

Completion

Prepare your Lab 8 submission package

Assessment distinction

Complete and export this HTML record, select the design and source files for the local ZIP, demonstrate the physical sequence to the instructor, and explain your code. Creating the ZIP does not perform the demonstration or submit anything to Avenue.

Submission package

Download your Lab 8 submission ZIP

The ZIP includes completion.json, the state-design evidence, complete Verilog source, and programmed-lighting evidence.

Submission Details

Enter all four required details before downloading.

Generating this local ZIP does not submit work. Evidence files must be reselected after reopening the page.