1 / 175

Lecture 18: Datapath Functional Units

Lecture 18: Datapath Functional Units. Outline. Multi-input Adders Comparators Shifters Multipliers More complex operations. Carry-Save Adders (CSA). You can use a carry save adder to add three n -bit operands A 0 , A 1 , and A 2 without performing any carry propagation.

amara
Download Presentation

Lecture 18: Datapath Functional Units

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 18: DatapathFunctionalUnits

  2. Outline • Multi-input Adders • Comparators • Shifters • Multipliers • More complex operations 18: Datapath Functional Units

  3. Carry-Save Adders (CSA) • You can use a carry save adder to add three n-bit operands A0, A1, and A2 without performing any carry propagation. • You can also add one n-bit operand to an n-digit carry-save operand. • Result is in carry-save format. 18: Datapath Functional Units

  4. Carry-Save Adders • Parallel arrangement of full-adders => constant delay. • Multi-operand carry-save adders also possible (m>3) • Array or tree arrangement. 18: Datapath Functional Units

  5. Multi-Operand Adders • Add three or more (m>2) n-bit operands. • Yield -bit result in irredundant number representation • Array adders • Linear arrangement of CPAs • Linear arrangement of CSAs and a final CPA • The final CPA has to be fast. If it is an RCA, the performances of the two alternatives are equal. 18: Datapath Functional Units

  6. 4-Operand CPA Array 18: Datapath Functional Units

  7. 4-Operand CSA Array 18: Datapath Functional Units

  8. Multi-input Adders • Suppose we want to add k N-bit words • Ex: 0001 + 0111 + 1101 + 0010 = 10111 • Straightforward solution: k-1 N-input CPAs • Large and slow 18: Datapath Functional Units

  9. Carry Save Addition • A full adder sums 3 inputs and produces 2 outputs • Carry output has twice weight of sum output • N full adders in parallel are called carry save adder • Produce N sums and N carry outs 18: Datapath Functional Units

  10. CSA Application • Use k-2 stages of CSAs • Keep result in carry-save redundant form • Final CPA computes actual result 18: Datapath Functional Units

  11. (m,2)-Compressors • 1-bit adders. Similar to (m,k)-counters. • Compresses m bits down to 2 by forwarding (m-3) intermediate carries to next higher position. • No horizontal carry propagation. • Built from full adders ((3,2) compressors) or (4,2) compressors arranged in linear or tree structures, 18: Datapath Functional Units

  12. (m,2)-Compressors • Example: 4-operand adder using (4,2) compressors. 18: Datapath Functional Units

  13. (m,2)-Compressors • Structure of a (4,2) compressor 18: Datapath Functional Units

  14. (m,2)-Compressors • Advantages of (4,2)-compressors over FAs for realizing (m,2)-compressors: • Higher compression rate. • Less deep and more regular trees. • Example: (8,2) compressor. 18: Datapath Functional Units

  15. Tree adders (Wallace Tree) • Adder tree: n-bit m-operand carry-save adder composed of n tree structured (m,2) compressors. • Fastest multi-operand adders using an adder tree and a fast final CPA. 18: Datapath Functional Units

  16. Adder Arrays and Trees • Some FAs can often be replaced by HAs or eliminated altogether. • Number of FAs does not depend on adder structure, but number of HAs does. • An m-operand adder accomdates (m - 1) carry inputs. • Adder trees (T = O(logn)) are faster than adder arrays (T = O(n)) at the same amount of gates (A = O(mn)). • Adder trees are less regular and have more complex routing than adder arrays => larger area, difficult layout => limited use in layout generators. 18: Datapath Functional Units

  17. Sequential Adders • Bit-serial adder • Accumulators • With CPA • With CSA and final CPA • Allows higher clock rates • Final CPA too slow • Pipelining or multiple cycles 18: Datapath Functional Units

  18. Complement and Subtraction • 2’s complement • 2’s complement subtracter • 2’s complement adder/subtracter • 1’s complement adder 18: Datapath Functional Units

  19. Subtraction 18: Datapath Functional Units

  20. Increment/Decrement • Adds a single bit cin to an n-bit operand A • Corresponds to addition with B=0 (FA -> HA) • Example: Ripple-carry incrementer using half-adders 18: Datapath Functional Units

  21. Increment/Decrement • Or, use incrementer slices • Prefix problem Ci:k = Ci:j+1Cj:k => AND prefix structure 18: Datapath Functional Units

  22. Increment/Decrement • Decrementer • Incrementer-decrementer 18: Datapath Functional Units

  23. Fast Incrementers • 4-bit incrementer using multi-input gates • 8-bit parallel-prefix incrementer (Sklansky-AND prefix structure) 18: Datapath Functional Units

  24. Gray Incrementer • Increments in Gray number system • Prefix problem => AND-prefix structure 18: Datapath Functional Units

  25. Counting • Count clock cycles => counter • Divide clock frequency => frequency divider (cout) • Binary counter • Sequential incrementer/decrementer • Incrementer speed-up techniques applicable • Down-and up-down counters using incrementers or incrementer-decrementers 18: Datapath Functional Units

  26. Example • Ripple-carry up-counter using counter slices (HA+FF), cin is count enable. 18: Datapath Functional Units

  27. Synchronous Counters 18: Datapath Functional Units

  28. Synchronous Counters 18: Datapath Functional Units

  29. Asynchronous Counters • Uses toggle flip-flops. • Lower toggle rate => lower power 18: Datapath Functional Units

  30. Gray Counter • Counter using Gray incrementers 18: Datapath Functional Units

  31. Fast Counters 18: Datapath Functional Units

  32. Fast Counters 18: Datapath Functional Units

  33. Ring Counters • Shift register connected to ring • State is not encoded => n FF for counting n states. • Must be initialized correctly. • Applications: • Fast dividers (no logic between FF) • State counter for one-hot coded FSMs 18: Datapath Functional Units

  34. Johnson Counter • Inverted feedback • n FF for counting 2n states. 18: Datapath Functional Units

  35. 3-bit LFSR 18: Datapath Functional Units

  36. 3-bit LFSR 18: Datapath Functional Units

  37. 8-bit LFSR 18: Datapath Functional Units

  38. Comparators • Comparison operations 18: Datapath Functional Units

  39. Comparators • 0’s detector: A = 00…000 • 1’s detector: A = 11…111 • Equality comparator: A = B • Magnitude comparator: A < B 18: Datapath Functional Units

  40. 1’s & 0’s Detectors • 1’s detector: N-input AND gate • 0’s detector: NOTs + 1’s detector (N-input NOR) 18: Datapath Functional Units

  41. Equality Comparison 18: Datapath Functional Units

  42. Equality Comparator • Check if each bit is equal (XNOR, aka equality gate) • 1’s detect on bitwise equality 18: Datapath Functional Units

  43. Magnitude Comparison 18: Datapath Functional Units

  44. Magnitude Comparator • Compute B – A and look at sign • B – A = B + ~A + 1 • For unsigned numbers, carry out is sign bit 18: Datapath Functional Units

  45. Comparators • Subtractor (A-B) • Optimized comparator • Removing redundancies in subtractor (unused si) • Single-tree structure => speed up at no cost 18: Datapath Functional Units

  46. Comparators • Example: ripple comparator using comparator slices 18: Datapath Functional Units

  47. Signed vs. Unsigned • For signed numbers, comparison is harder • C: carry out • Z: zero (all bits of A – B are 0) • N: negative (MSB of result) • V: overflow (inputs had different signs, output sign  B) • S: N xor V (sign of result) 18: Datapath Functional Units

  48. Decoder • Decodes binary number An-1:0 to vector Zm-1:0 (m= 2n) 18: Datapath Functional Units

  49. Encoder • Encodes vector Am-1:0 to binary number Zn-1:0 (m =2n) 18: Datapath Functional Units

  50. Detection Operations • All-zeroes detection • All-ones detection • Leading zeroes detection • For scaling, normalization, priority encding 18: Datapath Functional Units

More Related