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

priv unit: delay interrupt until ex_mem_stall goes low #43

Open
wants to merge 1 commit into
base: stage3
Choose a base branch
from

Conversation

devins2518
Copy link

@devins2518 devins2518 commented Mar 8, 2025

This PR fixes an issue where if the pipeline contains a jump instruction in execute and a load/store in memory when an interrupt is fired. In this case, the interrupt will fire, save the jump as the mepc, and insert the interrupt PC into the fetch stage. However, when the jump executes, the interrupt PC in the previous stage will be squashed giving incorrect behavior.
30122fcc-4131-4e1a-857f-a0dc58df2c85

After these changes, loads/stores will cause the interrupt to be stalled until the memory request completes.
Screenshot 2025-03-07 at 6 15 47 PM

The int_during_ret and bus_fault tests time out before and after this change, all other interrupt-exceptions tests continue to pass.

This won't cause any unintended effects to say tight loops which do many loads and stores since as soon as the first load/store completes, it will service the interrupt.

…injection

This fixes an issue where the pipeline is [garbage, jump, load] when the
interrupt is fired. After the interrupt fires and the PC is injected,
the pipeline becomes [interrupt, jump, load]. After the load completes,
the pipeline is [garbage, interrupt, jump] the jump flushes the
interrupt pc from execute so the pipeline becomes [jump dest, bubble,
bubble]. By injecting the PC the entire time `ex_mem_stall` is high,
when the load/store completes, the `ex_flush_hazard` signal will go high
and properly flush the jump. [interrupt, jump, load] -> [interrupt,
bubble, bubble]
@devins2518 devins2518 requested a review from cole-nelson March 8, 2025 00:22
@cole-nelson cole-nelson requested a review from wrcunnin March 10, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant