-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with multiple bit manipulation instructions #51
Comments
@itsomaia I'm a little confused as to how this occurred. Going by what's on your waveform the issue is The RTL that generates the cheriot-ibex/rtl/ibex_decoder.sv Lines 248 to 255 in eedb0ac
Notably it involves the top level Have you constrained If it is constrained can you confirm |
Hello @GregAC, Thank you for your response. I have already constrained cheri_pmode_i to 1. You can see in the attached .vcd file and the new waveform. The raddr_a signal, which causes illegal_reg_cheri to go high, can change, as shown in the code and reflected in the waveform, depending on whether the instruction is in its first cycle or not. cheriot-ibex/rtl/ibex_decoder.sv Lines 209 to 210 in eedb0ac
.vcd for this case: If you need more information, please let me know. |
@itsomaia , this seems to have something to do with RV32B support configured (what parameter value are you using?). Basically there is a multi-cycle RV32B instruction involves rs3 in this case. |
Looking further into the issue, the culprit seems to be that the id_fsm_d logic can't handle exception being issued in the 2nd half of a multi-cycle instruction. Specifically, the illegal_reg_cheri results in an EX stage exception but instr_kill is only raised in the 2nd half of a bit manipulation instruction (when rs3 is accessed). In this case multicycle_done is never issued and thus id_fsm_q will not updated properly. @GregAC do you plan to keep supporting the bit instructions with rs3? if so I can try fix the behavior in cheriot-ibex. You may want to take a look at the upstream ibex implementation as well. |
@kliuMsft the 3rd register operand is used by the non-ratified Zbt extension which we do support in Ibex but isn't part of the ratified v1.0 bitmanip spec (it comes from the earlier v0.93 spec). I think this issue will only occur in RV32E configurations (as in relies on an exception caused by trying to access a register index of 16 or above) so it wouldn't be a high priority fix for us but something we should sort out. My preferred fix here would be to alter the way the register index out of range error is calculated. Currently it's based on the register addresses being output: cheriot-ibex/rtl/ibex_decoder.sv Lines 238 to 255 in eedb0ac
I think that could be simply refactored to look at This also means no refactoring of the state machine to deal with an instruction under going a multi-cycle execution taking an exception (ignoring this problem it should be the case that either an instruction takes an exception before beginning multi-cycle execution or once that has begun we're guaranteed that execution can complete without an exception, though its result may get discarded if the instruction ahead in the WB stage takes an exception). |
Commit d7d4818 should fix the issue. @GregAC please review. |
Observed Behavior
In the case of multiple bit manipulation instructions, such as BINVI, the result of the operation is computed incorrectly due to an incorrect operand. The operand value passed from the decode stage and the input of the ALU, differ from the value used in the operation. This issue arises because the core incorrectly assumes it is not in the first cycle for BINVI, even though it is, due to an illegal CHERI exception that occurred a few cycles earlier.
Please see the waveform for more details.
Expected Behavior
Getting correct operands for the instruction.
Steps to reproduce the issue
Illegal_reg_cheri exception before the bit manipulation instructions.
My Environment
Running formalISA v 3.0 app with Cadence JasperGold 2023.09
EDA tool and version:
Running formalISA v 3.0 app with Cadence JasperGold 2023.09
Operating system:
Running formalISA v 3.0 app with Cadence JasperGold 2023.09
Version of the Ibex source code:
The text was updated successfully, but these errors were encountered: