Electronic – Digital Logic: What are “hamming code” and “Binary code” state machines

digital-logicflipflopstate-machines

I'm asked to draw the circuit for a state machine in one hot, hamming code and binary code models. I know what is one hot state machine, but i'm not sure what are the other 2. Google also didn't help. Any ideas?

Best Answer

If you have a state machine with N states, there are a number of different ways to encode those states as binary logic.

  • One-hot encoding assigns one FF to each state, so it requires N FFs. Only one FF has the value 1 (is "hot") at a time. If at any time, more than one FF is 1, that's an error.

  • Binary encoding assigns sequential integers to the states, and they get encoded on \$\lceil\log_2 N\rceil\$ FFs as unsigned binary numbers.

  • Hamming encoding is similar to binary encoding, except that enough additional FFs are added so that the state assignments are Hamming codes that are capable of correcting single-bit errors and detecting double-bit errors. An error detector monitoring the state values can determine that an error has occurred and correct it. If the binary encoding requires \$M = \lceil\log_2 N\rceil\$ FFs, then the Hamming encoding requires an additional \$\lceil\log_2 M\rceil + 1\$ FFs.