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

🐛 fix bug in CPU counter overflow logic #310

Merged
merged 4 commits into from
May 5, 2022
Merged

Conversation

stnolting
Copy link
Owner

@stnolting stnolting commented May 5, 2022

This PR fixes a bug in the CPU's counter overflow logic (low-word to high-word): the overflow bit, which is used as "carry input" for the high-word register, has to be cleared immediately when the counter-incrementing event is not valid anymore.

Affected CPU counters:

  • cycle -> cycleh
  • instret -> instreth
  • hpmcounter* -> hpmcounter*h

Furthermore, this PR does some minor optimizations of the CPU's B instruction decoding and the execution core (one state less in the central FSM).

@stnolting stnolting added bug Something isn't working HW hardware-related labels May 5, 2022
@stnolting stnolting self-assigned this May 5, 2022
@stnolting stnolting marked this pull request as ready for review May 5, 2022 14:10
@stnolting stnolting merged commit a76b45a into main May 5, 2022
@stnolting stnolting deleted the cnt_overflow_bug_fix branch May 5, 2022 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working HW hardware-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant