Time
Engineering

FPGA digital watch

A watch built from digital logic in SystemVerilog, running on an FPGA board: time, stopwatch, timer and ten alarms.

University of Melbourne, ELEN20006 Digital Systems, 2026.

Scroll to run it

Counting time in hardware.

Hours, minutes and seconds live in three counters, driven by the board’s 50 MHz clock.

I compared four ways to store the time and chose three counters: only 17 bits of state, and each unit is simple to set.

A stopwatch with laps.

It counts in centiseconds, and the first tick lands exactly 10 ms after you press start.

A snapshot multiplexer freezes the display for a lap time while the counter keeps running underneath.

A timer that edits like the watch.

Set the countdown, start it and it stops at zero.

A three-state controller (stopped, set, running) sits on top of an editable countdown with a borrow output, modelled on the 74LS193 counter chip.

Ten alarms.

Pick a slot, set it, or hold a button to clear it. The LEDs show which slot you’re on, and empty slots read 99 99 99.

When an alarm fires, the display flashes for five seconds. I wrapped the finished watch rather than editing it, so the working design stayed safe.

The details that finish it.

  • PWM brightness that dims the display without visible flicker
  • Synchronised, edge-detected buttons with hold and auto-repeat
  • Simulation tests and formal checks on each module
  • Yosys used to follow the design down to gates

Try it

My watch, running in your browser with the same controls as the real board. Hold the buttons and flip the switches on the board, or use the ones beside it.

3D view needs WebGL.

Watch

--:--:--

Brightness Mode

SW1 SW0
00 watch · 01 stopwatch · 11 timer · 10 alarms
SW9 SW8
00 12.5 % · 01 25 % · 11 50 % · 10 full brightness

Modelled on the SystemVerilog from my report: the same switches, buttons and timings, including the 1 s hold to edit, auto-repeat at 10 Hz after 0.5 s, and the 5 s alarm flash. It starts at your local time rather than midnight.

How I built it

Small modules, each tested on its own, then layered into a watch.

Test before you compile

Quartus takes about 20 minutes to compile. My simulation tests run in around 5 seconds, so I could check each module over and over before it went near the board.

Layers, not rewrites

Each version of the watch wraps the last: timekeeping, then mode selection, then setting, then accurate setting. Alarms and brightness follow the same pattern.

What I’d change

I assumed my first sketches were right and paid for it in debugging. Next time I’ll draw the state machines and data paths before writing any code.