Download Homework Solutions for CPSC 2105: Introduction to Computer Organization and more Assignments Computer Architecture and Organization in PDF only on Docsity! CPSC 2105 Introduction to Computer Organization Homework Set 8 Due Monday, April 3, 2006 HOMEWORK KEY WITH ANSWERS AND COMMENTS. 1. Suppose a computer using direct mapped cache has 232 words of main memory and a cache of 1024 blocks, where each cache block contains 32 words. a) How many blocks of main memory are there? b) What is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, block, and word fields? c) To which cache block will the memory reference 0000 63FA map? ANSWER: Recall that 1024 = 210 and 32 = 25, from which we may conclude 1024 = 32 ๏ท 32. a) The number of blocks is 232 / 25 = 2(32 โ 5) = 227 = 27 ๏ท 220 = 128 M = 134, 217, 728. b) 32 words per cache line ๏ Offset address is 5 bits. 1024 blocks in the cache ๏ Block number is 10 bits. 232 words ๏ 32 bit address ๏ 32 โ (5 + 10) = 10 โ 15 = 17 bit tag. Bits 31 15 14 5 4 0 Contents Tag Block Number Offset within block c) The number of bits allocated to the block number and offset are 15. We examine the last four hex digits of 0000 63FA, as they correspond to 16 binary bits. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Hex 6 3 F A Binary 0 1 1 0 0 0 1 1 1 1 1 1 1 0 1 0 11 0001 1111 = 0x31F 1 1010 = 0x1A = 26 0x31F = 3๏ท256 + 1๏ท16 + 15 = 768 + 16 + 15 = 799. 2. Suppose a computer using fully associative cache has 224 words of main memory and a cache of 128 blocks, where each cache block contains 64 words. a) How many blocks of main memory are there? b) What is the format of a memory address as seen by the cache, that is, what are the sizes of the tag and word fields? Answer: Recall that 128 = 27 and 64 = 26. a) The number of blocks is 224 / 26 = 2(24 โ 6) = 218 = 28 ๏ท 210 = 256 K = 262, 144. b) For associative mapping the address has only tag and word offset in the block. 64 word block ๏ 6 bit offset. 24 bit address ๏ (24 โ 6) = 18 bit tag. Bits 23 6 5 0 Contents Tag Offset in block