1. 16 MiB memory, 32 bytes x 256 lines,  address F6766F

a. 16 MiB = 2^4 x 2^20 ~ 24 bit memory address

b. 256 line = 2^8 ~ 8 bit line address

c. 32 bytes = 2^6 ~ 5 bit byte index

d. 256 lines/cache * 32 bytes/line =  2^8 * 2^5 = 2^13 or 8 KiB cache size.

e. 24 bits - ( 8 + 5 ) = 11 bit tag (segment) ID.

f. 256 lines * (11 bit tag/line  + 1 valid bit/line + 1 dirty bit/line))/8 bits
= (256 * 13 bits) / 8 bits/byte = 416 bytes

F6766F =  1111 0110 0111 0110 0110 1111

     i. Tag       h. line      g. byte
 111 1011 0011   1011 0011     0 1111
     7D3             D3         0F

***********
2. 256 MiB, 8 bytes x 64 line cache. Address 67373A

a. 256 MiB = 2^8 * 2^20 = 2 ^ 28 ~ 28 bits

b. 64 lines/cache 2^6 ~ 6 bit line index

c.  8 bytes/line 2^3 ~ 3 bit byte index

d.  2^6 * 2^3 = 2^9 ~ 512 Byte cache size.

e. 256 MiB/512 B = 2^28/2^9 = 2^19 ~ 19 bit segment Tag.

f. 64 lines * (1 valid bit/line + 1 dirty bit/line + 19 tag bits/line)/ 8 bits
    64 * (1 + 1 + 19)/8  = 168 bytes

  67373A  =  0110 0111 0011 0111 0011 1010

        i. Tag              h. line   g. byte
  011 0011 1001 1001 1011   10 0111   010
         339B                   27     2

***********
3. 512 MiB     4 bytes x 2048 lines    memory A1A163E 

a. 512 MiB  2^9 x 2^20 ~ 29 bit

b. 2048 lines/cache = 2^1 x 2^10 ~ 11 bit line index

c. 4 bytes/line = 2^2 ~ 2 bit byte index.

d. 2048 lines/cache * 4 bytes/line = 2^11 * 2^2 = 2^13 = 8192 bytes/cache.
   or 8 KiB/cache

e. 512 MiB/8 KiB = 2^29/2^13 = 2^16  ~ 16 bit Segment tag.

f. 2048 lines * (1 valid bit/line + 1 dirty bit/line + 26 tag bits/line)/8 bits
    2048*(1+1+16)/8 = 4086 bytes.

    A1A163E  = 1010 0001 1010 0001 0110 0011 1110

    i. Tag               h. line       g. byte
  101 0000 1101 0000  101 1000 1111        10
        50D0             58F                2

***********
4. 32 MiB     16 bytes x 128 lines    memory 6D2D39

a. 32 MiB = 2^5 * 2^20 ~ 25 bit memory address
 
b. 128 lines/cache = 2^7 ~ 7 bit line index

c. 16 bytes/line = 2^4 ~ 4 bit byte index

d. 128 lines/cache * 16 bytes/line = 2^7 * 2^4 = 2^11 bytes/cache or 2KiB

e. 32 Mib/2Kib = 2^25/2^11 = 2^14 ~ 14 bit segment tag.

f. 128 lines * (1 valid bit/line + 1 dirty bit/line + 14 tag bits/line)/8 bits 
   128*(1+1+14)/8 = 256 bytes.

    6D2D39 = 0110 1101 0010 1101 0011 1001
    i. Tag               h. line       g. byte
    0 1101 1010 0101     101 0011       1001
       0DA5                 53           9

***********
5. 1 GiB memory,  32 bytes x 1024 line cache  memory 757575

a. 1 GiB = 2^30 ~ 30 bit memory address

b. 1024 lines/cache = 2^10 ~ 10 bit line index

c.  32 bytes/line = 2^5 ~ 5 bit byte index

d.  1024 lines/cache * 32 bytes/line = 2^10 * 2^5 = 2^15 or 32KiB cache

e.  1 GiB/32 KiB cache = 2^30/2^14 = 2^15 ~ 15 bit segment tag.

f.  1024 lines * (1 valid bit + 1 dirty bit + 15 tag bits)/line  / 8 bits
    1024(1+1+15)/8 = 2176 bytes.

    757575 = 0111 0101 0111 0101 0111 0101

    757575 = 0 1110 1010    11 1010 1011    1 0101

      i. Tag        h. line           g. byte
    0 1110 1010   11 1010 1011        1 0101
            0EA            3AB            15