Professional Documents
Culture Documents
Content at a Glance
Week 2 Review Integer data representation/Interpretation Integer data addition and subtraction Integer data limitation Floating Point data IEEE754 Standard Floating Point data Arithmetic
Most computers are based on the Von Neumann architecture concepts developed by John Von Neumann in the mid 1940s.
1.
2.
Locn 410
Locn 414 Locn 416
March 20, 2012
3.
The 3 key concepts in Von Neumann architecture are: Data and instructions are stored in a single read/write memory The contents of this memory are addressable by location, regardless of its contents Instructions are executed in a sequential manner, one after another; in a single processing unit.
The Von Neumann bottleneck The speed of a von Neumann computer is limited by the fact that instructions and data must be accessed sequentially via a single bus
Harvard Architecture
Harvard architecture machines have separate program and data memories, with their own separate busses. Thus Harvard machines are potentially faster, as we can access the next instruction while fetching the data for the current instruction
IF
EI
STOP
Computer architectures are closely related to what their instructions may be able to do, and may be categorised as:
Zero Address One address Two Address and Three Address
architectures.
March 20, 2012
Observation
the simpler the instruction set i.e. supports only simple, short and therefore fast instruction. requires a longer and more complex program the shorter the program, but requires support for more complex instructions
All integer data is represented by a fixed length bit (Binary digit) sequence. Computers are designed to handle integer numbers in byte (8-bit) lots e.g. byte ( or octet ) 8 bits word 16 bits (2 bytes) long (or double) word 32 bits (4 bytes or 2 words) quad word 64 bits (4 words or 8 bytes) Most current programming languages like Java, handle integer data as a 32-bit quantity by default
March 20, 2012
8 bit pattern
0000 0010 0000 0110 1111 1110 2 6 -2 [or 254]
For simplicity we will use 4 bit numbers to illustrate the operations 6 2 --8 0110 0010 ------1000
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
so
6 + [-2] ---4
-4 1 1100 (addend)
(sum = -5) 1 0 0101
Sign bits
This carry is disregarded; the result is 01001(sum=+5)
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
Multiplication Example
Multiplicand (11 dec) Multiplier (13 dec) Partial products Note: if multiplier bit is 1 copy multiplicand (place value) otherwise zero Product (143 dec)
Remainder
Quotient Dividend
Remainder
Range
bits n 8 16 32 64
March 20, 2012
signed (2sComp) -2n-1 to + (2n-1 - 1) - 128 to +127 -32768 to +32767 2.14748 * 109 9.223 * 1018
Floating point data representation allow us to store fractional numbers, and is modelled on scientific notation. e.g.1: (+) 3.5 * 102 [ 350 ] e.g.2: - 25 * 10-3 [ - 0.025 ] We can store floating point numbers in three parts, namely: sign, significand, exponent The same applies to binary numbers
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
IEEE754 Standard
lsb
23 bits Significand In a normalized binary number the msd is 1, which is implied (not stored).
Biased Exponent
Add 127 for single precision (1023 for double precision) All possible exponents from -127 to +127 convert into unsigned numbers from 0 to 255. Examples: If the exponent is 4, the exponent field will be 4+127 = 131 (10000011). If exponent contains 01011101 (93), the actual exponent is 93-127 = -34. Easy to compare magnitudes like unsigned integers.
March 20, 2012
Significand
The significand represents a binary fraction. There is an implicit 1 to the left of the binary point. For example, for the significand 01101..., the actual mantissa would be 1.01101... There is exactly one non-zero digit to the left of the point.
March 20, 2012
01011011101000000000000
Question
Convert (479.75)10 to 32 bit IEEE 754 floating point format.
2 10 1.00 * 21 Exp = 128; Sig = 0 1 01 1.00 * 20 Exp = 127; Sig = 0 0.5 0.1 1.00 * 2-1 Exp = 126; Sig = 0 10 1010 1.01 * 23 Exp = 130; Sig = 010...0 0 0.00 ?? Special case Exp = Sig = 0
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
Negative numbers between - (2 2-23 ) x 2128 to -2-127 Positive numbers between 2-127 to (2-2-23) x 2128
There is a small number range near (and including) zero which cannot be represented in the normalized format. This is known as underflow. Zero is treated as a special case
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
Special Cases
Negative numbers less than -(2 - 2-23) x 2128, called negative overflow. Negative numbers greater than -2-127, called negative underflow. Zero Positive numbers less than 2-128, called positive underflow. Positive numbers greater than (2 - 2-23) x 2128, called positive overflow.
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
Expressible Numbers
(Stallings p.310)
March 20, 2012
IEEE754 Standard
Double precision numbers are stored in 64-bit normalized binary format: msb
lsb
52 bits Significand In a normalized binary number the msd is 1, which is implied (not stored).
0 2047 (all 1s) 0 2047 (all 1s) 0 or1 2047 (all 1s)
not 0 NaN
2e-127 (1.f)
2e-1023 (1.f)
-2
e-127
(1.f)
-2
e-1023
(1.f)
0 f <> 0
2e-126 (0.f)
0 f <> 0
2e-1022 (0.f)
0 f <> 0
-2
e-126
(0.f)
0 f <> 0
-2
e-1022
(0.f)
(Stallings, p.313)
Floating point arithmetic operations performed by numeric data processors (co-processors) are: addition subtraction multiplication and division
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
3.
4.
check for zero values denormalize significant and equalize exponent values add/subtract the significant values normalize the result
Addition - Example
99.99 + 0.161 = 100.151 Denormalize the numbers 9.999 x 101 1.610 x 10-1 Equalize Exponents 1.610 x 10-1 = 0.0161 x 101
Subtraction - Example
99.99 - 0.161 = 99.829 Denormalize the numbers 9.999 x 101 1.610 x 10-1 Equalize Exponents 1.610 x 10-1 = 0.0161 x 101 Add the Significands 9 .9990 x 101 - 0.0161 x 101 9.9829 x 101
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
Floating point multiplication and division are simpler than addition and subtraction because the is no need to align exponents
1. 2. 3. 4. 5. 6.
The steps in are: check for zero values add/subtract exponents check for errors multiply/divide significands normalize round
Multiplication - Example
To multiply two values, first multiply their magnitudes and add the exponents. 9.999 x 101 x 1.610 x 10-1 16 .098 x 100
The sign of a product is the xor of the signs of the operands.
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
Division - Example
To multiply two values, first divide their magnitudes and subtract the exponents. 9.999 x 101 1.610 x 10-1 6 .210 x 102
The sign of a product is the xor of the signs of the operands.
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
all arithmetic operations suffer from rounding errors rounding errors occur because we cant represent all values exactly, so we approximate their values
guard bits are additional bits attached to the rhs of the significand guard bits help to retain accuracy in the final result
NaN
NaN is a symbolic quantity encoded in floating point numbers for a result which can not be represented in the available space or format e.g. result, or meaningless result from 0/0, / , or 0*
Intels 80486, introduced in 1989, included floating-point support in the processor itself.
(Ravi, Haritha, Vasuki, Satish- Floating Point Architecture, July 2007)
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute
The main CPU would call the 8087 for floatingpoint operations. The 8087 had eight special 80-bit (extended precision) registers that could be accessed in a stack-like fashion. Some of the IEEE standard is based on the 8087.
Reference
Stallings William, 2003, Computer Organization & Architecture designing for performance, 7th edn, Pearson Education,Inc [Chapter 9] Ravi Paruchuri, Haritha Talluri, Vasuki Mulukutla, Satish Gogisetty - Floating Point Arithmetic Computer Systems Architecture, Frank Duyker. C S 465 Computer Organisation
Richard Salomon, Sudipto Mitra Copyright Box Hill Institute