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

Support for mstatus MBE, SBE #632

Open
MuhammadHammad001 opened this issue Dec 2, 2024 · 6 comments
Open

Support for mstatus MBE, SBE #632

MuhammadHammad001 opened this issue Dec 2, 2024 · 6 comments
Assignees

Comments

@MuhammadHammad001
Copy link
Contributor

Hi
I am currently writing the test for little and big endianess in the virtual memory verification.
I was trying to write the mstatush.SBE to enable big endianess for loads/stores but I am unable to do so.

mem[X,0x80000A98] -> 0xA073
mem[X,0x80000A9A] -> 0x3102
[643] [M]: 0x80000A98 (0x3102A073) csrrs zero, 0x310, t0
CSR 0x310 -> 0x00000000
CSR 0x310 <- 0x00000000 (input: 0x00000010)

I went through the sail code to figure out what is wrong and I saw the following comment here:

  /* We don't currently support changing MBE and SBE. */
  if xlen == 64 then {
    Mk_Mstatus([m.bits with 37 .. 36 = 0b00])
  } else m
}

Is there any plan to add the support for this or am I missing something?

@Timmmm
Copy link
Collaborator

Timmmm commented Dec 3, 2024

No plans but you're welcome to add support if you like. Do you know of actual users of this feature? I mean does any hardware actually exist that implements it?

@jordancarlin
Copy link
Collaborator

The OpenHWGroup CVW core implements support for switching endian modes using MBE/SBE. Would be a great feature to get into the Sail model eventually, but I don't think it's been that high on anyone's priority list.

@Timmmm
Copy link
Collaborator

Timmmm commented Dec 3, 2024

Has anyone actually taped it out with support for big endian though? Kind of feels like CVW is trying to support every feature of RISC-V regardless of whether anyone wants it (which is fine), and I would be mildly surprised if anyone really wants big endian! I guess someone asked for it though; the spec says it was added to support legacy code.

Anyway feel free to try. It might not be too invasive; you probably just need to modify mem_read_priv_meta and mem_write_value_priv_meta to swap the bytes (unless Typ is Execute).

It may interact awkwardly with #49 - maybe have a skim of Alasdair's PR there before doing anything.

@jordancarlin
Copy link
Collaborator

You're not wrong that CVW is trying to support most RISC-V features in at least one of its configurations. I'm pretty sure the configuration being used for an upcoming tapeout has big endian supported though.

I might look at adding endian support down the road, but probably won't get around to it for a while so if you're interested feel free @MuhammadHammad001.

@MuhammadHammad001
Copy link
Contributor Author

MuhammadHammad001 commented Dec 3, 2024

@Timmmm @jordancarlin Sure, I can work on this

@allenjbaum
Copy link
Collaborator

allenjbaum commented Dec 3, 2024 via email

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

No branches or pull requests

4 participants