Complete Question:
Determine the number of cache sets (S), tag bits (t), set index bits (s), and block offset bits (b) for a 4096-byte cache using 32-bit memory addresses, 8-byte cache blocks and a 8-way associative design. The cache has :
Cache size = 1024 bytes, sets t = 26.8, tag bits, s = 3.2, set index bit =2
Answer:
Check below for explanations
Explanation:
Cache size = 4096 bytes = 2¹² bytes
Memory address bit = 32
Block size = 8 bytes = 2³ bytes
Cache line = (cache size)/(Block size)
Cache line = 
Cache line = 2⁹
Block offset = 3 (From 2³)
Tag = (Memory address bit - block offset - Cache line bit)
Tag = (32 - 3 - 9)
Tag = 20
Total number of sets = 2⁹ = 512
Adam might have forgotten to loop the guessing code, meaning that instead of letting him guess multiple times, it simply does it once and ends the program. This could be fixed by adding a while loop, or something of the sort, that doesn't let the user finish the program until they guess the number correctly, while adding to the variable that stores the number of guesses each loop.
Answer:
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter a decimal value (0 to 15): ");
int num = scan.nextInt();
scan.close();
if (num < 0 || num >15) {
System.out.printf("%d is an invalid input\n", num);
} else {
System.out.printf("The hex value is %X\n", num);
}
}
}
Explanation:
Hopefully this example will get you going for the other assignments.
Answer:
Handheld/Mobile Computers