Home › Practice › RTL Design › Light up the volume bar
Light up the volume bar
EasyRTLcombinationalcodes
A 3-bit volume knob (0 to 7) drives a row of 7 LEDs. Volume 3 lights the first 3 LEDs, volume 0 lights none, volume 7 lights all.
Concept first. Binary is compact, but a bar graph needs a different code: a thermometer code, filled from the bottom like mercury in a thermometer. For 3 the thermometer is 0000111, for 5 it is 0011111. Write the thermometer for 1, 2 and 4 yourself, then look at one LED at a time: for which volumes is LED number 0 on? LED number 1? LED number 4?
What to build.
- Input
v[2:0], outputbars[6:0]. bars[i]is 1 exactly wheni < v. So v=0 gives all zeros, v=7 gives all ones.- No clock.
No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.