DOC PREVIEW
MASON ECE 645 - Lecture 1 Number Representation

This preview shows page 1-2-20-21 out of 21 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Number RepresentationECE 645: Lecture 1Required ReadingChapter 1, Numbers and Arithmetic, Sections 1.1-1.6, pp. 3-15Chapter 2, Representing Signed Numbers, Sections 2.1-2.6, pp. 19-31Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware DesignCodes for Numbers• Egyptian– ~4000 BC– “Sum of Symbols”=1 =10 =100= (34)102Positional Code for Numbers• Babylonians– Positional system– 2000 BC– Radix 60– = 1 = 10Babylonian Example1 x 60220 x 60156 x 600 = (4,856)10Positional Code with Zero• Zero Represented by Space– Partial solution– What about trailing zeros?• Babylonians Introduced New Symbol– or – 4th to 1st Century BC• Zero Allows Representation of Fractions– Fractions started with zero3Mixed System• Roman Numerals– Sum of all symbols– I=1 V=5 X=10 L=50 C=100 D=500 M=1000– Difficult to do arithmetic– e.g., ?IXMCDXLVII−Hindu-Arabic Numeral SystemBrahmi numerals, India, 400 BC-400 ADEvolution of numerals in early EuropePositional Code Decimal System– Documented in the 9th century– Position of coefficient determines its value– Coefficient in position is multiplied by radix (10) raised to the power determined by its position, e.g.,()4 10 8 10 5 10 6 10 4 8563 2 1 010* * * * ,+ + + =4Migration of Positional Notation• ~750 AD– Zero spread from India to Arabic countries• ~1250 AD– Zero spread to Europe• Importance of Zero– Ease of arithmetic which leads to improved commerceBinary Number System• Binary– Positional number system– Two symbols, B = { 0, 1 }– Easily implemented using switches– Easy to implement in electronic circuitry– Algebra invented by George Boole (1815-1864)allows easy manipulation of symbolsNumber systemPositionalNon-positionalFixed-radix Mixed-radixConventional UnconventionalSigned-digitNon-redundant RedundantBinaryDecimalHexadecimalClassification of number systems (1)5Classification of number systems (2)Positionalwi- weight of the digit xiFixed-radixikliiwxX ⋅=−−=1ikliirxX ⋅=−−=1r - radix of the number systemConventional fixed-radixikliirxX ⋅=−−=1r integer, r > 0xi∈ {0, 1, …, r-1}Classification of number systems (3)Unconventional fixed-radixikliirxX ⋅=−−=1xi∈ {-α, …, β }Non-redundant number of digits = α + β + 1 ≤ r Redundant number of digits = α + β + 1 > r Signed-digit α>0 negative digitsIntegral and fractional partX = xk-1xk-2… x1x0 . x-1 x-2… x-lIntegral part Fractional partRadix point• NOT stored in the register• understood to be in a fixed positionFixed-point representation6Range of numbersDecimalX = (xk-1xk-2… x1x0.x-1… x-l)10XminXmax10k - 10-l0BinaryNumber systemX = (xk-1xk-2… x1x0.x-1… x-l)202k - 2-lConventional fixed-radixX = (xk-1xk-2… x1x0.x-1… x-l)r0 rk- r-lulp = r-lNotation:unit in the least significant positionunit in the last positionNumber of digitsNumber systemNumber of digits in the integerpart necessary to cover the range0..XmaxDecimalBinaryConventionalfixed-radix )1(log1logmax10max10+==+=XXk )1(log1logmax2max2+==+=XXk )1(log1logmaxmax+==+=XXkrrRadix Conversion of the Integral PartXI= (xk-1xk-2… x1x0)R = = R - destination radixikiiRx ⋅∑−=10= ((...((xk-1 R + xk-2) R + xk-3) R + … + x2) R + x1) R + x0QuotientRemainder(...((xk-1 R + xk-2) R + xk-3) R + … + x2) R + x1x0...((xk-1 R + xk-2) R + xk-3) R + … + x2x1xk-1 xk-2xk-1 0………. ……….7Radix Conversion of the Fractional PartXF= (. x-1x-2… x-l+1x-l)R = = R - destination radixiliiRx ⋅∑−−=1= R-1(x-1+ R-1(x-2+ R-1(…. + R-1( x-l+1+ R-1x-l)….)))Integer part Fractional partx-1R-1(x-2+ R-1(….. + R-1( x-l+1+ R-1x-l)….))R-1(….. + R-1( x-l+1+ R-1x-l)….)x-2………………………………….x-l+1R-1x-lx-l...Shortcut for r=bg, R=bGr=bg→→→→ b →→→→ R=bG4=22→→→→ 2 →→→→ 8=23(2301.302)4 = (10 11 00 01. 11 00 10)2= (261.62)8Signed Number Representations8Representations of signed numbersSigned-magnitudeBiasedComplementRadix-complementDiminished-radix complement(Digit complement)Two’s complement One’s complementr=2r=27 0111 1111 0111 01116 0110 1110 0110 01105 0101 1101 0101 01014 0100 1100 0100 01003 0011 1011 0011 00112 0010 1010 0010 00101 0001 1001 0001 00010 0000 1000 0000 0000-0 1000 1111-1 1001 0111 1111 1110-2 1010 0110 1110 1101-3 1011 0101 1101 1100-4 1100 0100 1100 1011-5 1101 0011 1011 1010-6 1110 0010 1010 1001-7 1111 0001 1001 1000-8 0000 1000Signed-magnitudeBiasedTwo’s complementOne’s complementSigned-magnitude representation of signed numbersAdvantages:Disadvantages:• conceptual simplicity• symmetric range: -(2k-1-1) .. -(2k-1-1)• simple negation• addition of numbers with the same sign and witha different sign handled differently0k-2k-1signmagnitude9Biased representation of signed integers-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15B = 2k-1, k=4R(X) = X + B-2k-1X  2k-1-1 XR(X)RSigned number XUnsigned Representation R(X)Bit vector (xk-1xk-2...x0.x-1...x-l)Binary mappingRepresentation mappingikliixXR 2)(1⋅=−−=Biased representation with radix 2ComplementSigned Number Representations10Signed number XUnsigned Representation R(X)Bit vector (xk-1xk-2...x0.x-1...x-l)Binary mappingRepresentation mappingikliixXR 2)(1⋅=−−=Complement representations with radix 21 – xi= xi1 – xixixi011010Useful dependencies|X| =X when X ≥ 0- X when X < 0One’s complement transformationOC(A) = A = 2k– 2-l- AFor ikliiAA 21⋅=−−=≥ 00 ≤ OC(A) ≤ 2k– 2-lOC(OC(A)) = Adefk-1 k-2 ... 0 -1 -2 ... -l1 1 ... 1 . 1 1 ... 1– Ak-1Ak-2… A0. A-1A-2 ... A-lAk-1Ak-2… A0. A-1A-2 ... A-lProperties:11One’s Complement Representation of Signed NumbersR(X) = X for X > 00 or OC(0) for X = 0OC(|X|) for X < 0For –(2k-1– 2-l) ≤ X ≤ 2k-1– 2-l0 ≤ R(X) ≤ 2k– 2-ldefOne’s complement representation of signed integers-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Xk=4X>0 0X<0X+2k-1 = 2k-1 - |X|0,2k-1One’s complement representation of signed numbers12Two’s complement transformation (1)A + 2-l= 2k– A for A > 0For ikliiAA 21⋅=−−=≥


View Full Document

MASON ECE 645 - Lecture 1 Number Representation

Documents in this Course
Load more
Download Lecture 1 Number Representation
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 1 Number Representation 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 1 Number Representation 2 2 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?