-
Notifications
You must be signed in to change notification settings - Fork 38
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
Store-to-load forwarding when cache miss in Lsu2 Plugin #43
Comments
Hi, Congratulation for being able to read the LSU2 monolite :) So, yes you are right i think, when store to load bypass happen, we don't need a cache hit, but there is one very corner case thing :
Very corner case. |
Hi, Thanks for your response. I don't know if I can understand all of LSU2, but I'm trying. It's such a complex thing in an out-of-order core, congratulations on developing it. Yes, you're right, I hadn't thought about that scenario, which is very interesting, you really have to think about everything. |
Hi,
Debugging things is kind of easy, as long as the CPU behaviour is cross checked against a reference RISC-V model to catch the issue as soon as it happens. The main issue i git is to get "interresting" stimulus. https://github.com/chipsalliance/riscv-dv is unfortunatly System verilog, so not realy open-source dev friendly. Currently i'm mostly using "booting linux" as a "indepth" stimulus generator, which isn't realy great XD |
Hi @Dolu1990,
I'm currently studying the Lsu2 plugin, and I may have an optimisation to suggest.
When a load instruction is processed in
sharedPip
, we check whether an older store instruction points to the same address in thecheckSqMask
andcheckSqArbi
stages.If we detect an older store instruction with the same address, we have
OLDER_STORE_HIT = True
, and if this store is not waiting for address translation, we haveOLDER_STORE_BYPASS_SUCCESS = True
.So, if this is the case, we're performing store-to-load forwarding, the data from the store is transmitted to the load, and written to the register.
Finally, if I've understood correctly, at the
ctrl
stage, we should enter theSUCCESS
state, to indicate that the load instruction has been executed successfully. This is the case when the cache response is a cache hit.However when the cache response in
cacheRsp
stage is a cache miss, we enterLOAD_MISS
state inctrl
stage asrsp.redo = True
.NaxRiscv/src/main/scala/naxriscv/lsu2/Lsu2Plugin.scala
Line 1160 in d7213a3
We will have to wait for the cache refill before entering the
SUCCESS
state, even if we already have the data we need to load.My suggestion is to modify the above line in the Lsu2 plugin to avoid the
LOAD_MISS
state and enter theSUCCESS
state directly when there is a store-to-load forwarding.By doing this :
I hope I've understood your plugin correctly, and that I haven't forgotten something that would make my suggestion invalid.
Thank you in advance for your feedback
The text was updated successfully, but these errors were encountered: