Building infrastructure for coverage directed tests

This commit is contained in:
David Harris 2023-03-22 04:37:13 -07:00
parent f6bc499f34
commit 4a1592ccf8
4 changed files with 19 additions and 15 deletions

1
.gitignore vendored
View File

@ -111,3 +111,4 @@ sim/imperas.log
sim/results-error/ sim/results-error/
sim/test1.rep sim/test1.rep
sim/vsim.log sim/vsim.log
tests/coverage/*.S

View File

@ -1,19 +1,21 @@
TARGET = badinstr SRCS = $(wildcard *.S)
PROGS = $(patsubst %.S,%,$(SRCS))
$(TARGET).objdump: $(TARGET) all: $(PROGS)
riscv64-unknown-elf-objdump -D $(TARGET) > $(TARGET).objdump
%: %.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 sim: %.elf
riscv64-unknown-elf-gcc -g -o $(TARGET) -march=rv64gc -mabi=lp64 -mcmodel=medany \ spike +signature=%.signature.output +signature-granularity=8 %.elf
-nostartfiles -T../../examples/link/link.ld $(TARGET).S diff --ignore-case %.signature.output %.reference_output || exit
sim:
spike +signature=$(TARGET).signature.output +signature-granularity=8 $(TARGET)
diff --ignore-case $(TARGET).signature.output $(TARGET).reference_output || exit
echo "Signature matches! Success!" echo "Signature matches! Success!"
clean: clean:
rm -f $(TARGET) $(TARGET).objdump $(TARGET).signature.output rm -f *.elf *.objdump *.signature.output

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////// ///////////////////////////////////////////
// WALLY-init-lib.S // WALLY-init-lib.h
// //
// Written: David_Harris@hmc.edu 21 March 2023 // Written: David_Harris@hmc.edu 21 March 2023
// //

View File

@ -24,11 +24,12 @@
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
// load code to initalize stack, handle interrupts, terminate // load code to initalize stack, handle interrupts, terminate
#include "WALLY-init-lib.S" #include "WALLY-init-lib.h"
main: main:
.word 0x00000033 // legal instruction .word 0x00000033 // legal R-type instruction
.word 0x80000033 // illegal instruction .word 0x80000033 // illegal R-type instruction
.word 0x00007003 // illegal Load instruction
.word 0x00000000 // illegal instruction .word 0x00000000 // illegal instruction
j done j done