Cache

  • Blocks sind in diesem Beispiel 4 Byte lang, können aber auch grösser, bzwh. kleiner sein.

Aufbau im Memory

  • Gruppen von Blocks werden im Memory hintereinander gebilted.
  • Die CPU kopiert gewisse Blocks mit deren ID in den Cache.
BezeichnungSymbol
Anzahl Bits für die Adressierungt + i + o
Anzahl Bits für Offseto
Anzahl Bits für Indexi
Anzahl Bits für Tagt
  • Grösse des RAM in Bytes (Memory Size): 2^(t+i+o)
  • Anzahl Zeilen im Cache: 2^i
  • Grösse einer Cache-Zeile in Bytes (nur Nutzdaten): 2^o
  • Grösse des Cache in Bytes (Cache Size, nur Nutzdaten): 2^i * 2^o

Cache Organization

alt text

alt text

Fully Associative

alt text

Direct Mapped

alt text

N-Way Set Associative

  • max index corresponds to number of sets (s=m/n)

alt text

Memory Hierarchy

alt text]

alt text

Principle of locality

for (i=0; i < 10000; i++) {
	a[i] = b[i];					// spatial locality
}

if (a[1234] == a[4320]) {			// temporal locality
	a[1234] = 0;
}