More progress on debug.S, but it crashes in Spike

This commit is contained in:
David Harris 2023-02-04 09:59:22 -08:00
parent 1bb5599806
commit aba8b9a64b
3 changed files with 29 additions and 13 deletions

1
.gitignore vendored
View File

@ -89,6 +89,7 @@ tests/custom/*/*/*.elf
tests/custom/*/*/*.map
tests/custom/*/*/*.memfile
tests/custom/crt0/*.a
tests/custom/*/*.elf*
sim/sd_model.log
fpga/src/sdc/*
fpga/src/sdc.tar.gz

View File

@ -2,26 +2,26 @@
TARGET = debug
%.elf.memfile: %.elf %.elf.objdump.adr
$(TARGET).elf.memfile:$(TARGET).elf $(TARGET).elf.objdump.addr
riscv64-unknown-elf-elf2hex --bit-width $(if $(findstring rv64,$*),64,32) --input $< --output $@
%.elf.objdump.addr: %.elf.objdump
$(TARGET).elf.objdump.addr: $(TARGET).elf.objdump
extractFunctionRadix.sh $<
$(TARGET).objdump: $(TARGET).elf
riscv64-unknown-elf-objdump -D $(TARGET).elf > $(TARGET).objdump
$(TARGET).elf.objdump: $(TARGET).elf
riscv64-unknown-elf-objdump -D $(TARGET).elf > $(TARGET).elf.objdump
$(TARGET).elf: $(TARGET).S Makefile
riscv64-unknown-elf-gcc -g -o $(TARGET).elf -march=rv64gc -mabi=lp64 -mcmodel=medany \
-nostartfiles -T../../link/link.ld $(TARGET).S
-nostartfiles -T$(WALLY)/examples/link/link.ld $(TARGET).S
sim:
spike +signature=$(TARGET).signature.output +signature-granularity=8 $(TARGET)
spike --isa=rv64gc +signature=$(TARGET).signature.output +signature-granularity=8 $(TARGET).elf
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
rm -f $(TARGET).elf $(TARGET).elf.*

View File

@ -3,13 +3,22 @@
// 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, 0x7ff8000000000000
fmv.w.x f9, x1
fsgnjx.s f12,f9,f4 # expected f 0xffffffff7fc00000
.global rvtest_entry_point
rvtest_entry_point:
# openhwgroup/cvw Issue #55
la a6, begin_signature
la a7, rvtest_data
fadd.d ft0, ft1, ft2
fld f4, 0(a7)
fld f9, 8(a7)
# li x1, 0x7ff0000000000001
# sd x1, 0(a6)
# fmv.w.x f4, x1
# li x1, 0x7ff8000000000000
# fmv.w.x f9, x1
fsgnjx.s f12,f9,f4 # expected f 0xffffffff7fc00000
fsd f12, 0(a6)
#########################
# HTIF and signature
@ -23,14 +32,20 @@ write_tohost:
self_loop:
j self_loop # wait
.align 6
.section .tohost
tohost: # write to HTIF
.dword 0
fromhost:
.dword 0
.align 6
.data
rvtest_data:
.dword 0x7ff0000000000001
.dword 0x7ff8000000000000
.EQU XLEN,64
begin_signature:
.fill 2*(XLEN/32),4,0xdeadbeef #