Skip to content

Conversation

@KushalMeghani1644
Copy link
Contributor

This PR implements the DPC CSR for RISC-V

Related to #1

@KushalMeghani1644 KushalMeghani1644 requested a review from a team as a code owner November 8, 2025 12:10
romancardenas
romancardenas previously approved these changes Nov 8, 2025
Copy link
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

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

LGTM

@KushalMeghani1644
Copy link
Contributor Author

KushalMeghani1644 commented Nov 9, 2025

Great! @romancardenas is there any improvements to be made? or is just a quick merge? :)

@romancardenas
Copy link
Contributor

Let's leave a few days in case someone from the WG wants to do a second review.

@KushalMeghani1644
Copy link
Contributor Author

Alright! no probs :) either way that would ensure a clean implementation!

Copy link
Contributor

@rmsyn rmsyn left a comment

Choose a reason for hiding this comment

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

Small non-blocking suggestions, otherwise LGTM.

read_write_csr! {
/// Debug PC Register
Dpc: 0x7b1,
mask: !1usize,
Copy link
Contributor

Choose a reason for hiding this comment

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

What are you basing this alignment on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Debug Spec defines dpc as holding the address of the next instruction, and according to the base ISA alignment rules (for the C extension), instruction addresses are always 2-byte aligned.
So, bit 0 of dpc is always 0, which is why the mask !1usize is applied. Hope this clears out what you were concerned about :)

Co-authored-by: rmsyn <117854522+rmsyn@users.noreply.github.com>
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.

3 participants