At somewhere like AM, the return value of the main function is also used as the trap value (trm.c). However, currently, our trap value is only 3-bit-wide, which may lead to the situation where returning a non-zero value in the main function but difftest still HIT GOOD TRAP.
In fact, some of our users have encountered this issue while using AM to write test cases, and they hope that we can expand the width of the trap value. I believe this requirement is reasonable as it can help to use different return values to determine the accurate location and the specific reason of an abnormal exit.
Regarding the potential performance impact caused by expanding the bit width of the trap value, I have consulted @klin02 and he believe it has almost no impact on pldm.
As for the compatibility impact, chisel will automatically zero-extend the right values of UInt types. For return values larger than 7, we may think them as "reserved", and difftest framework also reports unknown trap reason for those trapcode currently (on verilator and vcs).
At somewhere like AM, the return value of the main function is also used as the trap value (trm.c). However, currently, our trap value is only 3-bit-wide, which may lead to the situation where returning a non-zero value in the main function but difftest still HIT GOOD TRAP.
In fact, some of our users have encountered this issue while using AM to write test cases, and they hope that we can expand the width of the trap value. I believe this requirement is reasonable as it can help to use different return values to determine the accurate location and the specific reason of an abnormal exit.
Regarding the potential performance impact caused by expanding the bit width of the trap value, I have consulted @klin02 and he believe it has almost no impact on pldm.
As for the compatibility impact, chisel will automatically zero-extend the right values of UInt types. For return values larger than 7, we may think them as "reserved", and difftest framework also reports unknown trap reason for those trapcode currently (on verilator and vcs).