()
| 243 | csr: addr::MIE, |
| 244 | operand: 0, |
| 245 | old_val: initial_mie, |
| 246 | next_pc: 0x8000_0004, |
| 247 | }; |
| 248 | |
| 249 | let next_pc = writeback(mem_result, &mut regs, &mut csrs).expect("writeback should succeed"); |
| 250 | |
| 251 | // CSR should be unchanged |
| 252 | assert_eq!( |
| 253 | csrs.read(addr::MIE).expect("writeback should succeed"), |
| 254 | initial_mie |
| 255 | ); |
| 256 | assert_eq!(next_pc, 0x8000_0004); |
| 257 | } |
| 258 | |
| 259 | #[test] |
| 260 | fn writeback_csr_read_only() { |
| 261 | let mut regs = Registers::new(); |
| 262 | let mut csrs = CsrFile::new(); |
| 263 | |
| 264 | let mem_result = MemResult::Csr { |
| 265 | funct3: 1, // CSRRW |
| 266 | rd: 5, |
| 267 | rs1_uimm: 0, |
| 268 | csr: addr::MHARTID, // Read-only |
| 269 | operand: 42, |
nothing calls this directly
no test coverage detected