1 / 17

Kuliah Rangkaian Digital Kuliah 7: Unit Aritmatika

Kuliah Rangkaian Digital Kuliah 7: Unit Aritmatika. Teknik Komputer Universitas Gunadarma. Topic #7 – Arithmetic Units. Comparator Adders Half-adder & Full-adder Carry-ripple adder & carry-look-ahead adder Overflow detection Subtractor Multiplier. (Equality) Comparators (using XOR).

Download Presentation

Kuliah Rangkaian Digital Kuliah 7: Unit Aritmatika

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. Kuliah Rangkaian Digital Kuliah 7: Unit Aritmatika Teknik Komputer Universitas Gunadarma

  2. Topic #7 – Arithmetic Units • Comparator • Adders • Half-adder & Full-adder • Carry-ripple adder & carry-look-ahead adder • Overflow detection • Subtractor • Multiplier

  3. (Equality) Comparators (using XOR) • 1-bit comparator • 4-bit comparator

  4. Outputs Inputs X 0 0 1 1 Y 0 1 0 1 S 0 1 1 0 Cout 0 0 0 1 X Y S Cout Half adder • Adds two 1-bit input to produce a sum and a carry-out • Does not account for carry-in S = X’·Y + X·Y = XY Cout = X·Y

  5. X Y Cin S Cout 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 Full adder • Building block to realize binary arithmetic operations • 1-bit-wide adder with carry-in, produces sum and carry-out • Truth table:

  6. S X X XY XY 00 01 11 10 00 01 11 10 Cin Cin 1 1 6 6 0 0 2 2 4 4 0 1 0 1 1 1 3 3 5 5 7 7 1 1 Cin Cin Cout Y Y 1 1 1 1 Designing full adder S = X’·Y’·(Cin) + X·Y’·(Cin)’ + X·Y’·(Cin)’ + X·Y·(Cin) = X Å Y Å(Cin) Cout = XY + X(Cin) + Y(Cin)

  7. Resulting circuit

  8. X’ X’Y’C-in Y’ C-in X Y X Y X’ Sum S X’YC-in’ X Y X’ Y’ Y C-in’ Full Adder C-out C-in X C-in Y C-in C-in’ C-in’ XY’C-in’ X S Y XYC-in C-in’ X XY Y X XC-in C-out C-in Y YC-in C-in Alternative: full adder using AND-OR

  9. Ripple adder • Speed limited by carry chain • 2 per full adder  2n for an n-bit adder • Approach: eliminate or reduce carry chain • Carry look-ahead: compute Cin directly from external inputs Q: Do we need C4 for a 4-bit 2’s complement addition?

  10. Carry look-ahead adder • Let Ci+1 = (Xi·Yi)+ (Xi+Yi)· Ci = Gi + Pi · Ci • For a 4-bit adder … C1 = G0 + P0·C0 C2 = G1 + P1·C1 = G1 + P1·G0 + P1·P0·C0 C3 = G2 + P2·G1 + P2·P1·G0 + P2·P1·P0·C0 C4 = G3 + P3·G2 + P3·P2·G1 + P3·P2·P1·G0 + P3·P2·P1·P0·C0 where Gi = Xi · Yi Pi = Xi + Yi • This is a 3 level circuit including generating the Gs and Ps • Rule of thumb: one carry look-ahead circuit every 4-bit

  11. Carry look-ahead circuit Gs and Ps are also useful for generating the sums

  12. 16-bit carry ripple adder

  13. 16-bit carry look-ahead adder

  14. Y3 Y2 Y1 Y0 X3 X2 X1 X0 4-bit Adder C4 C0 = 1 C-out C-in S3 S2 S1 S0 D3 D2 D1 D0 Subtraction • Recall our discussion on subtraction for 2’s complement … • X – Y = X + Y + 1 • Invert all bits of Y and set Cin to 1 • Example: 4-bit subtractor using 4-bit adder • Add a control circuit in ALU s.t. same circuit can be used for both addition and subtraction

  15. Multipliers • 8x8 multiplier

  16. Full-adder array

  17. Faster carry chain

More Related