Designing Logic Systems Using State Machines