Chapter 3 <1>
Digital Design and Computer Architecture, 2nd Edition
Chapter 3
David Money Harris and Sarah L. Harris
Chapter 3 Digital Design and Computer Architecture , 2 nd Edition - - PowerPoint PPT Presentation
Chapter 3 Digital Design and Computer Architecture , 2 nd Edition David Money Harris and Sarah L. Harris Chapter 3 <1> Chapter 3 :: Topics Introduction Latches and Flip-Flops Synchronous Logic Design Finite State Machines
Chapter 3 <1>
David Money Harris and Sarah L. Harris
Chapter 3 <2>
Chapter 3 <3>
Chapter 3 <4>
Chapter 3 <5>
Chapter 3 <6>
Chapter 3 <7>
Q Q I1 I2 1 1 Q Q I1 I2 1 1
Chapter 3 <8>
Chapter 3 <9>
R S Q Q N1 N2 1 1 R S Q Q N1 N2 1 1 1
Chapter 3 <10>
R S Q Q N1 N2 1 1 R S Q Q N1 N2 1 1 1
Chapter 3 <11>
R S Q Q N1 N2 R S Q Q N1 N2 Qprev = 0 Qprev = 1 1
R S Q Q N1 N2 1 1
Chapter 3 <12>
R S Q Q N1 N2 R S Q Q N1 N2 Qprev = 0 Qprev = 1
R S Q Q N1 N2 1 1
Chapter 3 <13>
Chapter 3 <14>
Chapter 3 <15>
S R Q Q Q Q D CLK
D R S
Chapter 3 <16>
S R Q Q Q Q D CLK
D R S
Chapter 3 <17>
Chapter 3 <18>
CLK D Q Q CLK D Q Q Q Q D N1 CLK L1 L2
– L1 is transparent – L2 is opaque – D passes through to N1
– L2 is transparent – L1 is opaque – N1 passes through to Q
– D passes through to Q
Chapter 3 <19>
CLK D Q (latch) Q (flop)
Chapter 3 <20> CLK D Q (latch) Q (flop)
Chapter 3 <21>
CLK D Q D Q D Q D Q D0 D1 D2 D3 Q0 Q1 Q2 Q3
Chapter 3 <22>
Internal Circuit D Q CLK EN D Q 1 D Q EN Symbol
Chapter 3 <23>
Reset r
Chapter 3 <24>
Chapter 3 <25>
Internal Circuit D Q CLK D Q Reset
Chapter 3 <26>
Set s
Chapter 3 <27> X Y Z time (ns) 0 1 2 3 4 5 6 7 8
X Y Z
Chapter 3 <28>
X Y Z
X Y Z time (ns) 0 1 2 3 4 5 6 7 8
Chapter 3 <29>
– Every circuit element is either a register or a combinational circuit – At least one circuit element is a register – All registers receive the same clock signal – Every cyclic path contains at least one register
– Finite State Machines (FSMs) – Pipelines
Chapter 3 <30>
Next State Current State S’ S CLK
Next State Logic Next State
Output Logic Outputs
Chapter 3 <31>
CLK M N k k
next state logic
logic
Moore FSM CLK M N k k
next state logic
logic
inputs inputs
state state next state next state
Mealy FSM
– Moore FSM: outputs depend only on current state – Mealy FSM: outputs depend on current state and inputs
Chapter 3 <33>
Chapter 3 <32>
TA LA TA LB TB TB LA LB
Academic Ave. Bravado Blvd. Dorms Fields Dining Hall Labs
Chapter 3 <34>
S0 LA: green LB: red Reset
Chapter 3 <35>
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
Chapter 3 <36>
Chapter 3 <37>
Chapter 3 <38>
Chapter 3 <39>
Chapter 3 <40>
Chapter 3 <41>
Chapter 3 <42>
S1 S0 S'1 S'0 CLK
state register
Reset r
Chapter 3 <43>
S1 S0 S'1 S'0 CLK
next state logic state register
Reset TA TB
inputs
S1 S0 r
Chapter 3 <44>
S1 S0 S'1 S'0 CLK
next state logic
state register
Reset LA1 LB1 LB0 LA0 TA TB
inputs
S1 S0 r
Chapter 3 <45>
CLK Reset TA TB S'1:0 S1:0 LA1:0 LB1:0 Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9 Cycle 10 S1 (01) S2 (10) S3 (11) S0 (00) t (sec) ?? ?? S0 (00) S0 (00) S1 (01) S2 (10) S3 (11) S1 (01) ?? ??
5 10 15 20 25 30 35 40 45 Green (00) Red (10)
S0 (00)
Yellow (01) Red (10) Green (00) Green (00) Red (10) Yellow (01) 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
Chapter 3 <46>
Chapter 3 <47>
Chapter 3 <48>
Mealy FSM: arcs indicate input/output
Moore FSM
Reset S0 S1 S2 1 1 1 1
Reset S0 S1 1/1 0/0 1/0 0/0
Mealy FSM
Chapter 3 <49>
S1 S0 A S'1 S'0
1 1 1 1 1 1 1
Chapter 3 <50>
S1 S0 A S'1 S'0
1 1 1 1 1 1 1 1 1 1 1
Chapter 3 <51>
Chapter 3 <52>
Chapter 3 <53>
Current State Input Next State Output S0 A S'0 Y
1 1 1 1
Chapter 3 <54>
Current State Input Next State Output S0 A S'0 Y
1 1 1 1 1 1 1
Chapter 3 <55>
Y CLK Reset A r S'0 S0 S'1 S1
Chapter 3 <56>
Chapter 3 <57>
Mealy Machine Moore Machine
CLK Reset A S Y S Y Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9 Cycle 10 S0 S2 ?? S2 S2 S0 S1 1 1 1 1 1 1 S1 S0 S0 ?? S0 S1 S0 S1 S1 S0 S1 Cycle 11
Chapter 3 <58>
Chapter 3 <59>
Controller FSM
TA TB LA LB P R Mode FSM Lights FSM
P M
Controller FSM
TA TB LA LB R
Chapter 3 <60>
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 S4 LA: green LB: red S5 LA: yellow LB: red S7 LA: red LB: yellow S6 LA: red LB: green TA TA P P P P P P R R R R R P R P TA P TA P P TA R TA R R TB R TB R
Chapter 3 <61>
S0 LA: green LB: red S1 LA: yellow LB: red S3 LA: red LB: yellow S2 LA: red LB: green TA TA M + TB MTB Reset Lights FSM S0 M: 0 S1 M: 1 P Reset P Mode FSM R R
Chapter 3 <62>
1. Rewrite state transition table with state encodings 2. Write output table
1. Rewrite combined state transition and output table with state encodings
Chapter 3 <63>
Chapter 3 <64>
CLK tsetup D thold ta
Chapter 3 <65>
CLK tccq tpcq Q
Chapter 3 <66>
Chapter 3 <67>
C L CLK CLK R1 R2 Q1 D2 (a) CLK Q1 D2 (b) Tc
Chapter 3 <68>
CLK Q1 D2 Tc tpcq tpd tsetup C L CLK CLK Q1 D2 R1 R2
Chapter 3 <69>
CLK Q1 D2 Tc tpcq tpd tsetup C L CLK CLK Q1 D2 R1 R2
Chapter 3 <70>
CLK Q1 D2 Tc tpcq tpd tsetup C L CLK CLK Q1 D2 R1 R2
(tpcq + tsetup): sequencing overhead
Chapter 3 <71>
CLK Q1 D2 tccq tcd thold C L CLK CLK Q1 D2 R1 R2
Chapter 3 <72>
CLK Q1 D2 tccq tcd thold C L CLK CLK Q1 D2 R1 R2
Chapter 3 <73>
CLK Q1 D2 tccq tcd thold C L CLK CLK Q1 D2 R1 R2
Chapter 3 <74>
CLK CLK A B C D X' Y' X Y
per gate
tccq = 30 ps tpcq = 50 ps tsetup = 60 ps thold = 70 ps tpd = 35 ps tcd = 25 ps
tpd = tcd = Setup time constraint: Tc ≥ fc = Hold time constraint: tccq + tcd > thold ?
Chapter 3 <75>
CLK CLK A B C D X' Y' X Y
per gate
tccq = 30 ps tpcq = 50 ps tsetup = 60 ps thold = 70 ps tpd = 35 ps tcd = 25 ps
tpd = 3 x 35 ps = 105 ps tcd = 25 ps Setup time constraint: Tc ≥ (50 + 105 + 60) ps = 215 ps fc = 1/Tc = 4.65 GHz Hold time constraint: tccq + tcd > thold ? (30 + 25) ps > 70 ps ? No!
Chapter 3 <76>
per gate
tccq = 30 ps tpcq = 50 ps tsetup = 60 ps thold = 70 ps tpd = 35 ps tcd = 25 ps
tpd = tcd = Setup time constraint: Tc ≥ fc = Hold time constraint: tccq + tcd > thold ?
CLK CLK A B C D X' Y' X Y
Add buffers to the short paths:
Chapter 3 <77>
per gate
tccq = 30 ps tpcq = 50 ps tsetup = 60 ps thold = 70 ps tpd = 35 ps tcd = 25 ps
tpd = 3 x 35 ps = 105 ps tcd = 2 x 25 ps = 50 ps Setup time constraint: Tc ≥ (50 + 105 + 60) ps = 215 ps fc = 1/Tc = 4.65 GHz Hold time constraint: tccq + tcd > thold ? (30 + 50) ps > 70 ps ? Yes!
CLK CLK A B C D X' Y' X Y
Add buffers to the short paths:
Chapter 3 <78>
t skew
CLK1 CLK2 C L CLK2 CLK1 R1 R2 Q1 D2 CLK delay CLK
Chapter 3 <79>
CLK1 Q1 D2 Tc tpcq tpd tsetuptskew C L CLK2 CLK1 R1 R2 Q1 D2 CLK2
Chapter 3 <80>
CLK1 Q1 D2 Tc tpcq tpd tsetuptskew C L CLK2 CLK1 R1 R2 Q1 D2 CLK2
Chapter 3 <81>
CLK1 Q1 D2 Tc tpcq tpd tsetuptskew C L CLK2 CLK1 R1 R2 Q1 D2 CLK2
Chapter 3 <82>
tccq tcd thold Q1 D2 tskew C L CLK2 CLK1 R1 R2 Q1 D2 CLK2 CLK1
Chapter 3 <83>
tccq tcd thold Q1 D2 tskew C L CLK2 CLK1 R1 R2 Q1 D2 CLK2 CLK1
Chapter 3 <84>
tccq tcd thold Q1 D2 tskew C L CLK2 CLK1 R1 R2 Q1 D2 CLK2 CLK1
Chapter 3 <85>
CLK tsetup thold
taperture
D Q D Q D Q ??? Case I Case II Case III
Chapter 3 <86>
Chapter 3 <87>
R S Q Q N1 N2
P(tres > t) = (T0/Tc ) e-t/τ tres : time to resolve to 1 or 0 T0, τ : properties of the circuit
Chapter 3 <88>
T0/Tc: probability input changes at a bad time (during aperture) P(tres > t) = (T0/Tc ) e-t/τ τ: time constant for how fast flip-flop moves away from metastability P(tres > t) = (T0/Tc ) e-t/τ
Chapter 3 <89>
D Q CLK SYNC
Chapter 3 <90>
D Q D2 Q D2 Tc tsetup tpcq CLK CLK CLK tres
metastable
F1 F2
Chapter 3 <91>
D Q D2 Q D2 Tc tsetup tpcq CLK CLK CLK tres
metastable
F1 F2
Chapter 3 <92>
Chapter 3 <93>
D D2 Q CLK CLK F1 F2
Tc = 1/500 MHz = 2 ns τ = 200 ps T0 = 150 ps tsetup = 100 ps N = 10 events per second
Chapter 3 <94>
D D2 Q CLK CLK F1 F2
Tc = 1/500 MHz = 2 ns τ = 200 ps T0 = 150 ps tsetup = 100 ps N = 10 events per second
P(failure) = (150 ps/2 ns) e-(1.9 ns)/200 ps = 5.6 × 10-6 P(failure)/second = 10 × (5.6 × 10-6 ) = 5.6 × 10-5 / second MTBF = 1/[P(failure)/second] ≈ 5 hours
Chapter 3 <95>
Chapter 3 <96>
Chapter 3 <97>
Chapter 3 <98>
Chapter 3 <99>
Chapter 3 <100>
Spatial Parallelism Roll Bake Ben 1 Ben 1 Alyssa 1 Alyssa 1 Ben 2 Ben 2 Alyssa 2 Alyssa 2 Time
5 10 15 20 25 30 35 40 45 50
Tray 1 Tray 2 Tray 3 Tray 4
Latency: time to first tray
Legend
Chapter 3 <101>
Spatial Parallelism Roll Bake Ben 1 Ben 1 Alyssa 1 Alyssa 1 Ben 2 Ben 2 Alyssa 2 Alyssa 2 Time
5 10 15 20 25 30 35 40 45 50
Tray 1 Tray 2 Tray 3 Tray 4
Latency: time to first tray
Legend
Chapter 3 <102>
Temporal Parallelism Ben 1 Ben 1 Ben 2 Ben 2 Ben 3 Ben 3 Time
5 10 15 20 25 30 35 40 45 50 Latency: time to first tray
Tray 1 Tray 2 Tray 3
Chapter 3 <103>
Temporal Parallelism Ben 1 Ben 1 Ben 2 Ben 2 Ben 3 Ben 3 Time
5 10 15 20 25 30 35 40 45 50 Latency: time to first tray
Tray 1 Tray 2 Tray 3