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 for #481 #483

Merged
merged 3 commits into from
Sep 7, 2020
Merged

Fix for #481 #483

merged 3 commits into from
Sep 7, 2020

Conversation

Silabs-ArjanB
Copy link
Contributor

Signed-off-by: Arjan Bink [email protected]

Signed-off-by: Arjan Bink <[email protected]>
@Silabs-ArjanB
Copy link
Contributor Author

Hi @silabs-PaulZ , @silabs-oysteink This pull request should fix #481 Some of the reserved 0 bits were writeable as well and I made them always-read-as-0 instead. I would like to hear your opinion on 'dcsr_n.prv = priv_lvl_q; '; I think this bit should be fully R/W but as the spec says "If the encoding written is not supported or the debugger is not allowed to change to it, the hart may change to any supported privilege level." (So I think we should change that assignment into 'dcsr_n.prv = csr_wdata_int[1:0]; ' and then always simply ignore the written value (and basically pretend it is alway M mode).

@silabs-oysteink
Copy link
Contributor

I agree with your suggestion Arjan. The only side effect I can think of right now is if it affects the Imperas reference model, but if it does it's probably a quick fix there as well.

@silabs-PaulZ
Copy link
Contributor

silabs-PaulZ commented Sep 4, 2020

I was starting the process to update stepie to be read/writeable, but it would be fairly involved. I agree with tying it stepie=0. The implementation looks correct for tying this off (along with other WARL fields).
I agree with your interpretation of the spec regarding writing the DCSR.prv to any value, and that this value will be essentially ignored when we exit debug mode.

priv_lvl_n = dcsr_q.prv;
// Restore to the recorded privilege level; if dcsr_q.prv is a non-supported mode,
// then lowest privilege supported mode is selected (so always Machine Mode in this case).
priv_lvl_n = (dcsr_q.prv == PRIV_LVL_M) ? PRIV_LVL_M : PRIV_LVL_M;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would consider priv_lvl_n = PRIV_LVL_M in this case for any code coverage issues. Hopefully we can refactor this file soon to reduce the duplication issues.

Copy link
Member

Choose a reason for hiding this comment

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

Hopefully we can refactor this file soon to reduce the duplication issues.

Its getting late in the day for RTL refactoring exercises. If you are serious about this, please open an issue so the cost/risk/benefit can be discussed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would consider priv_lvl_n = PRIV_LVL_M in this case for any code coverage issues. Hopefully we can refactor this file soon to reduce the duplication issues.

Okay, I will rewrite like that and merge this pull request. Thanks.

@Silabs-ArjanB Silabs-ArjanB merged commit 3335dbc into openhwgroup:master Sep 7, 2020
@Silabs-ArjanB Silabs-ArjanB deleted the ArjanB_dcsr branch September 7, 2020 08:28
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.

4 participants