about summary refs log tree commit diff stats
path: root/main.py
diff options
context:
space:
mode:
authorTheofilos Augoustis <theofilos.augoustis@gmail.com>2023-10-15 21:10:05 +0200
committerTheofilos Augoustis <theofilos.augoustis@gmail.com>2023-10-15 21:10:05 +0200
commit83d4b4dbe6f20c2fa7865e4888b89e888d3509f9 (patch)
treea021228596e0e1689351b63379c467c8cccbb963 /main.py
parent69c55d68d68c00007afa1af76a1d06f74ee72fe6 (diff)
downloadfocaccia-83d4b4dbe6f20c2fa7865e4888b89e888d3509f9.tar.gz
focaccia-83d4b4dbe6f20c2fa7865e4888b89e888d3509f9.zip
Implement simple comparison algorithm
Co-authored-by: Theofilos Augoustis <theofilos.augoustis@gmail.com>
Co-authored-by: Nicola Crivellin <nicola.crivellin98@gmail.com>
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/main.py b/main.py
index 076dc0e..d97a54d 100755
--- a/main.py
+++ b/main.py
@@ -4,9 +4,9 @@ import argparse
 
 import arancini
 from arch import x86
-from compare import compare
+from compare import compare_simple
 from run import run_native_execution
-from utils import check_version
+from utils import check_version, print_separator
 
 def read_logs(txl_path, native_path, program):
     txl = []
@@ -85,7 +85,24 @@ def main():
 
     txl = arancini.parse(txl, arch)
     native = arancini.parse(native, arch)
-    compare(txl, native, stats)
+    result = compare_simple(txl, native)
+
+    # Print results
+    for res in result:
+        pc = res['pc']
+        print_separator()
+        print(f'For PC={hex(pc)}')
+        print_separator()
+
+        txl = res['txl']
+        ref = res['ref']
+        for err in res['errors']:
+            reg = err['reg']
+            print(f'Content of register {reg} is possibly false.'
+                  f' Expected difference: {err["expected"]}, actual difference'
+                  f' in the translation: {err["actual"]}.\n'
+                  f'    (txl) {reg}: {hex(txl.regs[reg])}\n'
+                  f'    (ref) {reg}: {hex(ref.regs[reg])}')
 
 if __name__ == "__main__":
     check_version('3.7')