Download presentation
Presentation is loading. Please wait.
1
1 CS 140 Lecture 19 Sequential Modules Professor CK Cheng CSE Dept. UC San Diego
2
2 Standard Sequential Modules 1.Register 2.Shift Register 3.Counter
3
3 Counter Applications?
4
4 Counter: Applications Program Counter Address Keeper: FIFO, LIFO Clock Divider Sequential Machine
5
5 Counter Modulo-n Counter Modulo Counter (m<n) Counter (a-to-b) Counter of an Arbitrary Sequence Cascade Counter
6
6 Modulo-n Counter LD D Q TC Q (t+1) = (0, 0,.., 0) if CLR = 1 = D if LD = 1 and CLR = 0 = (Q(t)+1)mod nif LD = 0, CNT = 1 and CLR = 0 = Q (t) if LD = 0, CNT = 0 and CLR = 0 CNT CLR Clk TC = 1 if Q (t) = n-1 and CNT = 1 = 0otherwise
7
7 Modulo-m Counter (m< n) Given a mod 16 counter, construct a mod-m counter (0 < m < 16) with AND, OR, NOT gates m = 6 Q 3 Q 2 Q 1 Q 0 3 2 1 0 CLK CLR CNT D 3 D 2 D 1 D 0 0 0 LD Q2Q2 Q0Q0 X Set LD = 1 when X = 1 and (Q 3 Q 2 Q 1 Q 0 ) = (0101), ie m-1
8
8 A 5-to-11 Counter Q 3 Q 2 Q 1 Q 0 Clk CLR CNT D 3 D 2 D 1 D 0 0 1 0 1 (a) LD Q3Q3 Q0Q0 X Set LD = 1 when X = 1 and (Q 3 Q 2 Q 1 Q 0 ) = b (in this case, 1011) Counter (a-to-b) Given a mod 16 counter, construct an a-to-b counter (0 < a < b < 15) Q1Q1 (b)
9
9 Given a mod 8 counter, construct a counter with sequence 0 1 5 6 2 3 7 Q 2 Q 1 Q 0 Clk CLR CNT D 2 D 1 D 0 LD Q2’Q2’ Q0Q0 X Q2Q2 Q 0 Q 1 Q 0 Q0’Q0’ When Q = 1, load D = 5 When Q = 6, load D = 2 When Q = 3, load D = 7 Counter of an Arbitrary Sequence
10
10 LD = Q 2’ Q 0 + Q 2 Q 0’ D 2 = Q 0 D 1 = Q 1 D 0 = Q 0 K Mapping LD and D, we get Id Q2Q1Q0Q2Q1Q0 LDD2D2 D1D1 D0D0 00000--- 10011101 20100--- 30111111 4100---- 51010--- 61101010 71000--- Given a mod 8 counter, construct a counter with sequence 0 1 5 6 2 3 7 Counter of an Arbitrary Sequence
11
11 D 2 = Q 0 D 1 = Q 1’ + Q 0 D 0 = Q 1’ Q 0 LD = Q 2’ Q 1’ + Q 2 Q 0 + Q 2 Q 1 Through K-map, we derive Example: Count in sequence 0 2 3 4 5 7 6 LD = 1 D = 2 When Q(t) = 0 LD = 1 D = 7 When Q(t) = 5 LD = 1 D = 6 When Q(t) = 7 LD = 1 D = 0 When Q(t) = 6 Id Q2Q1Q0Q2Q1Q0 LDD2D2 D1D1 D0D0 00001010 1001---- 20100--- 30110--- 41000--- 51011111 61101000 71001110 Counter of an Arbitrary Sequence
12
12 Cascade Counter CNT LD TC Clk Q 7, Q 6, Q 5, Q 4 D 7, D 6, D 5, D 4 CNT LD TC Clk Q 3, Q 2, Q 1, Q 0 D 3, D 2, D 1, D 0 X T C0 A Cascade Modulo 256 Counter
13
13 TC = 1 when (Q 3, Q 2, Q 1, Q 0 )=(1,1,1,1) and X=1 (Q 7 (t+1) Q 6 (t+1) Q 5 (t+1) Q 4 (t+1) ) = (Q 7 (t) Q 6 (t) Q 5 (t) Q 4 (t) ) + 1 mod 16 when T C0 = 1 The circuit functions as a modulo 256 counter. Cascade Counter Time 0123…13141516171819 Q 7-4 0000…0001111 T C0 0000…0010000 Q 3-0 0123…1314150123
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.