# Fall 2015 CSCI 255 Homework 7 solution

## Problem 1

• 8G × 512 = 233 × 29 = 242 = 4T
• 16G / 256 = 234 / 28 = 226 = 64M
• 4k × 2M = 212 × 221 = 233 = 8G
• log2(64M) = log2(226) = 26

## Problem 2

• An 2 GB memory has a 32-bit word size. How many words are contained in this memory?
• 2 GB = 231 bytes = 231 × 23 bits = 234 bits
• 234 bits / (25 bits/word) = 229 words = 512M words
• A memory has 8 G words. Each word contains 64 bits. How many bytes are contained in this memory?
• 8 G words = 223 words
• 64 bits = 26 bits
• 223 words × (26 bits/word) = 229 bits
• 229 bits = 226 bytes = 64 GB
• How many bits are required to address the 8 G words of this memory?
• 8 G = 233
• log2(233) = 33

## Problem 3

Express the following base 10 numbers in 16-bit fixed-point twos-complement representation with 8 integer bits and 8 fraction bits. Some of the numbers can not be expressed exactly, so give the nearest fixed-point representaion.

• 13.5 is 00001101.10000000 or 0000110110000000 in fixed-point
• 100.05 is approximately 01100100.00001100 or 0110010000001100 in fixed-point
• 0000110110000001 in fixed-point is 100.046875
• 100.05 is approximated by 01100100.00001101 or 0110010000001101 in fixed-point
• 0000110110000000 in fixed-point is 100.05078125
• 0.3333333333333333333333333333333333333333333333333 is approximately 00000000.01010101 or 0000000001010101 in fixed-point
• 14 is 00001110.00000000 or 0000111000000000 in fixed-point

## Problem 4

Express the following 16-bit fixed-point twos-complement numbers with 8 integer bits and 8 fraction bits as base 10 decimal numbers.

• 0000100011001100 in fixed-point is 00001000.11001100 or 8 + 204/256 or 8.796875
• 1100100011001100 in fixed-point is 11001000.11001100 is -56 + 204/256 or -55.203125
• ## Problem 5

What is the 32-bit IEEE 754 representation for 3.5?

• In binary fixed point, 3.5 is 11.1
• Normalized, 11.1 is 1.11 × 21
• IEEE 754 sign field is 0 (for positive)
• IEEE 754 exponent field is 127+1 or 10000000 in binary
• IEEE 754 fraction field is 127+1 or 11000000000000000000000
• IEEE 754 representation is 01000000011000000000000000000000 or `0b01000000011000000000000000000000` (Java SE 7) or `0b0100_0000_0110_0000_0000_0000_0000_0000` (Java SE 7) or `0x40600000` (C and Java) or 40600000 (hex)

## Problem 6

If `0x42510000` is the 32-bit IEEE 754 representation of a floating point number, what is the floating point number?

• `0x42510000` is 01000010010100010000000000000000
• For IEEE 754, can be divided into 0.10000100.10100010000000000000000
• 0 means number is positive
• 10000100 means exponent field is 132 and binary exponent is 132-127 or 5 so exponent multiplier is 25 or 32
• 10100010000000000000000 means fraction is 1.10100010000000000000000 or 1+1/2+1/8+1/128 or 1+64/128+16/128+1/128 or 1+81/128 or 1.6328125
• Result is +32×1.6328125 or 52.25