A vhdl code example of a 3-bit binary counter that counts from 0 to 7. The counter uses an enumeration type for state coding, signals for state and next state, and three processes for modeling. The first process latches the next state into the current state, the second process generates the next state based on the current state, and the third process generates the output based on the current state (moore machine). The document also discusses the difference between binary and one-hot encoding and the advantages of binary encoding.