Started making debug testcase

This commit is contained in:
David Harris 2023-02-04 08:18:55 -08:00
parent 88ef0503fd
commit 0f7ea52f9b
2 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,27 @@
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
TARGET = debug
%.elf.memfile: %.elf %.elf.objdump.adr
riscv64-unknown-elf-elf2hex --bit-width $(if $(findstring rv64,$*),64,32) --input $< --output $@
%.elf.objdump.addr: %.elf.objdump
extractFunctionRadix.sh $<
$(TARGET).objdump: $(TARGET).elf
riscv64-unknown-elf-objdump -D $(TARGET).elf > $(TARGET).objdump
$(TARGET): $(TARGET).S Makefile
riscv64-unknown-elf-gcc -g -o $(TARGET).elf -march=rv64gc -mabi=lp64 -mcmodel=medany \
-nostartfiles -T../../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
echo "Signature matches! Success!"
clean:
rm -f $(TARGET).elf $(TARGET).objdump $(TARGET).objdump.adr %(TARGET).elf.memfile $(TARGET).signature.output

View File

@ -0,0 +1,42 @@
// debug.S
// David_Harris@hmc.edu 4 February 2023
// Small code snippets for the purpose of debugging issues
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
# openhwgroup/cvw Issue #55
li x1, 0x7ff0000000000001
fmv.w.x f4, x1
li x1, 7ff8000000000000
fmv.w.x f9, x1
fsgnjx.s f12,f9,f4 # expected f 0xffffffff7fc00000
#########################
# HTIF and signature
#########################
write_tohost:
la t1, tohost
li t0, 1 # 1 for success, 3 for failure
sd t0, 0(t1) # send success code
self_loop:
j self_loop # wait
.section .tohost
tohost: # write to HTIF
.dword 0
fromhost:
.dword 0
.data
.EQU XLEN,64
begin_signature:
.fill 2*(XLEN/32),4,0xdeadbeef #
end_signature:
# Initialize stack with room for 512 bytes
.bss
.space 512
topofstack: