From 8ea9413bfcc1e4c2172d163af61813d9014bf751 Mon Sep 17 00:00:00 2001 From: Saurabh Singh Date: Mon, 16 Oct 2023 00:25:45 -0400 Subject: [PATCH] scar: complete rewrite of the scar tool - better cli support using argparse - better code structure - evaluates expression using python's eval() allowing user to write complex python expressions as assertion. - assertions are fetched from an assertion file - tests are moved to tests dir - test list and assertion file for each test is now fetched from a json file - removed scar specific json dependency - better reports - provides reason for ignoring, marking a tests as passed or failed - added support for nocolor, scar autodetects output being piped to another command and disables color --- test/scar/Makefile | 2 +- test/scar/link.ld | 85 ---- test/scar/lui.S | 40 -- test/scar/scar.py | 496 +++++++++++++----------- test/scar/tests.json | 41 ++ test/scar/{ => tests}/add.S | 8 - test/scar/tests/add.asrt | 6 + test/scar/tests/add64.S | 19 + test/scar/tests/add64.asrt | 2 + test/scar/{ => tests}/addi.S | 8 - test/scar/tests/addi.asrt | 6 + test/scar/{ => tests}/and.S | 11 - test/scar/tests/and.asrt | 8 + test/scar/{ => tests}/andi.S | 10 - test/scar/tests/andi.asrt | 6 + test/scar/{ => tests}/auipc.S | 10 - test/scar/tests/auipc.asrt | 8 + test/scar/{ => tests}/beq.S | 9 - test/scar/tests/beq.asrt | 6 + test/scar/{ => tests}/bge.S | 9 - test/scar/tests/bge.asrt | 7 + test/scar/{ => tests}/bgeu.S | 9 - test/scar/tests/bgeu.asrt | 6 + test/scar/{ => tests}/blt.S | 9 - test/scar/tests/blt.asrt | 6 + test/scar/{ => tests}/bltu.S | 9 - test/scar/tests/bltu.asrt | 7 + test/scar/{ => tests}/bne.S | 8 - test/scar/tests/bne.asrt | 6 + test/scar/{ => tests}/function_call.S | 6 - test/scar/tests/function_call.asrt | 2 + test/scar/{ => tests}/jal.S | 7 - test/scar/tests/jal.asrt | 5 + test/scar/{ => tests}/jalr.S | 7 - test/scar/tests/jalr.asrt | 5 + test/scar/{ => tests}/li.S | 5 - test/scar/tests/li.asrt | 4 + test/scar/{ => tests}/load_store_byte.S | 7 - test/scar/tests/load_store_byte.asrt | 5 + test/scar/{ => tests}/load_store_hw.S | 16 - test/scar/tests/load_store_hw.asrt | 11 + test/scar/tests/lui.S | 23 ++ test/scar/tests/lui.asrt | 15 + test/scar/{ => tests}/lw.S | 14 - test/scar/tests/lw.asrt | 12 + test/scar/{ => tests}/mv.S | 5 - test/scar/tests/mv.asrt | 3 + test/scar/{ => tests}/or.S | 10 - test/scar/tests/or.asrt | 8 + test/scar/{ => tests}/ori.S | 9 - test/scar/tests/ori.asrt | 6 + test/scar/{ => tests}/sll.S | 6 - test/scar/tests/sll.asrt | 4 + test/scar/{ => tests}/slli.S | 6 - test/scar/tests/slli.asrt | 4 + test/scar/{ => tests}/slt.S | 6 - test/scar/tests/slt.asrt | 4 + test/scar/{ => tests}/slti.S | 6 - test/scar/tests/slti.asrt | 4 + test/scar/{ => tests}/sltiu.S | 6 - test/scar/tests/sltiu.asrt | 4 + test/scar/{ => tests}/sltu.S | 6 - test/scar/tests/sltu.asrt | 4 + test/scar/{ => tests}/sra.S | 6 - test/scar/tests/sra.asrt | 4 + test/scar/{ => tests}/srai.S | 6 - test/scar/tests/srai.asrt | 4 + test/scar/{ => tests}/srl.S | 6 - test/scar/tests/srl.asrt | 4 + test/scar/{ => tests}/srli.S | 6 - test/scar/tests/srli.asrt | 4 + test/scar/{ => tests}/stack.S | 6 - test/scar/tests/stack.asrt | 4 + test/scar/{ => tests}/storew.S | 6 - test/scar/tests/storew.asrt | 4 + test/scar/{ => tests}/sub.S | 8 - test/scar/tests/sub.asrt | 6 + test/scar/{ => tests}/sw.S | 14 - test/scar/tests/sw.asrt | 12 + test/scar/{ => tests}/xor.S | 11 - test/scar/tests/xor.asrt | 8 + test/scar/{ => tests}/xori.S | 8 - test/scar/tests/xori.asrt | 6 + 83 files changed, 590 insertions(+), 645 deletions(-) delete mode 100644 test/scar/link.ld delete mode 100644 test/scar/lui.S mode change 100644 => 100755 test/scar/scar.py create mode 100644 test/scar/tests.json rename test/scar/{ => tests}/add.S (65%) create mode 100644 test/scar/tests/add.asrt create mode 100644 test/scar/tests/add64.S create mode 100644 test/scar/tests/add64.asrt rename test/scar/{ => tests}/addi.S (68%) create mode 100644 test/scar/tests/addi.asrt rename test/scar/{ => tests}/and.S (62%) create mode 100644 test/scar/tests/and.asrt rename test/scar/{ => tests}/andi.S (66%) create mode 100644 test/scar/tests/andi.asrt rename test/scar/{ => tests}/auipc.S (68%) create mode 100644 test/scar/tests/auipc.asrt rename test/scar/{ => tests}/beq.S (82%) create mode 100644 test/scar/tests/beq.asrt rename test/scar/{ => tests}/bge.S (82%) create mode 100644 test/scar/tests/bge.asrt rename test/scar/{ => tests}/bgeu.S (77%) create mode 100644 test/scar/tests/bgeu.asrt rename test/scar/{ => tests}/blt.S (78%) create mode 100644 test/scar/tests/blt.asrt rename test/scar/{ => tests}/bltu.S (78%) create mode 100644 test/scar/tests/bltu.asrt rename test/scar/{ => tests}/bne.S (83%) create mode 100644 test/scar/tests/bne.asrt rename test/scar/{ => tests}/function_call.S (72%) create mode 100644 test/scar/tests/function_call.asrt rename test/scar/{ => tests}/jal.S (70%) create mode 100644 test/scar/tests/jal.asrt rename test/scar/{ => tests}/jalr.S (71%) create mode 100644 test/scar/tests/jalr.asrt rename test/scar/{ => tests}/li.S (75%) create mode 100644 test/scar/tests/li.asrt rename test/scar/{ => tests}/load_store_byte.S (83%) create mode 100644 test/scar/tests/load_store_byte.asrt rename test/scar/{ => tests}/load_store_hw.S (77%) create mode 100644 test/scar/tests/load_store_hw.asrt create mode 100644 test/scar/tests/lui.S create mode 100644 test/scar/tests/lui.asrt rename test/scar/{ => tests}/lw.S (75%) create mode 100644 test/scar/tests/lw.asrt rename test/scar/{ => tests}/mv.S (80%) create mode 100644 test/scar/tests/mv.asrt rename test/scar/{ => tests}/or.S (62%) create mode 100644 test/scar/tests/or.asrt rename test/scar/{ => tests}/ori.S (66%) create mode 100644 test/scar/tests/ori.asrt rename test/scar/{ => tests}/sll.S (69%) create mode 100644 test/scar/tests/sll.asrt rename test/scar/{ => tests}/slli.S (64%) create mode 100644 test/scar/tests/slli.asrt rename test/scar/{ => tests}/slt.S (60%) create mode 100644 test/scar/tests/slt.asrt rename test/scar/{ => tests}/slti.S (60%) create mode 100644 test/scar/tests/slti.asrt rename test/scar/{ => tests}/sltiu.S (61%) create mode 100644 test/scar/tests/sltiu.asrt rename test/scar/{ => tests}/sltu.S (60%) create mode 100644 test/scar/tests/sltu.asrt rename test/scar/{ => tests}/sra.S (68%) create mode 100644 test/scar/tests/sra.asrt rename test/scar/{ => tests}/srai.S (64%) create mode 100644 test/scar/tests/srai.asrt rename test/scar/{ => tests}/srl.S (68%) create mode 100644 test/scar/tests/srl.asrt rename test/scar/{ => tests}/srli.S (64%) create mode 100644 test/scar/tests/srli.asrt rename test/scar/{ => tests}/stack.S (81%) create mode 100644 test/scar/tests/stack.asrt rename test/scar/{ => tests}/storew.S (92%) create mode 100644 test/scar/tests/storew.asrt rename test/scar/{ => tests}/sub.S (66%) create mode 100644 test/scar/tests/sub.asrt rename test/scar/{ => tests}/sw.S (84%) create mode 100644 test/scar/tests/sw.asrt rename test/scar/{ => tests}/xor.S (62%) create mode 100644 test/scar/tests/xor.asrt rename test/scar/{ => tests}/xori.S (66%) create mode 100644 test/scar/tests/xori.asrt diff --git a/test/scar/Makefile b/test/scar/Makefile index 9274cee3..df0f1473 100644 --- a/test/scar/Makefile +++ b/test/scar/Makefile @@ -6,7 +6,7 @@ default: clean verify .PHONY: verify verify: - $(PY) scar.py + $(PY) scar.py -v tests.json clean: rm -rf work/* diff --git a/test/scar/link.ld b/test/scar/link.ld deleted file mode 100644 index 8c48c0ed..00000000 --- a/test/scar/link.ld +++ /dev/null @@ -1,85 +0,0 @@ -/* - SCAR LINKER SCRIPT - - @See : https://sourceware.org/binutils/docs/ld/Basic-Script-Concepts.html - @See : https://interrupt.memfault.com/blog/how-to-write-linker-scripts-for-firmware -*/ - -OUTPUT_ARCH( "riscv" ) -ENTRY(_start) - -/* MEMORY LAYOUT */ -MEMORY -{ - ROM (rx) : ORIGIN = 0x00010000, LENGTH = 64M - RAM (rwx): ORIGIN = 0x20000000, LENGTH = 2K -} - -SECTIONS -{ - /* ==== ROM ==== */ - .text : - { - /* ----- Initialization Code ----- */ - *(.boot*) - - /* ----- Code ----- */ - /* Load all text sections (from all files) */ - *(.text) - *(.text.*) - - . = ALIGN(4); - - /* ----- Read Only Data ----- */ - *(.rodata) - *(.rodata.*) - - . = ALIGN(4); - _etext = .; - - } > ROM - - - - /* ==== RAM ==== */ - /* The .data section contains static variables which have an initial value at boot. */ - .data : - { - _sdata = .; - - /* ----- Initialized Data ----- */ - *(.data) - *(.data.*) - - /* ----- Static Data ----- */ - . = ALIGN(16); - _global_pointer = . + 0x800; - - *(.sdata) - *(.sdata.*) - *(.srodata.*) - - . = ALIGN(4); - _edata = .; - - } > RAM - - - /* ----- Uninitialized Data ----- */ - /* .bss section which is used for uninitialized data */ - .bss (NOLOAD) : - { _sbss = .; - *(.bss) - *(.bss.*) - *(COMMON) - - . = ALIGN(4); - _ebss = .; - - } > RAM - - _end = .; -} - -PROVIDE(_start_heap = _ebss); -PROVIDE(_stack_pointer = ORIGIN(RAM) + LENGTH(RAM)); \ No newline at end of file diff --git a/test/scar/lui.S b/test/scar/lui.S deleted file mode 100644 index d644424a..00000000 --- a/test/scar/lui.S +++ /dev/null @@ -1,40 +0,0 @@ -.global _start -_start: - -lui a0, 0xfffff -lui a1, 0xf210a -lui a2, 0x00001 -lui a3, 0x00123 -lui a4, 0x01234 -lui a5, 0xdeadb -lui a6, 0xdbeef -lui a7, 0xae121 - -lui t0, 0x52cda -lui t1, 0xcda53 -lui t2, 0xab129 -lui t3, 0x95bcd -lui t4, 0x09090 -lui t5, 0xff11f -lui t6, 0x96dad - -nop -nop -ebreak - -# $-ASSERTIONS-$ -# eq a0 0xfffff000 -# eq a1 0xf210a000 -# eq a2 0x00001000 -# eq a3 0x00123000 -# eq a4 0x01234000 -# eq a5 0xdeadb000 -# eq a6 0xdbeef000 -# eq a7 0xae121000 -# eq t0 0x52cda000 -# eq t1 0xcda53000 -# eq t2 0xab129000 -# eq t3 0x95bcd000 -# eq t4 0x09090000 -# eq t5 0xff11f000 -# eq t6 0x96dad000 \ No newline at end of file diff --git a/test/scar/scar.py b/test/scar/scar.py old mode 100644 new mode 100755 index bc615dca..2b988884 --- a/test/scar/scar.py +++ b/test/scar/scar.py @@ -1,28 +1,32 @@ -######################################### -# RISCV - Atom verification framework # -######################################### -import os, sys -import subprocess -import glob -from colorama import Fore, Back, Style - - -linker_script_path = 'link.ld' #relative -cwd = os.getcwd() -work_dir = cwd + '/work' - - -RVPREFIX = 'riscv64-unknown-elf-' -CC = 'gcc' -CFLAGS = ['-march=rv32i', '-mabi=ilp32', '-nostartfiles'] -LDFLAGS = ['-T', linker_script_path] - -EXEC = 'atomsim' -EXEC_FLAGS = ['--ebreak-dump', '--maxitr', '1000', '--trace-file', work_dir+'/trace.vcd', '--dump-file', work_dir+'/dump.txt', '-v'] - - -############################################################################################### -reg_names = { +#!/usr/bin/python3 +################################################################################ +# RISC-V Atom verification framework # +################################################################################ +import os, sys, enum +import re, datetime + + +class Color: + RED = "\033[0;31m" + GREEN = "\033[0;32m" + YELLOW = "\033[1;33m" + CYAN = "\033[0;36m" + PURPLE = "\033[0;35m" + + BOLD = "\033[1m" + CROSSED = "\033[9m" + FAINT = "\033[2m" + ITALIC = "\033[3m" + UNDERLINE = "\033[4m" + RESET = "\033[0m" + + def disable_colors(): + for a in dir(Color): + if isinstance(a, str) and a[0] != "_": + setattr(Color, a, '') + + +RISCV_REG_ALIASES = { "zero" : "x0", "ra" : "x1", "sp" : "x2", @@ -58,258 +62,310 @@ "t6" : "x31" } -def convert_abiname_to_archname(name): - if name in ['pc', 'ir']: - pass - elif name in reg_names.keys(): - name = reg_names[name] - elif name[0] == 'x': - if int(name[1:]) >= 0 and int(name[1:]) < 32: - pass - else: - return None - else: - return None - return name - -def search(): - # get all tests - return sorted(glob.glob('*.S'), key=str.lower) +class ReturnCodes(enum.Enum): + COMPILE_ERR=0 + COMPILE_SUCCESS=1 + EXEC_ERR=2 + EXEC_SUCCESS=3 + VERIF_ASSERTION_FILE_DOES_NOT_EXIST=4 + VERIF_NO_ASSERTION=5 + VERIF_SOME_ASSERTIONS_FAILED=6 + VERIF_SOME_ASSERTIONS_IGNORED=7 + VERIF_ALL_ASSERTIONS_PASSED=8 -def compile(tests, save_objdump=False): - for t in tests: - print(Fore.GREEN+'compile: '+Style.RESET_ALL+t) - dump = subprocess.run( - [RVPREFIX+CC]+CFLAGS+LDFLAGS+[t, '-o', work_dir+'/'+t[0:-2]+'.elf'] , capture_output=True, text=True - ) - if len(dump.stdout) != 0: - print('stdout: ' + dump.stdout) - if len(dump.stderr) != 0: - print('stderr: '+ dump.stderr) - if (dump.returncode != 0): - print(Fore.RED+"EXITING due to compile error!"+Style.RESET_ALL) - sys.exit(1) +def run_cmd(cmd:list, print_dumps=True): + import subprocess + dump = subprocess.run(cmd, capture_output=True, text=True) + if len(dump.stdout) != 0 and print_dumps: + print('stdout:\n' + dump.stdout) + if len(dump.stderr) != 0 and print_dumps: + print('stderr:\n'+ dump.stderr) + return dump - # get objdumpdump - if save_objdump: - dump = subprocess.run( - [RVPREFIX+'objdump', '-htd', work_dir+'/'+t[0:-2]+'.elf'], capture_output=True, text=True - ) - if len(dump.stdout) != 0: - with open(work_dir+'/'+t[0:-2]+'.objdump', 'w') as f: - f.write(dump.stdout) - if len(dump.stderr) != 0: - print('stderr: '+ dump.stderr) +def compile_test(test:dict, save_objdump:bool=False): + # ---------- Configuration ---------- + RVPREFIX = 'riscv64-unknown-elf-' + CC = 'gcc' + CFLAGS = ['-march=rv32i', '-mabi=ilp32', '-nostartfiles'] + LDFLAGS = [] + # select linkerscript by auto detecting soctarget + try: + dump = run_cmd(['atomsim', '--soctarget'], print_dumps=False) + soctarget = dump.stdout.replace('\n', '') + LDFLAGS = ['-T', os.getenv('RVATOM')+'/sw/lib/link/link_'+soctarget+'.ld'] + except Exception as e: + print(e) + print('Failed to get soctarget') + sys.exit(1) + + ELF_FILE = WORKDIR+f'/{test["name"]}.elf' + OBJDUMP_FILE = WORKDIR+f'/{test["name"]}.lst' + # ----------------------------------- + + # Compile + compile_cmd = [RVPREFIX+CC] + CFLAGS + test["srcs"] + ['-o', ELF_FILE] + LDFLAGS + if VERBOSE: + print(" ".join(compile_cmd)) + dump = run_cmd(compile_cmd, print_dumps=VERBOSE) + if dump.returncode != 0: + print(Color.RED+"Compilation error!"+Color.RESET) + return ReturnCodes.COMPILE_ERR, None -def execute(test, mute=True): - print(40*"-") - elf = work_dir+'/'+test[0:-2]+'.elf' - print(Fore.GREEN+'execute: '+Style.RESET_ALL + elf) + # Generate Objdump + if save_objdump: + dump = run_cmd([RVPREFIX+'objdump', '-Shtd', ELF_FILE], print_dumps=False) + with open(OBJDUMP_FILE, 'w') as f: + f.write(dump.stdout) - if not mute: - for item in [EXEC]+EXEC_FLAGS+[elf]: - print(item, end=" ") - print("") + return ReturnCodes.COMPILE_SUCCESS, {"elf_file": ELF_FILE, "objdump_file": OBJDUMP_FILE} - dump = subprocess.run( - [EXEC]+EXEC_FLAGS+[elf] , capture_output=True, text=True - ) - if not mute and len(dump.stdout) != 0: - print('stdout: ' + dump.stdout) - if len(dump.stderr) != 0: - print('stderr: '+ dump.stderr) - if (dump.returncode != 0): - print(Fore.RED+"Execution error!"+Style.RESET_ALL) - return False - elif len(dump.stderr)!=0: - return False - else: - return True +def execute_test(test:dict, compile_outputs:dict, mute=True): + # ---------- Configuration ---------- + VCD_FILE = WORKDIR+f'/{test["name"]}.vcd' + DUMP_FILE = WORKDIR+f'/{test["name"]}.dump' + EXEC = 'atomsim' + EXEC_FLAGS = ['--ebreak-dump', '--no-banner', '--maxitr', '100000', '--trace-file', VCD_FILE, '--dump-file', DUMP_FILE, '-v'] + # ----------------------------------- + # Execute test + exec_cmd = [EXEC]+EXEC_FLAGS+[compile_outputs["elf_file"]] + if VERBOSE: + print(" ".join(exec_cmd)) + + dump = run_cmd(exec_cmd, print_dumps=VERBOSE) + if (dump.returncode != 0): + print(Color.RED+"Execution error!"+Color.RESET) + return ReturnCodes.EXEC_ERR, None + elif len(dump.stderr) != 0: + return ReturnCodes.EXEC_ERR, None + else: + return ReturnCodes.EXEC_SUCCESS, {"vcd_file": VCD_FILE, "dump_file": DUMP_FILE} -def verify(test): - print(Fore.GREEN+'verify: '+Style.RESET_ALL + test) - fcontents = [] - # read assembly files - try: - f = open(test, 'r') - fcontents = f.readlines() - f.close() - except: - print("Unable to open file :" + test) - sys.exit(1) - # find start of assert block - assert_block_start = -1 - for i in range(0, len(fcontents)): - if fcontents[i].strip() == "# $-ASSERTIONS-$": - assert_block_start = i - break - - # if no assertions found - if assert_block_start == -1: - print(Fore.YELLOW+"Skipping: no assertions!"+Style.RESET_ALL) - return None +def verify_test(test:dict, compile_outputs:dict, execute_outputs:dict): + # get dump contents + reg_vals={} + with open(execute_outputs["dump_file"], 'r') as dumpfile: + for line in dumpfile: + tokens = line.strip().split(' ') + reg_vals[tokens[0]] = int(tokens[1], 16) - # copy dump file - os.system('cp '+work_dir+'/dump.txt '+work_dir+'/'+test[0:-2]+'_dump.txt') - - # get dump data - dump_file = work_dir+'/'+'dump.txt' - dcontents = [] - with open(dump_file, 'r') as f: - dcontents = f.readlines() + # get assertion file contents + def remove_comments_from_line(line): + if '#' in line: + line = line.split('#', 1)[0] + return line.strip() + + assertions = [] + if not os.path.exists(test["assertion_file"]): + return ReturnCodes.VERIF_ASSERTION_FILE_DOES_NOT_EXIST - dump_data = {} - # create a dictionary of this data - for l in dcontents: - if l.strip() == "": - continue - - l = l.strip().split(' ') - l[0] = convert_abiname_to_archname(l[0]) - if l[0] is None: - print('Err: invalid register in dumpfile:', l[0]) - return None - dump_data[l[0]] = l[1] + with open(test["assertion_file"], 'r') as assertionfile: + for line in assertionfile: + line = remove_comments_from_line(line) + if line != '': + assertions += [line.strip()] - # process & check assertions - assertions = fcontents[assert_block_start+1:len(fcontents)] - - passed = [] - for assr in assertions: - # Parse assertions one-by-one - if assr.strip() == "": - continue - assr = assr[2:].strip() - assr = assr.split(" ") + # evaluate assertions + if len(assertions) == 0: + return ReturnCodes.VERIF_NO_ASSERTION + + def resolve_aliases(input_string, alias_mapping): + variable_names = re.findall(r'\b\w+\d*\b', input_string) + modified_string = input_string + for var_name in variable_names: + if var_name in alias_mapping: + modified_string = re.sub(r'\b' + var_name + r'\b', str(alias_mapping[var_name]), modified_string) + return modified_string + + results = [] + for i, raw_expr in enumerate(assertions): + expr = resolve_aliases(raw_expr, RISCV_REG_ALIASES) + res = None + try: + res = eval(expr, reg_vals) == True + except Exception as e: + print(f"Error:{test['assertion_file']}:{i+1}", f'"{raw_expr}"', e) + res = None + finally: + Res = { + True: Color.GREEN+'PASS'+Color.RESET, + False: Color.RED+'FAIL'+Color.RESET, + None: Color.YELLOW+'IGNORED'+Color.RESET + } + print('assert:', raw_expr, ':', Res[res]) - assr_op = assr[0] - assr_rg = assr[1] - assr_val = assr[2] - - assr_rg = convert_abiname_to_archname(assr_rg) - if assr_rg is None: - print('Err: invalid register in assertion: ', assr_rg) - return None - - for dump_rg in dump_data.keys(): - # check - if dump_rg != assr_rg: - continue - - if assr_op == 'eq' and assr_val != dump_data[dump_rg]: - print(Fore.RED+"Assertion Failed: "+Style.RESET_ALL+f"({dump_rg}: expected {assr_val}, got: {dump_data[dump_rg]})") - passed.append(False) - else: - passed.append(True) + results += [res] - if False in passed: - print(Fore.RED+"Some Assertions Failed"+Style.RESET_ALL) - print(passed) - return False + print('') + if False in results: + print(Color.RED+"Some Assertions Failed"+Color.RESET) + return ReturnCodes.VERIF_SOME_ASSERTIONS_FAILED + elif None in results: + print(Color.YELLOW+"Some Assertions Ignored"+Color.RESET) + return ReturnCodes.VERIF_SOME_ASSERTIONS_IGNORED else: - print(Fore.GREEN+"All Assertions Passed! "+Style.RESET_ALL) - return True + print(Color.GREEN+"All Assertions Passed! "+Color.RESET) + return ReturnCodes.VERIF_ALL_ASSERTIONS_PASSED +if __name__ == "__main__": + import argparse + parser = argparse.ArgumentParser() + parser.add_argument('-v', '--verbose', help='Enable verbose output', action='store_true') + parser.add_argument('-w', '--workdir', help='Specify work directory', type=str, default='work') + parser.add_argument('-o', '--output', help='Specify report output file', type=str, default='work/scartest.report') + parser.add_argument('--nocolor', help='Disable colors', action='store_true') + parser.add_argument('json', help='provide a json file containing tests list', type=str) + args = parser.parse_args() + global VERBOSE, WORKDIR + VERBOSE = args.verbose + WORKDIR = args.workdir + if args.nocolor or not sys.stdout.isatty(): + Color.disable_colors() -if __name__ == "__main__": - print(Fore.YELLOW, end="") + print(Color.YELLOW, end="") print("|==============================================|") print("| RISCV-Atom Verification framework |") print("|==============================================|") print(" By: Saurabh Singh(saurabh.s99100@gmail.com)") + print(Color.RESET) + + # Get test list + if(VERBOSE): + print(Color.CYAN+f"> Getting tests from: {args.json}"+Color.RESET) + + tests = None + with open(args.json, 'r') as jf: + import json + tests = json.load(jf) + if (VERBOSE): + print("Found ", len(tests), "tests!") + for i, t in enumerate(tests): + print(" {: <6s}{:s}".format(str(i)+':', t["name"])) + print(80*"=") - # Search tests - print(Fore.CYAN+"> Stage-1:"+Style.RESET_ALL+" Seaching for tests...") - tests = search() - print("Found "+str(len(tests))+' tests') - for t in tests: - print(t) - print(80*"=") + test_db = [] + for i, test in enumerate(tests): + print(Color.CYAN+"Test: "+Color.RESET+test["name"]+'\n') + # Compile test + print(Color.PURPLE + 'Compiling..' + Color.RESET) + compile_rc, compile_outputs = compile_test(test, save_objdump=True) + + # Execute test + print(Color.PURPLE + 'Executing..' + Color.RESET) + execute_rc, execute_outputs = execute_test(test, compile_outputs) + + # Verify test + print(Color.PURPLE + 'Verifying..' + Color.RESET) + verify_rc = verify_test(test, compile_outputs, execute_outputs) + + test_db += [{ + "name": test["name"], + "compile_rc": compile_rc, + "execute_rc": execute_rc, + "verify_rc": verify_rc + }] + + if i != len(tests)-1: + print('-'*80) - # Compile all - print(Fore.CYAN+"> Stage-2:"+Style.RESET_ALL+" Compiling tests...") - compile(tests, save_objdump=True) + print('='*80) - print(80*"=") + # Generate report + print(Color.CYAN+"> Generating report:"+Color.RESET+f' {args.output}') + rpt_txt = '+'+'-'*78+'+\n' + rpt_txt += '|{: ^78s}|\n'.format('SCAR Verification Report') + rpt_txt += '+'+'-'*78+'+\n' + curr_datetime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + rpt_txt +=f'Date: {curr_datetime}\n\n' - # Execute one by one - print(Fore.CYAN+"> Stage-3:"+Style.RESET_ALL+" Executing & verifying dumps...") - - failed_tests = [] ignored_tests = [] + failed_tests = [] passed_tests = [] - - for t in tests: - execute_status = execute(t, mute=False) - verify_status = verify(t) - - if execute_status == True: - if verify_status == True: - passed_tests = passed_tests + [t] - elif verify_status == False: - failed_tests = failed_tests + [t] - elif verify_status == None: - ignored_tests = ignored_tests + [t] + for i, test in enumerate(test_db): + test_status = '?' + reason = '' + if test["compile_rc"] == ReturnCodes.COMPILE_ERR: + reason = 'Compile Error' + test_status = f'{Color.YELLOW}Ignored{Color.RESET}' + ignored_tests += [test["name"]] + elif test["compile_rc"] == ReturnCodes.COMPILE_SUCCESS: + if test["execute_rc"] == ReturnCodes.EXEC_ERR: + reason = 'Execute Error' + test_status = f'{Color.YELLOW}Ignored{Color.RESET}' + ignored_tests += [test["name"]] + elif test["execute_rc"] == ReturnCodes.EXEC_SUCCESS: + if test["verify_rc"] == ReturnCodes.VERIF_ASSERTION_FILE_DOES_NOT_EXIST: + reason = 'Assertion File Doesn\'t Exist' + test_status = f'{Color.YELLOW}Ignored{Color.RESET}' + ignored_tests += [test["name"]] + elif test["verify_rc"] == ReturnCodes.VERIF_NO_ASSERTION: + reason = 'No Assertions' + test_status = f'{Color.YELLOW}Ignored{Color.RESET}' + ignored_tests += [test["name"]] + elif test["verify_rc"] == ReturnCodes.VERIF_SOME_ASSERTIONS_FAILED: + reason = 'Some Assertions Failed' + test_status = f'{Color.RED}Failed{Color.RESET}' + failed_tests += [test["name"]] + elif test["verify_rc"] == ReturnCodes.VERIF_SOME_ASSERTIONS_IGNORED: + reason = 'Some Assertions Ignored' + test_status = f'{Color.RED}Failed{Color.RESET}' + failed_tests += [test["name"]] + elif test["verify_rc"] == ReturnCodes.VERIF_ALL_ASSERTIONS_PASSED: + reason = 'All Assertions Passed' + test_status = f'{Color.GREEN}Passed{Color.RESET}' + passed_tests += [test["name"]] + else: + print('Internal Err: Invalid verif_test() return code:', test["verify_rc"]) + sys.exit(1) else: - print("Unknown return Value from execute function") + print('Internal Err: Invalid execute_test() return code:', test["execute_rc"]) + sys.exit(1) else: - ignored_tests = ignored_tests + [t] + print('Internal Err: Invalid compile_test() return code:', test["compile_rc"]) + sys.exit(1) + rpt_txt += '{: <7s} {: <20s} - {: <18s} {: <20s} \n'.format(str(i)+').', test["name"], test_status, Color.FAINT+reason+Color.RESET) - print(80*"=") + rpt_txt += '='*80 + '\n' - # Conclude - print(Fore.CYAN+"> Stage-4:"+Style.RESET_ALL+" Generating report...") - print("|----------------------------|") - print("| Verification Report |") - print("|----------------------------|") + n_failed_tests = len(failed_tests) + n_ignored_tests = len(ignored_tests) + n_passed_tests = len(passed_tests) + n_total_tests = len(test_db) - print("Total tests : " + str(len(tests))) + rpt_txt += Color.GREEN + f"Passed tests : {n_passed_tests} / {n_total_tests}" + Color.RESET + '\n' + rpt_txt += Color.YELLOW + f"Ignored tests : {n_ignored_tests} / {n_total_tests}" + Color.RESET + '\n' + rpt_txt += Color.RED + f"Failed tests : {n_failed_tests} / {n_total_tests}" + Color.RESET + '\n' - count = 1 - for t in tests: - print(str(count)+").\t"+t, end="") - print(" "*(30-len(t)), end="- ") - if t in passed_tests: - print(Fore.GREEN+"Passed"+Style.RESET_ALL) - elif t in ignored_tests: - print(Fore.YELLOW+"Ignored"+Style.RESET_ALL) - else: - print(Fore.RED+"Failed"+Style.RESET_ALL) - count=count+1 + print(rpt_txt) - - print(Fore.GREEN+"\nPassed tests : " + str(len(passed_tests)) + '/' + str(len(tests))+ Style.RESET_ALL) - print(Fore.YELLOW+"Ignored tests : " + str(len(ignored_tests)) + '/' + str(len(tests))+ Style.RESET_ALL) - print(Fore.RED+"Failed tests : " + str(len(failed_tests)) + '/' +str(len(tests))+ Style.RESET_ALL) + with open(args.output, 'w') as of: + of.write(rpt_txt) - if len(failed_tests) > 0: - sys.exit(1) - \ No newline at end of file + sys.exit(1 if n_failed_tests > 0 or n_ignored_tests > 0 else 0) diff --git a/test/scar/tests.json b/test/scar/tests.json new file mode 100644 index 00000000..570d5f7f --- /dev/null +++ b/test/scar/tests.json @@ -0,0 +1,41 @@ +[ + {"name":"add64", "srcs":["tests/add64.S"], "assertion_file": "tests/add64.asrt"}, + {"name":"addi", "srcs":["tests/addi.S"], "assertion_file": "tests/addi.asrt"}, + {"name":"add", "srcs":["tests/add.S"], "assertion_file": "tests/add.asrt"}, + {"name":"andi", "srcs":["tests/andi.S"], "assertion_file": "tests/andi.asrt"}, + {"name":"and", "srcs":["tests/and.S"], "assertion_file": "tests/and.asrt"}, + {"name":"auipc", "srcs":["tests/auipc.S"], "assertion_file": "tests/auipc.asrt"}, + {"name":"beq", "srcs":["tests/beq.S"], "assertion_file": "tests/beq.asrt"}, + {"name":"bge", "srcs":["tests/bge.S"], "assertion_file": "tests/bge.asrt"}, + {"name":"bgeu", "srcs":["tests/bgeu.S"], "assertion_file": "tests/bgeu.asrt"}, + {"name":"blt", "srcs":["tests/blt.S"], "assertion_file": "tests/blt.asrt"}, + {"name":"bltu", "srcs":["tests/bltu.S"], "assertion_file": "tests/bltu.asrt"}, + {"name":"bne", "srcs":["tests/bne.S"], "assertion_file": "tests/bne.asrt"}, + {"name":"function_call", "srcs":["tests/function_call.S"], "assertion_file": "tests/function_call.asrt"}, + {"name":"jalr", "srcs":["tests/jalr.S"], "assertion_file": "tests/jalr.asrt"}, + {"name":"jal", "srcs":["tests/jal.S"], "assertion_file": "tests/jal.asrt"}, + {"name":"li", "srcs":["tests/li.S"], "assertion_file": "tests/li.asrt"}, + {"name":"load_store_byte", "srcs":["tests/load_store_byte.S"], "assertion_file": "tests/load_store_byte.asrt"}, + {"name":"load_store_hw", "srcs":["tests/load_store_hw.S"], "assertion_file": "tests/load_store_hw.asrt"}, + {"name":"lui", "srcs":["tests/lui.S"], "assertion_file": "tests/lui.asrt"}, + {"name":"lw", "srcs":["tests/lw.S"], "assertion_file": "tests/lw.asrt"}, + {"name":"mv", "srcs":["tests/mv.S"], "assertion_file": "tests/mv.asrt"}, + {"name":"ori", "srcs":["tests/ori.S"], "assertion_file": "tests/ori.asrt"}, + {"name":"or", "srcs":["tests/or.S"], "assertion_file": "tests/or.asrt"}, + {"name":"slli", "srcs":["tests/slli.S"], "assertion_file": "tests/slli.asrt"}, + {"name":"sll", "srcs":["tests/sll.S"], "assertion_file": "tests/sll.asrt"}, + {"name":"slti", "srcs":["tests/slti.S"], "assertion_file": "tests/slti.asrt"}, + {"name":"sltiu", "srcs":["tests/sltiu.S"], "assertion_file": "tests/sltiu.asrt"}, + {"name":"slt", "srcs":["tests/slt.S"], "assertion_file": "tests/slt.asrt"}, + {"name":"sltu", "srcs":["tests/sltu.S"], "assertion_file": "tests/sltu.asrt"}, + {"name":"srai", "srcs":["tests/srai.S"], "assertion_file": "tests/srai.asrt"}, + {"name":"sra", "srcs":["tests/sra.S"], "assertion_file": "tests/sra.asrt"}, + {"name":"srli", "srcs":["tests/srli.S"], "assertion_file": "tests/srli.asrt"}, + {"name":"srl", "srcs":["tests/srl.S"], "assertion_file": "tests/srl.asrt"}, + {"name":"stack", "srcs":["tests/stack.S"], "assertion_file": "tests/stack.asrt"}, + {"name":"storew", "srcs":["tests/storew.S"], "assertion_file": "tests/storew.asrt"}, + {"name":"sub", "srcs":["tests/sub.S"], "assertion_file": "tests/sub.asrt"}, + {"name":"sw", "srcs":["tests/sw.S"], "assertion_file": "tests/sw.asrt"}, + {"name":"xori", "srcs":["tests/xori.S"], "assertion_file": "tests/xori.asrt"}, + {"name":"xor", "srcs":["tests/xor.S"], "assertion_file": "tests/xor.asrt"} +] \ No newline at end of file diff --git a/test/scar/add.S b/test/scar/tests/add.S similarity index 65% rename from test/scar/add.S rename to test/scar/tests/add.S index 103ef533..5be6ea36 100644 --- a/test/scar/add.S +++ b/test/scar/tests/add.S @@ -20,11 +20,3 @@ add a5, t5, t6 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x1eac2054 -# eq a1 0xfc89cf33 -# eq a2 0x00bdd1f0 -# eq a3 0x1d00286a -# eq a4 0x027b2593 -# eq a5 0xe26b23ea diff --git a/test/scar/tests/add.asrt b/test/scar/tests/add.asrt new file mode 100644 index 00000000..b1437e42 --- /dev/null +++ b/test/scar/tests/add.asrt @@ -0,0 +1,6 @@ +a0 == 0x1eac2054 +a1 == 0xfc89cf33 +a2 == 0x00bdd1f0 +a3 == 0x1d00286a +a4 == 0x027b2593 +a5 == 0xe26b23ea diff --git a/test/scar/tests/add64.S b/test/scar/tests/add64.S new file mode 100644 index 00000000..8e556ae9 --- /dev/null +++ b/test/scar/tests/add64.S @@ -0,0 +1,19 @@ +.global _start +_start: + li a2, 0x12345678 // A_LO + li a3, 0x12345678 // A_HI + + li a0, 0x12345678 // B_LO + li a1, 0x12345678 // B_HI + + add a4, a2, a0 // S_LO = A_LO + B_LO + mv a6,a4 + sltu a6,a6,a2 // C_LO: get 32 bit carry in a6 + + add a5,a3,a1 // S_HI = A_HI + B_HI + add a3,a6,a5 // S_HI += C_LO + mv a5,a3 + + nop + nop + ebreak diff --git a/test/scar/tests/add64.asrt b/test/scar/tests/add64.asrt new file mode 100644 index 00000000..afda117c --- /dev/null +++ b/test/scar/tests/add64.asrt @@ -0,0 +1,2 @@ +a4 == 0x2468acf0 +a5 == 0x2468acf0 diff --git a/test/scar/addi.S b/test/scar/tests/addi.S similarity index 68% rename from test/scar/addi.S rename to test/scar/tests/addi.S index 28a5e21a..a35c89f2 100644 --- a/test/scar/addi.S +++ b/test/scar/tests/addi.S @@ -19,11 +19,3 @@ addi a5, t5, 0x3c0 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x00d01054 -# eq a1 0x1ddc1633 -# eq a2 0xdeadc1f0 -# eq a3 0x2210186a -# eq a4 0xfaf01593 -# eq a5 0x078b13ea \ No newline at end of file diff --git a/test/scar/tests/addi.asrt b/test/scar/tests/addi.asrt new file mode 100644 index 00000000..c8f7b8a7 --- /dev/null +++ b/test/scar/tests/addi.asrt @@ -0,0 +1,6 @@ +a0 == 0x00d01054 +a1 == 0x1ddc1633 +a2 == 0xdeadc1f0 +a3 == 0x2210186a +a4 == 0xfaf01593 +a5 == 0x078b13ea \ No newline at end of file diff --git a/test/scar/and.S b/test/scar/tests/and.S similarity index 62% rename from test/scar/and.S rename to test/scar/tests/and.S index 7da7728b..7146dd90 100644 --- a/test/scar/and.S +++ b/test/scar/tests/and.S @@ -21,14 +21,3 @@ and a7, a4, a5 nop nop ebreak - -# $-ASSERTIONS-$ - -# eq a0 0x00d01000 -# eq a1 0x1c8c1044 -# eq a2 0x02001201 -# eq a3 0x22101101 -# eq a4 0x02801028 -# eq a5 0x02801000 -# eq a6 0x00000000 -# eq a7 0x02801000 \ No newline at end of file diff --git a/test/scar/tests/and.asrt b/test/scar/tests/and.asrt new file mode 100644 index 00000000..d5f2c5c8 --- /dev/null +++ b/test/scar/tests/and.asrt @@ -0,0 +1,8 @@ +a0 == 0x00d01000 +a1 == 0x1c8c1044 +a2 == 0x02001201 +a3 == 0x22101101 +a4 == 0x02801028 +a5 == 0x02801000 +a6 == 0x00000000 +a7 == 0x02801000 \ No newline at end of file diff --git a/test/scar/andi.S b/test/scar/tests/andi.S similarity index 66% rename from test/scar/andi.S rename to test/scar/tests/andi.S index ddba08c8..e5b8a42d 100644 --- a/test/scar/andi.S +++ b/test/scar/tests/andi.S @@ -19,13 +19,3 @@ andi a5, t5, 0x00f nop nop ebreak - -# $-ASSERTIONS-$ - -# eq a0 0x00000010 -# eq a1 0x00000004 -# eq a2 0x0000046b -# eq a3 0x00000301 -# eq a4 0x00000128 -# eq a5 0x0000000a - diff --git a/test/scar/tests/andi.asrt b/test/scar/tests/andi.asrt new file mode 100644 index 00000000..b495b5dd --- /dev/null +++ b/test/scar/tests/andi.asrt @@ -0,0 +1,6 @@ +a0 == 0x00000010 +a1 == 0x00000004 +a2 == 0x0000046b +a3 == 0x00000301 +a4 == 0x00000128 +a5 == 0x0000000a diff --git a/test/scar/auipc.S b/test/scar/tests/auipc.S similarity index 68% rename from test/scar/auipc.S rename to test/scar/tests/auipc.S index 0556987f..aa41b6a0 100644 --- a/test/scar/auipc.S +++ b/test/scar/tests/auipc.S @@ -22,13 +22,3 @@ sub x7, x7, x9 sub x8, x8, x9 ebreak - -# $-ASSERTIONS-$ -# eq x1 0x00433000 -# eq x2 0x00a44004 -# eq x3 0x0032d008 -# eq x4 0x0001000c -# eq x5 0x00004010 -# eq x6 0x0046b014 -# eq x7 0x00301018 -# eq x8 0x0012801c diff --git a/test/scar/tests/auipc.asrt b/test/scar/tests/auipc.asrt new file mode 100644 index 00000000..d7cae7c1 --- /dev/null +++ b/test/scar/tests/auipc.asrt @@ -0,0 +1,8 @@ +x1 == 0x00433000 +x2 == 0x00a44004 +x3 == 0x0032d008 +x4 == 0x0001000c +x5 == 0x00004010 +x6 == 0x0046b014 +x7 == 0x00301018 +x8 == 0x0012801c diff --git a/test/scar/beq.S b/test/scar/tests/beq.S similarity index 82% rename from test/scar/beq.S rename to test/scar/tests/beq.S index d545d253..8361513b 100644 --- a/test/scar/beq.S +++ b/test/scar/tests/beq.S @@ -55,12 +55,3 @@ exit: ebreak - -# $-ASSERTIONS-$ -# eq x10 0x00000001 -# eq x11 0x00000002 -# eq x12 0x00000003 -# eq x13 0x00000004 -# eq x14 0x00000005 -# eq x15 0x00000006 - diff --git a/test/scar/tests/beq.asrt b/test/scar/tests/beq.asrt new file mode 100644 index 00000000..9bc62760 --- /dev/null +++ b/test/scar/tests/beq.asrt @@ -0,0 +1,6 @@ +x10 == 0x00000001 +x11 == 0x00000002 +x12 == 0x00000003 +x13 == 0x00000004 +x14 == 0x00000005 +x15 == 0x00000006 diff --git a/test/scar/bge.S b/test/scar/tests/bge.S similarity index 82% rename from test/scar/bge.S rename to test/scar/tests/bge.S index 87fdd070..32c6a966 100644 --- a/test/scar/bge.S +++ b/test/scar/tests/bge.S @@ -55,12 +55,3 @@ exit: ebreak - -# $-ASSERTIONS-$ -# eq x10 0x00000001 -# eq x11 0x00000002 -# eq x12 0x00000003 -# eq x13 0x00000004 -# eq x14 0x00000005 -# eq x15 0x00000006 - diff --git a/test/scar/tests/bge.asrt b/test/scar/tests/bge.asrt new file mode 100644 index 00000000..48ad8b61 --- /dev/null +++ b/test/scar/tests/bge.asrt @@ -0,0 +1,7 @@ +x10 == 0x00000001 +x11 == 0x00000002 +x12 == 0x00000003 +x13 == 0x00000004 +x14 == 0x00000005 +x15 == 0x00000006 + diff --git a/test/scar/bgeu.S b/test/scar/tests/bgeu.S similarity index 77% rename from test/scar/bgeu.S rename to test/scar/tests/bgeu.S index 00042bfc..73330319 100644 --- a/test/scar/bgeu.S +++ b/test/scar/tests/bgeu.S @@ -45,12 +45,3 @@ li x15, 0 pass6: ebreak - -# $-ASSERTIONS-$ -# eq x10 0x00000001 -# eq x11 0x00000002 -# eq x12 0x00000003 -# eq x13 0x00000004 -# eq x14 0x00000005 -# eq x15 0x00000006 - diff --git a/test/scar/tests/bgeu.asrt b/test/scar/tests/bgeu.asrt new file mode 100644 index 00000000..9bc62760 --- /dev/null +++ b/test/scar/tests/bgeu.asrt @@ -0,0 +1,6 @@ +x10 == 0x00000001 +x11 == 0x00000002 +x12 == 0x00000003 +x13 == 0x00000004 +x14 == 0x00000005 +x15 == 0x00000006 diff --git a/test/scar/blt.S b/test/scar/tests/blt.S similarity index 78% rename from test/scar/blt.S rename to test/scar/tests/blt.S index 883ad99d..7af26fcb 100644 --- a/test/scar/blt.S +++ b/test/scar/tests/blt.S @@ -45,12 +45,3 @@ li x15, 0 pass6: ebreak - -# $-ASSERTIONS-$ -# eq x10 0x00000001 -# eq x11 0x00000002 -# eq x12 0x00000003 -# eq x13 0x00000004 -# eq x14 0x00000005 -# eq x15 0x00000006 - diff --git a/test/scar/tests/blt.asrt b/test/scar/tests/blt.asrt new file mode 100644 index 00000000..9bc62760 --- /dev/null +++ b/test/scar/tests/blt.asrt @@ -0,0 +1,6 @@ +x10 == 0x00000001 +x11 == 0x00000002 +x12 == 0x00000003 +x13 == 0x00000004 +x14 == 0x00000005 +x15 == 0x00000006 diff --git a/test/scar/bltu.S b/test/scar/tests/bltu.S similarity index 78% rename from test/scar/bltu.S rename to test/scar/tests/bltu.S index d4f9b523..e3d42624 100644 --- a/test/scar/bltu.S +++ b/test/scar/tests/bltu.S @@ -45,12 +45,3 @@ li x15, 0 pass6: ebreak - -# $-ASSERTIONS-$ -# eq x10 0x00000001 -# eq x11 0x00000002 -# eq x12 0x00000003 -# eq x13 0x00000004 -# eq x14 0x00000005 -# eq x15 0x00000006 - diff --git a/test/scar/tests/bltu.asrt b/test/scar/tests/bltu.asrt new file mode 100644 index 00000000..48ad8b61 --- /dev/null +++ b/test/scar/tests/bltu.asrt @@ -0,0 +1,7 @@ +x10 == 0x00000001 +x11 == 0x00000002 +x12 == 0x00000003 +x13 == 0x00000004 +x14 == 0x00000005 +x15 == 0x00000006 + diff --git a/test/scar/bne.S b/test/scar/tests/bne.S similarity index 83% rename from test/scar/bne.S rename to test/scar/tests/bne.S index 38b69139..8e607b77 100644 --- a/test/scar/bne.S +++ b/test/scar/tests/bne.S @@ -53,11 +53,3 @@ exit: finish: li x15, 0x00000006 ebreak - -# $-ASSERTIONS-$ -# eq x10 0x00000001 -# eq x11 0x00000002 -# eq x12 0x00000003 -# eq x13 0x00000004 -# eq x14 0x00000005 -# eq x15 0x00000006 diff --git a/test/scar/tests/bne.asrt b/test/scar/tests/bne.asrt new file mode 100644 index 00000000..9bc62760 --- /dev/null +++ b/test/scar/tests/bne.asrt @@ -0,0 +1,6 @@ +x10 == 0x00000001 +x11 == 0x00000002 +x12 == 0x00000003 +x13 == 0x00000004 +x14 == 0x00000005 +x15 == 0x00000006 diff --git a/test/scar/function_call.S b/test/scar/tests/function_call.S similarity index 72% rename from test/scar/function_call.S rename to test/scar/tests/function_call.S index ab7debfc..27c0d987 100644 --- a/test/scar/function_call.S +++ b/test/scar/tests/function_call.S @@ -13,9 +13,3 @@ _start: function: add a0, a0, a1 ret - - - -# $-ASSERTIONS-$ -# eq a0 0x000152f5 -# eq a1 0x0000fccd diff --git a/test/scar/tests/function_call.asrt b/test/scar/tests/function_call.asrt new file mode 100644 index 00000000..67748ee8 --- /dev/null +++ b/test/scar/tests/function_call.asrt @@ -0,0 +1,2 @@ +a0 == 0x000152f5 +a1 == 0x0000fccd diff --git a/test/scar/jal.S b/test/scar/tests/jal.S similarity index 70% rename from test/scar/jal.S rename to test/scar/tests/jal.S index 41c8a495..43cb6895 100644 --- a/test/scar/jal.S +++ b/test/scar/tests/jal.S @@ -18,10 +18,3 @@ subr: add a2, a2, 1 add a3, a3, 1 ret - -# $-ASSERTIONS-$ -# eq a0 0xdeadbef0 -# eq a1 0xbabecaff -# eq a2 0x10101011 -# eq a3 0xabcbedff -# eq a4 0x1b0b1d0d diff --git a/test/scar/tests/jal.asrt b/test/scar/tests/jal.asrt new file mode 100644 index 00000000..a8094efe --- /dev/null +++ b/test/scar/tests/jal.asrt @@ -0,0 +1,5 @@ +a0 == 0xdeadbef0 +a1 == 0xbabecaff +a2 == 0x10101011 +a3 == 0xabcbedff +a4 == 0x1b0b1d0d \ No newline at end of file diff --git a/test/scar/jalr.S b/test/scar/tests/jalr.S similarity index 71% rename from test/scar/jalr.S rename to test/scar/tests/jalr.S index 606a459b..a3d8da1c 100644 --- a/test/scar/jalr.S +++ b/test/scar/tests/jalr.S @@ -19,10 +19,3 @@ subr: add a2, a2, 1 add a3, a3, 1 ret - -# $-ASSERTIONS-$ -# eq a0 0xdeadbef0 -# eq a1 0xbabecaff -# eq a2 0x10101011 -# eq a3 0xabcbedff -# eq a4 0x1b0b1d0d diff --git a/test/scar/tests/jalr.asrt b/test/scar/tests/jalr.asrt new file mode 100644 index 00000000..c792174e --- /dev/null +++ b/test/scar/tests/jalr.asrt @@ -0,0 +1,5 @@ +a0 == 0xdeadbef0 +a1 == 0xbabecaff +a2 == 0x10101011 +a3 == 0xabcbedff +a4 == 0x1b0b1d0d diff --git a/test/scar/li.S b/test/scar/tests/li.S similarity index 75% rename from test/scar/li.S rename to test/scar/tests/li.S index 2b5a05de..95f2e3f8 100644 --- a/test/scar/li.S +++ b/test/scar/tests/li.S @@ -12,8 +12,3 @@ li x3, 0x01234567 nop ebreak -# $-ASSERTIONS-$ -# eq t0 0x000000ff -# eq t1 0x0000ffff -# eq t2 0xfffff343 -# eq x3 0x01234567 diff --git a/test/scar/tests/li.asrt b/test/scar/tests/li.asrt new file mode 100644 index 00000000..0fd91384 --- /dev/null +++ b/test/scar/tests/li.asrt @@ -0,0 +1,4 @@ +t0 == 0x000000ff +t1 == 0x0000ffff +t2 == 0xfffff343 +x3 == 0x01234567 diff --git a/test/scar/load_store_byte.S b/test/scar/tests/load_store_byte.S similarity index 83% rename from test/scar/load_store_byte.S rename to test/scar/tests/load_store_byte.S index 825a7c24..6ddb92b6 100644 --- a/test/scar/load_store_byte.S +++ b/test/scar/tests/load_store_byte.S @@ -18,10 +18,3 @@ _start: nop ebreak - -# $-ASSERTIONS-$ -# eq t1 0x00000071 -# eq t2 0x00000089 -# eq a0 0x00000071 -# eq a1 0xffffff89 -# eq a2 0x00000089 \ No newline at end of file diff --git a/test/scar/tests/load_store_byte.asrt b/test/scar/tests/load_store_byte.asrt new file mode 100644 index 00000000..3e977d1e --- /dev/null +++ b/test/scar/tests/load_store_byte.asrt @@ -0,0 +1,5 @@ +t1 == 0x00000071 +t2 == 0x00000089 +a0 == 0x00000071 +a1 == 0xffffff89 +a2 == 0x00000089 \ No newline at end of file diff --git a/test/scar/load_store_hw.S b/test/scar/tests/load_store_hw.S similarity index 77% rename from test/scar/load_store_hw.S rename to test/scar/tests/load_store_hw.S index d53aac7b..eecfbebd 100644 --- a/test/scar/load_store_hw.S +++ b/test/scar/tests/load_store_hw.S @@ -30,19 +30,3 @@ _start: nop ebreak - -# $-ASSERTIONS-$ -# eq t1 0x00007155 -# eq t2 0x00008955 -# eq a0 0x00007155 -# eq a1 0xffff8955 -# eq a2 0x00008955 - -# eq s0 0x89557155 - -# eq t3 0x000000dd - -# eq a3 0xffffcc55 -# eq a4 0xffff89dd -# eq a5 0x89ddcc55 -# eq a6 0x000089dd \ No newline at end of file diff --git a/test/scar/tests/load_store_hw.asrt b/test/scar/tests/load_store_hw.asrt new file mode 100644 index 00000000..47d03323 --- /dev/null +++ b/test/scar/tests/load_store_hw.asrt @@ -0,0 +1,11 @@ +t1 == 0x00007155 +t2 == 0x00008955 +a0 == 0x00007155 +a1 == 0xffff8955 +a2 == 0x00008955 +s0 == 0x89557155 +t3 == 0x000000dd +a3 == 0xffffcc55 +a4 == 0xffff89dd +a5 == 0x89ddcc55 +a6 == 0x000089dd \ No newline at end of file diff --git a/test/scar/tests/lui.S b/test/scar/tests/lui.S new file mode 100644 index 00000000..1587bedd --- /dev/null +++ b/test/scar/tests/lui.S @@ -0,0 +1,23 @@ +.global _start +_start: + +lui a0, 0xfffff +lui a1, 0xf210a +lui a2, 0x00001 +lui a3, 0x00123 +lui a4, 0x01234 +lui a5, 0xdeadb +lui a6, 0xdbeef +lui a7, 0xae121 + +lui t0, 0x52cda +lui t1, 0xcda53 +lui t2, 0xab129 +lui t3, 0x95bcd +lui t4, 0x09090 +lui t5, 0xff11f +lui t6, 0x96dad + +nop +nop +ebreak diff --git a/test/scar/tests/lui.asrt b/test/scar/tests/lui.asrt new file mode 100644 index 00000000..4a7adcfe --- /dev/null +++ b/test/scar/tests/lui.asrt @@ -0,0 +1,15 @@ +a0 == 0xfffff000 +a1 == 0xf210a000 +a2 == 0x00001000 +a3 == 0x00123000 +a4 == 0x01234000 +a5 == 0xdeadb000 +a6 == 0xdbeef000 +a7 == 0xae121000 +t0 == 0x52cda000 +t1 == 0xcda53000 +t2 == 0xab129000 +t3 == 0x95bcd000 +t4 == 0x09090000 +t5 == 0xff11f000 +t6 == 0x96dad000 \ No newline at end of file diff --git a/test/scar/lw.S b/test/scar/tests/lw.S similarity index 75% rename from test/scar/lw.S rename to test/scar/tests/lw.S index 1fd5eecb..3f35178c 100644 --- a/test/scar/lw.S +++ b/test/scar/tests/lw.S @@ -52,17 +52,3 @@ var9: .word 0x1beefbee var10: .word 0x12deadbe var11: .word 0x123deadb var12: .word 0x1234dead - -# $-ASSERTIONS-$ -# eq x1 0x12345678 -# eq x2 0x00002020 -# eq x3 0xf3232532 -# eq x4 0xdea14245 -# eq x5 0xdea12cad -# eq x6 0xdacadaca -# eq x7 0xbeefdead -# eq x8 0xdeadbeef -# eq x9 0x1beefbee -# eq x10 0x12deadbe -# eq x11 0x123deadb -# eq x12 0x1234dead \ No newline at end of file diff --git a/test/scar/tests/lw.asrt b/test/scar/tests/lw.asrt new file mode 100644 index 00000000..f3c1b1ae --- /dev/null +++ b/test/scar/tests/lw.asrt @@ -0,0 +1,12 @@ +x1 == 0x12345678 +x2 == 0x00002020 +x3 == 0xf3232532 +x4 == 0xdea14245 +x5 == 0xdea12cad +x6 == 0xdacadaca +x7 == 0xbeefdead +x8 == 0xdeadbeef +x9 == 0x1beefbee +x10 == 0x12deadbe +x11 == 0x123deadb +x12 == 0x1234dead \ No newline at end of file diff --git a/test/scar/mv.S b/test/scar/tests/mv.S similarity index 80% rename from test/scar/mv.S rename to test/scar/tests/mv.S index 0210fbc1..925e59f6 100644 --- a/test/scar/mv.S +++ b/test/scar/tests/mv.S @@ -12,8 +12,3 @@ mv t2, t1 # Copy contents of register t0 to register t1 nop nop ebreak - -# $-ASSERTIONS-$ -# eq t0 0x00ff4a1a -# eq t1 0x00ff4a1a -# eq t2 0x00ff4a1a diff --git a/test/scar/tests/mv.asrt b/test/scar/tests/mv.asrt new file mode 100644 index 00000000..3735b315 --- /dev/null +++ b/test/scar/tests/mv.asrt @@ -0,0 +1,3 @@ +t0 == 0x00ff4a1a +t1 == 0x00ff4a1a +t2 == 0x00ff4a1a diff --git a/test/scar/or.S b/test/scar/tests/or.S similarity index 62% rename from test/scar/or.S rename to test/scar/tests/or.S index 9217d15c..316d6512 100644 --- a/test/scar/or.S +++ b/test/scar/tests/or.S @@ -21,13 +21,3 @@ or a7, a4, a5 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x1ddc1054 -# eq a1 0xdffdbeef -# eq a2 0xfebdbfef -# eq a3 0xfaf01769 -# eq a4 0xfffb156b -# eq a5 0xdfeb13ea -# eq a6 0xdae013c0 -# eq a7 0xfffb17eb diff --git a/test/scar/tests/or.asrt b/test/scar/tests/or.asrt new file mode 100644 index 00000000..0a8e6cec --- /dev/null +++ b/test/scar/tests/or.asrt @@ -0,0 +1,8 @@ +a0 == 0x1ddc1054 +a1 == 0xdffdbeef +a2 == 0xfebdbfef +a3 == 0xfaf01769 +a4 == 0xfffb156b +a5 == 0xdfeb13ea +a6 == 0xdae013c0 +a7 == 0xfffb17eb diff --git a/test/scar/ori.S b/test/scar/tests/ori.S similarity index 66% rename from test/scar/ori.S rename to test/scar/tests/ori.S index f6fbd9ac..ed4041ab 100644 --- a/test/scar/ori.S +++ b/test/scar/tests/ori.S @@ -19,12 +19,3 @@ ori a5, t5, 0x00f nop nop ebreak - -# $-ASSERTIONS-$ - -# eq a0 0x00d0111a -# eq a1 0x1ddc126c -# eq a2 0xdeadbeef -# eq a3 0x2210175d -# eq a4 0xfaf0176f -# eq a5 0x078b102f diff --git a/test/scar/tests/ori.asrt b/test/scar/tests/ori.asrt new file mode 100644 index 00000000..e5a24f34 --- /dev/null +++ b/test/scar/tests/ori.asrt @@ -0,0 +1,6 @@ +a0 == 0x00d0111a +a1 == 0x1ddc126c +a2 == 0xdeadbeef +a3 == 0x2210175d +a4 == 0xfaf0176f +a5 == 0x078b102f diff --git a/test/scar/sll.S b/test/scar/tests/sll.S similarity index 69% rename from test/scar/sll.S rename to test/scar/tests/sll.S index fec16c29..bdd8bd1f 100644 --- a/test/scar/sll.S +++ b/test/scar/tests/sll.S @@ -17,9 +17,3 @@ sll t3, t3, a0 nop nop ebreak - -# $-ASSERTIONS-$ -# eq t0 0xdeadbeef -# eq t1 0x757d95fc -# eq t2 0x2f368000 -# eq t3 0x80000000 diff --git a/test/scar/tests/sll.asrt b/test/scar/tests/sll.asrt new file mode 100644 index 00000000..533d1009 --- /dev/null +++ b/test/scar/tests/sll.asrt @@ -0,0 +1,4 @@ +t0 == 0xdeadbeef +t1 == 0x757d95fc +t2 == 0x2f368000 +t3 == 0x80000000 diff --git a/test/scar/slli.S b/test/scar/tests/slli.S similarity index 64% rename from test/scar/slli.S rename to test/scar/tests/slli.S index 9980a911..867de03f 100644 --- a/test/scar/slli.S +++ b/test/scar/tests/slli.S @@ -13,9 +13,3 @@ slli t3, t3, 31 nop nop ebreak - -# $-ASSERTIONS-$ -# eq t0 0xdeadbeef -# eq t1 0x757d95fc -# eq t2 0x2f368000 -# eq t3 0x80000000 diff --git a/test/scar/tests/slli.asrt b/test/scar/tests/slli.asrt new file mode 100644 index 00000000..533d1009 --- /dev/null +++ b/test/scar/tests/slli.asrt @@ -0,0 +1,4 @@ +t0 == 0xdeadbeef +t1 == 0x757d95fc +t2 == 0x2f368000 +t3 == 0x80000000 diff --git a/test/scar/slt.S b/test/scar/tests/slt.S similarity index 60% rename from test/scar/slt.S rename to test/scar/tests/slt.S index c6f43cbe..5aaa48c6 100644 --- a/test/scar/slt.S +++ b/test/scar/tests/slt.S @@ -13,9 +13,3 @@ slt a3, t3, t0 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x00000001 -# eq a1 0x00000000 -# eq a2 0x00000000 -# eq a3 0x00000001 diff --git a/test/scar/tests/slt.asrt b/test/scar/tests/slt.asrt new file mode 100644 index 00000000..bc1eeea0 --- /dev/null +++ b/test/scar/tests/slt.asrt @@ -0,0 +1,4 @@ +a0 == 0x00000001 +a1 == 0x00000000 +a2 == 0x00000000 +a3 == 0x00000001 diff --git a/test/scar/slti.S b/test/scar/tests/slti.S similarity index 60% rename from test/scar/slti.S rename to test/scar/tests/slti.S index 4fbd1240..8d2e52b5 100644 --- a/test/scar/slti.S +++ b/test/scar/tests/slti.S @@ -13,9 +13,3 @@ slt a3, t3, 24 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x00000001 -# eq a1 0x00000000 -# eq a2 0x00000000 -# eq a3 0x00000001 diff --git a/test/scar/tests/slti.asrt b/test/scar/tests/slti.asrt new file mode 100644 index 00000000..bc1eeea0 --- /dev/null +++ b/test/scar/tests/slti.asrt @@ -0,0 +1,4 @@ +a0 == 0x00000001 +a1 == 0x00000000 +a2 == 0x00000000 +a3 == 0x00000001 diff --git a/test/scar/sltiu.S b/test/scar/tests/sltiu.S similarity index 61% rename from test/scar/sltiu.S rename to test/scar/tests/sltiu.S index 8cb5ae31..030f51a3 100644 --- a/test/scar/sltiu.S +++ b/test/scar/tests/sltiu.S @@ -13,9 +13,3 @@ sltiu a3, t3, 24 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x00000001 -# eq a1 0x00000000 -# eq a2 0x00000001 -# eq a3 0x00000000 diff --git a/test/scar/tests/sltiu.asrt b/test/scar/tests/sltiu.asrt new file mode 100644 index 00000000..762efa64 --- /dev/null +++ b/test/scar/tests/sltiu.asrt @@ -0,0 +1,4 @@ +a0 == 0x00000001 +a1 == 0x00000000 +a2 == 0x00000001 +a3 == 0x00000000 diff --git a/test/scar/sltu.S b/test/scar/tests/sltu.S similarity index 60% rename from test/scar/sltu.S rename to test/scar/tests/sltu.S index 5f159e9a..b4882079 100644 --- a/test/scar/sltu.S +++ b/test/scar/tests/sltu.S @@ -13,9 +13,3 @@ sltu a3, t3, t0 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x00000001 -# eq a1 0x00000000 -# eq a2 0x00000001 -# eq a3 0x00000000 diff --git a/test/scar/tests/sltu.asrt b/test/scar/tests/sltu.asrt new file mode 100644 index 00000000..762efa64 --- /dev/null +++ b/test/scar/tests/sltu.asrt @@ -0,0 +1,4 @@ +a0 == 0x00000001 +a1 == 0x00000000 +a2 == 0x00000001 +a3 == 0x00000000 diff --git a/test/scar/sra.S b/test/scar/tests/sra.S similarity index 68% rename from test/scar/sra.S rename to test/scar/tests/sra.S index 6f51be74..05b87425 100644 --- a/test/scar/sra.S +++ b/test/scar/tests/sra.S @@ -17,9 +17,3 @@ sra a3, t3, s0 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0xffffd555 -# eq a1 0x0000aaaa -# eq a2 0xffd7d7d7 -# eq a3 0xffffffff diff --git a/test/scar/tests/sra.asrt b/test/scar/tests/sra.asrt new file mode 100644 index 00000000..a2c16507 --- /dev/null +++ b/test/scar/tests/sra.asrt @@ -0,0 +1,4 @@ +a0 == 0xffffd555 +a1 == 0x0000aaaa +a2 == 0xffd7d7d7 +a3 == 0xffffffff diff --git a/test/scar/srai.S b/test/scar/tests/srai.S similarity index 64% rename from test/scar/srai.S rename to test/scar/tests/srai.S index eea854eb..73139a9c 100644 --- a/test/scar/srai.S +++ b/test/scar/tests/srai.S @@ -13,9 +13,3 @@ srai a3, t3, 31 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0xffffd555 -# eq a1 0x0000aaaa -# eq a2 0xffd7d7d7 -# eq a3 0xffffffff diff --git a/test/scar/tests/srai.asrt b/test/scar/tests/srai.asrt new file mode 100644 index 00000000..a2c16507 --- /dev/null +++ b/test/scar/tests/srai.asrt @@ -0,0 +1,4 @@ +a0 == 0xffffd555 +a1 == 0x0000aaaa +a2 == 0xffd7d7d7 +a3 == 0xffffffff diff --git a/test/scar/srl.S b/test/scar/tests/srl.S similarity index 68% rename from test/scar/srl.S rename to test/scar/tests/srl.S index bcefa6dc..08092c4c 100644 --- a/test/scar/srl.S +++ b/test/scar/tests/srl.S @@ -17,9 +17,3 @@ srl a3, t3, s0 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x7fffd555 -# eq a1 0x0000aaaa -# eq a2 0x07d7d7d7 -# eq a3 0x00000001 diff --git a/test/scar/tests/srl.asrt b/test/scar/tests/srl.asrt new file mode 100644 index 00000000..add786ba --- /dev/null +++ b/test/scar/tests/srl.asrt @@ -0,0 +1,4 @@ +a0 == 0x7fffd555 +a1 == 0x0000aaaa +a2 == 0x07d7d7d7 +a3 == 0x00000001 diff --git a/test/scar/srli.S b/test/scar/tests/srli.S similarity index 64% rename from test/scar/srli.S rename to test/scar/tests/srli.S index bcbe0e64..c86889e3 100644 --- a/test/scar/srli.S +++ b/test/scar/tests/srli.S @@ -13,9 +13,3 @@ srli a3, t3, 31 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x7fffd555 -# eq a1 0x0000aaaa -# eq a2 0x07d7d7d7 -# eq a3 0x00000001 diff --git a/test/scar/tests/srli.asrt b/test/scar/tests/srli.asrt new file mode 100644 index 00000000..add786ba --- /dev/null +++ b/test/scar/tests/srli.asrt @@ -0,0 +1,4 @@ +a0 == 0x7fffd555 +a1 == 0x0000aaaa +a2 == 0x07d7d7d7 +a3 == 0x00000001 diff --git a/test/scar/stack.S b/test/scar/tests/stack.S similarity index 81% rename from test/scar/stack.S rename to test/scar/tests/stack.S index ef181b84..1796f6b5 100644 --- a/test/scar/stack.S +++ b/test/scar/tests/stack.S @@ -37,9 +37,3 @@ exit: nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x43234323 -# eq a1 0xbabecafe -# eq a2 0xdeafbeef -# eq sp 0x010a020b \ No newline at end of file diff --git a/test/scar/tests/stack.asrt b/test/scar/tests/stack.asrt new file mode 100644 index 00000000..0530b963 --- /dev/null +++ b/test/scar/tests/stack.asrt @@ -0,0 +1,4 @@ +a0 == 0x43234323 +a1 == 0xbabecafe +a2 == 0xdeafbeef +sp == 0x010a020b \ No newline at end of file diff --git a/test/scar/storew.S b/test/scar/tests/storew.S similarity index 92% rename from test/scar/storew.S rename to test/scar/tests/storew.S index d238e1d2..db92159a 100644 --- a/test/scar/storew.S +++ b/test/scar/tests/storew.S @@ -22,9 +22,3 @@ lw a4, 12(t0) # Store the word in t1 to the second word slot of address s nop nop ebreak - -# $-ASSERTIONS-$ -# eq a1 0x9b7a7971 -# eq a2 0x4523521d -# eq a3 0x73451464 -# eq a4 0xf4323513 \ No newline at end of file diff --git a/test/scar/tests/storew.asrt b/test/scar/tests/storew.asrt new file mode 100644 index 00000000..b6cf87c8 --- /dev/null +++ b/test/scar/tests/storew.asrt @@ -0,0 +1,4 @@ +a1 == 0x9b7a7971 +a2 == 0x4523521d +a3 == 0x73451464 +a4 == 0xf4323513 \ No newline at end of file diff --git a/test/scar/sub.S b/test/scar/tests/sub.S similarity index 66% rename from test/scar/sub.S rename to test/scar/tests/sub.S index d883fb8b..dab1478d 100644 --- a/test/scar/sub.S +++ b/test/scar/tests/sub.S @@ -20,11 +20,3 @@ sub a5, t5, t6 nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0xe2f3ffcc -# eq a1 0x3f2e5155 -# eq a2 0xdeadabee -# eq a3 0x050ffd98 -# eq a4 0xf365053f -# eq a5 0x2caafc6a diff --git a/test/scar/tests/sub.asrt b/test/scar/tests/sub.asrt new file mode 100644 index 00000000..ef9f5aa9 --- /dev/null +++ b/test/scar/tests/sub.asrt @@ -0,0 +1,6 @@ +a0 == 0xe2f3ffcc +a1 == 0x3f2e5155 +a2 == 0xdeadabee +a3 == 0x050ffd98 +a4 == 0xf365053f +a5 == 0x2caafc6a diff --git a/test/scar/sw.S b/test/scar/tests/sw.S similarity index 84% rename from test/scar/sw.S rename to test/scar/tests/sw.S index 9bb666eb..ff3b1a1e 100644 --- a/test/scar/sw.S +++ b/test/scar/tests/sw.S @@ -95,17 +95,3 @@ _start: .data memloc: - -# $-ASSERTIONS-$ -# eq x1 0x12345678 -# eq x2 0x00002020 -# eq x3 0xf3232532 -# eq x4 0xdea14245 -# eq x5 0xdea12cad -# eq x6 0xdacadaca -# eq x7 0xbeefdead -# eq x8 0xdeadbeef -# eq x9 0x1beefbee -# eq x10 0x12deadbe -# eq x11 0x123deadb -# eq x12 0x1234dead \ No newline at end of file diff --git a/test/scar/tests/sw.asrt b/test/scar/tests/sw.asrt new file mode 100644 index 00000000..f3c1b1ae --- /dev/null +++ b/test/scar/tests/sw.asrt @@ -0,0 +1,12 @@ +x1 == 0x12345678 +x2 == 0x00002020 +x3 == 0xf3232532 +x4 == 0xdea14245 +x5 == 0xdea12cad +x6 == 0xdacadaca +x7 == 0xbeefdead +x8 == 0xdeadbeef +x9 == 0x1beefbee +x10 == 0x12deadbe +x11 == 0x123deadb +x12 == 0x1234dead \ No newline at end of file diff --git a/test/scar/xor.S b/test/scar/tests/xor.S similarity index 62% rename from test/scar/xor.S rename to test/scar/tests/xor.S index 1f09a95f..c7aab477 100644 --- a/test/scar/xor.S +++ b/test/scar/tests/xor.S @@ -21,14 +21,3 @@ xor a7, a4, a5 nop nop ebreak - -# $-ASSERTIONS-$ - -# eq a0 0x1d0c0054 -# eq a1 0xc371aeab -# eq a2 0xfcbdadee -# eq a3 0xd8e00668 -# eq a4 0xfd7b0543 -# eq a5 0xdd6b03ea -# eq a6 0xdae013c0 -# eq a7 0x201006a9 diff --git a/test/scar/tests/xor.asrt b/test/scar/tests/xor.asrt new file mode 100644 index 00000000..2bfe206b --- /dev/null +++ b/test/scar/tests/xor.asrt @@ -0,0 +1,8 @@ +a0 == 0x1d0c0054 +a1 == 0xc371aeab +a2 == 0xfcbdadee +a3 == 0xd8e00668 +a4 == 0xfd7b0543 +a5 == 0xdd6b03ea +a6 == 0xdae013c0 +a7 == 0x201006a9 diff --git a/test/scar/xori.S b/test/scar/tests/xori.S similarity index 66% rename from test/scar/xori.S rename to test/scar/tests/xori.S index a6cd53d8..55706395 100644 --- a/test/scar/xori.S +++ b/test/scar/tests/xori.S @@ -19,11 +19,3 @@ xori a5, t5, 0x00f nop nop ebreak - -# $-ASSERTIONS-$ -# eq a0 0x00d0110a -# eq a1 0x1ddc1268 -# eq a2 0xdeadba84 -# eq a3 0x2210145c -# eq a4 0xfaf01647 -# eq a5 0x078b1025 diff --git a/test/scar/tests/xori.asrt b/test/scar/tests/xori.asrt new file mode 100644 index 00000000..8cbbe710 --- /dev/null +++ b/test/scar/tests/xori.asrt @@ -0,0 +1,6 @@ +a0 == 0x00d0110a +a1 == 0x1ddc1268 +a2 == 0xdeadba84 +a3 == 0x2210145c +a4 == 0xfaf01647 +a5 == 0x078b1025