15-740/18-740 Computer Architecture Homework 6 Due Thursday, December 1, at Noon 1. Cache I A byte-addressable system with 16-bit addresses ships with a two-way set associative, writeback cache with perfect LRU replacement. The tag store (including the tag and all other meta-data) requires a total of 4352 bits of storage. What is the block size of the cache? Assume that the LRU information is maintained on a per-block basis as a single bit. (Hint: 4352 = 212 + 28 .) 2. Cache II A processor has an 8-bit physical address space and a physically addressed cache. Memory is byte addressable. The cache uses perfect LRU replacement. The processor supplies the following sequence of addresses to the cache. The cache is initially empty. The hit/miss outcome of each access is shown. Determine the block-size, associativity, and size of the cache. Assume that all three are powers of two. Address 0 2 4 128 0 128 64 4 0 32 64 Outcome Miss Hit Miss Miss Hit Hit Miss Hit Miss Miss Hit 3. Caches & Virtual Memory We have a byte-addressable toy computer that has a physical address space of 512 bytes. The computer uses a simple, one-level virtual memory system. The page table is always in physical memory. The page size is specified as 8 bytes and the virtual address space is 2kB. (a) How many bits of each virtual address is the virtual page number? (b) How many bits of each physical address is the physical frame number? We would like to add a 128-byte write-through cache to enhance the performance of this computer. However, we would like the cache access and address translation to be performed simultaneously. In other words, we would like to index our cache using a virtual address, but do the tag comparison using the physical addresses (virtually-indexed, physically-tagged). The cache we would like to add is direct-mapped, and has a block size of 2 bytes. The replacement policy is LRU. Answer the following questions: 1 (c) How many bits of a virtual address are used to determine which byte in a block is accessed? (d) How many bits of a virtual address are used to index into the cache? Which bits exactly? (e) How many bits of the virtual page number are used to index into the cache? (f) What is the size of the tag store in bits? (Exclude LRU-related metadata storage.) Suppose we have two processes sharing our toy computer. These processes share some portion of the physical memory. Some of the virtual page-physical frame mappings of each process are given below: Process 0 Virtual Page Physical Frame 0 0 3 7 7 1 15 3 Process 1 Virtual Page Physical Frame 0 4 1 5 7 3 11 2 (a) Give a complete physical address whose data can exist in two different locations in the cache. (b) Give the indexes of those two different locations in the cache. (c) We do not want the same physical address stored in two different locations in the 128-byte cache. We can prevent this by increasing the associativity of our virtually-indexed, physically-tagged cache. What is the minimum associativity required? (d) Assume we would like to use a direct-mapped cache. Describe a solution that ensures that the same physical address is never stored in two different locations in the 128-byte cache. 2