0% found this document useful (0 votes)
16 views15 pages

Cs316-Lec3 5

This document discusses finite state machines (FSMs) and provides examples of designing simple FSMs. It defines an FSM as an electronic machine that has external inputs, externally visible outputs, and an internal state. The output and next state depend on the inputs and current state. To design an FSM, one draws a state diagram, writes a state transition table, assigns numbers to states, and determines logic equations for outputs and the next state. A simple example of an FSM that flashes "HELLO" on LEDs is presented in detail, including its state diagram, table, and logic implementation. Another example of a serial binary adder FSM is also discussed.

Uploaded by

Gaith Rjoub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views15 pages

Cs316-Lec3 5

This document discusses finite state machines (FSMs) and provides examples of designing simple FSMs. It defines an FSM as an electronic machine that has external inputs, externally visible outputs, and an internal state. The output and next state depend on the inputs and current state. To design an FSM, one draws a state diagram, writes a state transition table, assigns numbers to states, and determines logic equations for outputs and the next state. A simple example of an FSM that flashes "HELLO" on LEDs is presented in detail, including its state diagram, table, and logic implementation. Another example of a serial binary adder FSM is also discussed.

Uploaded by

Gaith Rjoub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 15

Finite State Machines

Prof. Sirer
CS 316
Cornell University
Finite State Machines
An electronic machine which has
 external inputs
 externally visible outputs
 internal state
Output and next state depend on
 inputs
 current state
Designing an FSM
Draw a state diagram
Write down state transition table
Assign numbers to states
Determine logic equations for all flip-flops and
outputs
A Simple Example

o1 Goal: flash hello on LEDs


o2 o0 Inputs: clock
o3 Outputs: Just one
o4 o6
7-segment LED
o5
Flash “h” then “e” then “l”
then “l” then “o”
 h = <0011101>
 e = <0111110>
 l = <0010110>
 o = <1110111>
HELLObox: State Diagram

S0 S1 S2 S3 S4

<0011101> <0111110> <0010110> < 0010110 > <1110111>


H E L L O

Determine the transitions


 label all edges (transitions) with the inputs that cause them,
unlabeled edges are unconditional transitions
 show start state
HELLObox: State Table
Build state table
 rote encoding of the Curre Next Output
state diagram
ntStat State
e
S0 S1 001110
1
S1 S2 011111
0
S2 S3 001011
0
HELLObox: State Assignment 1
Assign bit patterns to
states that would Curren Next Output
make the resulting t State
device simple
 One option is shown State
Determine logic 000 001 00111
equations for every bit 01
of output and next
state, for every flip- 001 010 01111
flop and output 10
010 011 00101
10
HELLObox #1
o1o
o2 0
o
o4 3o6 12 bits of information
o5
(7 outputs + 5 bits of
combinational next state) are computed
circuit by the combinatorial
circuit
All 12 bits have non-
trivial logic equations

flip-flops
HELLObox: State Assignment 2
Assign bit
patterns to states Current Next Output
that would make State
the resulting State
device simple 0011101 0111110 00111
Here, we use far 0 0 01
more bits than
necessary 0111110 0010110 01111
 to simplify the 0 0 10
combinatorial 0010110 0010110 00101
circuit
0 1 10
0010110 1110111 00101
HELLObox #2
o1o
o2 0
o
o4 3o6 15 bits of information
o5
(7 outputs + 8 bits of
combinational next state) are computed
circuit by the combinatorial
circuit
8 bits have non-trivial
logic equations
 all 7 outputs are simple
pass-throughs

flip-flops
FSM: Serial Adder
Add two input bit streams
 streams are sent with least-significant-bit (lsb) first

…10110

…00101
…01111
FSM: State Diagram
00/1
00/0 S0 S1 11/1
11/0

10/1 01/1 10/0 01/0

Two states: S0 (no carry), S1 (carry in hand)


Inputs: a and b
Output: z
 Arcs labelled with input bits a and b, and output z
Serial Adder: State Table
a b stat z next Write down all input
e stat and state
combinations
e
0 0 S0 0 S0
0 1 S0 1 S0
1 0 S0 1 S0
1 1 S0 0 S1
0 0 S1 1 S0
0 1 S1 0 S1
Serial Adder: State Assignment
a b s z s’ Two states, so 1-bit is
0 0 0 0 0 sufficient
 A single flip-flop will
0 1 0 1 0 encode the state
1 0 0 1 0
1 1 0 0 1
0 0 1 1 0
0 1 1 0 1
1 0 1 0 1
Serial Adder: Circuit
a Equations
combinational z
b z = abs + abs + abs + abs
logic
s’ = abs + abs + abs + abs

s s’
Q D

clk

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy