Lecture 9: Sequential Networks: Implementation CSE 140: Components - - PowerPoint PPT Presentation

lecture 9 sequential networks implementation
SMART_READER_LITE
LIVE PREVIEW

Lecture 9: Sequential Networks: Implementation CSE 140: Components - - PowerPoint PPT Presentation

Lecture 9: Sequential Networks: Implementation CSE 140: Components and Design Techniques for Digital Systems Spring 2014 CK Cheng, Diba Mirza Dept. of Computer Science and Engineering University of California, San Diego 1 Implementation


slide-1
SLIDE 1

Lecture 9: Sequential Networks: Implementation

CSE 140: Components and Design Techniques for Digital Systems Spring 2014

CK Cheng, Diba Mirza

  • Dept. of Computer Science and Engineering

University of California, San Diego

1

slide-2
SLIDE 2

Implementation

  • Format and Tool
  • Procedure
  • Excitation Tables
  • Example

2

slide-3
SLIDE 3

3

Mealy Machine: yi(t) = fi(X(t), S(t)) Moore Machine: yi(t) = fi(S(t)) si(t+1) = gi(X(t), S(t))

C1 C2

CLK x(t) y(t)

Mealy Machine C1 C2

CLK x(t) y(t)

Moore Machine

S(t) S(t)

Canonical Form: Mealy and Moore Machines

slide-4
SLIDE 4

Understanding Current State and Next State in a sequential circuit

4

today sunrise

Preparing for tomorrow according to our effort today

slide-5
SLIDE 5

C1 C2

CLK x(t) y(t)

Implementation Format

Q(t)

Q(t+1) = h(x(t), Q(t)) Circuit C1 y(t) = f(x(t), Q(t)) Circuit C2

5

Canonical Form: Mealy & Moore machines State Table à Netlist Tool: Excitation Table

slide-6
SLIDE 6

Implementation Tool: Excitation Table

6

x(t) Q(t)

CLK

C1

id x(t) Q(t) Q(t+1) 1 1 1 1 2 1 3 1 1

State Table Find D, T, (S R), (J K) to drive F-Fs

slide-7
SLIDE 7

Implementation Tool: Excitation Table

7

x(t) Q(t)

CLK

Q(t)

C1

id x(t) Q(t) T(t) Q(t+1) 1 1 1 1 1 1 2 1 1 3 1 1 1 id x(t) Q(t) Q(t+1) 1 1 1 1 2 1 1 3 1 1

State Table Excitation Table Example with T flip flop

T(t)

slide-8
SLIDE 8

Implementation Tool: Excitation Table

8

x(t) Q(t)

CLK

Q(t)

C1

id x(t) Q(t) T(t) Q(t+1) 1 1 1 1 1 1 2 1 1 3 1 1 1

Excitation Table

Implement combinational logic C1 D(t), T(t), (S(t) R(t)), (J(t) K(t)) are functions of (x,Q(t))

slide-9
SLIDE 9

Implementation: Procedure

State Table => Excitation Table

Problem: Given a state table, we have NS: Q(t+1) = h(x(t),Q(t)) We find D, T, (S R), (J K) to drive F-Fs from Q(t) to Q(t+1). Excitation Table: The setting of D(t), T(t), (S(t) R(t)), (J(t) K(t)) to drive Q(t) to Q(t+1). We implement combinational logic C1 D(t), T(t), (S(t) R(t)), (J(t) K(t)) are functions of (x,Q(t)).

9

slide-10
SLIDE 10

Implementation: Procedure

State Table => Excitation Table

Problem: Given a state table, we have NS: Q(t+1) = h(x(t),Q(t)) We find D, T, (S R), (J K) to drive F-Fs from Q(t) to Q(t+1). Excitation Table: The setting of D(t), T(t), (S(t) R(t)), (J(t) K(t)) to drive Q(t) to Q(t+1). We implement combinational logic C1 D(t), T(t), (S(t) R(t)), (J(t) K(t)) are functions of (x,Q(t)).

10

slide-11
SLIDE 11

Implementation: Procedure

F-F State Table <=> F-F Excitation Table

11

DTSRJK PS Q(t) NS Q(t+1) NS Q(t+1) PS Q(t) DTSRJK

  • D F-F
  • D(t)= eD(Q(t+1), Q(t))
  • T F-F
  • T(t)= eT(Q(t+1), Q(t))
  • SR F-F
  • S(t)= eS(Q(t+1), Q(t))
  • R(t)= eR(Q(t+1), Q(t))
  • JK F-F
  • J(t)= eJ(Q(t+1), Q(t))
  • K(t)= eK(Q(t+1), Q(t))
slide-12
SLIDE 12

State table of JK F-F:

00 1 01 10 1 1 11 1 1 Q(t) Q(t+1) JK

Excitation table of JK F-F:

0-

  • 1

1 1-

1 PS NS Q(t) Q(t+1) JK

If Q(t) is 1, and Q(t+1) is 0, then JK needs to be -1.

Excitation Table

12

slide-13
SLIDE 13

Excitation Tables and State Tables

0- 01 1 10

1 PS NS Q(t) Q(t+1)

SR Excitation Tables:

1 1 1 1 PS NS Q(t) Q(t+1)

T

00 1 01 1 PS SR Q(t) Q(t+1)

SR

10 1 1 11

  • 1

1 1 1 PS T Q(t) Q(t+1)

T State Tables:

13

slide-14
SLIDE 14

0-

  • 1

1 1-

1 PS NS Q(t) Q(t+1)

JK Excitation Tables:

1 1 1 1 PS NS Q(t) Q(t+1)

D

00 1 01 1 PS JK Q(t) Q(t+1)

JK

10 1 1 11 1 1 1 1 1 PS D Q(t) Q(t+1)

D State Tables:

Excitation Tables and State Tables

14

slide-15
SLIDE 15

Implementation: Procedure

  • 1. State table: y(t)= f(Q(t), x(t)), Q(t+1)= h(x(t),Q(t))
  • 2. Excitation table of F-Fs:
  • D(t)= eD(Q(t+1), Q(t));
  • T(t)= eT(Q(t+1), Q(t));
  • (S, R), or (J, K)
  • 3. From 1 & 2, we derive excitation table of the system
  • D(t)= gD(x(t),Q(t))= eD(h(x(t),Q(t)),Q(t));
  • T(t)= gT(x(t),Q(t))= eT(h(x(t),Q(t)),Q(t));
  • (S, R) or (J, K).
  • 4. Use K-map to derive optional combinational logic

implementation.

  • D(t)= gD(x(t),Q(t))
  • T(t)= gT(x(t),Q(t))
  • y(t)= f(x(t),Q(t))

15

slide-16
SLIDE 16

Implementation: Example Implement a JK F-F with a T F-F

00 1 01 1 PS JK Q(t)

Q(t+1) = h(J(t),K(t),Q(t)) = J(t)Q’(t)+K’(t)Q(t) JK

10 1 1 11 1

Implement a JK F-F:

Q Q’ C1 J K T

16

Q

slide-17
SLIDE 17

id 1 2 3 4 5 6 7 J(t) 1 1 1 1 K(t) 1 1 1 1 Q(t) 1 1 1 1 Q(t+1) 1 1 1 1 T(t) 1 1 1 1 1 1 1 1 PS NS Q(t) Q(t+1)

Excitation Table of T Flip-Flop T(t) = Q(t) ⊕ Q(t+1) T(t) = Q(t) XOR ( J(t)Q’(t) + K’(t)Q(t)) Excitation Table of the Design

Example: Implement a JK flip-flop using a T flip-flop

T

17

slide-18
SLIDE 18

0 2 6 4 1 3 7 5

Q(t)

J

0 0 1 1 0 1 1 0

K

T(J,K,Q): T = K(t)Q(t) + J(t)Q’(t)

Q Q’ J K T

Example: Implement a JK flip-flop using a T flip-flop

18

slide-19
SLIDE 19

iClicker

19

Given a flip-flop, the relation of its state table and excitation table is

  • A. One to one
  • B. One to many
  • C. Many to one
  • D. Many to many
  • E. None of the above
slide-20
SLIDE 20

20

Let’s implement our free running 2-bit counter using T-flip flops

S0 S1 S2 S3

PS

Next state

S1 S2 S3 S0 State Table

S0 S1 S2 S3

slide-21
SLIDE 21

21

Let’s implement our free running 2-bit counter using T-flip flops

S0 S1 S2 S3

S1 S2 S3 S0 State Table

S0 S1 S2 S3

State Table with Assigned Encoding

0 0 0 1 1 0 1 1

Current

01 10 11 00

Next

slide-22
SLIDE 22

22

Let’s implement our free running 2-bit counter using T-flip flops

id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1) 1 1 1 1 2 1 1 1 3 1 1

Excitation table

slide-23
SLIDE 23

23

Let’s implement our free running 2-bit counter using T-flip flops

id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1) 1 1 1 1 1 1 1 2 1 1 1 1 3 1 1 1 1

Excitation table

slide-24
SLIDE 24

24

Let’s implement our free running 2-bit counter using T-flip flops

id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1) 1 1 1 1 1 1 1 2 1 1 1 1 3 1 1 1 1

Excitation table

T0(t) = T1(t) = Q0(t+1) = T0(t) Q’0(t)+T’0(t)Q0(t)

Q1(t+1) = T1(t) Q’1(t)+T’1(t)Q1(t)

slide-25
SLIDE 25

25

Let’s implement our free running 2-bit counter using T-flip flops

id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1) 1 1 1 1 1 1 1 2 1 1 1 1 3 1 1 1 1

Excitation table

T0(t) = 1 T1(t) = Q0(t)

slide-26
SLIDE 26

26

T Q Q’ T Q Q’

Q0 Q1 1 T1

Free running counter with T flip flops

T0(t) = 1 T1(t) = Q0(t)

slide-27
SLIDE 27

27

Implementation: State Diagram => State Table => Netlist

Pattern Recognizer: A sequential machine has a binary input x in {a,b}. For x(t-2, t) = aab, the output y(t) = 1, otherwise y(t) = 0.

Assign mapping a:0, b:1

slide-28
SLIDE 28

28

Implementation: State Diagram => State Table => Netlist

Pattern Recognizer: A sequential machine has a binary input x in {a,b}. For x(t-2, t) = aab, the output y(t) = 1, otherwise y(t) = 0.

Assign mapping a:0, b:1 PI Q How many states should the pattern recognizer have A. One because it has one output B. One because it has one input C. Two because the input can be one of two states (a or b) D. Three because . .. . . . . E. Four because . . . . .

slide-29
SLIDE 29

29

PI Q: How many states should the pattern recognizer have A. One because it has one output B. One because it has one input C. Two because the input can be one of two states (a or b) D. Three because . .. . . . . E. Four because . . . . .

slide-30
SLIDE 30

30

Implementation: State Diagram => State Table => Netlist

Pattern Recognizer: A sequential machine has a binary input x in {a,b}. For x(t-2, t) = aab, the output y(t) = 1, otherwise y(t) = 0.

S1 S0

a/0 b/0 a/0 b/1

S2

a/0 b/0

slide-31
SLIDE 31

31

State Diagram => State Table with State Assignment

State Assignment S0: 00 S1: 01 S2: 10

PS\x a b S0 S1,0 S0,0 S1 S2,0 S0,0 S2 S2,0 S0,1 PS\x 1 00 01,0 00,0 01 10,0 00,0 10 10,0 00,1 Q1(t+1)Q0(t+1), y a: 0 b: 1

S1 S0

a/0 b/0 a/0 b/1

S2

a/0 b/0

slide-32
SLIDE 32

32

Example 2: State Diagram => State Table => Excitation Table => Netlist PS\x 0 1 00 01,0 00,0 01 10,0 00,0 10 10,0 00,1

id Q1Q0x D1D0 y 000 01 1 001 00 2 010 10 3 011 00 4 100 10 5 101 00 1 6 110

  • 7

111

slide-33
SLIDE 33

33

0 2 6 4 1 3 7 5

x(t) Q1

0 1 - 1 0 0 - 0

Q0

D1(t): D1(t) = x’Q0 + x’Q1 D0 (t)= Q’1Q’0 x’ y= Q1x id Q1Q0x D1D0 y 000 01 1 001 00 2 010 10 3 011 00 4 100 10 5 101 00 1 6 110

  • 7

111

  • Example 2: State Diagram => State Table

=> Excitation Table => Netlist

slide-34
SLIDE 34

34

D Q Q’ D Q Q’ Q1 Q0 D1 D0

Q0

Q1 x’

D1(t) = x’Q0 + x’Q1 D0 (t)= Q’1Q’0 x’ y= Q1x x y Q’1 Q’0 x’ Example 2: State Diagram => State Table => Excitation Table => Netlist

slide-35
SLIDE 35

35

D Q Q’ D Q Q’ Q1 Q0 D1 D0

Q0

Q1 x’

x y Q’1 Q’0 x’

Example 3: State Diagram => State Table => Excitation Table => Netlist S1 S0

a/0 b/0 a/0 b/1

S2

a/0 b/0

iClicker: The relation between the above state diagram and sequential circuit.

  • A. One to one.
  • B. One to many
  • C. Many to one
  • D. Many to many

E. None of the above

slide-36
SLIDE 36

Modified 2 bit counter

36

Q0(t) Q1(t)

D Q Q’ D Q Q’

CLK

x(t) Q0(t) Q1(t)

y(t)

slide-37
SLIDE 37

Modified 2 bit counter

37

Q0(t) Q1(t)

D Q Q’ D Q Q’

CLK

x(t) Q0(t) Q1(t)

y(t) y(t) = Q1(t)Q0(t) Q0(t+1) = D0(t) = x(t)’ Q0(t)’ Q1(t+1) = D1(t) = x(t)’(Q0(t) + Q1(t))

slide-38
SLIDE 38

38

State table

0 0 0 1 1 0 1 1

PS

input

x=0 x=1

Q1(t) Q0(t) | (Q1(t+1) Q0(t+1), y(t)) Present State | Next State, Output

S0 S1 S2 S3

PS

input

x=0 x=1

Netlist ó State Table ó State Diagram ó Input Output Relation

State Assignment

Characteristic Expression:

y(t) = Q1(t)Q0(t) Q0(t+1) = D0(t) = x(t)’ Q0(t)’ Q1(t+1) = D1(t) = x(t)’(Q0(t) + Q1(t))

slide-39
SLIDE 39

39

State table

0 0 0 1 1 0 1 1

PS

input

x=0 x=1 01, 0 00, 0 10, 0 00, 0 11, 0 00, 0 00, 1 00, 1

Q1(t) Q0(t) | Q1(t+1) Q0(t+1), y(t) Present State | Next State, Output

S0 S1 S2 S3

PS

input

x=0 x=1

S1, 0 S0, 0 S2, 0 S0, 0 S3, 0 S0, 0 S0, 1 S0, 1

Let: S0 = 00 S1 = 01 S2 = 10 S3 = 11

Remake the state table using symbols instead of binary code , e.g. ’00’ Netlist ó State Table ó State Diagram ó Input Output Relation

State Assignment

y(t) = Q1(t)Q0(t) Q0(t+1) = D0(t) = x(t)’ Q0(t)’ Q1(t+1) = D1(t) = x(t)’(Q0(t) + Q1(t))

slide-40
SLIDE 40

40

Netlist ó State Table ó State Diagram ó Input Output Relation Given inputs and initial state, derive output sequence

S1 S2 S3 S0

Time 1 2 3 4 5 Input 1

  • State

S0 Output

S0 S1 S2 S3

PS

input

x=0 x=1

S1, 0 S0, 0 S2, 0 S0, 0 S3, 0 S0, 0 S0, 1 S0, 1

slide-41
SLIDE 41

41

Netlist ó State Table ó State Diagram ó Input Output Relation Example: Given inputs and initial state, derive

  • utput sequence

Time 1 2 3 4 5 Input 1

  • State

S0 S1 S0 S1 S2 S3 Output 0 1

(0 or 1)/1

S0 S1 S2 S3

PS

input

x=0 x=1

S1, 0 S0, 0 S2, 0 S0, 0 S3, 0 S0, 0 S0, 1 S0, 1

x/y

S1 S2 S3 S0

0/0 0/0 0/0 1/0 1/0 1/0

slide-42
SLIDE 42

42

Finite State Machine Example

  • Traffic light controller

– Traffic sensors: TA, TB (TRUE when there’s traffic) – Lights: LA, LB

TA LA TA LB TB TB LA LB

Academic Ave. Bravado Blvd. Dorms Fields Dining Hall Labs

slide-43
SLIDE 43

43

FSM Black Box

  • Inputs: CLK, Reset, TA, TB
  • Outputs: LA, LB

TA TB LA LB CLK Reset Traffic Light Controller

slide-44
SLIDE 44

44

FSM State Transition Diagram

  • Moore FSM: outputs labeled in each state
  • States: Circles
  • Transitions: Arcs

S0 LA: green LB: red Reset

slide-45
SLIDE 45

45

FSM State Transition Diagram

  • Moore FSM: outputs labeled in each state
  • States: Circles
  • Transitions: Arcs

S0 LA: green LB: red S1 LA: yellow LB: red S3 LA: red LB: yellow S2 LA: red LB: green TA TA TB TB Reset

slide-46
SLIDE 46

46

FSM State Transition Table

PS Inputs NS TA TB S0 X S1 S0 1 X S0 S1 X X S2 S2 X S3 S2 X 1 S2 S3 X X S0

slide-47
SLIDE 47

47

State Transition Table

PS Inputs NS Q1(t) Q0(t) TA TB Q1(t +1) Q0(t +1) X 1 1 X 1 X X 1 1 X 1 1 1 X 1 1 1 1 X X

State Encoding S0 00 S1 01 S2 10 S3 11

Q1(t+1)= Q1(t)xor Q0(t) Q0(t+1)= Q’1(t)Q’0(t)T’A + Q1(t)Q’0(t)T’B

slide-48
SLIDE 48

48

FSM Output Table

PS Outputs Q1 Q0 LA1 LA0 LB1 LB0 1 1 1 1 1 1 1 1 1 1

Output Encoding green 00 yellow 01 red 10

LA1 = Q1 LA0 = Q’1Q0 LB1 = Q’1 LB0 = Q1Q0

slide-49
SLIDE 49

49

FSM Schematic: State Register

S1 S0 S'1 S'0 CLK

state register

Reset r

slide-50
SLIDE 50

50

Logic Diagram

S1 S0 S'1 S'0 CLK

next state logic state register

Reset TA TB

inputs

S1 S0 r

slide-51
SLIDE 51

51

FSM Schematic: Output Logic

S1 S0 S'1 S'0 CLK

next state logic

  • utput logic

state register

Reset LA1 LB1 LB0 LA0 TA TB

inputs

  • utputs

S1 S0 r

slide-52
SLIDE 52

Summary: Implementation

52

  • Set up canonical form
  • Mealy or Moore machine
  • Identify the next states
  • state diagram ⇨ ¡state table
  • state assignment
  • Derive excitation table
  • Inputs of flip flops
  • Design the combinational logic
  • don’t care set utilization