Home › Practice › RTL Design › Electronic dice
Electronic dice
EasyRTLsequentialcounter
You are making the dice for a board game. Each press of the roll button steps the face to the next number, and it must never show 0 or 7, because a real die has faces 1 to 6.
Concept first. A normal 3-bit counter counts 0 to 7 and wraps by itself. A dice needs a counter that wraps early: it counts from 1 up to 6, then goes back to 1. The counter must check where it is, and when it sits on the last value it jumps instead of adding one. Try the idea on a different case: a counter for months would count 1 to 12, then back to 1. What does it compare against, and what does it load?
What to build.
- Inputs
clk,rst,roll. Outputface[2:0]. rstis synchronous: on a clock edge withrst= 1,facebecomes 1.- On a clock edge with
roll= 1, the face goes 1, 2, 3, 4, 5, 6 and then 1 again. Withroll= 0 it holds.
No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.