State assignment is the choice of binary code for each state of a finite state machine. With states, you need at least flip-flops; the assignment decides which bit pattern represents which state.
Different assignments produce different next-state and output logic — sometimes very different in cost.
Example
Take a 3-state FSM with states A, B, C. You need bits, giving 4 possible bit patterns (). Three are used, one is unused (don’t-care):

One reasonable assignment: , , , leaving as a don’t-care.
Another: , , .
A third: one-hot — use 3 flip-flops with , , .
All three implement the same FSM. The synthesis cost differs.
Common assignment strategies
-
Sequential / binary. Just number the states in order. Simple to read; usually small enough flip-flop count. Default for hand designs.
-
One-hot. Use one flip-flop per state. More flip-flops but simpler next-state logic — checking “are we in state X?” is just looking at one bit, no decoding needed. Common for FPGAs where flip-flops are cheap.
-
Gray code. Assign codes so adjacent states differ in one bit. Reduces switching activity and avoids glitches when the state changes — useful in low-power and high-speed designs.
-
Optimization-driven. Use a tool to try many assignments and pick the one that minimizes total gate count. This is what synthesizers do internally.
Why it matters
The state assignment determines what truth tables the next-state functions have. Different assignments give different K-maps, different prime implicants, and different total cost. For a small FSM, the difference can be 2–3× in gate count.
The output function is similarly affected. A Moore machine’s output is a function of the state code; with a clever code, the output may turn out to be just one of the state bits directly.
Tools like Synopsys, Vivado, and Quartus try many assignments behind the scenes; for hand-designed FSMs, picking a good assignment is part of the craft.
For the worked example showing how state assignment feeds into K-maps and final logic, see Sequence detector (FSM design example).