chapter 10: computer arithmetic - guilanalgorithm: b=11011 q=00111 4 q4=1,a=0,qs=1 ea=a+b=1011 eaq=...
TRANSCRIPT
![Page 1: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/1.jpg)
Chapter 10: Computer Arithmetic
![Page 2: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/2.jpg)
Addition and Subtraction
Sign-magnitude
2’s complement
![Page 3: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/3.jpg)
Hardware implementation: Sign flip flop
Overflow FF
XOR gates
![Page 4: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/4.jpg)
Algorithm:
Like as: A= -2 , B=5
![Page 5: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/5.jpg)
2’s complement addition and subtraction:
![Page 6: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/6.jpg)
Multiplication algorithms:
A binary example:
Partial product
![Page 7: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/7.jpg)
Hardware implementation
multiplier
#of bit in multiplier
Partial product
![Page 8: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/8.jpg)
Algorithm:
B=11011 Q=00111
4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011
3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000 0101
2 Q2=1 EA= 1 0011 EAQ 1 0011 01 01 shr EAQ 0 1001 101 0
1 Q1=0 Shr EAQ 0 0100 1101=77
0
![Page 9: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/9.jpg)
Booth multiplication algorithm
A= 00011 B= 00111 => A*B= A*(7)=A* (8-1)=A*8-A*1
In 2’s compl. representation, we can use Booth alg. without change.
![Page 10: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/10.jpg)
Hardware
![Page 11: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/11.jpg)
Algorithm
![Page 12: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/12.jpg)
An example:
![Page 13: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/13.jpg)
Array multiplier: Fast approach
![Page 14: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/14.jpg)
![Page 15: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/15.jpg)
![Page 16: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/16.jpg)
Division algorithms: A/B = q , r ; A: Dividend , B: Divisor, q: quotient, r: remainder
![Page 17: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/17.jpg)
Restoring method:
![Page 18: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/18.jpg)
Algorithm:
If A-B>= 0 then DVF1
![Page 19: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/19.jpg)
Other methods:
• Comparison
• Non-restoring: in the restoring method when A<B 2(A-B+B)-B=2A-B,
A<B 2(A-B)+B=2A-B
![Page 20: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/20.jpg)
Floating point operations
• The standard format:
IEEE 754 single precision
• F=0 : E=0 & f=0 •F=denormalized : E=0 & f≠0
•F= ±∞ : E=255 & f=0 •F=NAN: E=255 & f ≠0
![Page 21: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/21.jpg)
Hardware:
![Page 22: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/22.jpg)
Addition and subtraction
![Page 23: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/23.jpg)
Multiplication:
![Page 24: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/24.jpg)
Division:
![Page 25: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/25.jpg)
Decimal Arithmetic Unit BCD Adder
![Page 26: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/26.jpg)
Hardware:
![Page 27: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/27.jpg)
BCD subtractor:
A-B = A+ 9’s compl. of B
B’+ 1010= 15-B+1010=9-B+16
9’ compl.(B) = (B+ 0110)’ = 15 – B- 0110 =9-B
logic circuit
An example: -(0111) = 1000+1010=(0111+0110)’=0010
![Page 28: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/28.jpg)
Decimal arithmetic operation
![Page 29: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/29.jpg)
Decimal arithmetic operation
dshr (7680) 0768
![Page 30: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/30.jpg)
Addition and Subtraction Parallel adder:
![Page 31: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/31.jpg)
Digit serial bit parallel:
![Page 32: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/32.jpg)
All serial:
![Page 33: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/33.jpg)
Multiplication: Ai *Bi = [0,81]!
Adder
4bit
Overflow detection
9’s compl. Of B
![Page 34: Chapter 10: Computer Arithmetic - GuilanAlgorithm: B=11011 Q=00111 4 Q4=1,A=0,Qs=1 EA=A+B=1011 EAQ= 0 1011 0111 Shr EAQ= 0 0101 1011 3 Q3=1 EA = 1 0000 EAQ 1 0000 1011 Shr EAQ 0 1000](https://reader034.vdocument.in/reader034/viewer/2022042104/5e8283f0e9c1cf172844d5f6/html5/thumbnails/34.jpg)
Algorithm:
K: # 0f digits