80 likes | 240 Views
Overview. Number transformations: from one base to another Integer representations Real number representations IEEE Floating point format for single precision Review last discussion on major components of computer Continuation of chapter 2
E N D
Overview Number transformations: from one base to another Integer representations Real number representations IEEE Floating point format for single precision Review last discussion on major components of computer Continuation of chapter 2 CPU architecture, parallel operation, clock rate, caches…
Integer Transformation: From Decimal to Binary • Let’s convert 1697ten to base 2: • 1697 / 2 = 848 rem 1 • 848 / 2 = 424 rem 0 • 424 / 2 = 212 rem 0 • 212 / 2 = 106 rem 0 • 106 / 2 = 53 rem 0 • 53 / 2 = 26 rem 1 • 26 / 2 = 13 rem 0 • 13 / 2 = 6 rem 1 • 6 / 2 = 3 rem 0 • 3 / 2 = 1 rem 1 • 1 / 2 = 0 rem 1 • 1697ten = 11010100001two Notes that the same procedure is used when convert an integer from base 10 to base 16, but divide the decimal number by 16, instead of 2. ECS 50, Discussion on 4/25
Integer Transformation: From Binary to Decimal Compute the weight of each digit position and add weight with a “1” digit. Example: Let’s convert 01001101two to base 10: We have: original binary: 0 1 0 0 1 1 0 1 position: 7 6 5 4 3 2 1 0 Weight: 27 26 25 24 23 22 21 20 01001101two = 26+23+22+20 = (64 + 8 + 4 + 1) = 77ten Notes that the same procedure is used when convert an integer from base 16 to base 10, but the weight for each digit is computed as 16 raised to the power of the position. ECS 50, Discussion on 4/25
Integer Representations • Integer representations • Use 2’ complement representation for sign integers • e.g. 13ten = 01101two • But –13ten = { 10010 + 00001 }two = 10011two ECS 50, Discussion on 4/25
Real Number Representations Suppose, we have a real number 13.0. We can represent it in the form 1.3 x 101. The same is true for the binary number. For example, 1010110 = 1.010110 x 26. In general, we have: exponent mantissa m x 2n • So, how can we represent a real decimal number in the binary • form? Here is the rule: • Convert the real decimal number into the binary form • Normalize it to the form 1.k 1.k x 2n ECS 50, Discussion on 4/25
31 30 23 22 0 IEEE Format for a Real Number (single precision) • 1 bit for sign of the mantissa, 8 bits for exponent, and 23 bits for fraction • Value represented as: • (-1)sign x f x 2e • where • f = (Fraction / 223 ) + 1 • e = Exponent - 127 ECS 50, Discussion on 4/25
IEEE Format for a Real Number: Example • Example: let’s present 65.0 in the IEEE form. • Convert 64 into binary and normalize: • 65ten = 1000001two = 1. 000001 x 26 • Fraction = 000001 • In this case n= 6 • Exponent = 6ten + 127ten = 133ten = 10000101two • Since 65 is a positive number, s = 0 ECS 50, Discussion on 4/25
Chapter 2: Component of Computer Engine (Con’t) • CPU architecture • Parallel operations • Clock rate • Memory access time • Memory caches • Disk caches ECS 50, Discussion on 4/25