How to create a container to display cache class in the following picture ? ty c
ID: 3905346 • Letter: H
Question
How to create a container to display cache class in the following picture ? ty cs30 you Would displ (R)ead, (W)rite, or (D)isplay Cache? Slot Valid Tag Data 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f o 0 0 o o0 00 0 0 0 0 0 0 0 0 o o 0 o o 0 0 o o o o o o o oo 3 0 0 5 0 0 o 0 0 0 0 0 0 0 0 0 0 0 00 0 0 o o o o00 0 o 0 0 0 0 00 0 0 7 0 0 8 0 0 9 0 0 A 1 7 B 0 0 C 0 0 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF D 1 3 DO D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF . If information that might he needed to handle writesExplanation / Answer
We can have a cache class as
class cache {
private:
in valid[15];
int tag[15];
int data[16[16];
public display(){
cout << set(10) << left << "Slot" << set(10) << "Valid" << set(10) << "Tag" << set(20) << "Data" << endl;
for (int i = 0; i<15; i++){
cout << set(10) << left << std::hex << slot[i] << set(10) << valid[i] << set(10) << tag[i];
for (int j = 0; j < 16; j++)
cout << std::hex << data[i][j] << " ";
cout << endl;
}
}
}
We need to fill the data in the cache object and call the display function.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.