performance-aware/test_registers.sh

29 lines
669 B
Bash
Executable File

#!/bin/sh
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
make asm_files > /dev/null
if [ ! "$(command -v ./sim8086)" ]; then
echo -e "\nError: 'sim8086' executable not found"
exit 1
fi
odin build . -out:sim8086
for asm_txt in asm_files/*.txt;
do
asm_listing=$(basename $asm_txt .txt)
./sim8086 asm_files/${asm_listing}.bin registers | awk '{print $1 $4}' | sort > temp1
cat $asm_txt | awk '/Final registers/,0' | tail -n +2 | awk '{print $1 $2}' | sort > temp2
diff -U0 --color temp1 temp2
if [ $? -eq 1 ]; then
echo Listing $asm_listing Failed!
else
echo Listing $asm_listing Succeded!
fi
done
rm temp1 temp2