How to trace the data that is going through caches and DRAM memory in gem5?

假装没事ソ 提交于 2021-02-05 09:11:57

问题


--exec-flags Cache,DRAM show addresses and sizes, but sometimes I just need to see the actual data being sent.

I know that this might produce large logs, but that is fine as I'm restricting my area of interest well via --debug-start and -m/--debug-break (used a hack here to just finish the simulation at a tick).

https://gem5-users.gem5.narkive.com/VUAhxc7J/how-can-i-trace-data-of-cache mentions using CommMonitor. It is a bit annoying to have to modify the run script, but that's also a valid solution. It would be good to give a minimal example here that patches say se.py to add it and how to view its output.

I also have DPRINTF patch which seems to help and I'll try to publish. Here's a sketch:

@@ -385,14 +386,17 @@ void
 Packet::print(std::ostream &o, const int verbosity,
               const std::string &prefix) const
 {
-    ccprintf(o, "%s%s [%x:%x]%s%s%s%s%s%s", prefix, cmdString(),
+    ccprintf(o, "%s%s [%x:%x]%s%s%s%s%s%s D=%llx", prefix, cmdString(),
              getAddr(), getAddr() + getSize() - 1,
              req->isSecure() ? " (s)" : "",
              req->isInstFetch() ? " IF" : "",
              req->isUncacheable() ? " UC" : "",
              isExpressSnoop() ? " ES" : "",
              req->isToPOC() ? " PoC" : "",
-             req->isToPOU() ? " PoU" : "");
+             req->isToPOU() ? " PoU" : "",
+             flags.isSet(STATIC_DATA|DYNAMIC_DATA) ?
+                 mem2hex_string(getConstPtr<const char>(), getSize())
+                 : "");
 }

and then implement mem2hex_string as shown at: C++ read binary file and convert to hex

Edit: I managed to add a CommMonitor by hacking se.py, but I could not see any memory value output in any files nor in its code, the only thing I could see was new stats being added, so not sure that can help at all.

来源:https://stackoverflow.com/questions/63193082/how-to-trace-the-data-that-is-going-through-caches-and-dram-memory-in-gem5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!