Integrated finite state controller