Floating Point Representation; Logic Operations
Tom Kelliher, CS 220
Oct. 8, 1997
Finish reading Chapter 5. Homework handout.
Fields of a single precision floating point number:
- Mantissa sign.
- Exponent: Bias 127, 8 bits.
- Mantissa magnitude, 23 bits. Normalized range: .
Features:
- The hidden bit.
- Field ordering within a word and its impact.
Values (f is the fractional part of the mantissa):
- V = NaN, if e=255 and .
- V = , if e=255 and f=0.
- V = , if 0 < e < 255.
- V = , if e=0 and . (Denormalized.)
- V = , if e=0 and f=0.
Examples:
- Represent the value 3.14159E8 in IEEE FP. (In Hex, it's
12B9AF98.)
- What is the value of 0X12B9AF98?
Operations:
- not (2 operands)
- and
- or
- nand
- nor
- xor
- xnor
Others are three operands.
Truth tables?
Do you think all these exist in hardware?
- What is a mask?
- Setting bits with or.
- Clearing bits with and.
- 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
- Where are masking operations used?
- Logical shifts: sll and srl.
- Arithmetic shifts: sra.
- Where's sla?
- Can I really use these to divide/multiply?
- Rotates: ror and rol. Redundant.
Thomas P. Kelliher
Tue Oct 7 18:14:31 EDT 1997
Tom Kelliher