Floating Point Representation; Logic Operations

Tom Kelliher, CS 220

Oct. 8, 1997

Announcements

Assignment

Finish reading Chapter 5. Homework handout.

IEEE Floating Point

Fields of a single precision floating point number:

  1. Mantissa sign.

  2. Exponent: Bias 127, 8 bits.

  3. Mantissa magnitude, 23 bits. Normalized range: .

Features:

  1. The hidden bit.

  2. Field ordering within a word and its impact.

Values (f is the fractional part of the mantissa):

  1. V = NaN, if e=255 and .

  2. V = , if e=255 and f=0.

  3. V = , if 0 < e < 255.

  4. V = , if e=0 and . (Denormalized.)

  5. V = , if e=0 and f=0.

Examples:

  1. Represent the value 3.14159E8 in IEEE FP. (In Hex, it's 12B9AF98.)

  2. What is the value of 0X12B9AF98?

Logical Operations

Operations:

  1. not (2 operands)

  2. and

  3. or

  4. nand

  5. nor

  6. xor

  7. xnor

Others are three operands.

Truth tables?

Do you think all these exist in hardware?

Masking Operations

  1. What is a mask?

  2. Setting bits with or.

  3. Clearing bits with and.

  4. Example:
                   .data
    mask1:         .word 0X0000FF00
    temp:          .word
    char:          .word 'a'
    target:        .word
    
                   .text
                   ...   # Get characters into target
                   not temp, mask1
                   and target, target, temp
                   sll temp, char, 8
                   or target, target, temp
    

  5. Where are masking operations used?

Shifting Operations

  1. Logical shifts: sll and srl.

  2. Arithmetic shifts: sra.
    1. Where's sla?

    2. Can I really use these to divide/multiply?

  3. Rotates: ror and rol. Redundant.



Thomas P. Kelliher
Tue Oct 7 18:14:31 EDT 1997
Tom Kelliher