Solution to 1st part :
Given ,
No of bits for tag = 17
No of bits for block = 10
No of bits for offset = 5
So this is for direct mapped..We know
In direct mapped we do not need multiplexer as no of ways in each set = 1
So only hit only will be due to tag comparator only..
Given latency due to k - bit comparator = k / 10 = 17 / 10 = 1.7 ns
Now for set associative ,
No of sets = No of lines (blocks) / Associativity
= 1024 / 2
= 512
Hence set bits = log2 512 = 9
As block size remains the same in either case , so the one bit which has been decreased due to formation of sets becomes part of tag field..
So no of tag bits now = 17 + 1 = 18
So latency due to comparator = 1.8 ns
Latency due to mux = 0.6 ns
So total latency of given 2 way set assocative cache = 2.4 ns
So ratio of hit latency of direct to set assocative cache = 1.7 / 2.4
= 0.708 correct to 3 decimal places