State encoding assigns bit patterns to symbolic states. Binary encoding uses roughly log2 of the state count in registers. One-hot encoding assigns one bit per state. Gray-style assignments can reduce changes between selected adjacent states, but not every transition graph permits every edge to change only one bit.

Worked example

Four states can use binary codes 00, 01, 10, 11 or one-hot codes 0001, 0010, 0100, 1000. A cyclic sequence can use Gray codes 00, 01, 11, 10 so each step in that cycle changes one bit.

What to watch for

Encoding affects register count, decoding, timing and recovery. A Gray assignment does not automatically make asynchronous multi-bit control transfers safe.

Try it yourself

How many flip-flops are needed for six states using binary and one-hot encoding?

Answer: Binary needs three, because eight patterns cover six states. One-hot uses six, one per state.

How to study this topic

Begin with named states and a complete transition table. Then choose encodings and derive the logic. Trace inputs over several cycles, checking outputs as well as next states, including reset and unexpected encodings.

Explore related programmes

These recorded programmes are upcoming. This article is general educational content, not a syllabus or course sample.

Digital Electronics