fsm realization