sim: bfin: add helpful info for generating test tables
authorMike Frysinger <vapier@gentoo.org>
Mon, 17 Jun 2013 04:47:26 +0000 (04:47 +0000)
committerMike Frysinger <vapier@gentoo.org>
Mon, 17 Jun 2013 04:47:26 +0000 (04:47 +0000)
sim/testsuite/sim/bfin/ChangeLog
sim/testsuite/sim/bfin/se_allopcodes.h

index 753affcd0aa7f41d4dc42cb823381775033b14fd..a6344949b137d65ac66f4fbac4b6d1ef7b959276 100644 (file)
@@ -1,3 +1,7 @@
+2013-06-17  Mike Frysinger  <vapier@gentoo.org>
+
+       * se_allopcodes.h: Add debugging related comments.
+
 2013-06-17  Mike Frysinger  <vapier@gentoo.org>
 
        * se_allopcodes.h: Do not clear RETN/RETE/RETI.
index b49862a7b9bee483bb51502798c21a99f3bd852c..8f961259abfc3369a43778a4ae295fbfea7ad86a 100644 (file)
@@ -129,6 +129,25 @@ _match_done:
        jump _next_instruction;
 
 _new_instruction:
+       /* The table is generated in memory and can be extracted:
+          (gdb) dump binary memory bin &table next_location
+
+          16bit:
+          $ od -j6 -x --width=4 bin | \
+            awk '{ s=last; e=strtonum("0x"$2); \
+              printf "\t.dw 0x%04x,\t0x%04x,\t\t0x%02x\n", \
+                 s, e-1, strtonum("0x"seq); \
+              last=e; seq=$3}'
+
+          32bit:
+          $ od -j12 -x --width=8 bin | \
+            awk '{ s=last; e=strtonum("0x"$3$2); \
+              printf "\t.dw 0x%04x, 0x%04x,\t0x%04x, 0x%04x,\t\t0x%02x, 0\n", \
+                 and(s,0xffff), rshift(s,16), and(e-1,0xffff), rshift(e-1,16), \
+                 strtonum("0x"seq); \
+              last=e; seq=$3}'
+
+          This should be much faster than dumping over serial/jtag.  */
        se_all_new_insn_stub
 
        /* output the insn (R0) and excause (R3) if diff from last */