Presentation is loading. Please wait.

Presentation is loading. Please wait.

Latches and Flip-Flops Discussion D8.1 Section 13-9.

Similar presentations


Presentation on theme: "Latches and Flip-Flops Discussion D8.1 Section 13-9."— Presentation transcript:

1 Latches and Flip-Flops Discussion D8.1 Section 13-9

2 Sequential Logic Combinational Logic –Output depends only on current input Sequential Logic –Output depends not only on current input but also on past input values –Need some type of memory to remember the past input values

3 Cross-coupled Inverters State 1 State 2

4 ~S-~R Latch ~S ~R Q ~Q 0 0 1 1 0 1 ~S ~R Q ~Q 1 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand

5 ~S-~R Latch ~S ~R Q ~Q 0 0 1 1 0 1 ~S ~R Q ~Q 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand

6 ~S-~R Latch 0 0 1 1 0 1 ~S ~R Q ~Q 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand ~S ~R Q ~Q

7 ~S-~R Latch 0 0 1 1 0 1 0 1 1 0 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand 1 0 Set ~S ~R Q ~Q ~S ~R Q ~Q

8 ~S-~R Latch 0 0 1 1 0 1 1 1 1 0 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand 1 0 Set 1 0 Store ~S ~R Q ~Q ~S ~R Q ~Q

9 ~S-~R Latch 0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand 1 0 Set 1 0 Store ~S ~R Q ~Q ~S ~R Q ~Q

10 ~S-~R Latch 0 0 1 1 0 1 1 0 1 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand 1 0 Set 1 0 Store ~S ~R Q ~Q ~S ~R Q ~Q

11 ~S-~R Latch 0 0 1 1 0 1 1 0 0 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand 1 0 Set 1 0 Store 0 1 Reset ~S ~R Q ~Q ~S ~R Q ~Q

12 ~S-~R Latch 0 0 1 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand 1 0 Set 1 0 Store 0 1 Reset ~S ~R Q ~Q ~S ~R Q ~Q

13 ~S-~R Latch 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand 1 0 Set 1 0 Store 0 1 Reset 1 1 Disallowed Q 0 !Q 0 ~S ~R Q ~Q ~S ~R Q ~Q

14 ~S-~R Latch 0 0 1 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand 1 0 Set 1 0 Store 0 1 Reset 1 1 Disallowed Q 0 !Q 0 To close or lock with or as if with a latch, To catch or fasten ~S ~R Q ~Q ~S ~R Q ~Q

15 S-R Latch ~S ~R Q ~Q S R CLK S R CLK ~S ~R Q ~Q 0 0 1 1 1 Q 0 ~Q 0 Store 0 1 1 1 0 0 1 Reset 1 0 1 0 1 1 0 Set 1 1 1 0 0 1 1 Disallowed X X 0 1 1 Q 0 ~Q 0 Store

16 D Latch Q ~Q CLK D ~S ~R S R S R CLK Q ~Q 0 0 1 Q 0 ~Q 0 Store 0 1 1 0 1 Reset 1 0 1 1 0 Set 1 1 1 1 1 Disallowed X X 0 Q 0 ~Q 0 Store 0 1 1 1 1 0 X 0 Q 0 ~Q 0 D CLK Q ~Q

17 D Latch Q ~Q CLK D ~S ~R S R 0 1 1 1 1 0 X 0 Q 0 ~Q 0 D CLK Q ~Q Note that Q follows D when the clock in high, and is latched when the clock goes to zero.

18 Recall the ~S-~R Latch ~S ~R Q ~Q 0 0 1 1 0 1 ~S ~R Q ~Q 1 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 X Y nand 1 0 Set 1 0 Store 0 1 Reset 1 1 Disallowed Q 0 ~Q 0

19 Edge-triggered D Flip-flop 0 1 1 1 0 1

20 1 0 1 0 1 1 0 1

21 1 0 1 0 1 0 1 1

22 1 0 0 1 1 0 1 0

23 1 1 0 0 1 0 0 1

24 1 1 0 1 1 0 0 1

25 0 1 1 1 0 1 0 1

26

27

28 Edge-triggered D Flip-flop with asynchronous set and reset 0 1 1 1 0 1

29 0 1 1 1 0 1 0 1 0 1

30 0 1 1 1 0 1 1 1 0 1

31 0 1 1 1 1 0 1 0 1 0

32 0 1 1 1 0 1 1 0 1 1

33

34 D Flip-Flop 0 0 1 1 1 0 X 0 Q 0 ~Q 0 D CLK Q ~Q D gets latched to Q on the rising edge of the clock. Positive edge triggered

35 Each Xilinx 95108 macrocell contains a D flip-flop Controlled inverter

36 Each Xilinx 95108 macrocell contains a D flip-flop Note asynchronous preset x Note asynchronous reset y z

37 Divide-by-2 Counter CLK Q0 D = ~Q0 CLK DQ ~Q D = ~Q0 Q0 D ~Q0

38 module div2cnt ( Q,clr,clk ); input clr ; wire clr ; input clk ; wire clk ; output Q ; reg Q ; wire D ; assign D = ~Q; // D Flip-flop always @(posedge clk or posedge clr) if(clr == 1) Q = 0; else Q = D; endmodule div2cnt.abl CLK DQ !Q D = ~Q0 Q0 D ~Q0

39 J-K Flip-flops D = J & ~Q | ~K & Q J K D 0 0 Q 0 1 0 1 0 1 1 1 ~Q

40 J-K Flip-flops

41 T Flip-flops D = T ^ Q TD 0Q 1 ~Q

42 T Flip-flops


Download ppt "Latches and Flip-Flops Discussion D8.1 Section 13-9."

Similar presentations


Ads by Google