diff --git a/.gitignore b/.gitignore index e8ff572fa..38d466cd8 100644 --- a/.gitignore +++ b/.gitignore @@ -111,3 +111,4 @@ sim/imperas.log sim/results-error/ sim/test1.rep sim/vsim.log +tests/coverage/*.S diff --git a/tests/coverage/Makefile b/tests/coverage/Makefile index 7773e7c14..e026fa41b 100644 --- a/tests/coverage/Makefile +++ b/tests/coverage/Makefile @@ -1,19 +1,21 @@ -TARGET = badinstr +SRCS = $(wildcard *.S) +PROGS = $(patsubst %.S,%,$(SRCS)) -$(TARGET).objdump: $(TARGET) - riscv64-unknown-elf-objdump -D $(TARGET) > $(TARGET).objdump +all: $(PROGS) + +%: %.S WALLY-init-lib.h Makefile + echo $@ + riscv64-unknown-elf-gcc -g -o $@.elf -march=rv64gc -mabi=lp64 -mcmodel=medany \ + -nostartfiles -T../../examples/link/link.ld $@.S + riscv64-unknown-elf-objdump -D $@.elf > $@.objdump -$(TARGET): $(TARGET).S WALLY-init-lib.S Makefile - riscv64-unknown-elf-gcc -g -o $(TARGET) -march=rv64gc -mabi=lp64 -mcmodel=medany \ - -nostartfiles -T../../examples/link/link.ld $(TARGET).S - -sim: - spike +signature=$(TARGET).signature.output +signature-granularity=8 $(TARGET) - diff --ignore-case $(TARGET).signature.output $(TARGET).reference_output || exit +sim: %.elf + spike +signature=%.signature.output +signature-granularity=8 %.elf + diff --ignore-case %.signature.output %.reference_output || exit echo "Signature matches! Success!" clean: - rm -f $(TARGET) $(TARGET).objdump $(TARGET).signature.output + rm -f *.elf *.objdump *.signature.output diff --git a/tests/coverage/WALLY-init-lib.S b/tests/coverage/WALLY-init-lib.h similarity index 99% rename from tests/coverage/WALLY-init-lib.S rename to tests/coverage/WALLY-init-lib.h index 2d30aba24..4de5e7688 100644 --- a/tests/coverage/WALLY-init-lib.S +++ b/tests/coverage/WALLY-init-lib.h @@ -1,5 +1,5 @@ /////////////////////////////////////////// -// WALLY-init-lib.S +// WALLY-init-lib.h // // Written: David_Harris@hmc.edu 21 March 2023 // diff --git a/tests/coverage/badinstr.S b/tests/coverage/badinstr.S index 9ec6844d1..e77f5c980 100644 --- a/tests/coverage/badinstr.S +++ b/tests/coverage/badinstr.S @@ -24,11 +24,12 @@ //////////////////////////////////////////////////////////////////////////////////////////////// // load code to initalize stack, handle interrupts, terminate -#include "WALLY-init-lib.S" +#include "WALLY-init-lib.h" main: - .word 0x00000033 // legal instruction - .word 0x80000033 // illegal instruction + .word 0x00000033 // legal R-type instruction + .word 0x80000033 // illegal R-type instruction + .word 0x00007003 // illegal Load instruction .word 0x00000000 // illegal instruction j done