BitFlow

Button to LED

Inputs work the same way the other way round: btn[0] is 1 while you press button 0 on the board. Wire it straight to an LED and the LED follows your finger.

~ flips a bit. Use it to make LED 1 do the opposite of button 1. Click and hold the buttons on the 3D board to try it.

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 lights while button 0 is held
  • ○LED 1 lights while button 1 is not held
Hints
  1. assign led[0] = btn[0];
  2. For LED 1, invert button 1 with ~btn[1].
  3. Give the unused LEDs a value too: assign led[5:2] = 0;

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