Loading files
#!/usr/bin/env python3
import sys
gold = []
model = []
in_testdata = False
for l in open(sys.argv[1]):
if l.startswith("Test results:"):
in_testdata = True
continue
if in_testdata:
try:
model.append(int(l, 16))
except ValueError:
break
for l in open(sys.argv[2]):
line_contents = []
for index in range(0, len(l.strip()), 8):
line_contents.append(int(l[index:index + 8], 16))
gold.extend(reversed(line_contents))
all_match = True
for i, g in enumerate(gold):
if g == model[i]:
eq_str = "\033[1;32m==\033[0;0m"
else:
eq_str = "\033[1;31m!=\033[0;0m"
all_match = False
print("{:03x}: {:08x} (gate) {} {:08x} (gold)".format(i * 4, model[i], eq_str, g))
if all_match:
print("Test PASSED.")
else:
print("Test FAILED.")
25f8bb6eaThis file is pinned to the selected release. Download the original to open it in your design tool.