Presentation is loading. Please wait.

Presentation is loading. Please wait.

Kuliah Rangkaian Digital Kuliah 7: Unit Aritmatika

Similar presentations


Presentation on theme: "Kuliah Rangkaian Digital Kuliah 7: Unit Aritmatika"— 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 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 Inputs Outputs Y 1 S X Cout X Y S Cout

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

6 Designing full adder 1 00 01 11 10 Cout S 1 00 01 11 10
Cin X 1 Y XY 2 3 6 7 4 5 Cout S Cin X 1 Y XY 2 3 6 7 4 5 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 Alternative: full adder using AND-OR
X’Y’C-in XY’C-in’ Sum S X’YC-in’ XYC-in X’ X Y’ Y C-in C-in’ X X’ Y Y’ C-in C-in’ Full Adder X Y S C-in C-out XY YC-in C-out XC-in X Y C-in

9 Q: Do we need C4 for a 4-bit 2’s complement addition?
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 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 4-bit Adder X3 X2 X1 X0 D3 D2 D1 D0 C-in C-out C4 Y3 Y2 Y1 Y0 C0 = 1 S3 S2 S1 S0

15 Multipliers 8x8 multiplier

16 Full-adder array

17 Faster carry chain

18 Binary Multiplication
An n-bit X n-bit multiplier can be realized in combinational circuitry by using an array of n-1 n-bit adders where is adder is shifted by one position. For each adder one input is the multiplied by 0 or 1 (using AND gates) depending on the multiplier bit, the other input is n partial product bits. X3 X2 X1 X0 x Y3 Y2 Y1 Y0 __________________________ X3.Y0 X2.Y0 X1.Y0 X0.Y0 X3.Y1 X2.Y1 X1.Y1 X0.Y1 X3.Y2 X2.Y2 X1.Y2 X0.Y2 X3.Y3 X2.Y3 X1.Y3 X0.Y3 _______________________________________________________________________________________________________________________________________________ P P P P P P P P0

19 4x4 Array Multiplier


Download ppt "Kuliah Rangkaian Digital Kuliah 7: Unit Aritmatika"

Similar presentations


Ads by Google