mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Started making debug testcase
This commit is contained in:
		
							parent
							
								
									88ef0503fd
								
							
						
					
					
						commit
						0f7ea52f9b
					
				
							
								
								
									
										27
									
								
								tests/custom/debug/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								tests/custom/debug/Makefile
									
									
									
									
									
										Normal 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 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
							
								
								
									
										42
									
								
								tests/custom/debug/debug.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								tests/custom/debug/debug.S
									
									
									
									
									
										Normal 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: | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user