rv32-sail icon indicating copy to clipboard operation
rv32-sail copied to clipboard

Smoke tests fail spectacularly in WASM build

Open thoughtpolice opened this issue 6 years ago • 0 comments

Issue description

The smoke.elf test currently doesn't pass in the WASM build for some reason. In fact, it gets nowhere at all: the very first lui test immediately errors out, causing the whole demo to fail.

It's unclear to me exactly why this happens, especially given the fact that many more complete programs such as coremark, dhrystone, and even my very strange forth nonsense -- work correctly. I have not looked closely at this issue -- in fact, almost not at all. Therefore, I believe it could either be:

  • An extremely obvious bug somewhere (copy paste, another callee/save register disaster?), or, alternatively,
  • An extremely powerful ghost that will haunt us for over 1,000 years.

Steps to reproduce

Visit https://riscv.ls0f.pw and when the page loads, and open your magical Developer Tools (Ctrl+Shift+J). Reload the page (Ctrl+Shift+R), in order to watch the network requests and sources. Modify the main.js file, adding the smoke entry to validDemos, so that the command line will accept it. Reload the page (Ctrl+Shift+R) again. Then watch things explode badly.

image

image

Technical details

run smoke.elf -C debug.print_info=1 -C debug.disasm_ops=1 can get us an execute trace:

rv32> run smoke.elf -C debug.print_info=1 -C debug.disasm_ops=1
Loading smoke.elf...

[Sail] Allocating new block 0x0
[Sail] ELF Initial PC: 0x0
[Sail] Executing reset vector...
[Sail] Fetch - 0x00000000: nop
[Sail] Fetch - 0x00000004: nop
...
[Sail] Fetch - 0x0000A918: lb a1, a2, 0x000
[Sail] Fetch - 0x0000A91C: beq 
[Sail] Fetch - 0x0000A92C: j 0x001F9518
[Sail] Fetch - 0x00003E44: li a0, 0x000
[Sail] Fetch - 0x00003E48: lui a2, 0x00004
[Sail] Fetch - 0x00003E4C: addi a2, a2, 0xE64
[Sail] Fetch - 0x00003E50: lb a1, a2, 0x000
[Sail] Fetch - 0x00003E54: beq 
[Sail] Fetch - 0x00003E58: ecall  
[Sail] Fetch - 0x00003E5C: addi a2, a2, 0x001
[Sail] Fetch - 0x00003E60: j 0x001FFFF0
[Sail] Fetch - 0x00003E50: lb a1, a2, 0x000
[Sail] Fetch - 0x00003E54: beq 
[Sail] Fetch - 0x00003E58: ecall  
[Sail] Fetch - 0x00003E5C: addi a2, a2, 0x001
[Sail] Fetch - 0x00003E60: j 0x001FFFF0
[Sail] Fetch - 0x00003E50: lb a1, a2, 0x000
[Sail] Fetch - 0x00003E54: beq 
[Sail] Fetch - 0x00003E58: ecall  
[Sail] Fetch - 0x00003E5C: addi a2, a2, 0x001
[Sail] Fetch - 0x00003E60: j 0x001FFFF0
[Sail] Fetch - 0x00003E50: lb a1, a2, 0x000
[Sail] Fetch - 0x00003E54: beq 
[Sail] Fetch - 0x00003E68: li a1, 0x03A
[Sail] Fetch - 0x00003E6C: ecall  
[Sail] Fetch - 0x00003E70: li a1, 0x020
[Sail] Fetch - 0x00003E74: ecall  
[Sail] Fetch - 0x00003E78: lui ra, 0x00000
[Sail] Fetch - 0x00003E7C: li t4, 0x000
[Sail] Fetch - 0x00003E80: li t3, 0x002
[Sail] Fetch - 0x00003E84: bne 
[Sail] Fetch - 0x00003E88: lui ra, 0xFFFFF
[Sail] Fetch - 0x00003E8C: srai ra, ra, ra
[Sail] Fetch - 0x00003E90: li t4, 0x800
[Sail] Fetch - 0x00003E94: li t3, 0x003
[Sail] Fetch - 0x00003E98: bne 
[Sail] Fetch - 0x00003ED8: li a0, 0x000
[Sail] Fetch - 0x00003EDC: li a1, 0x045
[Sail] Fetch - 0x00003EE0: ecall  
[Sail] Fetch - 0x00003EE4: li a1, 0x052
[Sail] Fetch - 0x00003EE8: ecall  
[Sail] Fetch - 0x00003EEC: li a1, 0x052
[Sail] Fetch - 0x00003EF0: ecall  
[Sail] Fetch - 0x00003EF4: li a1, 0x04F
[Sail] Fetch - 0x00003EF8: ecall  
[Sail] Fetch - 0x00003EFC: li a1, 0x052
[Sail] Fetch - 0x00003F00: ecall  
[Sail] Fetch - 0x00003F04: li a1, 0x00A
[Sail] Fetch - 0x00003F08: ecall  
lui: ERROR
[Sail] Fetch - 0x00003F0C: ebreak  
[Sail] Trap (EBREAK) encountered - exiting
[Sail] Finished!
[Sail] Register dump:
x0:     0x00000000 ra:  0x7FFFF800 sp:  0x0000FFE0 gp:  0xDEADBEEF 
tp:     0xDEADBEEF t0:  0x00000000 t1:  0x00000000 t2:  0x00000000 
fp:     0x00000000 s1:  0x00000000 a0:  0x00000000 a1:  0x0000000A 
a2:     0x00003E67 a3:  0x00000000 a4:  0x00000000 a5:  0x00000000 
a6:     0x00000000 a7:  0x00000000 s2:  0x00000000 s3:  0x00000000 
s4:     0xDEADBEEF s5:  0xDEADBEEF s6:  0x0000FFE0 s7:  0x00000000 
s8:     0x00000000 s9:  0x00000000 s10: 0x00000000 s11: 0x00000000 
t3:     0x00000003 t4:  0xFFFFF800 t5:  0x00000000 t6:  0x00000000 

[Sail] Executed Instructions: 217
[Sail] Nanoseconds Elapsed:   24000000
[Sail] Approximate IPS:       9041

thoughtpolice avatar Feb 05 '19 17:02 thoughtpolice