title: Cache Addressing: Length of Index, Block offset, Byte offset & Tag?
body: <p>Let's say I know the following values:</p>
  
  <pre><code>W = Word length (= 32 bits)
  S = Cache size in words
  B = Block size in words
  M = Main memory size in words
  </code></pre>
  
  <p>How do I calculate how many bits are needed for:</p>
  
  <pre><code>- Index
  - Block offset
  - Byte offset
  - Tag
  </code></pre>
  
  <p>a) in Direct Mapped Cache
  b) in Fully Associative Cache?</p>