## Discussion 7

10/8/02 Tue

### IEEE Floating point standard

In IEEE 754, which is the most widely used floating point format, numbers are represented as follows:

S(1-bit) E(8-bits) M(23-bits)

Where S is the sign bit which is 0 for non-negatives and 1 for negatives.

E is the exponent in biased notation with bias 127 (=27 - 1)

M is the mantissa for normalized number with implicit leading 1.

For example,

2 = 1.000000 * 2^1 = 1.000000 * 2^(128-127)

S: 0

E: 128

M: 0000000

Thus, 2 = 0 10000000 00000000000000000000000

3.0 * 2^10 = 1.5 * 2^11 = 1.1two * 2^(138-127)

Thus, 3.0 * 2^10 = 0 10001010 10000000000000000000000

### Short Quiz 1

Suppose we represent floating point numbers using 16-bits. It is the same as IEEE 754 standard except that we use 5-bits for biased representation of exponent and 10-bits for mantissa.

S(1-bit) E(5-bits) M(10-bits)

What is the largest value that can be represented with this notation?

### Denormalized number

If we assume all numbers are normalized, then the smallest number greater than zero is

1.000000 * 2^(1-127) = 2^-126

By allowing the numbers are not normalized, we can represent much smaller numbers

0.000000...01 * 2^(0-127) = 2^-22 * 2^-127 = 2^-149

### Short Quiz 2

Assume the same format as in short quiz 1.

What is the smallest value greater than zero that can be represented with normalization?

What is the smallest value greater than zero without any normalizations?

Floating point number comparison

The point of using IEEE754 standard is that we can use integer comparison to compare two floating point numbers. To see the advantage of using biased notation let us look at the following floating point representation:

S(1-bit)E(8-bits)M(23-bits)

We assume that E is in two’s complement notation and the significant is the normalized notation with implicit leading one.

Suppose two integer registers \$t0 and \$t1 have the floating point representation for two floating point numbers.

Then, we need three comparisons in worst case:(1) sign bits, (2) exponents and (3) mantissa

### Short Quiz 3

How can you compare two floating point numbers in IEEE 754 format?

Explain in one or two sentences.

### Short Quiz 4

The following diagram explains how a program is made and then run in a machine.  Fill in the blank which describes the specific components at each step.

 ________ ________ ________ ________ C program à Assembly Program à Object module à Executable Module à Running program

### Short Quiz 5

The following sentences describe processing interrupts. But they are not in the right order. Right down the number to the left of each paragragh to process interrupts correctly.

(    ) Copies the value from EPC to the PC
(    ) Checks Cause Register and jumps to portion of interrupt handler which handles the current exception
(    ) PC is set to 0x80000080, process enters kernel mode, and interrupt handler code begins execution
(    ) Copies PC into EPC and puts correct code into Cause Reg
(    ) Calls instruction rfe (return from exception)

### Short Quiz 6

What are the three ways of handling I/Os?

Explain the situations where each of methods is preferrable to the others.

### Short Quiz 7

Assume for a processor with a 1GHz clock it takes 800 clock cycles for a polling operation (call polling routine, accessing the device, and returning). Determine % of processor time for polling
keyboard when it is polled 20 times/sec.