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

Simplify Wally tracer CSRs #1255

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jordancarlin
Copy link
Member

Use a macro so that CSRs can be connected with a single line instead of needing to modify many locations. Does not currently work for PMP registers because of the loop, so they are left as they are.

@rosethompson

@davidharrishmc
Copy link
Contributor

davidharrishmc commented Jan 29, 2025 via email

@jordancarlin
Copy link
Member Author

The pmp CSRs make this more complicated because I haven't been able to get them working using the macros (can't have an always_comb block inside a for loop). I'll see if we can at least simplify the macro though even if it doesn't completely eliminate the extra arrays.

@davidharrishmc
Copy link
Contributor

davidharrishmc commented Jan 29, 2025 via email

@jordancarlin jordancarlin marked this pull request as draft January 30, 2025 05:13
@jordancarlin
Copy link
Member Author

Had to do a few strange things, but I was able to get the PMP CSRs using the macros. Down to just a few more issues at this point:

  • The PMPCFG register loop is going out of bounds of the PMPCFG_ARRAY_REGW array. Need to figure out how to modify the loop to get that to match.
  • I had to comment out the PRINT_CSRS option because we no longer have an array of all of the old CSR values to compare against. I still think this is better overall, but need to figure out a solution if we still want to be able to print CSR changes. It might just need to be included in the macro, but I'd rather keep the macro simple if possible.

@davidharrishmc
Copy link
Contributor

Do the CSRs properly default to a non-x value if not connected?

genvar is not part of our usual SystemVerilog style for generate loops. Is it necessary in this code?

We haven't been printing CSRs anyway, so fine to remove.

@rosethompson
Copy link
Contributor

I'm not a big fan of macros. The tend to obfuscate debugging. Could we turn the macro into a module?

For the pmp config can you just divide P.PMP_ENTRIES by 8 since there are always config's packed into a register for XLEN=64?

I originally used PRINT_CSRS only for debugging the tracer. Occasionally this is useful when we add features. If we want to add it, we could have a 2d array of valid CSR addresses and have a loop iterate over that loop and then print those addresses. However I'm not entirely sure how valuable this is now.

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