wfi trace mismatch
Created by: davidharrishmc
We've fixed the previous bug that wfi didn't retire in Wally. Now we have a new disagreement with ImperasDV that seems to show Wally retiring a wfi, while ImperasDV doesn't retire it. Reproduce with
run-elf.bash --elf tests/riscof/work/wally-riscv-arch-test/rv64i_m/privilege/src/WALLY-wfi-01.S/ref/ref.elf
Wally executes a wfi at 8000088c and waits until the MTimerInterrupt fires. The trace below shows the DUT reporting the wfi retiring, but ref not reporting the wfi retiring. Hence, DUT.PC = 8000088c when the wfi retires, but ref.PC = 8000045c because it goes straight to the trap handler without reporting WFI retiring. On the next step, DUT.PC goes to 8000045c when the interrupt occurs.
@eroom1966
can you advise on how to keep the trace happy?
Thank you,
David
`` ` [NOTE] testbench.idv_trace2log.process_event @ 5370: RET,0,281,80000888,"00c08093 addi x1,x1,12 ",x1=0000000080000890,,,CSRb00(mcycle)=0000000000000214 CSRb02(minstret)=0000000000000119, Info 281: 'refRoot/cpu', 0x0000000080000888(nowrap+8): Machine 00c08093 addi x1,x1,12 Info MEMX 0x80000888 0x80000888 2 8093 Info MEMX 0x8000088a 0x8000088a 2 00c0 Info x1 0000000080000884 -> 0000000080000890
[NOTE] NET,606,MTimerInterrupt,1
[NOTE] testbench.idv_trace2log.process_event @ 6170: RET,0,282,8000088c,"10500073 wfi ",,,,CSR300(mstatus)=0000000a00001880 CSR341(mepc)=0000000080000890 CSR342(mcause)=8000000000000007 CSR344(mip)=0000000000000080 CSRb00(mcycle)=0000000000000264 CSRb02(minstret)=000000000000011a,
Error (IDV) The reference model is unable to find a legal set of actions to converge to the provided DUT state.
Info (IDV) Reference model mode (HartId: 0):
Info (IDV) Machine - Machine mode
Info (IDV) Pending net changes:
Info (IDV) - Group 0:
Info (IDV) - MTimerInterrupt => 1, age = 11 cycles, 0 retires
Info (IDV) DUT state change (hartId: 0):
Info (IDV) - dut.pc - 0x000000008000088c nowrap+12
Info (IDV) - dut.mstatus - 0x0000000a00001880 SD:0 MBE:0 SBE:0 SXL:2 UXL:2 TSR:0 TW:0 TVM:0 MXR:0 SUM:0 PRV:0 XS:0(Off) FS:0(Off) MPP:3 VS:0(Off) SPP:0 MPIE:1 UBE:0 SPIE:0 MIE:0 SIE:0
Info (IDV) - dut.mepc - 0x0000000080000890
Info (IDV) - dut.mcause - 0x8000000000000007 Interrupt:1 Code:7(Machine timer interrupt)
Info (IDV) - dut.mip - 0x0000000000000080
Info (IDV) - dut.mcycle - 0x0000000000000264
Info (IDV) - dut.minstret - 0x000000000000011a
Info (IDV) Reference state change evaluation tree (HartId: 0):
Info (IDV) + Net MTimerInterrupt => 0x1 { when:606 }
Info (IDV) + Exception { pc:0x8000088c(nowrap+12), mcause:0x8000000000000007, mstatus:0xa00001880 }
Info (IDV) + Retire { pc:0x8000045c(trap_handler_m+28) }
Info (IDV) > dut.pc - 0x000000008000088c nowrap+12
Info (IDV) ref.pc - 0x000000008000045c trap_handler_m+28
Info (IDV) > dut.mepc - 0x0000000080000890
Info (IDV) ref.mepc - 0x000000008000088c
Info (IDV)
Info (IDV) + Retire { pc:0x8000088c(nowrap+12) }
Info (IDV) > dut.mstatus - 0x0000000a00001880 SD:0 MBE:0 SBE:0 SXL:2 UXL:2 TSR:0 TW:0 TVM:0 MXR:0 SUM:0 MPRV:0 XS:0(Off) FS:0(Off) MPP:3 VS:0(Off) SPP:0 MPIE:1 UBE:0 SPIE:0 MIE:0 SIE:0
Info (IDV) ref.mstatus - 0x0000000a00000008 SD:0 MBE:0 SBE:0 SXL:2 UXL:2 TSR:0 TW:0 TVM:0 MXR:0 SUM:0 MPRV:0 XS:0(Off) FS:0(Off) MPP:0 VS:0(Off) SPP:0 MPIE:0 UBE:0 SPIE:0 MIE:1 SIE:0
Info (IDV) > dut.mepc - 0x0000000080000890
Info (IDV) ref.mepc - 0x0000000000000000
Info (IDV) > dut.mcause - 0x8000000000000007 Interrupt:1 Code:7(Machine timer interrupt)
Info (IDV) ref.mcause - 0x0000000000000000 Interrupt:0 Code:0(Instruction address misaligned)
Info (IDV)
Info (IDV) No state change found for reference to converge to DUT state.
Warning (IDV) The reference is being forced to converge to the DUT state, results that follow should be treated with caution.
[ERROR] testbench.idv_trace2api.state_compare @ 6170: MISMATCH
...
[NOTE] testbench.idv_trace2log.process_event @ 6410: RET,0,283,8000045c,"1e00006f j 8000063c ",,,,CSRb00(mcycle)=000000000000027c CSRb02(minstret)=000000000000011b,
Info (IDV) hart0 PC has been resynchronized to 8000045c
Info mstatus 0000000a00000008 -> 0000000a00001880 [SD:0 MBE:0 SBE:0 SXL:2 UXL:2 TSR:0 TW:0 TVM:0 MXR:0 SUM:0 MPRV:0 XS:0(Off) FS:0(Off) MPP:0->3 VS:0(Off) SPP:0 MPIE:0->1 UBE:0 SPIE:0 MIE:1->0 SIE:0]
Info mepc 0000000000000000 -> 0000000080000890
Info mcause 0000000000000000 -> 8000000000000007 [Interrupt:1 Code:7(Machine timer interrupt)]
`
``