Final project: up/down counter
Build a counter from 00 to 99: button 0 counts up, button 1 counts down, and it wraps both ways (99 → 00 and 00 → 99). Show it in decimal on hex1 hex0 and in binary on the LEDs.
You've built every piece already: edge detection from the stopwatch, decimal digits with a carry, and LEDs from a register. This time there's no starter logic.
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
- ○Button 0 counts up
- ○Button 1 counts down
- ○hex1 hex0 show 00–99 and wrap both ways
- ○The LEDs show the count in binary
Hints
- Keep the count as one 7-bit number and split it for the display:
hex1 = count / 10,hex0 = count % 10. - Detect each button going from 0 to 1.
Pin log
Run the design to see its outputs change.
Put it on a real board
- The Sipeed Tang Nano 9K (Gowin GW1NR-9) has no a 7-segment display: those ports go to header pins, where you can wire them.
- The clock is set to the board's 27 MHz, and its active-low buttons and LEDs are flipped for you.