Make fields and register access functions of Core accessible to the rest of the emulator

This commit is contained in:
2025-10-07 20:12:09 +02:00
parent 908be749ac
commit dbd022f9c9

View File

@@ -15,9 +15,9 @@ pub(crate) enum InstructionResult {
} }
pub struct Core { pub struct Core {
x_regs: [RegValue; 32], pub(crate) x_regs: [RegValue; 32],
pc: Addr, pub(crate) pc: Addr,
mem: MemConfig, pub(crate) mem: MemConfig,
} }
impl Core { impl Core {
@@ -73,11 +73,11 @@ impl Core {
self.pc = pc; self.pc = pc;
} }
fn reg_read(&self, id: RegId) -> RegValue { pub(crate) fn reg_read(&self, id: RegId) -> RegValue {
self.x_regs[id as usize] self.x_regs[id as usize]
} }
fn reg_write(&mut self, id: RegId, value: RegValue) { pub(crate) fn reg_write(&mut self, id: RegId, value: RegValue) {
if id == 0 { if id == 0 {
return; return;
} }