30
CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi [email protected]

CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi [email protected]

Embed Size (px)

Citation preview

Page 1: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

CENG 241Digital Design 1

Lecture 10

Amirali [email protected]

Page 2: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

2

This Lecture

Review of last lecture: Analysis Chapter 5: State Reduction, Design Procedure

Page 3: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

3

Analysis: Obtaining a table/diagram for the time sequence of inputs/outputs/internal states.

Examples: State Equations, State Table, State Diagram

Analysis of Clocked Sequential Circuits

Page 4: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

4

Analysis of Clocked Sequential Circuits

Example of state equation:

A(t+1) = A(t)x(t) + B(t)x(t)B(t+1) = A’(t)x(t)

A(t+1)=Ax+BxB(t+1)=A’x

y(t)=(A(t)+B(t)).x’(t) = (A+B)x’

Page 5: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

5

Example of state tables

Present state input Next State Output A B x A B y 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 1 0 1 1 0 0 1 1 0 0 0 1 1 1 1 1 0 0

State equation:

A(t+1) = A(t)x(t) + B(t)x(t)B(t+1) = A’(t)x(t)

y(t)=(A(t)+B(t)).x’(t)

Page 6: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

6

Example of state tables-2nd form

Present state Next State Output x=0 x=1 x=0 x=1 AB AB AB y y 00 00 01 0 0 01 00 11 1 0 10 00 10 1 0 11 00 10 1 0

State equation:

A(t+1) = A(t)x(t) + B(t)x(t)B(t+1) = A’(t)x(t)

y(t)=(A(t)+B(t)).x’(t)

Page 7: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

7

Example of state diagram

Present state Next State Output x=0 x=1 x=0 x=1AB AB AB y y 00 00 01 0 0 01 00 11 1 010 00 10 1 0 11 00 10 1 0

Page 8: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

8

Mealy & Moore

Mealy machine: Output depends on both input & present state Moore machine: Output only depends on present state.

Page 9: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

9

Example of Mealy Machine

Present state Next State Output x=0 x=1 x=0 x=1AB AB AB y y 00 00 01 0 0 01 00 11 1 010 00 10 1 0 11 00 10 1 0

Page 10: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

10

Example of Moore Machine

Present state input Next State A B x A B 0 0 0 0 1 0 0 1 0 0 0 1 0 1 1 0 1 1 1 0 1 0 0 1 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1

Page 11: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

11

State Reduction and Assignment

Goal: Reduce the number of states while keeping the external input-output requirements.

2m states need m flip-flops, so reducing the states may reduce flip-flops.

If two states are equal, one can be removed but what are equal states?

Page 12: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

12

State Reduction Example

As an example consider the input sequence below:

010101110100 applied and start from state a.

State a a b c d e f f g f g ainput 0 1 0 1 0 1 1 0 1 0 0 output 0 0 0 0 0 1 1 0 1 0 0

Page 13: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

13

State Reduction Example

Present State Next State Output x=0 x=1 x=0 x=1

a a b 0 0 b c d 0 0 c a d 0 0 d e f 0 1 e a f 0 1 f g f 0 1 g a f 0 1

States e and g are equal since for each member of the set of inputs, they give the same output and send the circuit either to the same state or an equivalent state.

Page 14: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

14

State Reduction Example

Present State Next State Output x=0 x=1 x=0 x=1

a a b 0 0 b c d 0 0 c a d 0 0 d e f 0 1 e a f 0 1 f e f 0 1

Table and state diagram after the first reduction: g is removed and replaced by state e.

NEW equal states: d and f

Page 15: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

15

State Reduction Example

Present State Next State Output x=0 x=1 x=0 x=1

a a b 0 0 b c d 0 0 c a d 0 0 d e d 0 1 e a d 0 1

Table and state diagram after the second reduction: f is removed and replaced by state d.

If we apply the same sequence

State a a b c d e d d e d e ainput 0 1 0 1 0 1 1 0 1 0 0 output 0 0 0 0 0 1 1 0 1 0 0

Page 16: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

16

Design Procedure

First Step: From the word description of the problem derive a state diagram

example:design a circuit to detect three or more consecutive 1’s in a string of bits coming through an input line.

Page 17: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

17

Design steps

1.From word description, derive state diagram 2.Reduce the number of states 3.Assign binary values to states 4.Obtain the binary coded state table 5.Choose the type of flip-flop used 6.Derive the simplified flip-flop input and output equations 7.Draw the logic diagram

steps 4 to 7can be implemented by exact algorithms and can be automated.

The part of the design that is well-defined is referred to as synthesis.

Page 18: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

18

State Table for Sequence Decoder

Present State Input Next State Output A B x A B y 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 0 0 0 1 1 1 1 1 1 1

A(t+1)= Σ(3,5,7)

B(t+1)= Σ(1,5,7)

Y(A,B,x)= Σ(6,7)

Page 19: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

19

Synthesis Using D Flip-Flops

A(t+1)=DA(A,B,x)= Σ(3,5,7)

B(t+1)=DB(A,B,x)= Σ(1,5,7)

Y(A,B,x)= Σ(6,7)

Page 20: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

20

Logic Diagram for a Sequence Detector

DA = Ax + BxDB= Ax + B’xy=AB

Page 21: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

21

Excitation Tables

Using flip-flops other than D can be complicated.

Why? Input equations for the circuit must be derived indirectly from the state table

Excitation tables can help.

Excitation tables give us the flip-flop input for every state transition.

Example : JK- Recall Q(t+1) = JQ’(t) + K’Q(t) Q(t) Q(t+1) J K 0 0 0 X 0 1 1 X 1 0 X 1 1 1 X 0

Page 22: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

22

Excitation Tables- T flip-flop

Example : JK- Recall Q(t+1) = TQ’(t) + T’Q(t) = T XOR Q Q(t) Q(t+1) T 0 0 0 0 1 1 1 0 1 1 1 0

Page 23: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

23

Synthesis Using JK Flip-Flops

Present State Input Next State Flip-Flop Inputs A B x A B JA KA JB KB 0 0 0 0 0 0 x 0 x 0 0 1 0 1 0 x 1 x 0 1 0 1 0 1 x x 1 0 1 1 0 0 0 x x 0 1 0 0 0 0 x 0 0 x 1 0 1 1 1 x 0 1 x 1 1 0 0 0 x 0 x 0 1 1 1 1 1 x 1 x 1

We also include J, K input conditions, derived from the excitation table.

Page 24: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

24

Synthesis Using JK Flip-Flops

Page 25: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

25

Synthesis Using JK Flip-Flops

Page 26: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

26

Synthesis Using T Flip-Flops

Example: 3-bit Binary Counter

The counter counts the clock.

Clock does not appear explicitly in the state diagram.

Page 27: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

27

Synthesis Using T Flip-Flops

Present State Next State Flip-Flop InputsA2 A1 A0 A2 A1 A0 TA2 TA1 TA00 0 0 0 0 1 0 0 10 0 1 0 1 0 0 1 10 1 0 0 1 1 0 0 10 1 1 1 0 0 1 1 11 0 0 1 0 1 0 0 1 1 0 1 1 1 0 0 1 11 1 0 1 1 1 0 0 11 1 1 0 0 0 1 1 1

Page 28: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

28

Synthesis Using T Flip-Flops

Page 29: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

29

Synthesis Using T Flip-Flops

Page 30: CENG 241 Digital Design 1 Lecture 10 Amirali Baniasadi amirali@ece.uvic.ca

30

Summary

State Reduction, Synthesis