Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

39
Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    222
  • download

    0

Transcript of Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

Page 1: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

Embedded Systems Hardware: Storage Elements;

Finite State Machines;

Sequential Logic

Page 2: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_08

Finite state machine (FSM):High-level view

Moore machine: output is a function of the present state only

Mealy machine: output is a function of the present stare and the inputs

Page 3: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_09

Examples:

Latch and register

What is the difference?

Shift register (shift right)

fig_03_10

Page 4: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_15fig_03_16

Verilog—shift registers; behavioral and structural (por=power on reset)

Page 5: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_18

fig_03_19

Parallel-in, serial-out shift register

Page 6: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_20, 3_21, 3_22

Linear feedback shift register (for providing random numbers, e.g.);

Note: pullUp needed to prevent floating Reset pin on D flipflops

Page 7: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_23,3_24

“Dividers”: slow clock down, e.g.

Simple divide-by-2 example

Page 8: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_25, 03_26, 03_27

Example:

Asynchronous divide-by-4 counter

[asynchronous 2-bit binary upcounter; ripple counter]

Note: asynchronous because flip-flops are changed by different signals

Note: if 1st stage output appears at time t0 + m, nth stage output appears at time t0 + nm; so this configuration is good for dividing the signal but using it as a ripple counter is prone to static and dynamic hazards Both outputs change:

Page 9: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_28, 03_29

Synchronous dividers and counters (preferred):

Example: 2-bit binary upcounter

Inputs:

DA = not A

DB = A xor B

Page 10: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_30, 03_31, 03_32, 03_33

Johnson counter (2-bit): shift register + feedback input; often used in embedded applications; states for a Gray code; thus states can be decoded using combinational logic; there will not be any race conditions or hazards

Page 11: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_343-stage Johnson counter:

--Output is Gray sequence—no decoding spikes

--not all 23 (2n) states are legal—period is 2n (here 2*3=6)

--unused states are illegal; must prevent circuit from ever going into these states

Page 12: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

Making actual working circuits:

Must consider--timing in latches and flip-flops--clock distribution--how to test sequential circuits (with n flip-

flops, there are potentially 2n states, a large number; access to individual flipflops for testing must also be carefully planned)

Page 13: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_36, 03_37

Timing in latches and flip-flops:

Setup time: how long must inputs be present and stable before gate or clock changes state?

Hold time: how long must input remain stable after the gate or clock has changed state?

Metastable oscillations can occur if timing is not correctSetup and hold times for a

gated latch enabled by a logical 1 on the gate

Page 14: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_38

Example: positive edge triggered FF; 50% point of each signal

Page 15: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_39, 03-40

Propagation delay: minimum, typical, maximum values--with respect to causative edge of clock:

Latch: must also specify delay when gate is enabled:

Page 16: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_41, 03_42

Timing margins: example: increasing frequency for 2-stage Johnson counter –output from either FF is 00110011….

assume tPDLH = 5-16ns

tPDLH =7-18ns

tsu = 16ns

Page 17: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

Case 1: L to H transition of QA

Clock period = tPDLH + tsu + slack0 tPDLH + tsu

If tPDLH is max,

Frequency Fmax = 1/ [5 + 16)* 10-9]sec = 48MHz

If it is min, Fmax = 31.3 MHz

Case 2: H to L transition:

Similar calculations give Fmax = 43.5 MHz or 29.4 MHz

Conclusion: Fmax cannot be larger than 29.4 MHz to get correct behavior

Page 18: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

Clocks and clock distribution:

--frequency and frequency range

--rise times and fall times

--stability

--precision

Page 19: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_43

Clocks and clock distribution:

Lower frequency than input; can use divider circuit above

Higher frequncy: can use phase locked loop:

Page 20: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_44

Selecting portion of clock: rate multiplier

Page 21: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_46

Note: delays can accumulate

Page 22: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_47

Clock design and distribution:

Need precision

Need to decide on number of phases

Distribution: need to be careful about delays

Example: H-tree / buffers

Page 23: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_48

Testing:

Scan path is basic tool

Page 24: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_47

Page 25: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_48

Page 26: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_49

Page 27: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_50

Page 28: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_51

Page 29: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_52

Page 30: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_53

Page 31: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_54

Page 32: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_55

Page 33: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_56

Testing fsms:

Real-world fsms are weakly connected, i.e., we can’t get from any state S1 to any state S2

Weakly connected: we can get from a state S initial to any state Sj; sequence of inputs which permits this is called a transfer sequence

Homing sequence: produce a unique destination state after it is applied

Inputs:

I test = Ihoming + Itransfer

Finding a fault: requires a

Distinguishing sequence

Page 34: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_57

Basic testing setup:

Page 35: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_58

Page 36: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_59

Example: machine specified by table below

Successor tree

Page 37: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_63

Example: recognize 1010

Page 38: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_65

Scan path

Page 39: Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.

fig_03_66

Standardized boundary scan architecture

Architecture and unit under test