Remove consts.rs and just use plain types
This commit is contained in:
13
src/core.rs
13
src/core.rs
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user