summaryrefslogtreecommitdiff
path: root/src/mem/cache/blk.hh
diff options
context:
space:
mode:
authorUri Wiener <uri.wiener@arm.com>2013-04-22 13:20:33 -0400
committerUri Wiener <uri.wiener@arm.com>2013-04-22 13:20:33 -0400
commita8fbfefb5e0fd3b45d6961b07a172018c87c0251 (patch)
treedbc13a043ab0c0daa0da3913ee349c933fc94ac6 /src/mem/cache/blk.hh
parent9929e884b6fe6567c3bd2fe2dd3bba85d4e9bbd1 (diff)
downloadgem5-a8fbfefb5e0fd3b45d6961b07a172018c87c0251.tar.xz
mem: Adding verbose debug output in the memory system
This patch provides useful printouts throughut the memory system. This includes pretty-printed cache tags and function call messages (call-stack like).
Diffstat (limited to 'src/mem/cache/blk.hh')
-rw-r--r--src/mem/cache/blk.hh36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/mem/cache/blk.hh b/src/mem/cache/blk.hh
index 80216ff89..4a89f3892 100644
--- a/src/mem/cache/blk.hh
+++ b/src/mem/cache/blk.hh
@@ -289,6 +289,42 @@ class CacheBlk
}
/**
+ * Pretty-print a tag, and interpret state bits to readable form
+ * including mapping to a MOESI stat.
+ *
+ * @return string with basic state information
+ */
+ std::string print() const
+ {
+ /**
+ * state M O E S I
+ * writable 1 0 1 0 0
+ * dirty 1 1 0 0 0
+ * valid 1 1 1 1 0
+ *
+ * state writable dirty valid
+ * M 1 1 1
+ * O 0 1 1
+ * E 1 0 1
+ * S 0 0 1
+ * I 0 0 0
+ **/
+ unsigned state = isWritable() << 2 | isDirty() << 1 | isValid();
+ char s = '?';
+ switch (state) {
+ case 0b111: s = 'M'; break;
+ case 0b011: s = 'O'; break;
+ case 0b101: s = 'E'; break;
+ case 0b001: s = 'S'; break;
+ case 0b000: s = 'I'; break;
+ default: s = 'T'; break; // @TODO add other types
+ }
+ return csprintf("state: %x (%c) valid: %d writable: %d readable: %d "
+ "dirty: %d tag: %x data: %x", status, s, isValid(),
+ isWritable(), isReadable(), isDirty(), tag, *data);
+ }
+
+ /**
* Handle interaction of load-locked operations and stores.
* @return True if write should proceed, false otherwise. Returns
* false only in the case of a failed store conditional.