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: icount: not to decrease on firing icount trigger with Debug Mode action #1337

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

YenHaoChen
Copy link
Collaborator

@YenHaoChen YenHaoChen commented Apr 21, 2023

Firing a icount trigger does not execute current instruction and should not decrease.

Update (2023.06.19) riscv/riscv-debug-spec#842 (comment):
The icount decreases on firing trigger action=breakpoint but not on firing trigger action=debug_mode when icount.count=1.

Copy link
Contributor

@scottj97 scottj97 left a comment

Choose a reason for hiding this comment

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

Can you explain the case here? It seems this would apply only in the screwy case that someone wrote (via csrw) pending=1 && count>0.

Even in that case, icount breakpoints decrement on traps, too, so why shouldn't it decrement on this trap?

@YenHaoChen
Copy link
Collaborator Author

@scottj97 is right. The icount should decrease the counter on firing with action=breakpoint. Sorry for the misunderstanding of the specification.

From the current implementation, the icount does not decrease the counter on entering debug mode due to debug interrupt but does on entering debug mode due to trigger firing. Although both conditions enter debug mode, the icount.count behaves differently under those conditions.
@timsifive Can you share some words about this? Thank you.

@YenHaoChen
Copy link
Collaborator Author

Clarifying desired behavior in riscv/riscv-debug-spec#842.

@YenHaoChen
Copy link
Collaborator Author

The issue (riscv/riscv-debug-spec#842) clarifies that the icount decreases on firing a breakpoint action but not on entering Debug Mode action. For example, consider the case by @scottj97, where pending=1 && count>0. Whether to decrease the count depends on the action.

The commit (4fce5a4) updates the behavior correspondingly.

@YenHaoChen YenHaoChen changed the title triggers: icount: firing a icount trigger does not execute current instruction and should not decrease triggers: icount: not to decrease on firing icount trigger with Debug Mode action May 4, 2023
@YenHaoChen YenHaoChen requested a review from scottj97 June 19, 2023 05:31
riscv/triggers.cc Outdated Show resolved Hide resolved
@YenHaoChen YenHaoChen requested a review from scottj97 June 23, 2023 05:39
… Mode action

The icount decreases on firing beakpoint action but not on entering Debug Mode action.
Reference: riscv/riscv-debug-spec#842
@aswaterman aswaterman merged commit f45f726 into riscv-software-src:master Jun 30, 2023
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