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

Function fetch_aligned_word

crates/virtual-machine/tests/vm_fetch.rs:10–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9#[test]
10fn fetch_aligned_word() {
11 let mut bus = SystemBus::new(Vec::new());
12
13 // Write a valid instruction at aligned address
14 bus.write_byte(0x8000_0000, 0x13)
15 .expect("bus write should succeed");
16 bus.write_byte(0x8000_0001, 0x00)
17 .expect("bus write should succeed");
18 bus.write_byte(0x8000_0002, 0x00)
19 .expect("bus write should succeed");
20 bus.write_byte(0x8000_0003, 0x00)
21 .expect("bus write should succeed"); // addi x0, x0, 0 (nop)
22
23 let result = fetch(&mut bus, 0x8000_0000, 0, PrivilegeMode::Machine, 0);
24 assert!(result.is_ok());
25 assert_eq!(

Callers

nothing calls this directly

Calls 2

fetchFunction · 0.85
write_byteMethod · 0.45

Tested by

no test coverage detected