chapter 5 digital design, 5ed. mano & ciletti. · combinational vs. sequential combinational...

57
Synchronous Sequential Logic Chapter 5 Digital Design, 5ed. Mano & Ciletti.

Upload: others

Post on 29-May-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Synchronous Sequential Logic

Chapter 5Digital Design, 5ed.

Mano & Ciletti.

Page 2: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Module Outline

● Introduction● Sequential Circuits

– Latches, and Flip‐Flops

● Analysis of Clocked Sequential Circuits● Synthesizable HDL Models of Sequential Circuits

– Verilog

● State Reduction and Assignment● Design Procedure

– Thought process

Page 3: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Outline

● Clock signal ● Sequential Circuits● Synchronous vs. Asynchronous circuits● Flip-Flops, Latches

Page 4: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Cycle● Clock is a special signal to hardware● A well defined indication for event start and

complete.

Time (ns) 1.0 2.01.5 2.5

Page 5: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Cycle● Clock is a special signal to hardware● A well defined indication for event start and

complete.

Time (ns)

Clock

1.0 2.01.5 2.5

Page 6: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Cycle● Clock is a special signal to hardware● A well defined indication for event start and

complete.

Time (ns)

Clock

1.0 2.01.5 2.5

Rising Edge Falling edge

Page 7: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Cycle● Clock is a special signal to hardware● A well defined indication for event start and

complete.

Time (ns)

Clock

1.0 2.01.5 2.5

Rising Edge Falling edge

Levels

Page 8: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Cycle● Clock is a special signal to hardware● A well defined indication for event start and

complete.

Time (ns)

Clock

1.0 2.01.5 2.5

Addition ADDITION COMPLETES INTHIS DURATION

ANOTHER BLOCK

Page 9: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Cycle● Clock is a special signal to hardware● A well defined indication for event start and

complete.

Time (ns)

Clock

1.0 2.01.5 2.5

Addition ADDITION COMPLETES INTHIS DURATION

Both operands are ready.

The result is ready.

ANOTHER BLOCK

Page 10: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Cycle● Clock is a special signal to hardware● A well defined indication for event start and

complete.

Time (ns)

Clock

1.0 2.01.5 2.5

Addition ADDITION COMPLETES INTHIS DURATION

Both operands are ready.

The result is ready.

The result is consumed by another block.

ANOTHER BLOCK

Page 11: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Cycle● Clock is a special signal to hardware● A well defined indication for event start and

complete.

Time (ns)

Clock

1.0 2.01.5 2.5

Addition ADDITION COMPLETES INTHIS DURATION

ANOTHER BLOCK

Page 12: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Cycle● Clock is a special signal to hardware● A well defined indication for event start and

complete.

Time (ns)

Clock

1.0 2.01.5 2.5

Addition ADDITION COMPLETES INTHIS DURATION

ANOTHER BLOCK

Posedge occured.Copy inputsto outputs.

Posedge occured.Copy inputsto outputs.

Page 13: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Sequential Circuits

● We’ll build a few of these

Page 14: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Combinational Circuits vs. Sequential Circuits

● Combinational Circuits–

● Sequential circuits–

Page 15: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Combinational vs. Sequential

● Combinational Circuits: Output depends only and immediately on their inputs– No memory

– No dependence on past input values

Page 16: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Combinational vs. Sequential

● Combinational Circuits: Output depends only and immediately on their inputs

● Sequential circuits: Have memory– Storage elements

– Can store, retain, and then retrieve information when needed at a later time

Page 17: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Combinational vs. Sequential

● Combinational Circuits: Output depends only and immediately on their inputs

● Sequential circuits: Have memory– Storage elements

– Can store, retain, and then retrieve information when needed at a later time

– Used to stabilize inputs to combinational circuits● Eg. RF feeds Adder

Page 18: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Sequential Circuit

Page 19: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Sequential Circuit

Page 20: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Sequential Circuit

● Information stored defines state of sequential circuit

Page 21: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Sequential Circuit

● Information stored defines state of sequential circuit

● Output depends on inputs + present state of the storage elements

Page 22: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Sequential Circuit

● Information stored defines state of sequential circuit

● Output depends on inputs + present state of the storage elements– Output Transition

Page 23: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

A System with States, Transitions

Page 24: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

A System with States, Transitions

– Nothing happens

● On a Coin insert, system transitions to “Unlocked” state● When in “Unlocked” state, adding more coins does not

change the state● “Push” changes state back to “Locked”

Page 25: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Sequential Circuits

● Synchronous●

● Asynchronous●

Page 26: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Sequential Circuits

● Synchronous– Behavior defined at discrete instants of time

– Eg. at the rising edge of a clock signal: copy input to output.

● Asynchronous

Page 27: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Sequential Circuits

● Synchronous– Behavior defined at discrete instants of time

– Eg. at the rising edge of a clock signal: copy input to output.

● Asynchronous– No clock signal to mark time

– Uses signals to indicate completion of tasks

– Eg. a. Send data, and signal that data is being sent. b. Reset signals

Page 28: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Signal

● Sequential circuits respond at discrete instants of time

● Clock signal identifies these discrete instants– Discrete vs. Continuous: Speech is continuous,

Recording is discrete

Page 29: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Signal

● Sequential circuits respond at discrete instants of time

● Clock signal identifies these discrete instants– Discrete vs. Continuous: Speech is continuous,

Recording is discrete

Page 30: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Signal

● A periodic train of clock pulses– clock/clk

clock

Page 31: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Signal

● A periodic train of clock pulses– clock/clk

● Clock pulse determines when computational activity will occur within the circuit– When computation should begin/end

clock

Page 32: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Signal

● A periodic train of clock pulses– clock/clk

● Clock pulse determines when computational activity will occur within the circuit– When computation should begin/end

● Eg. Adders compute their sum at the occurrence of a clock pulse

clock

Page 33: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Synchronous Clocked Sequential Circuits

Page 34: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop input output

clock

Page 35: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Stores 1-bit– In stable state, the output of a FF is either 0 or 1

input output

clock

Page 36: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Stores 1-bit– In stable state, the output of a FF is either 0 or 1

● FF state changes only at clock pulse transition– Eg. at a rising edge (clock signal changes from 0 to

1)

input output

clock

Page 37: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Stores 1-bit– In stable state, the output of a FF is either 0 or 1

● FF state changes only at clock pulse transition– Eg. at a rising edge (clock signal changes from 0 to

1)

● At all other instants, value at input is effectively ignored– Output cannot change even if inputs change

input output

clock

Page 38: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Inputs to FF are generated by a preceding Combinational Circuit– Eg. Adder

input output

clock

CC1CC1 CC2CC2

Page 39: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Inputs to FF are generated by a preceding Combinational Circuit– Eg. Adder

input output

clock

CC1CC1

Page 40: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Inputs to FF are generated by a preceding Combinational Circuit– Eg. Adder

input output

clock

CC1CC1

at Rising edge of clock:    output = f(input,old output); # create new state

at all other time instants: output = output; # replay output value from prev Rising edge

at Rising edge of clock:    output = f(input,old output); # create new state

at all other time instants: output = output; # replay output value from prev Rising edge

Page 41: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Inputs to FF are generated by a preceding Combinational Circuit– Eg. Adder

input output

clock

CC1CC1

at Rising edge of clock:   output = input; # create new state

at all other time instants: output = output; # replay output value from prev Rising edge

at Rising edge of clock:   output = input; # create new state

at all other time instants: output = output; # replay output value from prev Rising edge

ExampleExample

Page 42: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Inputs to FF are generated by a preceding Combinational Circuit– Eg. Adder

input output

clock

CC1CC1

at Rising edge of clock:   output = (input)?old output:!(old output);at all other time instants: output = output; # replay output value from prev Rising edge

at Rising edge of clock:   output = (input)?old output:!(old output);at all other time instants: output = output; # replay output value from prev Rising edge

ExampleExample

Page 43: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Output of CC1 should be ready and stable well before the clock edge arrives

● Output of CC1 should be stable until the FF captures the input correctly

input output

clock

CC1CC1

Page 44: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Output of CC1 should be ready and stable well before the clock edge arrives

● Output of CC1 should be stable until the FF captures the input correctly

input output

clock

CC1CC1

InputReady

InputStable

Page 45: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flop

● Output of CC1 should be ready and stable well before the clock edge arrives

● Output of CC1 should be stable until the FF captures the input correctly

input output

clock

CC1CC1

Setup timeSetup time Hold timeHold time

Page 46: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Clock Cycle

● Propagation delays in CC1 determine the minimum interval between clock pulses that will allow the circuit to operate correctly.

input output

clock

CC1CC1

input output

clock

CC1CC1

clock

Page 47: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flops vs. Latches

● FFs are edge sensitive– Only change state at clock edge

● Latch is a level sensitive sequential circuit

Page 48: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flops vs. Latches

● FFs are edge sensitive– Only change state at clock edge

● Latch is a level sensitive sequential circuit

Page 49: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flops vs. Latches

● FFs are edge sensitive– Only change state at clock edge

● Latch is a level sensitive sequential circuit

D

FF-

Page 50: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flops vs. Latches

● FFs are edge sensitive– Only change state at clock edge

● Latch is a level sensitive sequential circuit

D

FF-

Latch-Q

Page 51: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flops vs. Latches

● Latch is a level sensitive sequential circuit

D

FF-

Latch-Q

at Level-High of clock:    output = f(input,old output); # create new state

at all other time instants: output = output; # replay output value from prev Rising edge

at Level-High of clock:    output = f(input,old output); # create new state

at all other time instants: output = output; # replay output value from prev Rising edge

Page 52: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Latch

● Latches are building blocks for flip-flops● Back-to-back latches form a FF

Page 53: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Sequential Circuits – Summary

● Information stored defines state of Sequential Circuit

● Output depends on inputs + present state of the storage elements

● Inputs can change/retain state● Specified by a time sequence of inputs,

outputs, and internal states

Page 54: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Summary

● Clock signal ● Sequential Circuits● Synchronous vs. Asynchronous circuits● Flip-Flops, Latches

Page 55: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Appendix

Page 56: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Flip-Flops vs. Latches

● FFs are edge sensitive– Only change state at clock edge

● Latch is a level sensitive sequential circuit

D

FF-

Latch-Q

Page 57: Chapter 5 Digital Design, 5ed. Mano & Ciletti. · Combinational vs. Sequential Combinational Circuits: Output depends only and immediately on their inputs Sequential circuits: Have

Set-Reset Latch (SR Latch)

S

R

Q

Q

at Level-High of clock:

  If( (S == 1) && (R == 0)): then

    Q = 1; Q’ = 0;

  Else if( (S == 0) && (R == 1)): then

    Q = 0; Q’ = 1;

  Else if( (S == 0) && (R == 0)): then

    Q = Q; Q’ = Q’;

  Else if( (S == 1) && (R == 1)): then

    Q = Q; Q’ = Q’;

at all other time instants:

output = output; # replay output value from prev Rising edge

at Level-High of clock:

  If( (S == 1) && (R == 0)): then

    Q = 1; Q’ = 0;

  Else if( (S == 0) && (R == 1)): then

    Q = 0; Q’ = 1;

  Else if( (S == 0) && (R == 0)): then

    Q = Q; Q’ = Q’;

  Else if( (S == 1) && (R == 1)): then

    Q = Q; Q’ = Q’;

at all other time instants:

output = output; # replay output value from prev Rising edge