:rotating_lights: Small lint fixes
This commit is contained in:
parent
939e23883e
commit
ba8e36ea90
@ -17,6 +17,7 @@ use kernel::system::System;
|
|||||||
use simulator::machine::Machine;
|
use simulator::machine::Machine;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let machine = Machine::init_machine();
|
let mut machine = Machine::init_machine();
|
||||||
let system = System::default();
|
let system = System::default();
|
||||||
|
machine.run()
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
io::Write,
|
io::Write,
|
||||||
fs::File, ops::Add
|
fs::File
|
||||||
};
|
};
|
||||||
use crate::simulator::{
|
use crate::simulator::{
|
||||||
print,
|
print,
|
||||||
@ -24,7 +24,10 @@ use crate::simulator::{
|
|||||||
register::*
|
register::*
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Exceptions
|
/// # Exceptions
|
||||||
|
///
|
||||||
|
/// Textual names of the exceptions that can be generated by user program
|
||||||
|
/// execution, for debugging purpose.
|
||||||
/// todo: is this really supposed to stand in machine.rs?
|
/// todo: is this really supposed to stand in machine.rs?
|
||||||
pub enum ExceptionType {
|
pub enum ExceptionType {
|
||||||
/// Everything ok
|
/// Everything ok
|
||||||
@ -46,6 +49,7 @@ pub enum ExceptionType {
|
|||||||
NumExceptionTypes
|
NumExceptionTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ID of the stack register
|
||||||
pub const STACK_REG: usize = 2;
|
pub const STACK_REG: usize = 2;
|
||||||
/// Number of available Integer registers
|
/// Number of available Integer registers
|
||||||
pub const NUM_INT_REGS: usize = 32;
|
pub const NUM_INT_REGS: usize = 32;
|
||||||
@ -154,7 +158,7 @@ impl Machine {
|
|||||||
/// ### Parameters
|
/// ### Parameters
|
||||||
///
|
///
|
||||||
/// - **machine** contains the memory
|
/// - **machine** contains the memory
|
||||||
pub fn extract_memory(&self){
|
pub fn _extract_memory(&self){
|
||||||
let file_path = "burritos_memory.txt";
|
let file_path = "burritos_memory.txt";
|
||||||
let write_to_file = |path| -> std::io::Result<File> {
|
let write_to_file = |path| -> std::io::Result<File> {
|
||||||
let mut file = File::create(path)?;
|
let mut file = File::create(path)?;
|
||||||
@ -228,8 +232,8 @@ impl Machine {
|
|||||||
panic!("ERROR : number max of instructions rushed");
|
panic!("ERROR : number max of instructions rushed");
|
||||||
}
|
}
|
||||||
let mut val: [u8; 4] = [0; 4];
|
let mut val: [u8; 4] = [0; 4];
|
||||||
for i in 0..4 {
|
for (i, elem) in val.iter_mut().enumerate() {
|
||||||
val[i] = self.main_memory[self.pc as usize + i];
|
*elem = self.main_memory[self.pc as usize + i];
|
||||||
}
|
}
|
||||||
|
|
||||||
let val = u32::from_be_bytes(val) as u64;
|
let val = u32::from_be_bytes(val) as u64;
|
||||||
|
Loading…
Reference in New Issue
Block a user