Skip to content

Add CSR YAML files for Sscofpmf: scountovf #607

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

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

syedowaisalishah
Copy link
Contributor

@syedowaisalishah syedowaisalishah commented Apr 11, 2025

Extension CSR YAML files for the Sscofpmf extension.

CSR YAMLs for:

  • SCOUNTOVF

Closes Add Sscofpmf CSR #569

@ThinkOpenly
Copy link
Collaborator

@syedowaisalishah, did you intend to close this?

@syedowaisalishah
Copy link
Contributor Author

@syedowaisalishah, did you intend to close this?

Yes, I closed it because the regression test failed in this PR. I’ll address the issues and reopen it once everything passes.

@syedowaisalishah
Copy link
Contributor Author

I've made all the suggested changes — just haven’t added the sw_read() yet due to an error. Will follow up on that soon.

@ThinkOpenly
Copy link
Collaborator

You can either do this by hand, your own script that doesn't get checked in, or using a .layout file like arch/csr/Zicntr/mcountinhibit.layout. Any way is fine with me.

Derek was suggesting here to either explicitly describe all of the bits OF3-OF31, or parameterize their description using a layout like:

  <%- (3..31).each do |of_num| -%>
  OF<%= of_num %>:
    location: <%= of_num %>
[...]

Since you've already done the former (describing each of them), you do not need the ".layout" file.

(For reference, if you did choose to use a "layout" file, you'd need to have it explicitly handled in the Rakefile similarly to mcountinhibit. That has me wondering if we should make that handling more automatic... a thought for another day, perhaps.)

@syedowaisalishah
Copy link
Contributor Author

@ThinkOpenly , @dhower-qc Added .layout file for OF3–OF31 YAML generation and updated the Rakefile accordingly (similar to mcountinhibit). Verified functionality with rake gen:arch.

@syedowaisalishah syedowaisalishah requested a review from dhower-qc May 3, 2025 17:01
Copy link
Collaborator

@dhower-qc dhower-qc left a comment

Choose a reason for hiding this comment

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

Great, almost there. When using layout files, we also check in the generated files so that they are accessible via browsing GitHub. So, if you can add scountovf.yaml to the PR, then I think this looks good.

@syedowaisalishah syedowaisalishah requested a review from dhower-qc May 5, 2025 15:40
[when="mhpmevent<%= of_num %>.EN == false"]
This field is read-only zero because the event is not enabled.
type(): |
return mhpmevent<%= of_num %>.EN ? CsrFieldType::RO : CsrFieldType::RO-H;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This (and others) is actually:

return CSR[mhpmevent<%= of_num %>].EN ? # ...

That's why the regressions are failing.

Copy link
Contributor Author

@syedowaisalishah syedowaisalishah May 6, 2025

Choose a reason for hiding this comment

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

Thanks @dhower-qc — I updated the type() and reset_value() lines in scountovf.layout as you suggested, using CSR[mhpmevent<%= of_num %>].EN instead of the bare mhpmevent<%= of_num %>.EN
However, I’m encountering issues:

When I run regressions and smoke test locally in VS Code, the test appears to hang during type-checking. It stalls here with no further output:
Type checking IDL code for rv32... [INFO] 2025-05-06 13:43:32: Allocating more SymbolTables Instructions: |========================================================| CSRs: |===================== |
When I pushed the changes, 4 tests failed in CI.
if I run the smoke without including the YAML file scountovf, the test completes successfully and all checks pass.

@syedowaisalishah syedowaisalishah requested a review from dhower-qc May 6, 2025 17:30
Copy link
Collaborator

@dhower-qc dhower-qc left a comment

Choose a reason for hiding this comment

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

The regressions are failing because it can't find CSR[mhpmeventX].OF. That's because those fields don't exist yet...they are added by this extension!

We'll need to modify mhpmeventN.layout to add the fields [OF, MINH, SINH, UINH, VSINH, VUINH] to the event CSRs.

A few things to note: the OF and MINH fields are definedBy Sscofpmf. The SINH field is definedBy: allOf: [S, Sscofpmf]. Similar for the remaining *INH fields.

@ThinkOpenly
Copy link
Collaborator

The regressions are failing because it can't find CSR[mhpmeventX].OF. That's because those fields don't exist yet...they are added by this extension!

Why would the regression tests fail for this PR because of something added by this PR? (Maybe I don't understand.)

I wonder if it could be because we're still defining everything twice, until arch/csr/Sscofpmf/scountovf.yaml is removed?

@syedowaisalishah
Copy link
Contributor Author

The regressions are failing because it can't find CSR[mhpmeventX].OF. That's because those fields don't exist yet...they are added by this extension!

We'll need to modify mhpmeventN.layout to add the fields [OF, MINH, SINH, UINH, VSINH, VUINH] to the event CSRs.

A few things to note: the OF and MINH fields are definedBy Sscofpmf. The SINH field is definedBy: allOf: [S, Sscofpmf]. Similar for the remaining *INH fields.

I’ve updated mhpmeventN.layout to include the new fields (OF, MINH, SINH, UINH, VSINH, VUINH) as described, and regenerated the mhpmevent3–31 YAML files accordingly. However, the regressions are still failing, and when I run regress in VSCode, it hangs without producing any output.

Copy link
Collaborator

@dhower-qc dhower-qc left a comment

Choose a reason for hiding this comment

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

Thanks for the hard work with this one!

@ThinkOpenly ThinkOpenly enabled auto-merge May 8, 2025 17:57
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