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

triggers: Let mcontrol.match be default (0/equal) if maskmax is 0 #1786

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

YenHaoChen
Copy link
Collaborator

This PR fixes the issue in #1785.

Specifically, the spec requires unsupporting mcontrol.match=NAPOT if mcontrol.maskmax=0.
image

@@ -294,13 +294,14 @@ void mcontrol6_t::tdata1_write(processor_t * const proc, const reg_t val, const
auto xlen = proc->get_const_xlen();
assert(get_field(val, CSR_MCONTROL6_TYPE(xlen)) == CSR_TDATA1_TYPE_MCONTROL6);
dmode = get_field(val, CSR_MCONTROL6_DMODE(xlen));
const reg_t maskmax6 = xlen - 1;
Copy link
Collaborator Author

@YenHaoChen YenHaoChen Aug 27, 2024

Choose a reason for hiding this comment

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

@rtwfroody I didn't find an explicit upper bound for maskmax6 in the Debug spec. Does the spec intend maskmax6=31 in RV32 and maskmax6=63 in RV64 for maximum?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. It doesn't make sense for maskmax6 to be any larger than that, because then you're just doing an equal comparison.

Comment on lines +250 to -251
case MATCH_NAPOT: if (maskmax == 0) return MATCH_EQUAL;
case MATCH_EQUAL:
case MATCH_NAPOT:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This seems tricky. Invite comment on this modification.

Copy link
Contributor

@rtwfroody rtwfroody 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 OK to me.

To be clear, it explicitly removes napot support from mcontrol, and makes it work for mcontrol6.

Copy link
Collaborator

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

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

Code looks OK; I didn't review the functionality in detail.

@aswaterman aswaterman merged commit 60f02dd into riscv-software-src:master Aug 27, 2024
3 checks passed
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