420 likes | 433 Views
Latches and Flip-Flops. Discussion D8.1 Section 13-9. 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.
E N D
Latches and Flip-Flops Discussion D8.1 Section 13-9
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
Cross-coupled Inverters State 1 State 2
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 1 0 0 0 0 1 1 0 1 1 1 1 0 1 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 0 0 0 0 0 1 1 0 1 1 1 1 0 1 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 0 1 0 0 0 1 1 0 1 1 1 1 0 1 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 0 1 0 0 0 1 1 0 1 1 1 0 Set 0 1 0 1 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 1 1 0 0 0 1 1 0 1 1 1 0 Set 0 1 0 1 Store 1 0 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 1 1 0 0 0 1 1 0 1 1 1 0 Set 0 0 0 1 Store 1 0 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 1 1 0 0 0 1 1 0 1 1 1 0 Set 1 0 0 1 Store 1 0 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 1 0 0 0 0 1 1 0 1 1 1 0 Set 0 1 Reset 1 0 0 1 Store 1 0 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 1 0 0 0 0 1 1 0 1 1 1 0 Set 0 1 Reset 1 1 0 1 Store 1 0 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 0 1 0 0 0 1 1 0 1 1 1 1 Disallowed 1 0 Set 0 1 Reset 1 0 0 1 Store 1 0 Q0 !Q0 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
~S Q ~Q ~R ~S-~R Latch ~S ~R Q ~Q 1 0 0 0 0 1 1 0 1 1 1 1 Disallowed 1 0 Set 0 1 Reset 1 1 0 1 Store 1 0 Q0 !Q0 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0 To close or lock with or as if with a latch, To catch or fasten
S CLK R S R CLK ~S ~R Q ~Q S-R Latch ~S Q ~Q ~R 0 0 1 1 1 Q0 ~Q0 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 Q0 ~Q0 Store
D S R CLK Q ~Q D CLK Q ~Q 0 0 1 Q0 ~Q0 Store 0 1 1 0 1 Reset 1 0 1 1 0 Set 1 1 1 1 1 Disallowed X X 0 Q0 ~Q0 Store 0 1 0 1 1 1 1 0 X 0 Q0 ~Q0 D Latch S ~S Q CLK ~Q ~R R
D CLK Q ~Q 0 1 0 1 1 1 1 0 X 0 Q0 ~Q0 D Latch S ~S D Q CLK ~Q ~R R Note that Q follows D when the clock in high, and is latched when the clock goes to zero.
~S Q ~Q ~R Recall the ~S-~R Latch ~S ~R Q ~Q 1 0 0 0 0 1 1 0 1 1 1 1 Disallowed 1 0 Set 0 1 Reset 1 1 0 1 Store 1 0 Q0 ~Q0 X Y nand 0 0 1 0 1 1 1 0 1 1 1 0
Edge-triggered D Flip-flop 1 1 0 1 1 0
Edge-triggered D Flip-flop 1 1 0 1 1 0 1 0
Edge-triggered D Flip-flop 1 1 0 1 1 0 0 1
Edge-triggered D Flip-flop 0 1 1 0 1 0 0 1
Edge-triggered D Flip-flop 0 0 1 1 0 1 0 1
Edge-triggered D Flip-flop 0 0 1 1 0 1 1 1
Edge-triggered D Flip-flop 1 0 1 0 1 1 1 0
Edge-triggered D Flip-flop with asynchronous set and reset 1 1 0 1 1 0
Edge-triggered D Flip-flop with asynchronous set and reset 1 0 1 1 0 1 0 1 1 0
Edge-triggered D Flip-flop with asynchronous set and reset 1 1 1 1 0 1 0 1 1 0
Edge-triggered D Flip-flop with asynchronous set and reset 0 1 0 1 0 1 1 1 0 1
Edge-triggered D Flip-flop with asynchronous set and reset 1 1 0 1 0 1 1 1 1 0
D CLK Q ~Q 0 0 1 1 1 0 X 0 Q0 ~Q0 D Flip-Flop Positive edge triggered D gets latched to Q on the rising edge of the clock.
Controlled inverter Each Xilinx 95108 macrocell contains a D flip-flop
Each Xilinx 95108 macrocell contains a D flip-flop Note asynchronous preset x z y Note asynchronous reset
Divide-by-2 Counter CLK D D Q Q0 CLK ~Q ~Q0 Q0 D = ~Q0 D = ~Q0
div2cnt.abl 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 orposedge clr) if(clr == 1) Q = 0; else Q = D; endmodule D D Q Q0 CLK !Q ~Q0 D = ~Q0
J-K Flip-flops J K D 0 0 Q 0 1 0 1 0 1 1 1 ~Q D = J & ~Q | ~K & Q
T Flip-flops T D 0 Q 1 ~Q D = T ^ Q