cse 140l lecture 4 flip-flops, shifters and counters

10
CSE 140L Lecture 4 Flip-Flops, Shifters and Counters Professor CK Cheng CSE Dept. UC San Diego

Upload: kareem

Post on 05-Jan-2016

40 views

Category:

Documents


2 download

DESCRIPTION

CSE 140L Lecture 4 Flip-Flops, Shifters and Counters. Professor CK Cheng CSE Dept. UC San Diego. F-F Shift register Counter (Asynchronous) Counter (Synchronous). Flip-Flops. D. DFF. Asynchronous Clear. Q. Inputs Output. CE. C. CLR CE D C Q - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSE 140L Lecture 4 Flip-Flops, Shifters and Counters

CSE 140L Lecture 4Flip-Flops, Shifters and Counters

Professor CK Cheng

CSE Dept.

UC San Diego

Page 2: CSE 140L Lecture 4 Flip-Flops, Shifters and Counters

1) F-F2) Shift register3) Counter (Asynchronous)4) Counter (Synchronous)

Page 3: CSE 140L Lecture 4 Flip-Flops, Shifters and Counters

Flip-Flops

DFF

D

CE

C

CLR

Q

CLR CE D C Q 1 X X X 0 0 0 X X No change 0 1 1 1 0 1 0 0

Asynchronous Clear

Inputs Output

Clock Enable

CLK = 0 CLK = 1

Page 4: CSE 140L Lecture 4 Flip-Flops, Shifters and Counters

D Q

CLK

CLK

t

t

t

tsetup thold

D

Q

tcq

D-FF Timing

Page 5: CSE 140L Lecture 4 Flip-Flops, Shifters and Counters

Input Timing Constraints• Setup time: tsetup = time before the clock edge that

data must be stable (i.e. not changing)

• Hold time: thold = time after the clock edge that data must be stable

• Aperture time: ta = time around clock edge that data must be stable (ta = tsetup + thold)

CLK

tsetup

D

thold

ta

Page 6: CSE 140L Lecture 4 Flip-Flops, Shifters and Counters

Output Timing Constraints• Propagation delay: tpcq = time after clock edge that

the output Q is guaranteed to be stable (i.e., to stop changing)

• Contamination delay: tccq = time after clock edge that Q might be unstable (i.e., start changing)

CLK

tccqtpcq

Q

Page 7: CSE 140L Lecture 4 Flip-Flops, Shifters and Counters

Setup Time Constraint• The setup time constraint: The maximum delay from

register R1 through the combinational logic.

• The input to register R2 must be stable at least tsetup before the clock edge.

CLK

Q1

D2

Tc

tpcq tpd tsetup

CL

CLKCLK

Q1 D2

R1 R2

Tc ≥ tpcq + tpd + tsetup

tpd ≤ Tc – (tpcq + tsetup)

Page 8: CSE 140L Lecture 4 Flip-Flops, Shifters and Counters

Hold Time Constraint• The hold time constraint depends on the minimum delay

from register R1 through the combinational logic.

• The input to register R2 must be stable for at least thold after the clock edge.

thold < tccq + tcdtcd > thold - tccq

CLK

Q1

D2

tccq tcd

thold

CL

CLKCLK

Q1 D2

R1 R2

Page 9: CSE 140L Lecture 4 Flip-Flops, Shifters and Counters

2) A 3 Bit Shift Register

DQ

CLK

DQ

DQ

0 0 X X X 1 1 0 X X 2 0 1 0 X3 1 0 1 0

4 1 1 0 15 0 1 1 0

6 0 0 1 1 7 1 0 0 1

Time Steps A B C D

AB C D

Signal A is given as input.

Page 10: CSE 140L Lecture 4 Flip-Flops, Shifters and Counters

3) A 3 Bit Counter (Asynchronous)

TQ

CLK

TQ

TQ

CLK

tA

C

Bt

t

1 0 1 0

1 1 0 0

B C

t1 1 1 1

7 6 5 4

A

1 1 1

Reset A(0) = B(0) = C(0) = 0

0 0 0 0 0

1 1 1 1 7

2 1 1 0 63 1 0 1 5

4 1 0 0 45 0 1 1 3

6 0 1 0 2

7 0 0 1 1

Time C B A