Problems / Logic Synthesis / FSM state encoding

FSM state encoding

Logic Synthesis medium interactive · in-browser

FSM state encoding. A finite-state machine's states each need a binary code stored in the state flip-flops, and the choice of codes decides how much next-state logic is built. Every bit that flips on a transition is a bit the logic must compute, so a good proxy for the cost is the total Hamming distance (the number of bits that change) summed over all transitions. States that transition into one another want codes that differ in as few bits as possible.

Click a state to cycle its 2-bit code; all four codes must stay distinct. The transitions form a ring plus one chord, so give the ring a Gray-code order (each step changes one bit). Reach the minimum total distance, then Submit encoding.