Creating machine.rs file

This commit is contained in:
Rémi Rativel 2022-11-09 15:59:05 +01:00
parent 3cbe1c0601
commit c377929ce1
2 changed files with 28 additions and 0 deletions

27
src/machine.rs Normal file
View File

@ -0,0 +1,27 @@
use crate::decode::*;
pub struct Machine {
pub _pc : u32,
pub _int_reg : [u32 ; 32],
pub _instructions : [u32 ; 100]
}
impl Machine {
fn _init_machine() -> Machine {
Machine {
_pc : 0,
_instructions : [0 ; 100],
_int_reg : [0 ; 32]
}
}
}
#[cfg(test)]
mod test {
use crate::{_init_machine};
}

View File

@ -1,5 +1,6 @@
mod decode; mod decode;
mod print; mod print;
mod machine;
fn main() { fn main() {
let instr = decode::decode(98); let instr = decode::decode(98);