From c377929ce10739d66501a370f01934db8dd3aa7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rativel?= Date: Wed, 9 Nov 2022 15:59:05 +0100 Subject: [PATCH] Creating machine.rs file --- src/machine.rs | 27 +++++++++++++++++++++++++++ src/main.rs | 1 + 2 files changed, 28 insertions(+) create mode 100644 src/machine.rs diff --git a/src/machine.rs b/src/machine.rs new file mode 100644 index 0000000..5845ae3 --- /dev/null +++ b/src/machine.rs @@ -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}; + + } diff --git a/src/main.rs b/src/main.rs index aefc218..346a5b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ mod decode; mod print; +mod machine; fn main() { let instr = decode::decode(98);