BitFlow

FPGA vs microcontroller

An Arduino or an ESP32 is a microcontroller: one processor running your program one instruction after another. To blink two LEDs at different rates it has to take turns, checking one timer, then the other, in a loop.

An FPGA has no program counter. What you write becomes hardware, and every always block is its own circuit, running at the same time as all the others. Two blinkers are just two counters side by side, and adding a third doesn't slow the first two down.

The starter already blinks LED 0 twice a second. Add a second, separate counter that makes LED 1 change every 0.15 s.

lab.v
drag to turn · scroll to zoom

Loading the board…

Press Run on the board: your Verilog is turned into gates in this browser and runs here, cycle by cycle.

Goals

  • ○LED 0 still changes every 0.5 s
  • ○LED 1 changes every 0.15 s, on its own
Hints
  1. Copy the first counter and its always block, with new names (count1, on1).
  2. CLK_HZ * 15 / 100 cycles is 0.15 s.

Pin log

Run the design to see its outputs change.

Put it on a real board

  • The clock is set to the board's 27 MHz, and its active-low buttons and LEDs are flipped for you.
Waveform