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 issues related to successive mtspr/mtspr instructions #124

Merged
merged 5 commits into from
Jul 1, 2021

Conversation

stffrdhrn
Copy link
Member

Issue #122

Writing to the tlb rams was dependent on the spr_bus_ack as a means
to only write during the first cycle after a spr_bus_stb_i. This works
fine for a single write, but if we have a write to itlb_match_spr
followed by itlb_trans_spr the spr_bus_ack never goes low so the write
to itlb_trans_spr is skipped.

Fix this by using the itlb_match_spr_cs_r and itlb_trans_spr_cs_r
signals to control the "first cycle after spr_bus_stb_i" condition. This
way writes can happen independently.

Note, there may still be issues with a write to itlb_match followed by
another write to itlb_match. Fixing that requires changing the "first
cycle after spr_bus_stb_i" policy, which is similar to dmmu.

stffrdhrn added 5 commits July 1, 2021 16:25
Issue openrisc#122

Writing to the tlb rams was dependent on the spr_bus_ack as a means
to only write during the first cycle after a spr_bus_stb_i.  This works
fine for a single write, but if we have a write to itlb_match_spr
followed by itlb_trans_spr the spr_bus_ack never goes low so the write
to itlb_trans_spr is skipped.

Fix this by using the itlb_match_spr_cs_r and itlb_trans_spr_cs_r
signals to control the "first cycle after spr_bus_stb_i" condition. This
way writes can happen independently.

Note, there may still be issues with a write to itlb_match followed by
another write to itlb_match.  Fixing that requires changing the "first
cycle after spr_bus_stb_i" policy, which is similar to dmmu.
This was not connected.
Issue openrisc#122

This fixes case 1 from issue 122 where writes are missed after
invalidate state.

The change to invalidate_ack to to allow the invalidate_ack to
be asserted after the invalidate happens not before.

For writes we allow forwarding to WRITE state directly from invalidate
at this point pending_write will still be high and we can use that
to initialiate the write.  When we have delays the cpu_req_i may be
low when we get to the write state.
Issue openrisc#122

An additional fix for back to back spr writes.  I was seeing that during
back to back writes the busy_o signal would go low after the first spr
write complete. This caused the fetch to proceed and present bad data to
the bus caused by the second in-progress write.  This is because ack
goes high during the first write and stays high as long as we are
writing.

Introducing a busy tracker based on the assuming that spr transactions
take 2 clocks to complete.
@stffrdhrn stffrdhrn changed the title Fix issue with multiple mtspr insns Fix issues related to successive mtspr/mtspr instructions Jul 1, 2021
@stffrdhrn
Copy link
Member Author

This should fix all of #122 now as the test case passes for me know. This also fixes a trivial issue found related to cache hits not being forwarded to the performance counters.

@stffrdhrn
Copy link
Member Author

If anyone has time please help review @olofk @bandvig @wallento @juliusbaxter @skristiansson, it does pass tests.

@skristiansson skristiansson merged commit b234f27 into openrisc:master Jul 1, 2021
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