Home › Practice › RTL Design › Divisible by 3?

Divisible by 3?

EasyRTLsequentialfsm

The bits of a binary number arrive one per clock, biggest bit first. After each bit, the circuit must say whether the number so far is a multiple of 3.

Concept first. You do not need to remember the whole number, only its remainder when divided by 3. That is only three possible values, so three states are enough, however long the number gets. When a new bit arrives, the number doubles and the new bit is added. Compare with decimals: when a new digit arrives, the number is multiplied by 10 and the digit is added, so 12 followed by 7 is 127. Use that to find the new remainder from the old one and the new bit. Build the small table with the 3 remainders as rows and the bit 0 or 1 as columns.

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

← Candy machineWaveform: the counter that stops early →