ECE 231 - Fall 2023 - HW4 - Solutions

pdf

School

George Mason University *

*We aren’t endorsed by this school

Course

231

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

13

Uploaded by CoachTurtle8298

Report
Homework Assignment #4 – Solutions Fall 2023 Homework #4 Solutions R EADING : 1. ZyBook: 1.14, 3.6 – 3.8 (Binary numbers) 2. ZyBook: 3.6 – 3.7, 3.9 (Binary arithmetic) M ULTIPLE C HOICE AND S HORT - ANSWER Q UESTIONS : [½ point each] 1. Which of the following statements is true of the number of bits required to represent each decimal number? (a) One bit is required to represent the decimal value 2. (b) Three bits are required to represent the decimal value 7. (c) Four bits are required to represent the decimal value 16. (d) Three bits are required to represent the decimal value 9. 2. Which of the following Two’s Complement additions results in overflow? (a) 1010 + 1001 (b) 1001 + 0010 (c) 0011 + 0001 (d) 0110 + 1000 3. Which of the following decimal numbers is in normalized scientific notation? (a) 3.06 x 10 3 (b) 0.30 x 10 3 (c) 0.11 x 10 5 (d) 10.01 x 10 5 ECE 231 – Digital System Design 1 of 13 Dr. Craig Lorie
Homework Assignment #4 – Solutions Fall 2023 4. Normalizing the binary number 1010.11 2 yields 1.01011 2 . What is the biased exponent for the normalized number given above? (a) 6 (b) 11 (c) 127 (d) 130 5. Determine the result of the binary floating-point addition given below. 1.001 x 2 2 + 1.101 x 2 2 (a) 1.0110 x 2 1 (b) 1.0110 x 2 2 (c) 1.0110 x 2 3 (d) 1.0110 x 2 4 (e) 1.110 x 2 3 6. Determine the result of the binary floating-point multiplication given below. (1.10 x 2 5 ) x (1.1 x 2 3 ) (a) 1.0010 x 2 8 (b) 1.0010 x 2 9 (c) 1.0010 x 2 15 (d) 1.0010 x 2 5 ECE 231 – Digital System Design 2 of 13 Dr. Craig Lorie
Homework Assignment #4 – Solutions Fall 2023 L ONG -A NSWER P ROBLEMS : [Point value specified with each problem] 1. [2] Sign and Magnitude Representation. Show your work. (a) Convert the 8-bit Sign-and-Magnitude binary number 1010 0101 2 to decimal. 1010 0101 -> 1 0100101 = -(1 + 4 + 32) = -37 (b) Convert the 8-bit Sign-and-Magnitude binary number 0011 1001 2 to decimal. 0011 1001 -> 0 0111001 = +(1 + 8 + 16 + 32) = +57 (c) Convert the decimal number +47 10 to an 8-bit Sign-and-Magnitude binary number. 47 = 32 + 8 + 4 + 2 + 1 = 2 5 + 2 3 + 2 2 + 2 1 + 2 0 = 010 1111 (7-bit unsigned magnitude) +47 = 0010 1111 (8-bit Sign and Magnitude) (d) Convert the decimal number -113 10 to an 8-bit Sign-and-Magnitude binary number. 113 = 64 + 32 + 16 + 1 = 2 6 + 2 5 + 2 4 + 2 0 = 111 0001 (7-bit unsigned magnitude) -113 = 1111 0001 (8-bit Sign and Magnitude) ECE 231 – Digital System Design 3 of 13 Dr. Craig Lorie
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Homework Assignment #4 – Solutions Fall 2023 2. [2] Two’s Complement Representation. Show your work. (a) Convert the 8-bit Two’s Complement binary number 1001 1101 2 to decimal. 1001 1101 = -(1)(128) + (16 + 8 + 4 + 1) = -99 (b) Convert the 8-bit Two’s Complement binary number 0111 1010 2 to decimal. 0111 1010 = -(0)(128) + (64 + 32 + 16 + 8 + 2) = +122 (c) Convert the decimal number -122 10 to an 8-bit Two’s Complement binary number. 122 = 64 + 32 + 16 + 8 + 2 = 2 6 + 2 5 + 2 4 + 2 3 + 2 1 = 0111 1010 (8-bit unsigned binary number) -122 = 1000 0101 + 1 1000 0110 (8-bit Two's Complement binary number) (d) Convert the decimal number +85 10 to an 8-bit Two’s Complement binary number. 85 = 64 + 16 + 4 + 1 = 2 6 + 2 4 + 2 2 + 1 0 = 0101 0101 (8-bit unsigned binary number) +85 = 0101 0101 (8-bit Two's Complement binary number) ECE 231 – Digital System Design 4 of 13 Dr. Craig Lorie
Homework Assignment #4 – Solutions Fall 2023 3. [2] Unsigned binary arithmetic Calculate the sum and difference of the given 8-bit unsigned binary numbers. All calculations must be done in binary. Show your work. Use a “ – ” to indicate a negative result. For the sum, indicate if carry-out occurs. Complete the table given below. A B A + B Carry-out (Y/N) A – B 1001 0101 0010 1110 0110 1101 0111 0011 1001 0101 1001 0101 + 0010 1110 - 0010 1110 1100 0011 0110 0111 (no carry-out) 0110 1101 0110 1101 0111 0011 + 0111 0011 - 0111 0011 -> - 0110 1101 1110 0000 0000 0110 (no carry-out) Answer = -0000 0110 ECE 231 – Digital System Design 5 of 13 Dr. Craig Lorie
Homework Assignment #4 – Solutions Fall 2023 4. [1] Unsigned binary arithmetic. Calculate the product of the given unsigned binary numbers. All calculations must be done in binary. Show your work. Complete the table given below. A B A * B 101 11011 101 (5) x 11011 (27) 101 101 000 101 + 101 10000111 (135) ECE 231 – Digital System Design 6 of 13 Dr. Craig Lorie
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Homework Assignment #4 – Solutions Fall 2023 5. [2] Two's Complement binary addition and subtraction Calculate the sum of the given 8-bit Two’s Complement binary numbers. All calculations must be done using Two’s Complement binary arithmetic. Show your work. Specify each result as an 8-bit Two’s Complement binary number. Indicate if overflow occurred. 0100 1110 1001 1011 (a) + 0110 0011 (b) + 1110 1001 0100 1110 1001 1011 + 0110 0011 + 1110 1001 1011 0001 11000 0100 OVERFLOW. No Overflow. Calculate the difference of the given 8-bit Two’s Complement binary numbers. All calculations must be done using Two’s Complement binary arithmetic. Show your work. Specify each result as an 8-bit Two’s Complement binary number. Indicate if overflow occurred. 0011 1110 1100 0101 (c) - 1101 0101 (d) - 0110 1110 B = 1101 0101 B = 0110 1110 -B = 0010 1011 -B = 1001 0010 0011 1110 1100 0101 + 0010 1011 + 1001 0010 0110 1001 10101 0111 NO Overflow. OVERFLOW. ECE 231 – Digital System Design 7 of 13 Dr. Craig Lorie
Homework Assignment #4 – Solutions Fall 2023 6. [2] Two's Complement binary arithmetic Calculate the sum and difference of the given signed decimal numbers. All calculations must be done using Two's Complement binary arithmetic. Show your work. Specify each result in 8-bit Two's Complement binary representation. For the sum, indicate if overflow occurs. Complete the table given below. Decimal 8-bit Two's Complement A + B Overflow (Y/N) A – B A B A B +122 -41 +83 +59 Remember: A – B = A + (– B) 122 = 0111 1010 (8-bit Two's Complement) 41 = 0010 1001 (8-bit Unsigned) -41 = 1101 0111 (8-bit Two's Complement) 0111 1010 + 1101 0111 10101 0001 8-bit Result = 0101 0001 NO overflow. Negative + Positive = Positive. 0111 1010 0111 1010 - 1101 0111 -> + 0010 1001 1010 0011 8-bit Result = 1010 0011 OVERFLOW. Positive + Positive = Negative. ECE 231 – Digital System Design 8 of 13 Dr. Craig Lorie
Homework Assignment #4 – Solutions Fall 2023 83 = 0101 0011 (8-bit Two's Complement) 59 = 0011 1011 (8-bit Two's Complement) 0101 0011 + 0011 1011 1000 1110 8-bit Result = 1000 1110 OVERFLOW. Positive + Positive = Negative. 0101 0011 0101 0011 - 0011 1011 -> + 1100 0101 10001 1000 8-bit Result = 0001 1000 NO overflow. Positive + Negative = Positive. ECE 231 – Digital System Design 9 of 13 Dr. Craig Lorie
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Homework Assignment #4 – Solutions Fall 2023 P RACTICE P ROBLEMS : (Do not submit solutions to these problems) 1. Convert the unsigned binary number 11100101 2 to decimal. (a) 231 (b) 172 (c) 59 (d) 215 (e) None of the above. Correct answer is 229 10 . 2. Convert the 8-bit sign and magnitude binary number 10011101 2 to decimal. (a) +157 (b) -157 (c) +29 (d) -29 (e) None of the above. 3. Convert the decimal number -67 10 to 8-bit 2’s Complement representation. (a) 01000011 (b) 11000011 (c) 10111100 (d) 10111101 (e) None of the above. 4. Convert the 8-bit 2’s Complement binary number 10110010 2 to decimal. (a) +178 (b) -178 (c) -30 (d) -78 (e) None of the above. 5. Convert the 8-bit 2’s Complement binary number 01011010 2 to decimal. (a) +166 (b) -38 (c) +90 (d) +82 (e) None of the above. ECE 231 – Digital System Design 10 of 13 Dr. Craig Lorie
Homework Assignment #4 – Solutions Fall 2023 6. Which of the following 8-bit 2’s Complement binary numbers represents the most positive decimal value? (a) 00000000 2 (b) 11111111 2 (c) 10000000 2 (d) 01111111 2 (e) 10100101 2 7. Which of the following 8-bit 2’s Complement binary numbers represents the most negative decimal value? (a) 00000000 2 (b) 11111111 2 (c) 10000000 2 (d) 01111111 2 (e) 10100101 2 8. Calculate the sum of the 8-bit unsigned binary numbers given below. 1000 1101 + 0011 1011 ------------ (a) 1100 1011 (b) 1101 0111 (c) 1011 0110 (d) 1100 1000 (e) 1011 1000 9. Calculate the difference of the 8-bit unsigned binary numbers given below. 1000 0011 - 0001 1010 ------------ (a) 1001 1001 (b) 0110 0111 (c) 1001 0101 (d) 0110 1001 (e) 0111 0101 ECE 231 – Digital System Design 11 of 13 Dr. Craig Lorie
Homework Assignment #4 – Solutions Fall 2023 10. Calculate the sum of the 8-bit Two’s Complement binary numbers given below. If overflow occurred, select Overflow . 0001 1110 + 1100 0111 ------------ (a) 1110 0101 (b) 0110 0101 (c) 0110 1010 (d) 1101 1111 (e) Overflow. 11. Calculate the difference of the 8-bit Two’s Complement binary numbers given below. If overflow occurred, select Overflow . 0011 1110 - 1101 0101 ------------ (a) 1001 0111 (b) 0110 1001 (c) 0001 0011 (d) 1010 0110 (e) Overflow. 12. In which of the 8-bit Two's Complement additions given below did overflow occur? 1101 0110 1010 0110 (1) + 1011 1000 (2) + 1001 0011 (a) (1) only. (b) (2) only. (c) Both (1) and (2). (d) Neither (1) nor (2). (e) Cannot be determined. ECE 231 – Digital System Design 12 of 13 Dr. Craig Lorie
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Homework Assignment #4 – Solutions Fall 2023 13. In which of the 8-bit Two's Complement additions given below did overflow occur? 1001 1100 0101 0011 (1) + 1110 1001 (2) + 1011 1001 (a) (1) only. (b) (2) only. (c) Both (1) and (2). (d) Neither (1) nor (2). (e) Cannot be determined. 14. Did overflow or carry-out occur in the 8-bit Two's Complement addition give below? 0101 0110 + 1100 1010 (a) Overflow occurred. Carry-out did not occur. (b) Carry-out occurred. Overflow did not occur. (c) Both occurred. (d) Neither occurred. (e) Cannot be determined. 15. Did overflow or carry-out occur in the 8-bit Two's Complement addition give below? 1101 0110 + 1011 1000 (a) Overflow occurred. Carry-out did not occur. (b) Carry-out occurred. Overflow did not occur. (c) Both occurred. (d) Neither occurred. (e) Cannot be determined. ECE 231 – Digital System Design 13 of 13 Dr. Craig Lorie