Title: LECTURE 6: State machines
1LECTURE 6 State machines
EECS 318 CADComputer Aided Design
Instructor Francis G. Wolff wolff_at_eecs.cwru.edu
Case Western Reserve University This
presentation uses powerpoint animation please
viewshow
2VHDL Component, Entity, and Architecture
for-generate if generate
Component Instance
Component Declaration
Entity
Architecturei
ConcurrentWith-Select-WhenWhen-Else
OtherConcurrentComponents
ConcurrentBoolean Equations
3VHDL Components
Component Declaration
Optional repeat
COMPONENT component_entity_name GENERIC (
identifier type initial_value )
PORT ( identifier mode type ) END
Component Instance
identifier component_entity_name GENERIC
MAP ( identifier ,identifier ) PORT
MAP ( identifier ,identifier )
mode IN OUT INOUT
type std_logic std_logic_vector(n downto 0)
bit
4VHDL Concurrent Statements
Example y lt NOT ( NOT (a) AND NOT (b) )
Example 2 to 1 multiplexor WITH s SELECT y lt a
WHEN 0, b WHEN OTHERS
5VHDL Concurrent Statements
Conditionial signal assignment
signal lt signal_value1 WHEN condition1
ELSE signal_valuen WHEN
conditionn ELSE signal_valuen1
Example Priority Encoder y lt a WHEN s0 ELSE
b
6SR Flip-Flop (Latch)
Q lt R NOR NQNQ lt S NOR Q
Q lt R NAND NQNQ lt S NAND Q
7SR Flip-Flop (Latch)
Example R lt 1, 0 after 10ns, 1 after
30ns S lt 1
8Gated-Clock SR Flip-Flop (Latch Enable)
Q lt (S NAND LE) NAND NQ
S
NQ lt (R NAND LE) NAND Q
Q
LE
Synchronous Set and Reset
Q
R
Asynchronous Preset and Clear
Latches require that during the gated-clock the
data must also be stable (i.e. S and R) at the
same time
Suppose each gate was 5ns how long does the
clock have to be enabled to latch the data?
Answer 15ns
9Rising-Edge Flip-flop
10Rising-Edge Flip-flop logic diagram
11Synchronous Sequential Circuit
12Abstraction Finite State Machine
13FSM Representations
14Simple Design Example
15State Encoding
16Logic Implementations
17FSM Observations
18Coke Machine Example
19Coke Machine State Diagram
20Coke Machine Diagram II
21Moore Machines
22Mealy Machines