Unformatted text preview:

Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data RepresentationChapter ContentsFixed Point NumbersWeighted Position CodeBase Conversion with the Remainder MethodBase Conversion with the Multiplication MethodNonterminating Base 2 FractionBase 2, 8, 10, 16 Number SystemsMore on Base ConversionsBinary AdditionSigned Fixed Point NumbersSigned MagnitudeOne’s ComplementTwo’s ComplementExcess (Biased)BCD Representations in Nine’s and Ten’s Complement3-Bit Signed Integer RepresentationsBase 10 Floating Point NumbersNormalizationFloating Point ExampleError, Range, and PrecisionError, Range, and Precision (cont’)Slide 23Example Floating Point FormatGap Size Follows Exponent SizeConversion ExampleIEEE-754 Floating Point FormatsIEEE-754 ExamplesIEEE-754 Conversion ExampleEffect of Loss of PrecisionASCII Character CodeSlide 32Unicode Character Code2-1Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationPrinciples of Computer ArchitectureMiles Murdocca and Vincent HeuringChapter 2: Data Representation2-2Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationChapter Contents2.1 Introduction2.2 Fixed Point Numbers2.3 Floating Point Numbers2.4 Case Study: Patriot Missile Defense Failure Caused by Loss of Precision2.5 Character Codes2-3Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationFixed Point Numbers• Using only two digits of precision for signed base 10 numbers, the range (interval between lowest and highest numbers) is [-99, +99] and the precision (distance between successive numbers) is 1.• The maximum error, which is the difference between the value of a real number and the closest representable number, is 1/2 the precision. For this case, the error is 1/2  1 = 0.5.• If we choose a = 70, b = 40, and c = -30, then a + (b + c) = 80 (which is correct) but (a + b) + c = -30 which is incorrect. The problem is that (a + b) is +110 for this example, which exceeds the range of +99, and so only the rightmost two digits (+10) are retained in the intermediate result. This is a problem that we need to keep in mind when representing real numbers in a finite representation.2-4Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationWeighted Position Code• The base, or radix of a number system defines the range of possible values that a digit may have: 0 – 9 for decimal; 0,1 for binary.• The general form for determining the decimal value of a number is given by:Example:541.2510 = 5  102 + 4  101 + 1  100 + 2  10-1 + 5  10-2= (500)10 + (40)10 + (1)10 + (2/10)10 + (5/100)10 = (541.25)102-5Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationBase Conversion with the Remainder Method•Example: Convert 23.37510 to base 2. Start by converting the integer portion:2-6Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationBase Conversion with the Multiplication Method• Now, convert the fraction:• Putting it all together, 23.37510 = 10111.01122-7Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationNonterminating Base 2 Fraction• We can’t always convert a terminating base 10 fraction into an equivalent terminating base 2 fraction:2-8Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationBase 2, 8, 10, 16 Number Systems• Example: Show a column for ternary (base 3). As an extension of that, convert 1410 to base 3, using 3 as the divisor for the remainder method (instead of 2). Result is 11232-9Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationMore on Base Conversions• Converting among power-of-2 bases is particularly simple:10112 = (102)(112) = 234234 = (24)(34) = (102)(112) = 101121010102 = (1012)(0102) = 528011011012 = (01102)(11012) = 6D16• How many bits should be used for each base 4, 8, etc., digit? For base 2, in which 2 = 21, the exponent is 1 and so one bit is used for each base 2 digit. For base 4, in which 4 = 22, the exponent is 2, so so two bits are used for each base 4 digit. Likewise, for base 8 and base 16, 8 = 23 and 16 = 24, and so 3 bits and 4 bits are used for base 8 and base 16 digits, respectively.2-10Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationBinary Addition• This simple binary addition example provides background for the signed number representations to follow.2-11Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationSigned Fixed Point Numbers• For an 8-bit number, there are 28 = 256 possible bit patterns. These bit patterns can represent negative numbers if we choose to assign bit patterns to numbers in this way. We can assign half of the bit patterns to negative numbers and half of the bit patterns to positive numbers.• Four signed representations we will cover are:Signed MagnitudeOne’s ComplementTwo’s ComplementExcess (Biased)2-12Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationSigned Magnitude• Also know as “sign and magnitude,” the leftmost bit is the sign (0 = positive, 1 = negative) and the remaining bits are the magnitude.• Example:+2510 = 000110012-2510 = 100110012• Two representations for zero: +0 = 000000002, -0 = 100000002.• Largest number is +127, smallest number is -12710, using an 8-bit representation.2-13Chapter 2 - Data RepresentationDepartment of Information Technology, Radford University ITEC 352 Computer OrganizationOne’s Complement• The leftmost bit is the sign (0 = positive, 1 = negative). Negative of a number is obtained by subtracting each bit from 2 (essentially, complementing each bit from 0 to 1 or from 1 to 0). This goes both ways: converting positive numbers to negative numbers, and converting negative numbers to positive numbers.•


View Full Document

Radford ITEC 352 - Lecture Notes

Download Lecture Notes
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 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 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?