Remove consts.rs and just use plain types

This commit is contained in:
2025-12-28 12:01:39 +01:00
parent 8024af6b13
commit 9a9bef7dd7
13 changed files with 117 additions and 148 deletions

View File

@@ -7,7 +7,6 @@
use std::{collections::HashSet, sync::mpsc};
use crate::{
consts::{Addr, RegId, RegValue},
core::commands::CoreCmd,
decode::Instruction,
exceptions::{Exception, ExceptionType, MemoryException},
@@ -17,8 +16,8 @@ use crate::{
};
pub struct Core {
pub(crate) x_regs: [RegValue; 32],
pub(crate) pc: Addr,
pub(crate) x_regs: [u64; 32],
pub(crate) pc: u64,
pub(crate) mem: MemConfig,
command_stream: mpsc::Receiver<CoreCmd>,
}
@@ -119,7 +118,7 @@ impl Core {
fn continue_loop(
&mut self,
breakpoints: &HashSet<Addr>,
breakpoints: &HashSet<u64>,
stopper: oneshot::Receiver<()>,
) -> StopReason {
loop {
@@ -177,15 +176,15 @@ impl Core {
dbg!(self.pc, self.x_regs);
}
pub fn reset(&mut self, pc: Addr) {
pub fn reset(&mut self, pc: u64) {
self.pc = pc;
}
pub(crate) fn reg_read(&self, id: RegId) -> RegValue {
pub(crate) fn reg_read(&self, id: u8) -> u64 {
self.x_regs[id as usize]
}
pub(crate) fn reg_write(&mut self, id: RegId, value: RegValue) {
pub(crate) fn reg_write(&mut self, id: u8, value: u64) {
if id == 0 {
return;
}