Home › Practice › RTL Design › Light up a clock digit

Light up a clock digit

EasyRTLcombinational

The digits on a microwave clock are made of seven small bars. To show a number, the chip decides which bars to light.

Concept first. Name the bars a to g: a is the top bar, b top-right, c bottom-right, d bottom, e bottom-left, f top-left and g the middle. The digit 1 lights b and c only; the digit 8 lights all seven. A decoder is a lookup: for each possible 4-bit input there is one fixed pattern of lit bars. Because the table is just "input number, then pattern", the natural way to write it in Verilog is a case statement, one line per digit. Inputs above 9 are not digits.

What to build.

Solve in your browser →

No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.

More in this track

← A mail sorterBlink an LED at half speed →