Slide 1Slide 2Codes for NumbersPositional Code for NumbersBabylonian ExamplePositional Code with ZeroMixed SystemSlide 8Positional Code Decimal SystemMigration of Positional NotationBinary Number SystemModern Arithmetic and Number SystemsEncoding Numbers in 4-BitsSlide 14Slide 15Slide 16Slide 17Fixed-Radix Conventional (Unsigned) RepresentationsFixed-Radix Conventional Number SystemsSlide 20Slide 21Radix ConversionOption 1: Arithmetic in old radix rSlide 24Slide 25Option 2: Arithmetic in new radix ROption 2 cont'd: Horner's rule for fractionsRadix Conversion Shortcut for r=bg, R=bGNumber RepresentationPart 1Fixed-Radix Unsigned RepresentationsECE 645: Lecture 1Required ReadingChapter 1, Numbers and Arithmetic, Sections 1.1-1.6B. Parhami, Computer Arithmetic: Algorithms and Hardware DesignJ-P. Deschamps, G. Bioul, G. Sutter, Synthesis of Arithmetic Circuits: FPGA, ASIC and Embedded Systems, Chapter 1, IntroductionChapter 3.1.1 Weighted systemsCodes for Numbers•Egyptian–~4000 BC–“Sum of Symbols” =1 =10 =100 = (34)10Positional Code for Numbers•Babylonians–Positional system–2000 BC–Radix 60– = 1 = 10Babylonian Example 1 x 602 20 x 601 56 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 zeroMixed 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., ?IXMCDXLVIIHindu-Arabic Numeral SystemBrahmi numerals, India, 400 BC-400 AD Evolution 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* * * * , Migration 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 symbols 100123252*12*02*12*0 0101 12Modern Arithmetic and Number Systems•Modern number systems used in digital arithmetic can be broadly classified as:•Fixed-point number representation systems•Integers•Rational numbers of the form x = a/2f, a is an integer, f is a positive integer•Floating-point number representation systems•x * bE, where x is a rational number, b the integer base, and E the exponent•Note that all digital numbers are eventually coded in bits {0,1} on a computer130 2 4 6 8 10 12 14 16 2 4 6 8 10 12 14 16 Unsigned integers Signed-magnitude 3 + 1 fixed-point, xxx.x Signed fraction, .xxx 2’s-compl. fraction, x.xxx 2 + 2 floating-point, s 2 e in [ 2, 1], s in [0, 3] 2 + 2 logarithmic (log = xx.xx) Number format log x s e e fixed pointfloating pointEncoding Numbers in 4-BitsNumber systemPositionalNon-positionalFixed-radix Mixed-radixConventional UnconventionalSigned-digitNon-redundant RedundantBinaryDecimalHexadecimalClassification of number systems (1)Classification 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-1 xk-2 … x1 x0 . x-1 x-2 … x-lIntegral part Fractional partRadix point• NOT stored in the register• understood to be in a fixed positionFixed-point representationFixed-Radix Conventional (Unsigned) Representations19Fixed Point Number systemPositionalNon-positionalFixed-radix Mixed-radixConventional (unsigned)Unconventional (signed)Signed-digitNon-redundant RedundantBinaryDecimalHexadecimalFixed-Radix Conventional Number SystemsRange of numbersDecimalX = (xk-1 xk-2 … x1 x0.x-1 … x-l)10XminXmax10k - 10-l0BinaryNumber systemX = (xk-1 xk-2 … x1 x0.x-1 … x-l)202k - 2-lConventional fixed-radixX = (xk-1 xk-2 … x1 x0.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(log1logmax10max10XXk )1(log1logmax2max2XXk )1(log1logmaxmaxXXkrr22Radix ConversionOption 1) Radix conversion, using arithmetic in the old radix r Convenient when converting from r = 10 or familiar radixu = w . v = ( xk–1xk–2 . . . x1x0 . x–1x–2 . . . x–l )r Old = ( XK–1XK–2 . . . X1X0 . X–1X–2 . . . X–L )RNewOption 2) Radix conversion, using arithmetic in the new radix R Convenient when converting to R = 10 or familiar radixWhole part Fractional partExample: (31)eight = (25)tenFrom: Parhami, Computer Arithmetic: Algorithms and Hardware DesignTwo methods:23Option 1: Arithmetic in old radix rConverting whole part w: (105)ten = (?)fiveRepeatedly divide by five Quotient Remainder 105 0 21 1 4 4 0Therefore, (105)ten = (410)five Converting fractional part v: (105.486)ten = (410.?)fiveRepeatedly multiply by five Whole Part Fraction .486 2 .430 2 .150 0 .750 3 .750 3 .750 Therefore, (105.486)ten (410.22033)five From: Parhami, Computer Arithmetic: Algorithms and Hardware DesignRadix Conversion of the Integral PartXI = (xk-1 xk-2 … x1 x0)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 + x1 x0...((xk-1 R + xk-2) R + xk-3 ) R +
View Full Document