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

Question : why read/write SIE register is different from other register? #5

Open
huangzixun123 opened this issue Sep 6, 2021 · 1 comment

Comments

@huangzixun123
Copy link

huangzixun123 commented Sep 6, 2021

Excuse me ,I am a new hand, and the particularity of SIE confuses me a lot.
Could me tell me why read/write SIE register is different from other register?

    /// Load a value from a CSR.
    pub fn load_csr(&self, addr: usize) -> u64 {
        match addr {
            SIE => self.csrs[MIE] & self.csrs[MIDELEG],
            _ => self.csrs[addr],
        }
    }

    /// Store a value to a CSR.
    pub fn store_csr(&mut self, addr: usize, value: u64) {
        match addr {
            SIE => {
                self.csrs[MIE] =
                    (self.csrs[MIE] & !self.csrs[MIDELEG]) | (value & self.csrs[MIDELEG]);
            }
            _ => self.csrs[addr] = value,
        }
    }
@xobs
Copy link

xobs commented Dec 26, 2023

The SIE and UIE registers are identical copies of the MIE register, except some bits are reserved and cannot be updated.

This is showing how the SIE register offers only partial access when writing to the underlying MIE bits.

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

2 participants