-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Branch prediction processor #289
base: master
Are you sure you want to change the base?
Conversation
Awesome for taking a stab at this, can't wait to try it out! Its a big PR so let's make sure that we take our time and get it right - given the size I'll be reviewing it in stages. My first major comment before going into the nitty gritty details is that I think it would be elegant if the branch predictor work is detached from the notion that it's a RISCV processor that it's executing under. This would mean that checks for risc-v specific branch-like instructions aren't done inside the branch predictor tab/whereever this is done. Instead, processors should announce whether they support a branch predictor interface, and said interface should communicate ISA-agnostic information. I imagine it should be fairly simple to come up with an ISA-agnostic interface for this (i.e. "Is the current instruction a branch-like instruction? what is the branch target? branch taken, not taken, ...). In line with the above, i'd also like to see the branch predictors themselves conform to some form of interface which each predictor type inherits. This will clean up your code a lot (i.e. a separate class for Third, do you think it is possible that we can do some form of inheritance between e.g. |
I'll work on fixing the failed checks then try and work on what you noted, however it might prove difficult to "detach" the branch predictor from the processor implementation considering that the branch predictor itself is part of the processor hardware. But, I will definitely attempt regardless because I would find it valuable to make it more generic and extendable. I'll take the time to make sure it's done right. |
Oh most definitely, and there's probably no way around having to have an e.g. "RISC-V branch predictor"-gasketmodule. But that should just be a gasket which performs any intermediate conversions required to use the generic branch predictor model. |
Implemented a 5-stage branch prediction processor, along with a tab to control its properties like predictor type and whatnot, along with statistics and visualizations of internal state. Once the processor with branch prediction is selected through the processor selection menu, the branch prediction tab is enabled. The processor will hold its internal state through different program changes and reloads, allowing multiple iterations of running a single program or seeing how different programs interact through the predictor. The user can reset the state at any time if they wish. It supports reversing execution, RV32IMC, and RV64IMC.
Small note: the test programs (such as tst_riscv) supplied with Ripes do not work with the processor, but I did run each test assembly file manually and they all were successful. The errors (usually segmentation faults) originate from different places at different times, sometimes consistent between runs and sometimes producing different errors. Possible race condition?
However, in the Ripes software itself, it is very stable and error free, at least as far as I've been able to test.
If there's any changes that need to be made, I'd be more than glad to do them, and any guidance on the aforementioned issue would be greatly appreciated.