Introduction to computing systems -------------------------------------------------------------------------------- Lab L01: Pages 43-50, Exercises 2.10-11, 2.13-14, 2.17 (interpret bits as signed numbers, use calculator, sign-extend to 8 or 16 bit quantities as necessary), 2.18-19, 2.30, 2.32-35, 2.43 and 2.45-50 (use calculator as necessary), 2.53-54 -------------------------------------------------------------------------------- 2.10 Convert the following 2's complement binary numbers to decimal. a. 1010 b. 01011010 c. 11111110 d. 0011100111010011 2.11 Convert these decimal numbers to 8-bit 2's complement binary numbers. a. 102 b. 64 c. 33 d. -128 e. 127 2.13 Without changing their values, convert the following 2's complement binary numbers into 8-bit 2's complement numbers. a. 1010 c. 1111111000 h 011001 d. 01 2.14 Add the following bit patterns. Leave your results in binary form. a. 1011 + 0001 b. 0000 + 1010 c. 1100 + 0011 d. 0101 + 0110 e. 1111 + 0001 2.17 Add the following 2's complement binary numbers. Also express the answer in decimal. Interpret bits as signed numbers, use calculator, sign-extend to 8 or 16 bit quantities as necessary. a. 01 + 1011 b. 11 + 01010101 c. 0101 + 110 d. 01 + 10 2.18 Add the following unsigned binary numbers. Also, express the answer in decimal. a. 01 + 1011 b. 11 + 01010101 c. 0101 + 110 d. 01 + 10 2.19 Express the negative value —27 as a 2's complement integer, using eight 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? 2.30 Compute the following. Write your results in binary. a. 01010111 AND 11010111 b. 101 AND 110 C. 11100000 AND 10110100 d. 00011111 AND 10110100 e. ( 0011 AND 0110) AND 1101 f. 0011 AND (0110 AND 1101) 2.32 Fill in the following truth table for a one-bit OR operation. ------------ X Y (X OR Y) - - -------- 0 0 0 1 1 0 1 1 2.33 Compute the following: a. 01010111 OR 11010111 b. 101 OR 110 c. 11100000 OR 10110100 d. 00011111 OR 10110100 e. ( 0101 OR 1100 ) OR 1101 f. 0101 OR (1100 OR 1101) 2.34 Compute the following: a. NOT ( 1011 ) OR NOT ( ll00) b. NOT ( 1000 AND (1100 OR 0101 )) C. NOT (NOT ( 1101 ) ) d. (0110 OR 0000) AND 1111 2.35 What are the bit masks used for? 2.43 Translate the following ASCII codes into strings of characters by interpreting each group of eight bits as an ASCII character. a. x48656c6c6f21 b. x68454c4c4f21 c. x436f6d70757465727321 d. x4c432d32 2.45 Convert the following unsigned binary numbers to hexadecimal. a. 1101 0001 1010 1111 b. 001 1111 c. 1 d. 1110 1101 1011 0010 2.46 Convert the following hexadecimal numbers to binary. a. x10 b. x801 c. xF731 d. X0F1E2D e. xBCAD 2.47 Convert the following hexadecimal representations of 2's complement binary numbers to decimal numbers. a. xF0 b. x7FF c. xl6 d. x8000 2.48 Convert the following decimal numbers to hexadecimal representations of 2's, complement numbers. a. 256 b. 111 c. 123,456,789 d. -44 2.49 Perform the following additions. The corresponding 16-bit binary numbers are in 2's complement notation. Provide your answers in hexadecimal. a. x025B + x26DE b. x7D96 + xF0A0 c. xA397 + xA35D d. x7D96 + x7412 e. What else can you say about the answers to parts c and d? 2.50 Perform the following logical operations. Express your answers in hexadecimal notation. a. x5478 AND xFDEA b. xABCD OR xl234 c. NOT((NOT(xDEFA)) AND (NOT(xFFFF))) d. x00FF XOR x325C 2.53 Fill in the truth table for the equations given. The first line is done as an example. Q1 = NOT(A AND B) Q2 = NOT(NOT(A) AND NOT(B)) --------- A B Q1 Q2 - - -- -- 0 0 1 0 2.54 Fill in the truth table for the equations given. The first line is done as an example. Q1 = NOT(NOT(X) OR (X AND Y AND Z)) Q2 = NOT((Y OR Z) AND (X AND Y AND Z)) ----------- X Y Z Q1 Q2 - - - -- -- 0 0 0 0 1