cs 140 lecture 15
play

CS 140 Lecture 15 Sequential Modules Professor CK Cheng CSE Dept. - PowerPoint PPT Presentation

CS 140 Lecture 15 Sequential Modules Professor CK Cheng CSE Dept. UC San Diego 1 Standard Sequential Modules 1. Serial Adders 2. Serial Multipliers 3. Register 4. Counter 2 Motivation for Serial Adders and Multipliers Tradeoff of


  1. CS 140 Lecture 15 Sequential Modules Professor CK Cheng CSE Dept. UC San Diego 1

  2. Standard Sequential Modules 1. Serial Adders 2. Serial Multipliers 3. Register 4. Counter 2

  3. Motivation for Serial Adders and Multipliers • Tradeoff of silicon area and system performance – Perform process in a series of time • Utilization of FPGA architecture – Slice operation bitwise • Metrics of Cost, Speed, and Power • Ad: Cheaper hardware, Fit for FPGA architecture, Pipelining for excellent throughput • Dis: Longer latency 3

  4. Serial Adder: Perform serial bit-addition At time i, read a i and b i . Produce s i and c i+1 Internal state stores c i . Carry bit c 0 is set as c in a 3 b 3 a 0 b 0 c in a i a Serial s i sum Adder b i b c out s 3 s 0 4

  5. Serial Adder using D F-F a i C2 b i s i D Q D Q’ C1 Clk Feed a i and b i and generate s i at time i. Where is c i and c i+1 ? 5

  6. Serial Adder using a D Flip-Flop id a i b i c i c i+1 s i 0 0 0 0 0 0 D=c i+1 1 0 0 1 0 1 Q=c i 2 0 1 0 0 1 3 0 1 1 1 0 4 1 0 0 0 1 5 1 0 1 1 0 6 1 1 0 1 0 7 1 1 1 1 1 6

  7. Serial Adder using a D Flip-Flop Logic Diagram a i s i b i D Q c i Q’ Clk 7

  8. Multiplication using Serial Addition 3 X 5 = 15 0 1 1 a 2 a 1 a 0 x 1 0 1 x b 2 b 1 b 0 0 1 1 a 2 b 0 a 1 b 0 a 0 b 0 0 0 0 a 2 b 1 a 1 b 1 a 0 b 1 a 2 b 2 a 1 b 2 a 0 b 2 0 1 1 + + 0 1 1 1 1 m5 m4 m3 m2 m1 m0 For m=AxB, set m (0) =0 At time i, perform m (i+1) =m (i) +Ab i 2 i 8

  9. Register D LD Clk CLR Q Q (t+1) = (0, 0, .. , 0) if CLR = 1 = D if LD = 1 and CLR = 0 = Q (t) if LD = 0 and CLR = 0 9

  10. Counter • Program Counter • Address Keeper: FIFO, LIFO • Clock Divider • Sequential Machine 10

  11. Counter • Modulo-n Counter • Modulo Counter (m<n) • Counter (a-to-b) • Counter of an Arbitrary Sequence • Cascade Counter 11

  12. Modulo-n Counter D CNT TC LD Clk CLR Q Q (t+1) = (0, 0, .. , 0) if CLR = 1 = D if LD = 1 and CLR = 0 = (Q(t)+1)mod n if LD = 0, CNT = 1 and CLR = 0 = Q (t) if LD = 0, CNT = 0 and CLR = 0 TC = 1 if Q (t) = n-1 and CNT = 1 = 0 otherwise 12

  13. Modulo-m Counter (m< n) Given a mod 16 counter, construct a mod-m counter (0 < m < 16) with AND, OR, NOT gates Q 3 Q 2 Q 1 Q 0 m = 6 3 2 1 0 CLR CLK CNT X D 3 D 2 D 1 D 0 LD Q 2 Q 0 0 0 0 0 Set LD = 1 when X = 1 and (Q 3 Q 2 Q 1 Q 0 ) = (0101), ie m-1 13

  14. Counter (a-to-b) Given a mod 16 counter, construct an a-to-b counter (0 < a < b < 15) A 5-to-11 Counter Q 3 Q 2 Q 1 Q 0 CLR Clk CNT X D 3 D 2 D 1 D 0 LD Q 3 (b) Q 1 0 1 0 1 (a) Q 0 Set LD = 1 when X = 1 and (Q 3 Q 2 Q 1 Q 0 ) = b (in this case, 1011) 14

  15. Counter of an Arbitrary Sequence Given a mod 8 counter, construct a counter with sequence 0 1 5 6 2 3 7 When Q = 1, load D = 5 When Q = 6, load D = 2 When Q = 3, load D = 7 Q 2 Q 1 Q 0 CLR Clk CNT X D 2 D 1 D 0 LD Q 2 ’ Q 0 Q 0 Q 1 Q 0 Q 2 Q 0 ’ 15

  16. Counter of an Arbitrary Sequence Given a mod 8 counter, construct a counter with sequence 0 1 5 6 2 3 7 K Mapping LD and D, Id Q 2 Q 1 Q 0 LD D 2 D 1 D 0 we get 0 000 0 - - - LD = Q 2’ Q 0 + Q 2 Q 0’ 1 001 1 1 0 1 D 2 = Q 0 2 010 0 - - - D 1 = Q 1 3 011 1 1 1 1 D 0 = Q 0 4 100 - - - - 5 101 0 - - - 6 110 1 0 1 0 7 111 0 - - - 16

  17. Counter of an Arbitrary Sequence Example: Count in sequence 0 2 3 4 5 7 6 Q 2 Q 1 Q 0 LD D 2 Id D 1 D 0 LD = 1 D = 2 When Q(t) = 0 LD = 1 D = 7 When Q(t) = 5 0 000 1 0 1 0 LD = 1 D = 6 When Q(t) = 7 1 001 - - - - LD = 1 D = 0 When Q(t) = 6 2 010 0 - - - Through K-map, we derive 3 011 0 - - - LD = Q 2’ Q 1’ + Q 2 Q 0 + Q 2 Q 1 4 100 0 - - - D 2 = Q 0 5 101 1 1 1 1 D 1 = Q 1’ + Q 0 D 0 = Q 1’ Q 0 6 110 1 0 0 0 7 111 1 1 1 0 17

  18. Cascade Counter A Cascade Modulo 256 Counter Q 7, Q 6, Q 5, Q 4 Q 3, Q 2, Q 1, Q 0 T C0 Q 3 Q 2 Q 1 Q 0 Q 3 Q 2 Q 1 Q 0 CNT CNT X TC TC Clk Clk D 3 D 2 D 1 D 0 LD LD D 3 D 2 D 1 D 0 D 7, D 6, D 5, D 4 D 3, D 2, D 1, D 0 18

  19. Cascade Counter 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. … 13 14 15 16 17 18 19 Time 0 1 2 3 … 0 Q 7-4 0 0 0 0 0 0 1 1 1 1 … 0 T C0 0 0 0 0 0 1 0 0 0 0 … 13 14 15 0 Q 3-0 0 1 2 3 1 2 3 19

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend