You are working on a 16-bit microprocessor that uses a 2-way set-associative cache with a...
Texas Instruments technical mcq question, verified with a worked answer. Free to practise - no sign-up.
You are working on a 16-bit microprocessor that uses a 2-way set-associative cache with a total capacity of 256 bytes. It is given that each cache line contains 8 bytes.
How many cache sets are there in the cache?
Show answer & explanation
The number of cache sets is calculated by dividing the total number of cache lines by the associativity (the number of lines per set). In this case, 32 total lines divided by 2 lines per set equals 16 sets.
Step-by-step Derivation:
Step 1: Calculate the total number of cache lines in the cache.
Total Capacity = 256 bytes
Line Size = 8 bytes
Total Lines = Total Capacity / Line Size = 256 / 8 = 32 lines.
Step 2: Determine the number of sets based on the associativity.
Associativity (k) = 2-way (meaning 2 lines per set).
Number of Sets = Total Lines / Associativity = 32 / 2 = 16 sets.
Final Result: The number of cache sets is 16.