Add traceprocessing steps for PC trace comparisons
Documenting sed/awk/grep one-liners for extracting PC trace from
Spike/Renode in a format that can be directly diff-ed with the SystemC
trace.dat for the same elf file.
Change-Id: Ib9e527c0049a6e7d5d33433cc30a42bf9b0a7b26
diff --git a/TraceGeneration.md b/TraceGeneration.md
index e34c78a..ebc745b 100644
--- a/TraceGeneration.md
+++ b/TraceGeneration.md
@@ -144,3 +144,29 @@
```sh
renode_trace_output.txt | wc -l
```
+
+### PC for Trace Analysis
+
+SystemC trace output contains the 8 digit PC in hex (without the '0x' prefix).
+
+These commands reformat the raw output trace from Spike and Renode for
+comparison with the SystemC output trace, located at:
+
+```sh
+$ROOTDIR/out/springbok/systemc/sim/simulations/trace.dat
+```
+
+
+#### Spike
+
+```sh
+cat spike_trace.txt | awk '/_start/,/_finish/' | sed 's/.*: 0x\([0-9a-fA-F]\{8\}\).*/\1/g' | egrep "^32" > spike_trace_pc.txt
+```
+
+#### Renode
+
+
+```sh
+cat renode_trace.txt | awk -F":" '{print $1}' | tr "[:upper:]" "[:lower:]" > renode_trace_pc.txt
+```
+