From b1909e3280e05ae6936eec8ff0e559186d3d10e0 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Wed, 11 Jan 2023 14:58:12 +0100 Subject: [PATCH] Moving files to simulator module --- src/main.rs | 7 +++---- src/{ => simulator}/decode.rs | 0 src/{ => simulator}/machine.rs | 3 +-- src/simulator/mod.rs | 3 +++ src/{ => simulator}/print.rs | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) rename src/{ => simulator}/decode.rs (100%) rename src/{ => simulator}/machine.rs (99%) create mode 100644 src/simulator/mod.rs rename src/{ => simulator}/print.rs (99%) diff --git a/src/main.rs b/src/main.rs index 4e93275..953914e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,6 @@ -mod decode; -mod print; -mod machine; -use machine::Machine; +mod simulator; + +use simulator::machine::Machine; fn main() { let mut m = Machine::_init_machine(); diff --git a/src/decode.rs b/src/simulator/decode.rs similarity index 100% rename from src/decode.rs rename to src/simulator/decode.rs diff --git a/src/machine.rs b/src/simulator/machine.rs similarity index 99% rename from src/machine.rs rename to src/simulator/machine.rs index 2453d23..42e19f4 100644 --- a/src/machine.rs +++ b/src/simulator/machine.rs @@ -1,5 +1,4 @@ -use crate::decode::*; -use crate::print::*; +use super::{decode::{Instruction, decode}, print::*}; /// doit disparaitre const MEM_SIZE : usize= 4096; diff --git a/src/simulator/mod.rs b/src/simulator/mod.rs new file mode 100644 index 0000000..581621e --- /dev/null +++ b/src/simulator/mod.rs @@ -0,0 +1,3 @@ +pub mod machine; +pub mod decode; +pub mod print; \ No newline at end of file diff --git a/src/print.rs b/src/simulator/print.rs similarity index 99% rename from src/print.rs rename to src/simulator/print.rs index c80cf9c..99ce2d0 100644 --- a/src/print.rs +++ b/src/simulator/print.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] #![allow(unused_variables)] -use crate::decode::Instruction; +use super::decode::{Instruction}; pub const RISCV_LUI: u8 = 0x37; @@ -307,8 +307,8 @@ pub fn print(ins: Instruction, pc: i32) -> String { //TODO pc should be u64 #[cfg(test)] mod test { + use crate::simulator::{decode, print}; - use crate::{print, decode}; #[test] fn test_op() {