1

--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.

Ciro Santilli
  • 3,693
  • 1
  • 18
  • 44
  • Hi @Ciro Santilli , did you managed to get the memory value? I used CMs in BaseCPU.py, CacheConfig.py and modified comm_monitor.cc as following to see the packet fields I need. It would be great to see the memory values too. `DPRINTF(CommMonitor, "cmd: %s, cmdIndex: %d, addr: %lld masterId: %d \n", pkt->cmdString(),pkt->cmdToIndex(),pkt->getAddr(), pkt->masterId());//, pkt->print());` – Rubel Ahmed Sep 14 '20 at 23:25
  • 1
    @RubelAhmed I've posted a sketch here, I'll try to publish the proper patch soon. – Ciro Santilli Sep 15 '20 at 07:10
  • Hi @CiroSantilli, did you publish the patch? I could not implement the mem2hex_string() function, getting a bunch of errors when I include the "working solution" in the packet.hh. Can you throw some hints here? – Rubel Ahmed Sep 17 '20 at 02:11
  • @Rubel Sorry, I didn't manage, I will try soon. You just have to walk over an array of bytes, and output an hex ascii value for each. Maybe this one is more direct: https://stackoverflow.com/questions/14050452/how-to-convert-byte-array-to-hex-string-in-visual-c/14051107#14051107 – Ciro Santilli Sep 17 '20 at 06:41

0 Answers0