Skip to content
Snippets Groups Projects
Commit 3c9c1931 authored by andrew_miranti's avatar andrew_miranti
Browse files

Opcode decoding seems to work!

parent 2f1ad327
No related branches found
No related tags found
No related merge requests found
...@@ -93,11 +93,11 @@ module DECODER ...@@ -93,11 +93,11 @@ module DECODER
<decoderBuffer> _ => B </decoderBuffer> <decoderBuffer> _ => B </decoderBuffer>
<instructionpointer> _ => A </instructionpointer> <instructionpointer> _ => A </instructionpointer>
rule <k> OutputDisassembly => DecodedInstruction(Q, S, INumOSZToOpcode(N, O) .Operands) ... </k> rule <k> OutputDisassembly => DecodedInstruction(Q, S, INumOSZToOpcode(N, O -Int 1) .Operands) ... </k>
<ilen> Q </ilen> <ilen> Q </ilen>
<REP> R </REP> <REP> R </REP>
<INUM> N </INUM> <INUM> N </INUM>
<OSZ> O </OSZ> <EOSZ> O </EOSZ>
<suffix> SF </suffix> <suffix> SF </suffix>
<disassemblerOut> S </disassemblerOut> <disassemblerOut> S </disassemblerOut>
......
#!/bin/bash
#set -x
CUR_DIR="$(pwd)"
SEMANTICS_DIR="$(dirname "$CUR_DIR/$0")"
WORK_DIR="$(mktemp -d)"
OUT_FILE="$(mktemp)"
TEMP_OUT="$(mktemp)"
trap "{ cat \"$OUT_FILE\"; rm -rf \"$WORK_DIR\"; rm -f \"$OUT_FILE\"; rm -f \"$TEMP_OUT\"; cd \"$CUR_DIR\"; }" EXIT
# https://stackoverflow.com/questions/687014/removing-created-temp-files-in-unexpected-bash-exit
cd $WORK_DIR
split -a 3 -d "$CUR_DIR/$1"
cd $SEMANTICS_DIR
for filename in $WORK_DIR/*; do # https://stackoverflow.com/questions/20796200/how-to-iterate-over-files-in-a-directory-with-bash
krun -o none "$filename" > $TEMP_OUT
LINES_NEEDED="$(wc -l <$filename)"
LINES_GOT="$(wc -l <$TEMP_OUT)"
cat "$TEMP_OUT" >> "$OUT_FILE"
if [ "$LINES_NEEDED" -ne "$LINES_GOT" ]
then
>&2 echo "Lines for $FILE did not match. Needed $LINES_NEEDED, but got $LINES_GOT"
fi
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment