Skip to content
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

Bus_keeper module incorrectly generates bus errors #314

Closed
GideonZ opened this issue May 12, 2022 · 4 comments · Fixed by #315
Closed

Bus_keeper module incorrectly generates bus errors #314

GideonZ opened this issue May 12, 2022 · 4 comments · Fixed by #315
Assignees
Labels
bug Something isn't working as expected HW Hardware-related

Comments

@GideonZ
Copy link
Collaborator

GideonZ commented May 12, 2022

Observed behavior
NeoRV32 crashes at random when executing from external DDR2 memory.

Cause
The bus_keeper module incorrectly generates an internal bus error on an external cycle when the wishbone acknowledge arrives exactly when the internal bus cycle timeout counter is at zero. Not before, not after; only exactly at zero. It seems that this happens because the bus_xip_i signal is zero in this cycle, so the cycle is incorrectly marked as internal.

Screenshots
image

@stnolting
Copy link
Owner

stnolting commented May 12, 2022

I have heard about problems where the external memory access latency is close to the internal timeout value, but I thought these problems were caused by some improper handling of the wishbone handshake... Seems like this is my fault 😅

Thanks for the great problem description! 👍
I think this can be easily fixed without additional logic. I will do some tests and after that I'll propose a PR to (hopefully) fix this.

@stnolting stnolting added bug Something isn't working as expected HW Hardware-related labels May 12, 2022
@stnolting stnolting self-assigned this May 12, 2022
@stnolting
Copy link
Owner

I am trying to reproduce the error. I can see that the BUSKEEPER assert it's ERROR signal - but 1 cycle after the ACK has been sent to the CPU. So the CPU does not raise an exception. Can you confirm this?

However, for debugging the internal bus this is bad. I have made a simple update in #315 that seems to fix this issue.

@GideonZ
Copy link
Collaborator Author

GideonZ commented May 13, 2022

I merged the changes from the branch 'hotfix_buskeeper' into my branch and built the FPGA. I can indeed see that the error signal still fires, but the CPU no longer traps. My FreeRTOS test program now runs continuously. (Another that runs fine on Nios-II still crashes on RiscV, so I am not 'there' yet.) Thank you for the quick turnaround on this bug! You fixed it faster than I could find it!

@stnolting
Copy link
Owner

stnolting commented May 13, 2022

I merged the changes from the branch 'hotfix_buskeeper' into my branch and built the FPGA. I can indeed see that the error signal still fires, but the CPU no longer traps.

The CPU does not raise an exception if ERR is asserted right after ACK has been asserted. This is because of some recent changes in the CPU's bus unit (#303).

However, the BUSKEEPER should not assert it's ERROR signal anymore when using the (latest) changes from #315. This is what my test looks like - same scenario (I think) as in your setup: access to external memory via Wishbone; external memory has an access latency of 15 cycles (= max_proc_int_response_time_c):

buskeeper

stnolting added a commit that referenced this issue May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected HW Hardware-related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants