This assignment is should be uploaded to
Homework 5 on moodle by 5:00 PM on *Friday* 26 September.

There are two parts for this problem.

## Implementation of Finite State Machines

Problem 4 of Homework 4 asked you to draw a diagram or create a table to represent the finite state machine representated by the following Java methods.

enum State { S0, S1, S2 } ; private static char output(State presState) { return presState == State.S0 ? '1' : '0' ; } private static State nextState(State presState, char inChar) { State nxtState ; if (inChar == '0') { if (presState == State.S0) { nxtState = State.S0 ; } else if (presState == State.S1) { nxtState = State.S2 ; } else /* presState == State.S2*/ { nxtState = State.S1 ; } } else /* inChar == '1' */ { if (presState == State.S0) { nxtState = State.S1 ; } else if (presState == State.S1) { nxtState = State.S0 ; } else /* presState == State.S2*/ { nxtState = State.S2 ; } } return nxtState ; }

Or you can use this tabular representation of the next state function.

present state | input | next state |
---|---|---|

`S0` | 0 | `S0` |

`S0` | 1 | `S1` |

`S1` | 0 | `S2` |

`S1` | 1 | `S0` |

`S2` | 0 | `S1` |

`S2` | 1 | `S2` |

Or of the output function.

state | output |
---|---|

`S0` | 1 |

`S1` | 0 |

`S2` | 0 |

For this homework, you are to implement this finite state machine in Logisim. Try to keep it simple. You can use AND-gates and flip-flops or you can use a ROM and register.

Be sure to include a reset line for starting your circuit in the right state.

## Testing of the Finite State Machines

Describe your plan for testing your finite state machine. This should be a couple of paragraphs long.

## What to turn in

Turn in the Logisim .circ file for your implementation and and either a text or PDF file describing your testing strategy.