0 votes 0 votes If there is k-set associative cache, with total x cache blocks, and 2^n main memory locations, how is the mapping calculated? CO and Architecture cache-memory co-and-architecture memory-interfacing + – Tehreem asked Sep 22, 2015 retagged Nov 13, 2017 by Arjun Tehreem 1.0k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 2 votes 2 votes Let m be the memory block Calculate no of sets(p)=x/k Block m will be mapped to any one of block of set no m%p In this way consecutive memory blocks will be going to different sets in cache there by making use of spatial locality. Pooja Palod answered Sep 22, 2015 Pooja Palod comment Share Follow See all 2 Comments See all 2 2 Comments reply Tehreem commented Sep 22, 2015 reply Follow Share Does k-set associative cache mean 1 set has k cache? –2 votes –2 votes Pooja Palod commented Sep 22, 2015 reply Follow Share k set associative cache means 1 set has k blocks 1 votes 1 votes Please log in or register to add a comment.
0 votes 0 votes number of lines in cache = x number of memory locations= number of memory blocks= 2^n since it is k-set associative, number of sets given by x/k now mapping will be done from main memory to cache ---> (2^n) / (x/k) will tell how many memory blocks can reside in one set of cache however, if m is any particular memory block:- then its set location in cache given by m mod (x/k) vamp_vaibhav answered Jun 2, 2017 edited Jun 2, 2017 by vamp_vaibhav vamp_vaibhav comment Share Follow See all 0 reply Please log in or register to add a comment.