Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1...

34
Sequential Synchronous Circuit Analysis General Model Current State at time (t) is stored in an array of flip-flops. Next State at time (t+1) is a Boolean function of State and Inputs. Outputs at time (t) are a Boolean function of State(t) and (sometimes) Inputs (t). Combina- tional Logic Inputs State Next State Outputs Storage Elements CLK

Transcript of Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1...

Page 1: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Sequential Synchronous Circuit Analysis

General Model• Current State at time (t) is stored in an array of flip-flops.• Next State at time (t+1) is a Boolean function of State and

Inputs.• Outputs at time (t) are a Boolean function of State(t) and

(sometimes) Inputs (t).

Combina-tional

Logic

Inputs

State

Next

State

Outputs

Storage Elements

CLK

Page 2: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Example 1

Input: x(t)

Output: y(t)

State: (A(t), B(t))

What is the Output Function?

What is the Next State Function?

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

C

D Q

Q

C

D Q

Q'

y

xA

A

B

CP

Next State

Output

B

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

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

Page 3: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Example 1

Where in time are inputs, outputs and states defined? A(t+1) = A(t)x(t) + B(t)x(t)

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

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

Reset

Clock

X

Next A

Next B

A

B

Y

Page 4: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

State Table Characteristics

State table – a multiple variable table with the following four sections:• Present State – the values of the state variables for

each allowed state.• Input – the input combinations allowed.• Next-state – the value of the state at time (t+1) based

on the present state and the input.• Output – the value of the output as a function of the

present state and (sometimes) the input.

From the viewpoint of a truth table:• the inputs are Input, Present State• and the outputs are Output, Next State

Page 5: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Example 1: Alternate State Table

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

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

• y(t) =x(t) (B(t) + A(t))

The time sequence of inputs, outputs, and flip-flop states can be enumerated in a state table (sometimes called transition table).

Page 6: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

State Diagrams

The sequential circuit function can be represented in graphical form as a state diagram with the following components:• A circle with the state name in it for each state• A directed arc from the Present State to the Next

State for each state transition• A label on each directed arc with the Input values which

causes the state transition, and• A label:

On each circle with the output value produced, or On each directed arc with the output value produced.

Page 7: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

State Diagrams

Label form:• On circle with output included:

state/output

Moore type output depends only on state

• On directed arc with the output included: input/output

Mealy type output depends on state and input

Page 8: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Example 1: State Diagram

Which type? Diagram gets

confusing forlarge circuits

For small circuits,usually easier tounderstand thanthe state table

A B0 0

0 1 1 1

1 0

x=0/y=1 x=1/y=0

x=1/y=0

x=1/y=0

x=0/y=1

x=0/y=1

x=1/y=0

x=0/y=0

1/0 : means input = 1output = 0

Page 9: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

9

Analysis with JK Flip-Flops

Page 10: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

10

Analysis with JK Flip-Flop

JA = B KA = B xJB = x KB = Ax + Ax = A x

The circuit can be specified by the flip-flop input equations:

Page 11: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

11

Analysis with JK Flip-Flops

A(t + 1) = JA + KAB(t + 1) = JB + KB

Substituting the values of JA and KA from the input equations, we obtain the state equation for A:

A(t + 1) = BA + (Bx)A = AB + AB +Ax The state equation provides the bit values for the column under

next state of A in the state table. Similarly, the state equation for flip-flop B can be derived from the characteristic equation by substituting the values of JB and KB:

B(t + 1) = xB + (A x)B = Bx + ABx + ABx

Page 12: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

12

Analysis with JK Flip-Flops

The state diagram of the sequential circuit is:

Page 13: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

13

Analysis With T Flip-Flops Characteristic equation:

Q(t + 1) = T Q

TA = Bx

TB = x

y = AB

Page 14: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

14

Analysis With T Flip-Flops

Consider the previous sequential circuit. It has two flip-flops A and B, one input x, and one output y. It can be described algebraically by two input equations and an output equation:

TA = Bx

TB = x

y = AB

A(t+1)=(Bx)A+(Bx)A

=AB+Ax+ABx

B(t+1)=xB

Page 15: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

15

Analysis With T Flip-Flops

00/0 : meansstate is 00output is 0

Characteristic equation:

Q(t + 1) = T Q

Page 16: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Example 1: Sequential Circuit Analysis

Logic Diagram:

Clock

Reset

D

QC

Q

R

D

QC

Q

R

D

QC

Q

R

A

B

C

Z

Page 17: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Example 2: Flip-Flop Input Equations

Clock

Reset

D

QC

Q

R

D

QC

Q

R

D

QC

Q

R

A

B

C

Z

Page 18: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Example 2: State Table

A B C A’ B’ C’ Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

(t+1)

0 0 1

0 1 0

0 1 1

1 0 0

0 0 0

0 1 0

0 1 0

1 0 0

0

0

0

0

1

1

1

1

(t)

Page 19: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

What is the function ofthe circuit?

Which states are used?

000

011 010

001100

101

110

111

Reset ABC

Example 2: State Diagram

Page 20: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Analysis with D Flip-Flop

The circuit we want to analyze is described by the input equation

DA = A x y

The DA symbol implies a D flip-flop with output A. The x and y variables are the inputs to the circuit. No output equations are given, so the output is implied to come from the output of the flip-flop.

Page 21: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Analysis with D Flip-Flop

The binary numbers under Axy are listed from 000 through 111. The next state values are obtained from the state

equation DA = A x y The state diagram consists of two circles-one for each

state

Page 22: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Equivalent State Definitions

Two states are equivalent if their response for each possible input sequence is an identical output sequence.

Alternatively, two states are equivalent if their outputs produced for each input symbol is identical and their next states for each input symbol are the same or equivalent.

Two states that are not equivalent are distinguishable

Page 23: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Equivalent State Example 1

For states S3 and S2,• the output for input

0 is 1 and input 1 is 0,and

• the next state for input0 is S0 and for input1 is S2.

• states S3 and S2 are equivalent. S2 S3

1/00/1

1/0

0

S0/0 S1

1/0

0/1

1

0/1

Page 24: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Equivalent State Example

Replacing S3 and S2by a single state givesstate diagram:

Examining the new diagram,states S1 and S2 are equivalent since• their outputs for input

0 is 1 and input 1 is 0,and

• their next state for input0 is S0 and for input1 is S2,

Replacing S1 and S2 by asingle state gives statediagram:

S2

1/0

0/0

S0 S1

1/0

0/1

1/0

0/1

0/0

S0 S1

1/0

0/1

1/0

Page 25: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Moore and Mealy Models

Sequential Circuits or Sequential Machines are also called Finite State Machines (FSMs). Two formal models exist:

Moore Model

• Named after E.F. Moore

• Outputs are a function ONLY of states

• Usually specified on the states.

Mealy Model• Named after G. H. Mealy• Outputs are a function of

inputs AND states• Usually specified on the

state transition arcs.

Page 26: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Moore and Mealy Example Diagrams

Mealy Model State Diagrammaps inputs and state to outputs

Moore Model State Diagram maps states to outputs

0 1

x=1/o=1

x=1/o=0

x=0/o=0

x=0/o=0

1/0 2/1

x=1x=1

x=0

x=0

x=1

x=0

0/0

Page 27: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Moore and Mealy Example Tables

Mealy Model state table maps inputs and state to outputs

Moore Model state table maps state to outputs

Present

State

Next State

x=0 x=1

Output

0 0 1 0

1 0 2 0

2 0 2 1

Present

State

Next State

x=0 x=1

Output

x=0 x=1

0 0 1 0 0

1 0 1 0 1

0 1

x=1/o=1

x=1/o=0

x=0/o=0

x=0/o=0

1/0 2/1

x=1x=1

x=0

x=0

x=1

x=0

0/0

Page 28: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

Mixed Moore and Mealy Outputs

In real designs, some outputs may be Moore type and other outputs may be Mealy type.

Example: Figure can be modified to illustrate this• State 00: Moore

• States 01, 10,and 11: Mealy

Simplifies outputspecification

10 11

1/00/1

1/0

0

00/0 01

1/0

0/1

1

0/1

Page 29: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

30

State Reduction

state a a b c d e f f g f g a

input 0 1 0 1 0 1 1 0 1 0 0

output 0 0 0 0 0 1 1 0 1 0 0

Example :

Initial point

Page 30: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

31

State Reduction We now proceed to reduce the number of states for this example.

First, we need the state table; it is more convenient to apply procedures for state reduction using a table rather than a diagram. The state table of the circuit is listed in Table 5-6 and is obtained directly from the state diagram.

Page 31: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

32

State Reduction

States g and e are two such states: they both go to states a and f and have outputs of 0 and 1 for x=0 and x=1, respectively. Therefore, states g and e are equivalent and one of these states can be removed. The procedure of removing a state and replacing it by its equivalent is demonstrated in Table 5-7. The row with present g is removed and state g is replaced by state e each time it occurs in the next-state columns.

Page 32: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

33

State Reduction Present state f now has next states e and f and outputs

0 and 1 for x=0 and x=1, respectively. The same next states and outputs appear in the row with present state d. Therefore, states f and d are equivalent and state f can be removed and replaced by d. The final reduced table is shown in Table 5-8. The state diagram for the reduced table consists of only five states.

Page 33: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

34

State Reduction

state a a b c d e f f g f g a

input 0 1 0 1 0 1 1 0 1 0 0

output 0 0 0 0 0 1 1 0 1 0 0

Example :

state a a b c d e d d e d e a

output 0 0 0 0 0 1 1 0 1 0 0

Page 34: Sequential Synchronous Circuit Analysis - Computer …vision.unipv.it/reti-logiche/Chap_05_P1 Sequential... ·  · 2015-04-29Analysis with JK Flip-Flops A(t + 1) = JA + KA B(t +

35

State Assignment