Finite State Machines
CS 3410 Computer System Organization & Programming
[K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon]
Finite State Machines CS 3410 Computer System Organization & - - PowerPoint PPT Presentation
Finite State Machines CS 3410 Computer System Organization & Programming [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon] Stateful Components Combinational logic Output computed directly from inputs System has no internal state
[K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon]
2
Inputs Combinational circuit Outputs N M
3
4
Registers Comb. Logic
5
Legend
state
input/output
start state
0/0 1/0 0/0 1/1
[Mealy Machine]
state
6
Registers Comb. Logic
7
Registers Comb. Logic Comb. Logic
1 1 Legend
state
input
state
1
start state
8
9
https://learnyousomeerlang.com/finite-state-machines barks wags tail sits gets petted waits g e t s p e t t e d sees squirrel
doesn’t give a crap about you a n y e v e n t e v e r !
10
Tennis
https://www.c-sharpcorner.com/article/understanding-state-design-pattern-by-implementing-finite-state/
http://blog.mikemccandless.com/201 4/08/scoring-tennis-using-finite- state.html
11
12
13
Legend
state
input/output
start state state
15
16
a b Curr State s z Next State s’
18
19
a b Curr State s z Next State s’
(1-hot also an option)
21
22
24
25
D Q
27
28
29
Consider a finite state machine that takes two inputs, A and B, and generates a single output, Z. Inputs are unsigned binary numbers, entered into the FSM one digit at a time, beginning with the most significant digit. The output, Z, should be the larger of the two numbers. Example: A = 1000 and B = 0101, then Z = 1000 (the value of A). Draw the state transition diagram (states & arrows) that expresses this
(1) Draw a state diagram (2) Write output and next-state tables (3) Encode states, inputs, and outputs as bits (4) Determine logic equations for next state and outputs (5) Draw the circuit
30