Caching (part 2) byte block size result address (hex) exercise 3 tag index ofgset exercise: how many accesses are hits? tag bits (block) ofgset bits (set) index bits 00000001 (01) sets bit addresses up into tag/index/ofgset? how is the address 61 (01100001) split 11 1 01 00 value 00000000 (00) 01100011 (63) index valid how is the address 61 (01100001) split tag index ofgset exercise: how many accesses are hits? tag bits (leftover) sets ; set index bits; byte block size; block ofgset bits; up into tag/index/ofgset? 11 01100001 (61) 10 01 00 value tag index valid 01100100 (64) 00000000 (00) 01100010 (62) tag 10 01100100 (64) tag byte block size; 00000000 (00) up into tag/index/ofgset? how is the address 61 (01100001) split 11 10 01 00 value index valid sets ; 01100100 (64) 00000000 (00) 01100010 (62) 01100001 (61) 01100011 (63) 00000001 (01) 00000000 (00) result address (hex) exercise set index bits; block ofgset bits; tag bits (leftover) exercise 01100010 (62) 01100001 (61) 01100011 (63) 00000001 (01) 00000000 (00) result address (hex) bit addresses 3 3 tag bits sets (set) index bits byte block size (block) ofgset bits exercise: how many accesses are hits? tag index ofgset 4 byte blocks, 4 sets 4 byte blocks, 4 sets 4 byte blocks, 4 sets m = 8 bit addresses b block ofgset bits; B = 4 = 2 b byte block size B = 2 b byte block size; S = 4 = 2 s sets b = 2 (block) ofgset bits s set index bits; S = 2 s sets ; s = 2 (set) index bits t = m − ( s + b ) = 4 tag bits t = m − ( s + b ) tag bits (leftover)
00000000 (00) miss 00000001 (01) hit 01100011 (63) miss 01100001 (61) miss 01100010 (62) hit 00000000 (00) hit 01100100 (64) miss miss caused by confmict tag index ofgset 0 11 mem[0x65] 4 10 mem[0x63] 1 01 adding associativity 1 exercise tag mem[0x01] 1 00 value tag address (hex) result address (hex) example access pattern (1) 3 tag index ofgset exercise: how many accesses are hits? index valid value value tag indexofgset tag bits (block) ofgset bits byte block size (set) index bits sets bit addresses way 1 way 0 set 1 set 0 needs to replace block in set 0! result valid address (hex) avoid confmict misses multiple places to put values with same index 0 0 1 0 0 0 (block) ofgset bits tag tag bits 5 byte block size how is the address 61 (01100001) split 00000001 (01) 00000000 (00) result address (hex) exercise 3 tag index ofgset exercise: how many accesses are hits? tag bits (leftover) sets ; set index bits; byte block size; block ofgset bits; up into tag/index/ofgset? 11 01100001 (61) 10 01 00 value tag index valid 01100100 (64) 00000000 (00) 01100010 (62) 01100001 (61) 01100011 (63) 00000001 (01) 00000000 (00) result (set) index bits 01100011 (63) 01 index valid how is the address 61 (01100001) split 11 10 block ofgset bits; 00 byte block size; value tag up into tag/index/ofgset? set index bits; bit addresses 00000000 (00) 01100010 (62) 01100100 (64) sets sets ; tag bits (leftover) 4 byte blocks, 4 sets 4 byte blocks, 4 sets m = 8 bit addresses B = 4 = 2 b byte block size S = 4 = 2 s sets b = 2 (block) ofgset bits s = 2 (set) index bits t = m − ( s + b ) = 4 tag bits 2 byte blocks, 4 sets 2 -way set associative, 2 byte blocks, 2 sets index valid 00000 mem[0x00] 00000000 (00) miss 00000001 (01) hit 01100 mem[0x62] 01100011 (63) miss 01100001 (61) miss 01100 mem[0x64] 01100010 (62) hit 00000000 (00) miss 01100100 (64) miss m = 8 bit addresses B = 2 = 2 b byte block size S = 4 = 2 s sets b = 1 (block) ofgset bits s = 2 (set) index bits t = m − ( s + b ) = 5 tag bits
00000000 (00) miss 00000000 (00) miss 00000001 (01) hit 00000001 (01) hit 01100011 (63) miss 01100011 (63) miss 01100001 (61) miss 01100001 (61) miss 01100010 (62) hit 01100010 (62) hit 00000000 (00) hit 00000000 (00) hit 01100100 (64) miss 01100100 (64) miss 00000000 (00) miss 00000001 (01) hit 01100011 (63) miss 01100001 (61) miss 01100010 (62) hit 00000000 (00) hit 01100100 (64) miss address (hex) result tag indexofgset needs to replace block in set 0! avoid confmict misses adding associativity set 1 multiple places to put values with same index 0 0 1 0 0 0 value tag valid value set 0 index valid way 0 avoid confmict misses tag bits (block) ofgset bits byte block size (set) index bits sets bit addresses way 1 way 0 set 1 set 0 needs to replace block in set 0! tag indexofgset result address (hex) multiple places to put values with same index way 1 tag 5 adding associativity index valid tag value valid value 0 0 1 mem[0x01] 0 1 0 tag index valid adding associativity result 5 tag bits (block) ofgset bits byte block size (set) index bits sets bit addresses way 1 way 0 set 1 set 0 needs to replace block in set 0! tag indexofgset address (hex) index valid avoid confmict misses multiple places to put values with same index 0 0 1 0 0 0 value tag valid value tag adding associativity 5 5 multiple places to put values with same index tag bits (block) ofgset bits byte block size (set) index bits sets bit addresses way 1 way 0 set 1 set 0 needs to replace block in set 0! tag indexofgset address (hex) avoid confmict misses result 0 0 value tag valid value tag 0 0 1 0 2 -way set associative, 2 byte blocks, 2 sets 2 -way set associative, 2 byte blocks, 2 sets 2 -way set associative, 2 byte blocks, 2 sets 2 -way set associative, 2 byte blocks, 2 sets 000000 mem[0x00] m = 8 bit addresses B = 2 = 2 b byte block size S = 2 = 2 s sets b = 1 (block) ofgset bits 00000000 (00) miss s = 1 (set) index bits t = m − ( s + b ) = 6 tag bits 00000001 (01) hit 01100011 (63) miss 01100001 (61) miss 01100010 (62) hit 00000000 (00) hit 01100100 (64) miss
adding associativity tag indexofgset mem[0x63] 0 multiple places to put values with same index avoid confmict misses address (hex) result needs to replace block in set 0! 1 set 0 set 1 way 0 way 1 bit addresses sets 1 mem[0x61] byte block size index valid (set) index bits byte block size (block) ofgset bits tag bits 5 adding associativity tag 1 index valid valid tag value 0 1 mem[0x01] (set) index bits (block) ofgset bits bit addresses way 0 address (hex) result tag indexofgset needs to replace block in set 0! set 0 set 1 way 1 multiple places to put values with same index bit addresses sets (set) index bits byte block size (block) ofgset bits tag bits avoid confmict misses 0 tag bits tag 5 adding associativity index valid tag value valid value mem[0x63] 0 1 mem[0x01] 1 mem[0x61] 1 1 sets value way 1 byte block size set 1 way 0 way 1 bit addresses sets (set) index bits way 0 needs to replace block in set 0! tag bits 5 adding associativity index valid tag value valid set 0 tag indexofgset value 1 tag value valid tag value 0 mem[0x01] result 0 1 0 0 multiple places to put values with same index avoid confmict misses address (hex) tag (block) ofgset bits 5 mem[0x01] 0 address (hex) mem[0x63] 1 1 0 multiple places to put values with same index result 1 0 tag indexofgset needs to replace block in set 0! set 0 set 1 avoid confmict misses 2 -way set associative, 2 byte blocks, 2 sets 2 -way set associative, 2 byte blocks, 2 sets 000000 mem[0x00] 000000 mem[0x00] 011000 mem[0x62] 00000000 (00) miss 00000000 (00) miss 00000001 (01) hit 00000001 (01) hit 01100011 (63) miss 01100011 (63) miss 01100001 (61) miss 01100001 (61) miss 01100010 (62) hit 01100010 (62) hit 00000000 (00) hit 00000000 (00) hit 01100100 (64) miss 01100100 (64) miss 2 -way set associative, 2 byte blocks, 2 sets 2 -way set associative, 2 byte blocks, 2 sets 000000 mem[0x00] 011000 mem[0x60] 000000 mem[0x00] 011000 mem[0x60] 011000 mem[0x62] 011000 mem[0x62] 00000000 (00) miss 00000000 (00) miss 00000001 (01) hit 00000001 (01) hit 01100011 (63) miss 01100011 (63) miss 01100001 (61) miss 01100001 (61) miss 01100010 (62) hit 01100010 (62) hit 00000000 (00) hit 00000000 (00) hit 01100100 (64) miss 01100100 (64) miss
Recommend
More recommend