New version page

TnTech ECE 3110 - Lecture notes

This preview shows page 1-2-3-4 out of 13 pages.

View Full Document
View Full Document

End of preview. Want to read all 13 pages?

Upload your study docs or become a GradeBuddy member to access this document.

View Full Document
Unformatted text preview:

ECE 3110: Introduction to Digital SystemsPrevious class Summarysigned addition/subtractionTwo’s Complement OverflowDetecting Two’s Complement OverflowSome ExamplesAdding Precision (unsigned)Adding Precision (two’s complement)Signed 2’s-complement and unsigned binary numbersUnsigned multiplication/divisionUnsigned binary multiplication: exampleWhat do you need to know?Next… [Chapter 2.10--2.16]ECE 3110: Introduction to Digital SystemsSigned Addition/Subtractionunsigned Multiplication/Division2Previous class SummarySigned Conversions3signed addition/subtractionTwo’s-complementAddition rulesSubtraction rulesOverflowAn operation produces a result that exceeds the range of the number system.4Two’s Complement OverflowConsider two 8-bit 2’s complement numbers. I can represent the signed integers -128 to +127 using this representation.What if I do (+1) + (+127) = +128. The number +128 is OUT of the RANGE that I can represent with 8 bits. What happens when I do the binary addition? +127 = 7F16+ +1 = 0116------------------- 128 /= 8016 (this is actually -128 as a twos complement number!!! - the wrong answer!!!)5Detecting Two’s Complement OverflowTwo’s complement overflow occurs is: Add two POSITIVE numbers and get a NEGATIVE result Add two NEGATIVE numbers and get a POSITIVE resultWe CANNOT get two’s complement overflow if I add a NEGATIVE and a POSITIVE number together.The Carry out of the Most Significant Bit means nothing if the numbers are two’s complement numbers.6Some ExamplesAll hex numbers represent signed decimal in two’s complement format. FF16 = -1+ 0116 = + 1-------- 0016 = 0Note there is a carry out, but the answer is correct. Can’t have 2’s complement overflow when adding positive and negative number. FF16 = -1+ 8016 = -128-------- 7F16 = +127 (incorrect!!)Added two negative numbers, got a positive number. Twos Complement overflow.7Adding Precision (unsigned)What if we want to take an unsigned number and add more bits to it? Just add zeros to the left. 128 = 8016 (8 bits) = 008016 (16 bits) = 0000008016 (32 bits)8Adding Precision (two’s complement)What if we want to take a twos complement number and add more bits to it? Take whatever the SIGN BIT is, and extend it to the left. -128 = 8016 = 100000002 (8 bits) = FF8016 = 11111111100000002 (16 bits) = FFFFFF8016 (32 bits) + 127 = 7F16 = 011111112 (8 bits) = 007F16 = 00000000011111112 ( 16 bits) = 0000007F16 (32 bits)This is called SIGN EXTENSION. Extending the MSB to the left works for two’s complement numbers and unsigned numbers.9Signed 2’s-complement and unsigned binary numbersBasic binary addition and subtraction algorithms are sameInterpretation may be different.1101+111010Unsigned multiplication/divisionMultiplication: shift-and-add: partial productDivision: shift-and-subtractOverflow: divisor is 0 orQuotient would take more than m bits11Unsigned binary multiplication: example1011 x 1101=?Add each shifted multiplicand as it is created to a partial product.12What do you need to know?Addition, subtraction of binary, hex numbersDetecting unsigned overflowNumber ranges for unsigned, SM, 1s complement, 2s complementOverflow in 2s complementSign extension in 2s complement13Next… [Chapter 2.10--2.16]BCD, GRAY, and other


View Full Document
Loading Unlocking...
Login

Join to view Lecture notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture notes and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?