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

If "C" cannot be disabled, all changes to misa must be suppressed #269

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

ahadali-10x
Copy link

Changed

  • Updated legalize_misa function in the riscv_sys_regs.sail in the model/ directory to add condition If "C" cannot be disabled because of next PC is misaligned, all changes to misa will be suppressed

Issue Fixed

Copy link
Collaborator

@billmcspadden-riscv billmcspadden-riscv left a comment

Choose a reason for hiding this comment

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

One more question:
Did you test this? If so, what form did the test take?

model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
@ahadali-10x
Copy link
Author

The original PR was #143 since I don't have permission to make changes to that. So I submitted this new PR.
Hi, @scottj97 Could you please verify that the changes are according to the spec as you asked in the comment?

model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Jun 2, 2023

Unit Test Results

712 tests  ±0   712 ✔️ ±0   0s ⏱️ ±0s
    6 suites ±0       0 💤 ±0 
    1 files   ±0       0 ±0 

Results for commit e01da53. ± Comparison against base commit ae905fb.

♻️ This comment has been updated with latest results.

model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
Copy link
Collaborator

@jrtc27 jrtc27 left a comment

Choose a reason for hiding this comment

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

Various outstanding comments

@jrtc27
Copy link
Collaborator

jrtc27 commented Jun 2, 2023

You'll also need to have a proper commit message that documents the F/D part of this. That should probably even be a separate commit to be honest.

@ptomsich
Copy link
Collaborator

ptomsich commented Jun 2, 2023

One more question: Did you test this? If so, what form did the test take?

Given that it doesn't even compile, we can safely assume that the answer will be "no"...

@ptomsich ptomsich linked an issue Jun 2, 2023 that may be closed by this pull request
@scottj97
Copy link
Contributor

scottj97 commented Jun 2, 2023

You'll also need to have a proper commit message that documents the F/D part of this. That should probably even be a separate commit to be honest.

Agreed, if there are two behavioral changes here, that needs to be two separate commits, and arguably even two separate PRs, since this one's title refers only to misa.C.

I'll try to test the C for correct behavior once this PR settles down.

@ahadali-10x ahadali-10x requested a review from jrtc27 June 6, 2023 07:40
@billmcspadden-riscv billmcspadden-riscv added the tgmm-agenda Tagged for the next Golden Model meeting agenda. label Jun 13, 2023
@ahadali-10x ahadali-10x force-pushed the misa_illegal_write branch 2 times, most recently from 35fae4b to be6fafb Compare July 3, 2023 06:14
@ahadali-10x
Copy link
Author

Updated the commit to add changes only related to the C extension and tested the changes through assembly tests. Changes related to F/D extension are in addition to these changes. Will submit a separate PR after these changes are merged.

model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
@ahadali-10x
Copy link
Author

@jrtc27 @billmcspadden-riscv Let me know if anything needs to be changed. Otherwise, this PR can be merged.

@ptomsich
Copy link
Collaborator

One more question: Did you test this? If so, what form did the test take?

@ahadali-10x I was about to merge, when I saw that this question still seemed unanswered... could you provide the requested information? Thx.

@ahadali-10x
Copy link
Author

Updated the commit to add changes only related to the C extension and tested the changes through assembly tests.

Yes, it is tested with the assembly tests.

@jrtc27
Copy link
Collaborator

jrtc27 commented Aug 15, 2023

Which "assembly tests"?..

@ahadali-10x
Copy link
Author

I wrote them manually.

@allenjbaum
Copy link
Collaborator

allenjbaum commented Aug 15, 2023 via email

@ahadali-10x
Copy link
Author

Yes I followed the ACT tests format.

@allenjbaum
Copy link
Collaborator

allenjbaum commented Aug 15, 2023 via email

@ahadali-10x
Copy link
Author

ahadali-10x commented Aug 16, 2023

Here is the link to test: https://github.com/ahadali-10x/riscv-arch-test/tree/sail_test/riscv-test-suite/rv32i_m/sail_test. These tests were run on the RISCOF by passing the required command line arguments. Checked results manually.

@ahadali-10x
Copy link
Author

@allenjbaum Kindly let me know if anything else is needed.

@billmcspadden-riscv
Copy link
Collaborator

@ahadali-10x , question: I'm looking for the text in the Priv Spec that requires this change. I'm not finding anything. Would you point me to the place in the spec that requires this functionality?

Based on the title of this PR, the logic of the code looks correct to me.

Bill Mc.

@ahadali-10x
Copy link
Author

Writing misa may increase IALIGN, e.g., by disabling the “C” extension. If an instruction that
would write misa increases IALIGN, and the subsequent instruction’s address is not IALIGN-bit
aligned, the write to misa is suppressed, leaving misa unchanged.

This is the second last paragraph of section 3.1.1 of the privilege spec.

Copy link
Collaborator

@billmcspadden-riscv billmcspadden-riscv left a comment

Choose a reason for hiding this comment

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

I approve.

@ahadali-10x
Copy link
Author

@ptomsich Let me know if you need any more information. Otherwise, this PR can be merged.

@billmcspadden-riscv billmcspadden-riscv merged commit 861bd6f into riscv:master Aug 28, 2023
2 checks passed
@billmcspadden-riscv billmcspadden-riscv removed the tgmm-agenda Tagged for the next Golden Model meeting agenda. label Oct 10, 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.

Writing misa should suppress entire write if C=0 illegal
7 participants