Exam 1 Solutions 15-213 / 18-213 Spring 2012 ********* Problem 1 ********* A. -1 B. (c) C. (c) D. (1) f (2) h (3) None (4) e (5) b,c (6) d ********* Problem 2 ********* A. Value Floating Point Bits Rounded Value 9/32 0 0101 001 9/32 40 0 1100 010 40 15/2 0 1001 111 15/2 1/128 0 0000 100 1/128 B. 2^8 - 2^4 - 1 = 239 C. (e) ********* Problem 3 ********* func1: (C) func2: (B) func3: (D) ********* Problem 4 ********* A. False B. (c) C. False D. (b) E. +-----------------------------------+ | | 0xffff1004 +-----------------------------------+ | n = 2 | 0xffff1000 +-----------------------------------+ | return address | 0xffff0ffc +-----------------------------------+ | %ebp of calling func | 0xffff0ff8 +-----------------------------------+ | %ebx | 0xffff0ff4 +-----------------------------------+ | unknown | 0xffff0ff0 +-----------------------------------+ | unknown | 0xffff0fec +-----------------------------------+ | unknown | 0xffff0fe8 +-----------------------------------+ | n = 1 | 0xffff0fe4 +-----------------------------------+ | return address | 0xffff0fe0 +-----------------------------------+ | %ebp of calling func | 0xffff0fdc +-----------------------------------+ | %ebx | 0xffff0fd8 +-----------------------------------+ | unknown | 0xffff0fd4 +-----------------------------------+ | unknown | 0xffff0fd0 +-----------------------------------+ | unknown | 0xffff0fcc +-----------------------------------+ Smallest location pointed by %esp: 0xffff0fc8 Smallest location pointed by %ebp: 0xffff0fdc ********* Problem 5 ********* A. 28 bytes +----+----+----+----+----+----+----+----+ | f | f | f | f | c | XX | XX | XX | +----+----+----+----+----+----+----+----+ | x | x | x | x |z[0]|z[1]|z[2]|z[3]| +----+----+----+----+----+----+----+----+ | d | d | d | d | d | d | d | d | +----+----+----+----+----+----+----+----+ | s | s | XX | XX | | | | | +----+----+----+----+----+----+----+----+ | | | | | | | | | +----+----+----+----+----+----+----+----+ B. 40 bytes +----+----+----+----+----+----+----+----+ | f | f | f | f | f | f | f | f | +----+----+----+----+----+----+----+----+ | c | XX | XX | XX | x | x | x | x | +----+----+----+----+----+----+----+----+ |z[0]|z[1]|z[2]|z[3]| XX | XX | XX | XX | +----+----+----+----+----+----+----+----+ | d | d | d | d | d | d | d | d | +----+----+----+----+----+----+----+----+ | s | s | XX | XX | XX | XX | XX | XX | +----+----+----+----+----+----+----+----+ C. 60 bytes D. 88 bytes ********* Problem 6 ********* A. (b) B. 2 - 1 - 3 ********* Problem 7 ********* A. CT-CT-CT-SI-SI-SI-BO-BO B. Total 3 cache hits. Load No. Set Number Hit or Miss? 1 1 M 2 5 M 3 6 M 4 1 H 5 1 M 6 5 H 7 5 M 8 2 M 9 5 H 10 5 M C. (f)