Synthesis of finite state machines on memristor crossbars