Practical Programmable Circuits: A Guide to PLDs, State Machines, and Microcontrollers