I am running an RV64IMZicsr_Zifencei DUT against SAIL and I am struggling to understand why the elf's generated for the Ref and DUT differ on this single instruction:
This section of code checks mcause against a mask, 0xB0FB or 0xB0F3.
If the mask bit associated with the given mcause value is set (i.e 3rd bit for mcause = 3), then it proceeds to check if mtval holds the PC for the exception thrown, writing the offset from the beginning of the test to the signature file.
If the same bit is clear, then the test assumes that mtval contains zero and writes that to the signature.
This behavior seems to correspond to the mtval_update config in the riscv-config, but changing this value has no effect.
Essentially what I am running into is that the Ref test executable seems to always assume that mtval=0 after EBREAK (without checking), while the DUT executable expects mtval=PC after EBREAK.
If I modify the DUT's elf so that this mask is the same as the instruction in the Ref's elf, the test passes, otherwise the test fails. Likewise, If I modify the Ref's elf file so that the mask matches the DUT, the test passes.
If both tests have 8000091c: 0fb40413, the signatures match
If both tests have 8000091c: 0f340413, the signatures match
If the tests have different values here (specifically if bit 3 is different) the signatures will not match
It does not seem correct to me that the DUT and Ref could possibly have different expectations during the test like this.
I am running an RV64IMZicsr_Zifencei DUT against SAIL and I am struggling to understand why the elf's generated for the Ref and DUT differ on this single instruction:
This section of code checks
mcause
against a mask,0xB0FB
or0xB0F3
.mcause
value is set (i.e 3rd bit formcause = 3
), then it proceeds to check ifmtval
holds the PC for the exception thrown, writing the offset from the beginning of the test to the signature file.mtval
contains zero and writes that to the signature.This behavior seems to correspond to the mtval_update config in the riscv-config, but changing this value has no effect.
Essentially what I am running into is that the Ref test executable seems to always assume that
mtval=0
afterEBREAK
(without checking), while the DUT executable expectsmtval=PC
afterEBREAK
.If I modify the DUT's elf so that this mask is the same as the instruction in the Ref's elf, the test passes, otherwise the test fails. Likewise, If I modify the Ref's elf file so that the mask matches the DUT, the test passes.
8000091c: 0fb40413
, the signatures match8000091c: 0f340413
, the signatures matchIt does not seem correct to me that the DUT and Ref could possibly have different expectations during the test like this.
My isa.yaml:
and my platform.yaml:
And here is the source for my project if needed: rv-application-rough-RV64IMZicsr_Zifencei.zip