Chap. 6 Digital Arithmetic: Operations & Circuits

1 / 12

# Chap. 6 Digital Arithmetic: Operations & Circuits - PowerPoint PPT Presentation

Chap. 6 Digital Arithmetic: Operations & Circuits. Introduction This chapter will be concentrate on how computers perform the basic arithmetic operations 6-1 Binary Addition Addition is the most important operation in digital systems

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## Chap. 6 Digital Arithmetic: Operations & Circuits

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
1. Chap. 6 Digital Arithmetic: Operations & Circuits • Introduction • This chapter will be concentrate on how computers perform the basic arithmetic operations • 6-1 Binary Addition • Addition is the most important operation in digital systems • Subtraction, multiplication and division are usually implemented using addition. • Basic Rules : 0 + 0 = 0 1 + 0 = 1 1 + 1 = 10 = carry of next position + 0 1 + 1 + 1 = 11 = carry of next position + 1 • Binary Example : 0 1 1 (3) 1 0 0 1 (9) 1 1. 0 1 1 (3.375) + 1 1 0 (6) + 1 1 1 1 (15) + 1 0. 1 1 0 (2.750) 1 0 0 1 (9) 1 1 0 0 0 (24) 1 1 0. 0 0 1 (6.125)

2. 6-2 Representing signed Numbers • Sign Bit • 0 : positive, 1 : negative • Sign-magnitude system • Example : 5210 (decimal) = 1101002 (binary) + 5210 = 01101002 (sign-magnitude) - 5210 = 11101002 (sign-magnitude) • This is simple, but is normally not used, as it makes circuit implementation more complex • 1’s Complement Form • Example : 101101(original binary number) 010010(1’s complement) • Change each bit in the number to its complement • 2’s Complement Form • Example : 4510 (decimal) = 1011012 (binary) + 4510 = 01011012 (true binary) - 4510 = 10100112 (2’s complement)= 1010010(1’s complement) + 1 • Take the 1’s complement and add 1 to the LSB position 1) Sign magnitude system 2) 1’s complement system 3) 2’s complement system

3. Representing signed Numbers Using 2’s Complement : Fig. 6-2 • If number is positive • Magnitude = true binary form, Sign = 0 is placed in front of the MSB • If number is negative • Magnitude = 2’s complement form, Sign = 1 is placed in front of the MSB • 2’s complement is the most commonly used system for representing signed binary numbers • Perform the operation of subtraction by actually performing addition • A digital computer can use the same circuitry to both add and subtract(saving in hardware) • Negation • The operation of converting a positive number to its negative equivalent or a negative number to its positive equivalent • 0 1 0 0 1 = + 9 Start with • 1 0 1 1 1 = - 9 Negate(2’s complement) • 0 1 0 0 1 = + 9 Negate again(2’s complement) • We negate a signed binary number by 2’s complementing it Sign 과 Magnitude를 동시에 2’s 보수 취하는 것과 동일함

4. Special Case in 2’s Complement Representation : Tab. 6-1 • Smallest number(using N magnitude bits) • 1 followed by N zeros : 1000 = - 8 ( -2N ) • Largest number(using N magnitude bits) • 0 followed by N ones : 0111 = +7 ( 2N -1 ) • 6-3 2’s Complement Addition • Addition Rules • 1) Simply add the two signed 2’s complement numbers • 2) Disregard any carry from the sign bit. • Examples : • 9 + 4 = 01001 + 00100 = 01101 • 9 + ( -4 ) = 01001 + 11100 = 1 00101 • ( -9 ) + 4 = 10111 + 00100 = 11011 • ( -9 ) + ( -4 ) = 10111 + 11100 = 1 10011 • 9 + ( -9 ) = 01001 + 10111 = 1 00000 Discard Carry

5. 6-4 2’s Complement Subtraction • Subtraction Rules • 1) Negate the subtrahend • 2) Add this to the minuend • Examples : • 9 - 4 = 9 + ( - 4 ) = 01001 + 11100 • ( - 9 ) - 4 = ( - 9 ) + ( - 4 ) = 10111 + 11100 • 9 - 9 = 9 + ( - 9 ) = 01001 + 10111 • Arithmetic Overflow • Overflow Condition • Two positive or two negative numbers are being added • Overflow Detection • Detected by observing the carry into the sign bit position and the carry out of the sign bit position • If these two carries are not equal, an overflow condition is produced (Exclusive-OR gate = 1) * Overflow Exam) out inout in carries 0 1 carries 1 0 + 70 0 1000110 - 70 1 0111010 + 80 0 1010000 - 80 1 0110000 + 150 1 0010110 - 150 0 1101010

6. 6-5/6-6 Binary Multiplication/Division • Use the same procedures as for decimal multiplication and division • Exam) • 6-7 BCD Addition • BCD Addition Procedure • 1) Add the BCD code by using ordinary binary addition • 2) The sum is 9 or less, no correction is needed • 3) The sum is greater than 9, the 0110(6) should be added Multiplication: Division: 1 0 0 1 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 0 1 0 1 1 1 0 0 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 1 0 1 1 0 0 0 1 1 shift and add! shift and subtract! 0 1 1 0 BCD for 6 + 0 1 1 1 BCD for 7 1 1 0 1 invalid sum 0 1 1 0 add 6 for correction 0 0 0 1 0 0 1 1 BCD for 13

7. 6-8 Hexadecimal Arithmetic • Hex Addition : Exam. 6-6, 6-7, 6-8 • Hex Subtraction : Exam. 6-9 • 1) The 2’s complement of the subtrahend will be taken, then added to the minuend • 2) Any carry out of the MSD position will be disregarded • Hex Representation of Signed Number : Tab. 6-2 • Computer Numbering System = 2’s Complement System • 6-9 Arithmetic Circuits • ALU(Arithmetic/Logic Unit) : Fig. 6-3 • All arithmetic operation take place in the ALU of a computer • The purpose of the ALU : • 1) Accept binary data that are stored in the memory • 2) Execute arithmetic and logic operations on these data (according to instruction from the control unit) • ALU contains at least two flip/flop registers : Accumulator(ACC or A), B register • A : Operand 1 저장(중간 또는 최종 연산 결과 저장) • B : Operand 2 저장