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

Various DV fixes #2183

Merged
merged 7 commits into from
Jul 3, 2024
Merged

Various DV fixes #2183

merged 7 commits into from
Jul 3, 2024

Conversation

GregAC
Copy link
Collaborator

@GregAC GregAC commented Jul 1, 2024

As part of my deep dive regression triage I've been fixing up a few things.

With this set of fixes we can hit 95 - 96% pass rate

They require an updated spike, PR is here: lowRISC/riscv-isa-sim#25.

Once that's merged I can kick off a binary build in CI and then update the cosim version we point to which will allow CI to pass on this commit.

@GregAC GregAC changed the title Clean various fixes Various DV fixes Jul 1, 2024
Copy link
Contributor

@rswarbrick rswarbrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks sensible, but there are a couple of slight tidy-ups that I think are worth doing.

I also notice that Verible claims some over-long lines (not caused by this PR). Are you happy to address those in a separate PR?

dv/cosim/spike_cosim.cc Outdated Show resolved Hide resolved
dv/cosim/spike_cosim.cc Outdated Show resolved Hide resolved
dv/cosim/spike_cosim.cc Show resolved Hide resolved
dv/cosim/spike_cosim.cc Outdated Show resolved Hide resolved
Where an access is unaligned Ibex splits it into two transactions, each
of which undergoes a PMP check. It is possible for the first half to
fail a PMP check and the second to succeed and hence produce a request
on the memory interface.

In Spike it accesses memory byte by byte and if it encounters a PMP
error for a particular byte it won't try any further bytes.

This results in a mis-match between Ibex and spike when an unaligned
transaction is split across two PMP regions, one of which allows the
access and the other doesn't. Ibex generates a transaction and spike
doesn't producing an error.

This adds a fixup into the co-simulation environment. It detects when we
have an access that fails PMP that is misaligned. Where this has
resulted in Ibex producing a memory request that spike would not we
remove it from the list of memory requests to check after checking that
the request passes PMP within spike.
The 'pre_val' MIP addresses the scenario where MIP changes as an
instruction is excuting, this means a CSR instruction can observe a
different MIP from the one that decides whether or not that instruction
will be interrupted.
The cosimulation environment does not know if a memory access from spike
is due to an instruction fetch or a data memory access. It uses a
heuristic to differentiate the two. Any access between the PC and the PC
+ 8 is considered an instruction fetch.

This heuristic did not correctly handle addresses at the top of the
range where the PC + 8 calculation overflows. This commit fixes the top
of range handling.
When an interrupt is raised the Ibex controller will move from the
DECODE state to the IRQ_TAKEN state when it chooses to handle the
interrupt. When in IRQ_TAKEN it's possible for the interrupt state to
change again which aborts the interrupt entry. This leads to mis-matches
against cosim.

This change adds a warning to flag up cases where this has occurred to
enable quick triage of failures related to this scenario.
@GregAC GregAC force-pushed the clean_various_fixes branch 3 times, most recently from fa53ff4 to f94cf96 Compare July 3, 2024 14:20
Copy link
Contributor

@rswarbrick rswarbrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks.

@GregAC GregAC added this pull request to the merge queue Jul 3, 2024
Merged via the queue into lowRISC:master with commit 3384bf4 Jul 3, 2024
11 checks passed
@GregAC GregAC deleted the clean_various_fixes branch July 3, 2024 19:20
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.

2 participants