MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / writeback_csr_read_only

Function writeback_csr_read_only

crates/virtual-machine/tests/vm_writeback.rs:245–266  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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]
260fn 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,

Callers

nothing calls this directly

Calls 1

writebackFunction · 0.85

Tested by

no test coverage detected