Department of Electrical and Computer Engineering
The
EE 306, Fall 2002
TAs: Asad Bawa, Linda Bigelow, Mustafa Erwa, Lester Guillory, Kevin Major, Abhay Pradhan, Moinuddin Qureshi, Paroma Sen, Santosh Srinath, Matt Starolis, David Thompson, Vikrant Venkateshwar
Problem Set 1
Due:
Instructions:
You are welcome, and in fact encouraged, to do the homework in groups. Remember to put the names of all students in your study group on the one solution sheet. Also remember to put the name and discussion section meeting time/day of the TA in whose discussion section you want the homework returned back to you. Good luck!!!
1) Textbook: Problem 1.4
Say we had a “black box,” which takes two numbers as input and outputs their sum. See figure 1a. Say we had another box capable of multiplying two numbers together. See figure 1b.We can connect these boxes together to calculate p x (m + n). See figure 1c. Assume we have an unlimited number of these boxes. Show how to connect them together to calculate:
a) ax + b
b) The average of the four input numbers w, x, y, and z.
c)
a2
+ 2ab + b2 (with only one add and one
multiply box)
2) In section 1.6.1 you were given the sentence “Time flies like an arrow” with 3 unique interpretations. Come up with your own sentence and 3 unique interpretations. Explain each clearly.
3) Textbook: Problem 2.2 (modified)
There are 26 characters in the English alphabet.
a) What is the least number of bits needed to give each character a unique bit pattern?
b) How many bits would we need if we want to distinguish between upper and lower case versions of all 26 characters?
c) If we also wanted to represent the digits 0-9, could we uniquely represent these digits in addition to the upper case and lower case characters using the same number of bits from your answer in part b? Why or why not?
4) Textbook: Problem 2.7 (modified)
a) Create a table showing the decimal values of all four-bit 2’s complement numbers.
b) Create a table showing the decimal values of all four-bit 1’s complement numbers.
5) Textbook: Problem 2.8
a) What is the largest positive number one can represent in an eight-bit 2’s complement code? Write your result in binary and decimal.
b) What is the greatest magnitude negative number one can represent in eight-bit 2’s complement code? Write your result in binary and decimal.
c) What is the largest positive number one can represent in n-bit 2’s complement code?
d) What is the greatest magnitude negative number one can represent in n-bit 2’s complement code?
6) Textbook: Problem 2.10 (modified)
Convert these decimal numbers to eight-bit 2’s complement binary numbers.
a) -32
b) -65
c) 127
d) -1
7) Textbook: Problem 2.14
Write the results of the following additions as both eight-bit binary and decimal numbers. For each part, use standard binary addition as described in Section 2.5.1.
a) Add the 1’s complement representation of 7 to the 1’s complement representation of -7.
b) Add the signed magnitude representation of 7 to the signed magnitude representation of -7.
c) Add the 2’s complement representation of 7 to the 2’s complement representation of -7.
8) Textbook: Problem 2.18
Express the negative value -27 as a 2’s complement integer, using 8 bits. Repeat, using 16 bits. Repeat, using 32 bits. What does this illustrate with respect to the properties of sign extension, as they pertain to 2’s complement representation?
9) Textbook: Problem 2.37.2
Write the decimal equivalent for this IEEE floating point number:
1 10000011 00010000000000000000000
10) Textbook: Problem 2.19
The following binary numbers are 2’s complement binary numbers. Which of the following operations generate overflow? Justify your answer by translating the operands and results into decimal.
a) 1100 + 0011
b) 1100 + 0100
c) 0111 + 0001
d) 1000 – 0001
e) 0111 + 1001
11) Textbook: Problem 2.48.2
What is the hexadecimal representation of 675.625 in the IEEE 754 floating point standard?
12) Textbook: Problem 2.49
Consider two hexadecimal representations: x434F4D50 and x55544552. What values do they
represent for each of the five data types shown?
[HINT: in the first four cases, express each value as a decimal number. In the fifth case, express the value
as a sequence of characters that one could type on a keyboard, for example.]
|
x434F4D50 |
x55544552 |
Unsigned binary |
|
|
1’s complement |
|
|
2’s complement |
|
|
IEEE 754 floating point |
|
|
ASCII string |
|
|
13) Textbook: Problem 2.51 (modified)
Fill in the truth table for the equation given below.
Q1 = NOT(NOT(A) OR (A AND (B AND C))
Q2 = NOT((B OR C) AND ((A AND B)
A |
B |
C |
Q1 |
Q2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14) Click on the Student Information Sheet on the EE 306 home page, and follow the instructions given.
Added
15) Textbook: Problem 2.33
Refer to Example 2.5 for the following questions:
a) What mask value and what operation would one use to indicate that machine 2 is busy?
b) What mask value and what operation would one use to indicate that machines 2 and 6 are no longer busy? (Note: This can be done with only one operation.)
c) What mask value and what operation would one use to indicate that all machines are busy?
d) What mask value and what operation would one use to indicate that all machines are idle?
e) Develop a procedure to isolate the status bit of machine 2 as the sign bit. For example, if the BUSYNESS pattern is 01011100, then the output of this procedure is 10000000. If the BUSYNESS pattern is 01110011, then the output is 00000000. In general, if the BUSYNESS pattern is:
b7 |
b6 |
b5 |
b4 |
b3 |
b2 |
b1 |
b0 |
the output is:
b2 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
Hint: What happens when you ADD a bit pattern to itself?
16) Textbook: Problem 2.39
A computer programmer wrote a program that adds two numbers. He/she ran the program and
observed that when 5 is added to 8, the result is the character m. Explain why this program is
behaving erroneously.